Repository navigation
Conversation
Inner labels overlap when a slice is too small to hold the text. Skip slices under 5% and drop a label that still collides with another. Signed-off-by: colivi <charles.olivi@gmail.com>
There was a problem hiding this comment.
🟡 Changes recommended
The regression test does not exercise the below-5% slice or label-overlap behavior it claims to cover, so it cannot detect regressions in that functionality.
1 open issue
What changed in this PR
This pull request improves pie chart readability by hiding labels for slices that are too small or overlap with other labels.
Changes:
- Adds an 18° minimum slice angle for displaying labels.
- Enables ECharts overlap hiding for pie labels.
- Adds test coverage for the generated chart options.
| File | Summary | Review note |
|---|---|---|
piechart/src/PieChartBase.tsx |
Configures minimum slice angle and overlap hiding for pie labels. | — |
piechart/src/PieChartBase.test.tsx |
Verifies that the new label-layout options are passed to ECharts. | Nit: The regression test uses empty data, so it does not exercise small slices or overlapping labels. Consider using representative non-empty data and asserting the resulting label visibility. |
Review effort: Lite
Comment on lines
+97
to
+100
| it('omits labels that cannot fit in a slice', () => { | ||
| render( | ||
| <ChartsProvider chartsTheme={testChartsTheme}> | ||
| <PieChartBase width={400} height={300} data={EMPTY_DATA} showLabels outerRadius={90} /> |
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.

Description
Inner labels overlap when a slice is too small to hold the text, this contribution skips slices under 5% and drop a label that still collides with another.
Screenshots
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes