How to create a

Stacked Bar Chart.

Perfect to show the results of surveys. Comes with a number of features to refine the final result quickly.

What you learn


How to create a stacked bar chart

 E.g. to display results from a survey


Place the legend over the bar

Resulting in better use of white space, more clarity


Using a color key to guide users

Make it easy to understand what the colors mean

Stacked Bar Charts

This is one example of the new bar charts available through Datawrapper. Let us show you how to create a chart like this.


Below is our dataset we use to create this stacked bar chart. The data is the level of trust in media reporting regarding a range of much discussed topics. This is from a survey conducted in Germany, but you can imagine seeing similar data from surveys conducted in your own country.

[["Topic","Very high trust","High trust","No answer","Low trust","Very low trust"],["Mediterranean Migrant Crisis","0.03","0.45","0.02","0.41","0.09"],["Protests of Islam critical \"PEGIDA\" movement in Dresden","0.03","0.37","0.04","0.41","0.15"],["Financial Crisis in Greece","0.04","0.31","0.02","0.46","0.17"],["Ukraine conflict between Russia and Western Countries","0.02","0.3","0.02","0.52","0.14"]]

Import into Datawrapper

Either copy the data from a spreadsheet. Or alternatively export and then import the data in as a CSV (comma-separated values, a common exchange format for data). 

Choose the right chart type

The chart type to choose here is - obviously - the Stacked Bar Chart

Experienced users of Datawrapper will know that, but if you just started it is important to know that with the selection of this chart type the options and features available for this chart will change in the sections Refine, Annotate and Design

First iteration of your chart

Datawrapper will now automatically create a first chart, by making a few guesses on how the chart should look like. The result will look more or less like the one below. 

This is not a bad chart, but it has issues. 

For example the long labels on the left do not leave much space for the bars on the right. 

Another issue is that the color is currently only in a range of blue - although we are showing values for "very high" and "very low" trust in media reporting.  Wether the majority has high or low trust should be be reflected in the chart. 


To make the chart better, click on the tab Refine, then click on Labeling lower down.    

We will now use the option Display labels in separate line to make understanding the chart much simpler for the user.

Here is the better version of the chart. The labels are now placed over the bars, which makes them easy to read and at the same time makes them easier to compare. Another benefit is that the handling of white space in the chart as a whole is much better - the bars are the most prominent element, not being compressed by the longish labels any more. 

If you used Datawrapper before this will come as a big relief: Even longer legends can not be handled easily, making the horizontal bar chart much more versatile. 

More clarity: Colors, color key, thicker bars

Still, we can make the chart even better. The options to do that are all found in Appearance, the changes will be made with just a few clicks.

(1) We use dark blue/light blue as well as orange display how many people do or do not trust media reporting. 

(3) Check Show color key - this will add a description above the bar chart to show what color represents what answer. 

Here is how the color key will look like:

(4) Check Separate rows with dotted lines. This will add a line between each answer/topic and the bar. It can be debated whether this is strictly following the "data-ink rule". But as the question/answer are each one block of information the dotted line helps a bit to go from one section in the chart to the next. Plus, adding the dotted line is just an option.

(5) Finally, as another option, you can choose to make the bars "thicker". Leaving them thinner should be used if you have a lot of bars, to save space. But for the number of bars we have here, the "thicker" option makes the bars stick out more.

For comparison, here is the very first version of the chart and how it looks after we made the adjustments. We hope we found a good balance between options and easy usage. Test for yourself: Once you did a number of stacked bar charts you will find that creating a great chart this way is still done very quickly. 

Below now is the final, live and interactive version of the chart we just created:

Note on automatic features

We built a number of nice little features into Datawrapper here. 

For example, notice how the color of your test automatically changes from white to black, depending on what color for the bar you choose. When the color is light, the label text will be black, and vice versa.

Another very helpful automatic feature is: In the stacked Bar Chart and in other chart types where this is needed Datawrapper will not show the value label if the bar is just too small. It is a compromise, but in most cases people will easily see that e.g. the small dark blue part is another 1-2%, the big picture is clear. Showing the labels would otherwise result in many messy display situations, so we hope you agree that this is a good compromise. 

Other Interesting Tutorials

How to create a Stacked Column Chart

Learn how to create a stacked column chart in minutes with Datawrapper.

View Guide

All-new line charts

Datawrapper has completely revamped line charts: More responsive, cleaner and with annotations.

View Guide