Repository navigation
feat(charts): RowHeight on every chart that lays its categories out as rows - #176
Merged
Merged
Conversation
…s rows A D3Chart is as tall as its measured width divided by AspectRatio, so a chart with a row per category got taller rows on wider screens, and callers could only guess a ratio for a 640px width. RowHeight moves from RangeBarChart to D3Chart: each row chart (Gantt, Lollipop, Bullet, Dumbbell, Beeswarm, Ridgeline, Heatmap, and BoxPlot, Violin, Waterfall and Column3D when horizontal) reports its rows from the same filtering as its layout, with its frame's band padding and margins, and is then RowHeight per row tall. A horizontal BarChart sizes its box the same way instead of Height. GanttChart gets From/To to pin its time window. A node test checks every chart's rows land RowHeight apart at the height its component computes; a bUnit test checks the components compute it. Closes #175 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #175. Follow-up to #173, which fixed only
RangeBarChart.What
D3Chart.RowHeight(moved here fromRangeBarChart, so its API is unchanged): a chart that lays its categories out as rows becomes RowHeight × (rows + band padding) + its frame's margins tall, instead of width ÷AspectRatio. Each chart reports its rows through an internalRowBandsoverride, counted with the same filtering its layout applies:GanttChartFrom/ToLollipopChart,DumbbellChart,RangeBarChartBulletChartSharedAxisis set; when left automatic and the layout shares the axis, rows are 16 ÷ n units shorterHeatmapChartRows, else rows with a finite cellBeeswarmChart,RidgelineChartBoxPlotChart,ViolinChart,WaterfallChartColumn3DChartCharts without rows, or in the other orientation, ignore it and keep
AspectRatio.BarChart.RowHeight: a horizontal bar chart sizes its box by its categories instead ofHeight. Reference and marker labels above the plot take a little of that space.GanttChart.From/To: pin the time window. Bars are clipped to it; tasks wholly outside it are left out, and are not counted as rows.Tests
tests/charts-row-height.test.mjs: for every chart, lays it out at the height its component computes and asserts that consecutive rows are exactlyRowHeightapart (Column3D: within 20%). Changing a frame constant fails the matching case; I checked that a wrong margin turns a 24-unit step into 25.91. Ganttfrom/toclipping and filtering are covered too.ChartsRowHeightTests(bUnit): checks that each component computes those same heights, including the orientations that ignoreRowHeight, Gantt without headers or with a window, and the horizontalBarChartbox.layouts.fixture.jsonwas re-recorded. The Charts.Server (Jint) tests run in CI only: the docs site's Tailwind CLI is killed by macOS on this machine.🤖 Generated with Claude Code