fix(plugin-chart-echarts): improve ECharts visuals#806
fix(plugin-chart-echarts): improve ECharts visuals#806villebro merged 5 commits intoapache-superset:masterfrom
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/superset/superset-ui/ilmqpv9ot |
1768996 to
f089667
Compare
f089667 to
48656f1
Compare
48656f1 to
5c303a6
Compare
Codecov Report
@@ Coverage Diff @@
## master #806 +/- ##
==========================================
+ Coverage 25.50% 25.57% +0.07%
==========================================
Files 358 359 +1
Lines 7937 7949 +12
Branches 1051 1056 +5
==========================================
+ Hits 2024 2033 +9
- Misses 5792 5796 +4
+ Partials 121 120 -1
Continue to review full report at Codecov.
|
5c303a6 to
3d4d2c2
Compare
3d4d2c2 to
a38d260
Compare
6d1cb46 to
0893d88
Compare
| { | ||
| name: 'show_labels_threshold', | ||
| config: { | ||
| type: 'TextControl', |
There was a problem hiding this comment.
NIT(optional/out-of-scope-for-this-pr): slider could be cool here eventually. I just discovered how cool the antd sliders are! https://ant.design/components/slider/
There was a problem hiding this comment.
Oh yeah, that Slider with input number looks perfect. I tinkered with the existing slider control, but it felt clunky as it doesn't allow for setting decimals, which in this case is often relevant. Let's refactor the SliderControl to use AntD in a follow-up PR and change this when that's in place.
| let [yAxisMin, yAxisMax] = yAxisBounds || []; | ||
| if (yAxisMin === undefined && contributionMode === 'row' && stack) yAxisMin = 0; | ||
| if (yAxisMax === undefined && contributionMode === 'row' && stack) yAxisMax = 1; |
There was a problem hiding this comment.
This section is fairly opaque and hard to read, wondering if/how much ts can help prevent issues around undef with more types hints here. Nothing outrageous though.
There was a problem hiding this comment.
True, will refactor.
| min: contributionMode === 'row' && stack ? 0 : undefined, | ||
| max: contributionMode === 'row' && stack ? 1 : undefined, | ||
| // these might be NaN which break the y axis | ||
| min: yAxisMin || undefined, |
There was a problem hiding this comment.
related to the comment above, but what else than int/undef could it be? Also I think 0 would be switched to undef here as 0 || undefined === undefined which seems like it's not desirable if someone wanted 0 to be the bound
a6c4fad to
49b03dc
Compare
|
|
||
| // yAxisBounds sometimes starts returning NaNs, which messes up the u-axis | ||
| let [min, max] = (yAxisBounds || []).map((val?: number) => | ||
| val !== undefined && Number.isNaN(val) ? undefined : val, |
There was a problem hiding this comment.
Apparently TS doesn't allow for Number.isNaN(undefined), hence the seemingly unnecessary check for undefined here..
There was a problem hiding this comment.
You can probably just do yAxisBounds.map(Number) and use Number.isNaN check later.
There was a problem hiding this comment.
Thanks, looks much better!
49b03dc to
6e66175
Compare
| return buildQueryContext(formData, baseQueryObject => [ | ||
| { | ||
| ...baseQueryObject, | ||
| orderby: [[metric, false]], |
There was a problem hiding this comment.
This is now needed to do descending ordering by the chosen metric: apache/superset#11153
🏆 Enhancements
Improve ECharts plugin visuals. Changes:
Pie
Timeseries
Storybook
population) with multiple thin slices to demonstrate minimum percentage threshold.Screenshot from Storybook demonstrating lower threshold with lots of thin slices:

Same with labels outside:

Screenshot of chart where a slice below the threshold is hovered above.

Truncate and bounds on y-axis:
