This is an automated email from the ASF dual-hosted git repository.

enzomartellucci pushed a commit to branch enxdev/fix/time-compare-dashed-style
in repository https://gitbox.apache.org/repos/asf/superset.git

commit c0934ceada6c4b2292fd13e45ed63628a4ee0863
Author: Enzo Martellucci <[email protected]>
AuthorDate: Wed Jan 14 17:12:23 2026 +0100

    fix(echarts): restore dashed line style for time comparison series
---
 .../src/Timeseries/transformProps.ts               | 28 +++++++++++++++-------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git 
a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
 
b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
index d1675454fe..f3d5149503 100644
--- 
a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
+++ 
b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
@@ -44,6 +44,8 @@ import { GenericDataType } from 
'@apache-superset/core/api/core';
 import {
   extractExtraMetrics,
   getOriginalSeries,
+  getTimeOffset,
+  hasTimeOffset,
   isDerivedSeries,
 } from '@superset-ui/chart-controls';
 import type { EChartsCoreOption } from 'echarts/core';
@@ -289,21 +291,29 @@ export default function transformProps(
   const array = ensureIsArray(chartProps.rawFormData?.time_compare);
   const inverted = invert(verboseMap);
 
-  let patternIncrement = 0;
+  const offsetLineWidths: { [key: string]: number } = {};
 
   rawSeries.forEach(entry => {
     const derivedSeries = isDerivedSeries(entry, chartProps.rawFormData);
+    const entryName = String(entry.name || '');
+    const seriesName = inverted[entryName] || entryName;
+    // Check if this is a time comparison series:
+    // 1. hasTimeOffset checks for patterns like "metric__1 day ago" or "1 day 
ago, groupby"
+    // 2. array.includes checks if the series name exactly matches a time 
offset value
+    const isTimeCompare =
+      hasTimeOffset(entry, array) || array.includes(seriesName);
     const lineStyle: LineStyleOption = {};
-    if (derivedSeries) {
-      patternIncrement += 1;
-      // use a combination of dash and dot for the line style
-      lineStyle.type = [(patternIncrement % 5) + 1, (patternIncrement % 3) + 
1];
+    if (derivedSeries || isTimeCompare) {
+      // Get the time offset for this series to assign different line widths
+      const offset = getTimeOffset(entry, array) || seriesName;
+      if (!offsetLineWidths[offset]) {
+        offsetLineWidths[offset] = Object.keys(offsetLineWidths).length + 1;
+      }
+      lineStyle.type = 'dashed';
+      lineStyle.width = offsetLineWidths[offset];
       lineStyle.opacity = OpacityEnum.DerivedSeries;
     }
 
-    const entryName = String(entry.name || '');
-    const seriesName = inverted[entryName] || entryName;
-
     let colorScaleKey = getOriginalSeries(seriesName, array);
 
     // If this series name exactly matches a time compare value, it's a 
time-shifted series
@@ -328,7 +338,7 @@ export default function transformProps(
       colorScaleKey,
       {
         area,
-        connectNulls: derivedSeries,
+        connectNulls: derivedSeries || isTimeCompare,
         filterState,
         seriesContexts,
         markerEnabled,

Reply via email to