GitHub user dosubot[bot] added a comment to the discussion: Configuring two 
metrics causes SQL statements to appear in the echart legend configuration, 
while configuring one metric works normally.

<!-- Answer -->
This happens because Superset generates legend labels for echart visualizations 
by combining the metric display name (which defaults to the SQL expression or 
aggregate function if no custom label is set) with the groupby dimension value. 
When you use only one metric, the legend shows just the groupby value. With 
multiple metrics, the legend label includes both the metric and the dimension, 
so if your metric doesn't have a user-friendly label, you'll see the raw SQL 
expression in the legend.

This is expected behavior, not a bug. To get cleaner legend labels, set a 
custom "label" or "verbose name" for each metric in your chart configuration. 
Superset will use these for legend labels instead of the SQL expression or 
aggregate function. For some chart types (like Mixed Timeseries), there's also 
a "Show query identifiers" checkbox—if you turn this off, legend labels will 
omit SQL expressions and show only the metric display name and dimension 
values. [See code 
reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/plugin-chart-echarts/src/utils/metricDisplayName.ts),
 [Mixed Timeseries PR](https://github.com/apache/superset/pull/34406).

So, to get the legend labels you expect, add custom labels to your metrics or 
check for relevant chart options in the control panel.


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/f7524d69-036d-4b9f-9753-e417b7d9f59d?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/f7524d69-036d-4b9f-9753-e417b7d9f59d?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/f7524d69-036d-4b9f-9753-e417b7d9f59d?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/f7524d69-036d-4b9f-9753-e417b7d9f59d?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/f7524d69-036d-4b9f-9753-e417b7d9f59d?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/f7524d69-036d-4b9f-9753-e417b7d9f59d?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/f7524d69-036d-4b9f-9753-e417b7d9f59d?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat
 with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&
 nbsp;[![Join 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/34689)

GitHub link: 
https://github.com/apache/superset/discussions/34689#discussioncomment-14100857

----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: 
notifications-unsubscr...@superset.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to