Stacked Bar Chart

In this tutorial, we’ll demonstrate how to draw a Stacked Bar Chart in Glimpse to visualize the cumulative totals of various types of barley across 6 locations.

First, add in the data by going Data > Sample Data > barley.json from the top menu.

Then, in the Inspector panel under Visual > Mark, set the Mark type to Bar.


Drag the quantitative field yield into the X encoding and in the Inspector panel, set the Aggregate to Sum.


Then drag in the nominal field variety into the Y encoding.


Finally, drag the nominal field site into the Color encoding.


100% Stacked Bar Chart

A 100% Stacked Bar Chart is a variation of a Stacked Bar Chart, which uses segmented bars of equal length to display the percentage-of-the-whole relationships. To convert the created chart in this tutorial, press X encoding channel (with SUM(yield)), and in the Inspector panel, set the Stack to Normalized.


To convert the X-axis into percentages, go Visual > Encoding > Axis > Labels > Formatting and in the Format As menu select Number.


After, in the Template dropdown menu, select 12%.


The label positioning can be fixed by going Labels > Alignment and selecting the central alignment.


This concludes this tutorial on drawing a Stacked Bar Chart. If you want to further customize your chart, please read the documentation.