Display change label and color of bar chart based on value #36016
Replies: 2 comments 2 replies
-
|
Superset bar charts require numeric values for the Y-axis, so you can't directly display string labels (like status_str) on the Y-axis—only numeric formatting is supported for axis and bar labels (source). Tooltips are generated by a formatter function that displays numeric values, and there isn't a built-in UI option to remove tooltips or show only a string label; customizing this would require code changes (source). Bar colors are assigned per series name using a color function, not dynamically per bar value. Conditional coloring based on metric values (like status) isn't natively supported in the UI—you'd need to preprocess your data to create separate series for each status or modify the frontend code (source). Recent updates added more color and label customization for Waterfall charts, but these settings aren't general-purpose for all bar charts or for mapping arbitrary metric values to custom colors or labels (source). If you need to show status_str, consider using a Table chart, or preprocess your data to group by status_str and use it as a series or groupby dimension. For advanced customizations (like mapping Y-axis values to strings, custom tooltips, or conditional bar colors), code changes in the frontend would be required. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
You can’t directly replace the Y-axis numeric value with strings in a bar chart in Apache Superset, but you can handle this with a simple workaround: Create a new column via SQL or a virtual dataset: CASE Use status_label as a dimension (group by) instead of status as a metric, so the chart shows readable text. To control bar colors based on status, go to Customize → Color Scheme and define a mapping (for example: “Open”=green, “Closed”=red, “Unknown”=yellow). If you want to simplify or hide the tooltip, you can disable tooltips in the chart’s “Customize” tab or use a custom JSON override template. If you’re running Superset on a cloud VPS, platforms like AccuWeb Cloud make managing datasets and chart performance smooth, feel free to check out. |
Beta Was this translation helpful? Give feedback.





Uh oh!
There was an error while loading. Please reload this page.
-
Apologies if this is answered elsewhere - I've been searching and not really come up with much.
I'm trying to graph a simple bar chart of
locationxmax(status)over time. So the table looks something likeSet up a bar chart:
This kinda works:

But the Y axis displays the raw status integer, and the tool tip displays the actual formula (
MAX(status) 3) which is really gibberish to the end user the graph will be surfaced to. I'd really like to:a - get the Y axis to display the status_str instead of the status. I'd be OK doing this with a CASE custom SQL or something like that, but Superset is complaining it has to be numerical values.
b - I'd like to scrap the tooltip altogether, or display only the status_str value, not the formula.
c - I'd REALLY love to change the bar color based on the status value (e.g. 1 = Green, 2 = Red, 3 = Yellow)
Is there any way to manage this? Seems like I can't be the only one looking for these kinds of customizations, but I'm having a hard time coming up with it.
Beta Was this translation helpful? Give feedback.
All reactions