rusackas commented on code in PR #45555:
URL: https://github.com/apache/superset/pull/45555#discussion_r4343243243
##########
superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts:
##########
@@ -544,7 +546,23 @@ export default function transformProps(
let displayName: string;
- if (groupby.length > 0) {
+ if (truncateMetric && groupby.length > 0) {
+ // Drop the metric part entirely and show only the groupby/dimension
+ // values. The label-map tuple is [metric, ...dimensions] only when the
+ // query has more than one metric; with a single metric the whole
+ // tuple is dimensions. Still apply the query-identifier suffix when
asked
+ // for, or Query A and Query B become indistinguishable whenever they
+ // share a groupby value (#38451).
+ const groupbyValues =
+ labelMapValues && ensureIsArray(metrics).length > 1
+ ? labelMapValues.slice(1)
Review Comment:
@sadpandajoe good catch. Truncation is now skipped when a time comparison is
active, so the current and historical series keep their offset-based names and
stay distinct.
##########
superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps.test.ts:
##########
@@ -1967,3 +1967,105 @@ test('converts xAxisLabelInterval string "0" to number
0', () => {
// "All" must also disable hideOverlap so ECharts never drops a label.
expect(xAxis.axisLabel.hideOverlap).toBe(false);
});
+
+describe('truncateMetric / truncateMetricB', () => {
Review Comment:
@sadpandajoe added a two-metric case with identifiers on for both queries. I
did not add a time-comparison case, since that path now bypasses truncation.
--
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]