Repository navigation
fix(pie): center pies in Cartodiagram when the chart size is unknown - #46478
Open
schizophrenicmaniac wants to merge 2 commits into
Open
schizophrenicmaniac wants to merge 2 commits into
schizophrenicmaniac wants to merge 2 commits into
Conversation
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #46478 +/- ##
=======================================
Coverage 85.93% 85.93%
=======================================
Files 3122 3122
Lines 217023 217034 +11
Branches 51450 51459 +9
=======================================
+ Hits 186491 186502 +11
Misses 27112 27112
Partials 3420 3420
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
|
CC @jansule |
…layed # Conflicts: # superset-frontend/plugins/plugin-chart-echarts/test/Pie/transformProps.test.ts
This branch has not been deployed
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.
SUMMARY
Since #42151 the Pie chart works out its center in pixels from the chart's width and height (
getPieLayout). The Cartodiagram builds the pie props once withwidth/heightset tonull, on purpose so resizing on zoom doesn't trigger extra updates, and then renders each pie at a zoom-dependent size. With a null size the layout rect collapsed to 1x1 px, so every pie on the map was drawn around the top-left corner of its box.When no size is available,
getPieLayoutnow lays the arc out in a 100x100 square and returns the center as percentages, which ECharts resolves against the real size when rendering. For a full pie this is the usual['50%', '50%']with unscaled radii, as in 6.1. Partial arcs keep their recentering, which is exact for square charts (the Cartodiagram default). The "Total" label also relied on pixel coordinates, so in that case it falls back to ECharts'left/toppositioning. Charts that pass a size are unchanged.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: see the screenshot in #46477 (pies stuck in the top-left corner of each box). After screenshots still to be added.
TESTING INSTRUCTIONS
Unit tests:
npm run test -- plugins/plugin-chart-echarts/test/Pie/transformProps.test.ts plugins/plugin-chart-cartodiagramADDITIONAL INFORMATION