gkhnelbstn opened a new pull request, #42755:
URL: https://github.com/apache/superset/pull/42755
### SUMMARY
On a stacked Timeseries Bar/Area chart with "Show Total"/"Only Total"
enabled, `extractDataTotalValues`
(`plugins/plugin-chart-echarts/src/utils/series.ts`) summed every non x-axis
column of each data row into the stacked total. This included the
`timeseries_limit_metric` ("Sort by" metric), which is added to the query
purely for sorting/limiting the x-axis and is correctly excluded from the
rendered series/legend by `extractSeries` via `extraMetricLabels`. Since that
column never appears as a legend entry, `legendState` could not exclude it
either, so its value silently leaked into the displayed total.
This threads `extraMetricLabels` (already computed in
`Timeseries/transformProps.ts` for `extractSeries`) into
`extractDataTotalValues` and excludes those keys the same way the x-axis column
is excluded.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (data-only bug, see reproduction in linked issue)
### TESTING INSTRUCTIONS
1. Create an `echarts_timeseries_bar` chart with 2 metrics `A`, `B`,
Stacked, "Only Total" enabled.
2. Set `timeseries_limit_metric` ("Sort Series By") to a metric not among
the displayed metrics, e.g. `MIN(some_sequence_column)`.
3. Before the fix, the "Only Total" label includes the sort metric's value
(e.g. `32 + 0 + 2 = 34`) instead of the correct sum of only the displayed
metrics (`32 + 0 = 32`).
4. Added unit tests in
`plugins/plugin-chart-echarts/test/utils/series.test.ts` covering
`extractDataTotalValues` with and without `extraMetricLabels`, combined with
`legendState` and non-stacked mode.
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #42701
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] 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]