sadpandajoe commented on code in PR #43238:
URL: https://github.com/apache/superset/pull/43238#discussion_r3817737933
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -480,11 +480,62 @@ export default function transformProps(
? [minMarkerSize, maxMarkerSize]
: [maxMarkerSize, minMarkerSize];
+ // When stackDimension is configured, each series is assigned to a separate
+ // ECharts stack group keyed by the dimension value. Compute this mapping
+ // before calling extractShowValueIndexes so each group's topmost series is
+ // tracked independently (fixing the bug where only the last series across
+ // all groups was flagged to show the total label).
+ // When metrics.length > 1 the label-map tuple is [metric, dim0, dim1, ...],
+ // so the stackDimension sits at offset 1 + groupby.indexOf(stackDimension).
+ // When there is a single metric the tuple is [dim0, dim1, ...] with no
+ // metric prefix, so the offset is just groupby.indexOf(stackDimension).
+ const idxSelectedDimension =
+ stack === StackControlsValue.Stack &&
+ stackDimension &&
+ chartProps.rawFormData?.groupby
+ ? (formData.metrics.length > 1 ? 1 : 0) +
Review Comment:
The multi-metric offset correction is not exercised through
`transformProps`, so a later regression can group the `Only Total` labels by
the first dimension again. Could this add a two-metric, two-groupby case that
asserts `stackDimension` selects the matching stack and total?
--
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]