Fix Rose Chart area encoding: use sqrt radius on ECharts and Chart.js to match Vega-Lite#51
Merged
Merged
Conversation
[deploy] publish
Prepare 0.1.2 patch release
Update Flint public title
Restore AI-era public title
MCP: trust-by-default file access via --disable-file-reference
Copilot
AI
changed the title
[WIP] Fix Rose Chart encoding inconsistencies across backends
Fix Rose Chart area encoding: use sqrt radius on ECharts and Chart.js to match Vega-Lite
Jul 11, 2026
Chenglong-MS
approved these changes
Jul 12, 2026
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.
The same Rose Chart
ChartAssemblyInputcompiled to different perceptual encodings per backend: Vega-Lite setradius.scale.type = 'sqrt'(wedge area ∝ value), while ECharts and Chart.js placed raw values on linear radial scales (area ∝ value²). A 4:1 input rendered as 4× area in Vega-Lite but 16× in the other two.Neither ECharts' polar
radiusAxisnor Chart.js' radialrscale supports asqrttype, so the transform is applied to the series data itself, with the true value preserved for the tooltip.Changes
echarts/templates/rose.ts)value: sqrt(raw)plus_rawValue.sqrt(cumsum) − sqrt(prevCumsum), so each stacked segment's area — not just the outer edge — is proportional to its value (mirrors Vega-Lite's stacked sqrt scale).formatterreports_rawValue; sqrt-space radial tick labels are hidden.chartjs/templates/rose.ts)sqrt(value); a tooltiplabelcallback reports the true value (kept in arawValuesclosure aligned after slice sorting); sqrt-space radial ticks are hidden.tests/rose-area-truth.test.ts) — asserts the sqrt/area invariant across all three backends, including the stacked cumulative-radius case and raw-value preservation.Result
For values
9:4:1, all three backends now render radii3:2:1(area9:4:1):The stacked case stays area-true per segment:
D1 = {S1: 9, S2: 16}→ outer edge atsqrt(25) = 5, with theS1segment at radius3and theS2increment at2.