GitHub user dosubot[bot] added a comment to the discussion: Labels are not displayed correctly in version 5.0
<!-- Answer --> The issue with saved metric labels not appearing in Pie Chart tooltips—while ad hoc metric labels do—is due to how Superset retrieves and displays metric labels. For saved metrics, the tooltip tries to use the `verbose_name` or `metric_name`, but if the label isn't set or isn't properly referenced, it may fall back to the internal name instead of your custom label. Ad hoc metrics (defined directly in the chart) use the label you provide, so they display as expected. You can see this logic in the code that handles metric label retrieval and tooltip rendering [[source]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/utils.ts). For the concatenation of quantity and percentage in the tooltip, this is a known formatting issue. The tooltip formatter by default may concatenate these values without spaces or punctuation. You can improve readability by customizing the tooltip formatter in the Pie Chart plugin code. For example, you can change the formatter function in `transformProps.ts` to format the tooltip string with spaces and commas, or even remove the percentage if you don't want it shown [[source]](https://github.com/apache/superset/issues/33913). Here’s a suggested change: ```javascript // Instead of: const [name, formattedValue, formattedPercent] = parseParams({ ... }); return tooltipHtml([[metricLabel, formattedValue, formattedPercent]], name); // Use: const [name, formattedValue, formattedPercent] = parseParams({ ... }); return `${name} ${formattedValue}, ${formattedPercent}`; // Or, to remove the percent: const [name, formattedValue] = parseParams({ ... }); return tooltipHtml([[metricLabel, formattedValue]], name); ``` If you want to ensure your saved metric label appears, double-check that the metric's `verbose_name` or label is set in the dataset, and that your Superset version includes recent fixes for tooltip formatting [[source]](https://github.com/apache/superset/issues/35120). If you’re comfortable editing code, the above formatter tweak will give you full control over the tooltip display. <!-- 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/352c6ee6-b8d3-4252-9026-818f3e592530?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/352c6ee6-b8d3-4252-9026-818f3e592530?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/352c6ee6-b8d3-4252-9026-818f3e592530?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/352c6ee6-b8d3-4252-9026-818f3e592530?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/352c6ee6-b8d3-4252-9026-818f3e592530?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/352c6ee6-b8d3-4252-9026-818f3e592530?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/352c6ee6-b8d3-4252-9026-818f3e592530?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)& nbsp;[](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/35862) GitHub link: https://github.com/apache/superset/discussions/35862#discussioncomment-14796536 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
