Skip to content

Fix chart axis spacing, dynamic padding, and Uptime hover#116

Merged
jaymantri merged 1 commit intomainfrom
fix/chart-bugs
Feb 27, 2026
Merged

Fix chart axis spacing, dynamic padding, and Uptime hover#116
jaymantri merged 1 commit intomainfrom
fix/chart-bugs

Conversation

@jaymantri
Copy link
Contributor

Summary

  • Grid line visibility: Bumped stroke-opacity from 0.06 to 0.18 across SVG and canvas charts
  • Dynamic axis padding: Replaced hardcoded PAD_LEFT_AXIS = 48px with measurement-based padding (axisPadForLabels) that adapts to formatted label widths — applied to all chart types (LineChart, StackedAreaChart, BarChart, ComposedChart) for both left and right axes
  • Dynamic tick counts: Y-axis ticks scale with chart height via axisTickTarget; horizontal BarChart value axis uses dynamicTickTarget with canvas-measured label widths
  • X-axis label thinning: Shared thinIndices utility prevents label overlap, applied consistently across all chart types including ComposedChart (which previously had none)
  • Uptime chart improvements: Replaced tooltip pop-in with an always-visible label prop that updates on hover; replaced opacity dimming with a subtle 4px height-based hover indicator
  • Cleanup: Removed dead PAD_LEFT_AXIS constant, extracted CHART_LABEL_FONT, restored fadeLeft demos, stabilized memo references with EMPTY_TICKS constants

Breaking changes

  • Chart.Uptime: tooltip prop removed, replaced by label (string | false) and labelStatus props. Grid does not consume Uptime yet.

Test plan

  • tsc --noEmit passes
  • 390 unit tests pass (88 chart-specific, including new tests for axisPadForLabels, thinIndices, measureLabelWidth, dynamicTickTarget)
  • Visual verification of all chart demos (line, bar, stacked area, composed, uptime)
  • Code review passed with no critical or important issues

Made with Cursor

- Bump grid line opacity from 0.06 to 0.18 (SVG + canvas)
- Replace hardcoded PAD_LEFT_AXIS (48px) with measurement-based
  padding via axisPadForLabels across all chart types
- Dynamic Y-axis tick count based on chart height (axisTickTarget)
- X-axis label thinning via thinIndices for all chart types
- Dynamic horizontal BarChart value-axis spacing via measureLabelWidth
- Dynamic right-axis padding for ComposedChart dual-axis charts
- Remove dead PAD_LEFT_AXIS constant
- Extract CHART_LABEL_FONT constant, use in LiveChart
- Restore fadeLeft demos removed in prior refactor
- Uptime: replace tooltip pop-in with always-visible label prop,
  replace opacity dimming with 4px height-based hover indicator
- Add unit tests for axisPadForLabels, thinIndices, measureLabelWidth,
  dynamicTickTarget (88 chart tests total)

Made-with: Cursor
@vercel
Copy link

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
origin-storybook Building Building Preview, Comment Feb 27, 2026 8:18pm

Request Review

@jaymantri jaymantri merged commit 890b747 into main Feb 27, 2026
6 checks passed
@jaymantri jaymantri deleted the fix/chart-bugs branch February 27, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant