SaadAhmed7 opened a new pull request, #42933:
URL: https://github.com/apache/superset/pull/42933

   ## Summary
   
   Fixes #42701
   
   When a stacked Timeseries Bar chart uses a `timeseries_limit_metric` (Sort 
By metric) that is not among the displayed metrics, the "Only Total" stacked 
label incorrectly includes the sort metric's value in the sum.
   
   **Root cause**: `extractDataTotalValues` in `src/utils/series.ts` sums ALL 
numeric keys in each data record, including extra metrics used only for 
sorting/limiting. These sort-only metrics are correctly excluded from the 
rendered series by `extractSeries` (via `extraMetricLabels`), but 
`extractDataTotalValues` was not aware of them.
   
   **Fix**:
   - Added an optional `extraMetricLabels` parameter to 
`extractDataTotalValues` so it can skip sort-only metric keys when computing 
the stacked total
   - Moved the `extraMetricLabels` computation in `transformProps.ts` to before 
the `extractDataTotalValues` call and passed it as a parameter
   
   **Example**: A data row `{"category": "1-3g", "A": 32, "B": 0, "Sort": 2}` 
where `Sort` is a sort-only metric will now correctly show a total of `32` (32 
+ 0) instead of `34` (32 + 0 + 2).
   
   ## Test plan
   
   - [ ] Create an `echarts_timeseries_bar` chart with 2+ metrics, Stacked, 
"Only Total" enabled
   - [ ] Set `timeseries_limit_metric` to a metric not among the displayed 
metrics
   - [ ] Verify the "Only Total" label shows the correct sum (excluding the 
sort metric)
   - [ ] Verify charts without `timeseries_limit_metric` are unaffected 
(parameter is optional)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to