rlei-odes opened a new pull request, #43660:
URL: https://github.com/apache/superset/pull/43660
### SUMMARY
Currently, we are not able to turn off the labels of the value axis in
charts. They are hard-coded in the timeseries transform, guarded only by the
micro-chart height check:
```ts
axisLabel: {
show: !isMicroChart,
showMinLabel: !isMicroChart,
showMaxLabel: !isMicroChart,
...
}
```
That matters when trying to get a clean look for a chart with minimal
optical distractions. Also if we use **Show value**, then the numbers are
already printed on the bars or points, so the axis scale repeats
information the reader has in front of them. Removing it today needs
hand-written JSON in
*Customize → ECharts Options*.
This adds a **Value axis labels** checkbox to the Customize tab of every
chart
that already carries the gridline and tick controls added in #43428: Bar,
Line,
Area, Step, Scatter, Smooth Line and Mixed.
Three details for review:
- **It defaults to on, so nothing renders differently until a user unticks
it.**
The transform destructures from `{ ...DEFAULT_FORM_DATA, ...formData }`, so
charts saved before this change pick the default up too.
- **All three coupled properties follow the control.** `showMinLabel` and
`showMaxLabel` force the boundary labels on; leaving them `true` beside
`show: false` would be contradictory, even though ECharts ignores them in
that
state.
- **The micro-chart guard is preserved.** Written as
`isMicroChart ? false : valueAxisLabels`, matching the surrounding lines,
so a
ticked box cannot put labels back on a chart too short to carry them. Note
the
threshold here is `microChartHeight` (60px), not the `compactChartHeight`
(100px) that gridlines and ticks use.
On the Mixed chart both `yAxis` entries are value axes and neither set
`axisLabel.show`, so both now follow the control. ECharts defaults that
property
to a plain `true`, so the enabled state is identical to today.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Value axis labels on / off:
<img width="924" height="1197" alt="Value axis labels on / off"
src="https://github.com/user-attachments/assets/a62de180-879c-40ae-ab78-3ec17a781699"
/>
The Customize tab, where it joins the gridline and tick controls:
<img width="506" height="1151" alt="Value axis labels control"
src="https://github.com/user-attachments/assets/7ad6f73b-b525-41f8-ab47-02fd6ae7dbc8"
/>
### TESTING INSTRUCTIONS
Unit tests: `npm run test --
plugins/plugin-chart-echarts/test/Timeseries/transformProps
plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps`
Manually, on any Bar or Mixed chart:
1. Open an existing chart that has never seen this control and confirm it
renders exactly as before. This is the regression that matters most.
2. Turn on **Show value** so the numbers appear on the series, then
Customize →
untick **Value axis labels**. The axis numbers go; the gridlines, ticks
and
category labels stay.
3. Re-tick and confirm the chart returns to its original look.
4. On a Bar chart, set Orientation to Horizontal and untick the control. The
labels still follow the value axis, which is now the horizontal one.
5. Shrink a chart below 60px tall. The labels stay hidden regardless of the
checkbox, as they do today.
A chart that already sets `yAxis.axisLabel.show` in *Customize → ECharts
Options* will ignore the control, because custom options are merged over the
computed ones. That is existing precedence, not a regression.
### ADDITIONAL INFORMATION
- [x] Has associated issue:
https://github.com/apache/superset/discussions/43426
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]