sadpandajoe commented on code in PR #43113:
URL: https://github.com/apache/superset/pull/43113#discussion_r3926625442


##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -606,6 +607,47 @@ export default function transformProps(
   const array = ensureIsArray(chartProps.rawFormData?.time_compare);
   const inverted = invert(verboseMap);
 
+  // A Percentage or Ratio time comparison replaces the derived series' values 
with a
+  // dimensionless number, so that row is no longer in the source metric's 
units and
+  // must not inherit its currency/D3 format.
+  //
+  // `label_map` carries the structured identity behind a rendered series 
name, and
+  // `renameOperator` puts the offset at the front of a derived row's entry:
+  //
+  //   derived  '1 week ago, East'  -> ['1 week ago', 'East']
+  //   derived  'count, 1 year ago' -> ['1 year ago', 'count']
+  //   base     'sum__num, East'    -> ['sum__num', 'East']
+  //
+  // so the leading column says which it is. Matching the rendered name 
instead would
+  // misread a base series whose dimension value happens to equal the offset — 
a region
+  // literally named "1 week ago" gives 'sum__num, 1 week ago', which reads as 
derived.
+  const isDerivedComparisonSeries = (seriesKey: string) => {
+    const columns = labelMap?.[seriesKey];
+    // Without an entry there is nothing structured to go on, and the only 
name that can
+    // stand alone is the bare offset of an ungrouped single-metric chart.

Review Comment:
   When `formData.timeCompare` is populated, the earlier `labelMap` 
normalization removes the leading offset before this check runs, so a derived 
grouped comparison row no longer matches and falls back to the source metric's 
formatter. Could this retain/use the pre-normalization derived identity and add 
a Percentage/Ratio fixture with `timeCompare` set?



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