sfirke opened a new issue, #45488:
URL: https://github.com/apache/superset/issues/45488

   ### Bug description
   
   (I found this issue by hand, then wrote it up with Claude AI. I edited and 
am posting this by hand having read it all)
   
   In 7.0.0rc2, a Timeseries chart whose Legend Type is **List** and Legend 
Orientation is **Top** or **Bottom** draws every legend item as the same filled 
12px square. That includes data series and annotation layers, and solid and 
dashed lines alike. In 6.1.0 the legend icon reflected the series: a line with 
its marker, drawn in the series' line style.
   
   The practical loss is the line style. Our chart of PFAS concentrations has 
two Formula annotation layers: a solid red line for a regulatory limit (8 ppt) 
and a dashed gold line for the lab reporting limit (2 ppt). In 6.1.0 the legend 
showed the dashed one as dashed, so readers could match legend to line by style 
as well as color. In 7.0.0rc2 both are plain colored squares, and so is the 
data series.
   
   This comes from #43314, which renders List Top/Bottom legends as HTML 
outside the ECharts canvas 
(`superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/TimeseriesLegend.tsx`).
 The swatch is a fixed square that only knows the series color:
   
   ```ts
   const Swatch = styled.span<{ color: string; selected: boolean }>`
     ${({ color, selected }) => `
       background: ${selected ? color : 'transparent'};
       border: 1px solid ${color};
       ...
       height: 12px;
       width: 12px;
     `}
   `;
   ```
   
   The PR fixes a real problem (long legends painting over the plot), and I'm 
not suggesting reverting it. But its testing instructions say a chart with only 
a few legend entries should be "unaffected". The icons are a visible change for 
every such chart. Other legend types (Scroll), Left/Right orientation, and 
other chart plugins still use the ECharts legend, so legend icons are now 
inconsistent between charts on the same dashboard depending on a legend setting.
   
   This affects ~99 charts in my deployment.
   
   **How to reproduce**
   
   1. Create a Line Chart with a metric and a Formula annotation layer with 
Style "Dashed" (e.g. value `2`).
   2. Under Customize, set Legend Type to List and Legend Orientation to Top.
   3. The legend shows a filled square for the metric and for the annotation; 
the annotation isn't shown as dashed.
   4. Switch Legend Type to Scroll: the legend shows ECharts' usual line-series 
icons again. (Sam: I confirmed this)
   5. Compare with 6.1.0, where the List legend shows the same icons as Scroll.
   
   **Expected behavior**
   
   The legend icon reflects the series it labels, as in 6.1.0 and as the Scroll 
legend still does: at least the line style (solid/dashed/dotted) and ideally 
the symbol. Ideally line series (including annotation lines) show as a short 
line segment in their style, so a dashed annotation line is recognizable in the 
legend.
   
   **Proposed fix**
   
   `buildTimeseriesCustomLegend` already receives the final series. It could 
pass each item's series type, symbol and `lineStyle.type` to 
`TimeseriesLegend`, and `Swatch` could render a small inline SVG (a line 
segment in the right dash style, plus the symbol) instead of a fixed square. 
Bar and area series could keep a filled square.
   
   ### Screenshots/recordings
   
   6.1.0 has the right symbol/line weight and dashing:
   
   <img width="1540" height="477" alt="Image" 
src="https://github.com/user-attachments/assets/432eaf93-ff73-4603-9058-0a1e1f43aac3";
 />
   
   7.0.0rc2 is missing it:
   
   <img width="1552" height="505" alt="Image" 
src="https://github.com/user-attachments/assets/651b416e-1401-402e-a632-09260e59db38";
 />
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   Not applicable
   
   ### Node version
   
   Not applicable
   
   ### Browser
   
   Not applicable
   
   ### Additional context
   
   - Superset 7.0.0rc2, Docker image built from the release. Works as expected 
on 6.1.0.
   - Introduced by #43314 (render Plain Timeseries legends as HTML, not canvas).
   - Annotation layers aren't the trigger; a chart with no annotations and a 
Plain Top legend also gets squares.
   
   ### Checklist
   
   - [ ] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


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