Bug description
In most recent Superset, tooltips in line charts display metric values using a dollar format ($,.2f), even when:
- The metric is clearly set to a percentage format (e.g., .2%) in the axis config
- The "Show Values" option correctly displays the value as a percentage
- The Series Configuration > Display Format is set to .2%
This appears to be a regression from earlier versions (~4.0), where the tooltip respected the correct format defined per metric.
Screenshots/recordings
This is what I see (Show Values display them OK), but the tooltip is always formatting in $
In a previous version of superset (a dev build – branch: master, commit: 1573c101a71d6ade1f24ac89f99c4c0998b429c7) the issue was not present. See:
Both supersets use "Mixed chart" and all settings are just verbatim. In fact, the new superset is just a copy with an almost up to date master branch – as recent as last week).
Superset version
master / latest-dev
Python version
3.11
Node version
16
Browser
Chrome
Additional context
No response
Checklist
- [x] 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.
Comment From: dosubot[bot]
Hi @fgil-gn! I'm Dosu and I’m helping the superset team.
I couldn't find any existing tickets or discussions about this regression. Based on the code, tooltip formatting in line charts is handled in the transformProps
function for ECharts timeseries charts. The tooltip uses a formatter
that decides between percent or currency/number formatting depending on flags like contributionMode
, isAreaExpand
, and the presence of a currency symbol. If the tooltip always shows a dollar format, it's likely that either currencyFormat
is being set when it shouldn't be, or the logic for picking the formatter isn't respecting your per-metric or axis format settings.
You may want to check if currencyFormat
is being set in your chart config or if the forcePercentFormatter
flag is being triggered as expected. The formatter logic is here:
transformProps.ts (tooltip config)
and the relevant formatter selection is:
const formatter = forcePercentFormatter
? percentFormatter
: (getCustomFormatter(customFormatters, metrics) ?? defaultFormatter);
where defaultFormatter
uses currencyFormat
if present, otherwise falls back to yAxisFormat
.
If your chart is configured for percent but the tooltip still shows dollars, double-check that currencyFormat
is not set and that your yAxisFormat
is .2%
. If you have custom metric formats, make sure they're being picked up by buildCustomFormatters
. You may want to compare your current config and data flow to a working version from before the regression to spot any differences in how these props are set.
Let me know if you want a deeper dive into a specific part of the formatter logic or config!
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
Comment From: rusackas
I think @michael-s-molina worked on these tooltips, and might have the most informed opinion(s) here.
Comment From: michael-s-molina
@fgil-gn Do you have currency format set?