Repository navigation
fix(echarts): plots without a grid clear of title, toolbox and legend; labels on fills by contrast - #38
Merged
Conversation
…; labels on fills by contrast Charts without a cartesian grid (funnel, treemap, pie, sunburst, gauge, polar, radialbar, radar) are placed for the size they have: below title and toolbox, above a legend that wraps over several lines (layout.js fitPlot, applied in EChart.jsx after the width rules and again when the size changes). Boxplots start below the toolbox like the other cartesian charts. Labels inside funnel stages, pie slices, treemap tiles and sunburst rings take dark or white text by WCAG contrast with the palette colour ECharts assigns (shared/js/contrast.js, layout.js insideLabelColors). Fixes #30, fixes #31, fixes #32 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 6, 2026
Closed
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.
Charts without a cartesian grid now keep their plot clear of title, toolbox and legend at every size, and labels on filled shapes take the text colour with the higher contrast to the fill.
Fixes #30
Fixes #31
Fixes #32
What changed
Components/layout.js(new), one place for both:fitPlot()estimates the bands that title, toolbox and legend take from the option (legend lines of aPlainlegend from the item texts and the width). It then moves the plot out of them. Funnel and treemap start below the toolbox. Pie, sunburst, gauge (rings move together), polar/radialbar and radar move down, and shrink only when they would otherwise touch the toolbox, title or legend. Anything set in-Options(top,bottom,center,radius) is kept.insideLabelColors()colours labels on fills: funnel stages, pie slices with inside labels, treemap tiles and sunburst rings (deeper rings lightened as ECharts draws them). It uses the palette colours ECharts assigns, from-Paletteor the current theme. Alabel.colorfrom-Optionsstays.shared/js/contrast.js(new): WCAG contrast helper. It picks dark (#1f2430) or white text, whichever contrasts more.EChart.jsxapplies both after the width rules. It applies them again when the chart's size or its number of legend lines changes; this happens only for these chart types, cartesian charts are unaffected. It also re-applies them when the theme changes.buildOption.js:fitPlotreplaces it.shared/js).Treemap group headers are not recoloured: they sit on the theme's gap colour, not on the tile.
Test plan
npm test: 71/71, including new tests forfitPlot,legendRows,insideLabelColorsand the contrast helper#003452,#4D7186,#A8B7C4Plainlegend and a titleNot covered here, still open:
Places checked: module README, CHANGELOG, AGENTS.md, root README (no layout details), docs site examples (no change needed).
🤖 Generated with Claude Code