Menu

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.

image1


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

image2


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

image3


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

image4


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.

image5


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

image6


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

image7


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

image8


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