Skip to main content

Changing colours for bar charts

Tired of all your bars having the same colour? This is your guide

Ted Tigerschiöld avatar
Written by Ted Tigerschiöld
Updated over a month ago

One shortcoming of Apache Superset is that bar charts default to having the same colours for all bars. Below is a bar char created for the number of interactions per team.

We want each bar to have the correct colour that represents the team name. But as you can see each separate bar will have the same colour by default.

Colour separation in a bar chart is set by adding a dimension to the bar chart. The problem is that we cannot add team_list directly as a dimension as that will give below error

To solve this we have to perform a neat little trick to create a new and separate name for the team_list variable on the X-Axis.

We do this by clicking the team_list variable in the X-Axis section and heading into the custom sql tab. Here we change the name of the variable to something else. I changed it to "team" below instead of "team_list". Then Click save.


​Now we go to the dimension section and add our original varible ("team_list" in our case) as our dimension.

Now we click update chart and you should have colour seperated bars. It does not look fully as we want it yet as the bars appear wonky over the X-Axis.

To fix this we head to the customize section and choose stack in the Stacked style pick list.

After updating the chart it should look like below, voila!

Note that the colours of the bars are determined by your colour scheme. This can be changed in the chart settings or the dashboard settings depending on your dashboard setup.

Did this answer your question?