-
Notifications
You must be signed in to change notification settings - Fork 272
fix(plugin-chart-echarts): remove label line if below threshold #1071
fix(plugin-chart-echarts): remove label line if below threshold #1071
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/superset/superset-ui/56DeUX3hHWPC8bobiNtMZRudQsgX |
@@ -102,6 +102,7 @@ export default function transformProps(chartProps: EchartsPieChartProps): PieCha | |||
emitFilter, | |||
}: EchartsPieFormData = { ...DEFAULT_LEGEND_FORM_DATA, ...DEFAULT_PIE_FORM_DATA, ...formData }; | |||
const metricLabel = getMetricLabel(metric); | |||
const minShowLabelAngle = (showLabelsThreshold || 0) * 3.6; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turns out the TextControl
with isFloat: true
returns an empty string when unset, making it important to replace a falsy value for showLabelsThreshold
with zero.
Codecov Report
@@ Coverage Diff @@
## master #1071 +/- ##
=======================================
Coverage 27.80% 27.80%
=======================================
Files 453 453
Lines 9104 9104
Branches 1416 1416
=======================================
Hits 2531 2531
+ Misses 6382 6381 -1
- Partials 191 192 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for this fix.
Thank you @villebro , i believe the actual implementation/fix is happening in Echarts repo and will be available in their next release? |
@junlincc you are right - this fix only partly works on the 5.1.0 release - the rest of it is implemented in 5.1.1 (apache/echarts#14702) which is being bumped here: #1074 |
🐛 Bug Fix
When
showLabelsThreshold
is set, the label lines are shown despite the labels being missing. This PR removes the hack to make labels empty strings when the threshold is not met and implements theminShowLabelAngle
(set to3.6 * showLabelsThreshold
as 100 % == 360 degrees) property that provides native support for removal of thin slices.BEFORE
As can be seen in the screenshot, the top slices show a line despite no labels being shown:
AFTER
After the fix, no label lines are shown for the slices that don't exceed the threshold: