Menu

Unit Chart

In this tutorial, you’ll learn how to draw a Unit Chart in Glimpse. This chart uses a series of shapes (in our example we used circles) to represent the values in a dataset. Each shape can represent one unit or any number of units (e.g. each shape represents 10).

Open the Data Grid from the bottom of the window and add the data from the table below:

Category Value
A 3
B 12
C 6


Then, go to Visual > Mark in the Inspector panel to the right side of the UI. Set the Mark Type to Circle. (You can also use Square or Shape).

image1


From the left side of the app, drag the field Category into the X encoding.

image2


To convert the data values into a series of dots, you’ll need to create 3 data transforms. To create the first one, go to Insert > Transform > Calculate from the top menu.

Go to the Inspector panel and enter the following:

“Create Array From Value” in the Title field. “CreateArrays” in the Output field.
Enter the following expression in the Calculate field:

sequence(datum['Value'])

Then activate the transform by switching on the toggle at the top of the Inspector panel.

image3


Add in the next transform by going Insert > Transform > Flatten from the top menu. For the Title enter “Flatten Array into Rows”, select CreateArrays from the Field dropdown and then type “Array”. Make sure to activate the transform with the toggle at the top of the panel.

image4


Add in the last transform from the top menu, go to Insert > Transform > Window. Type in “Rank Flattened Array” for the Title input. Below, in the Window dropdown select Rank, the next dropdown should be set to None, and type in Rank in the last input. For Group below, select the field Category. Finally, activate the transform.

image5


Now, drag the transform token Rank into the Y encoding.

image6


The chart is upside down. Let’s reverse it. In the Inspector panel, go to Visual > Encoding > Scale > Range and tick Reverse.

image7


To make the units more visible, go Visual > Mark > Size and enter 30 pt.

image8


Done! This is how you draw a Unit Chart. If you want to further customize your chart, please read the documentation.