Skip to main content
All CollectionsBuilding Metrics
Creating Custom Column Charts
Creating Custom Column Charts
Lukas Nordbeck avatar
Written by Lukas Nordbeck
Updated over 2 years ago

Column charts display data using vertical bars where the length is proportional to the value of the data. There are 3 types of column charts within the tool: the basic column chart, the stacked column chart, and the stacked column % chart. Typically, we see the metric name as dim1, profile ID as the X-Axis (dim2), and then the range of values for the data on the Y-Axis. Our guide on using the Metric Builder is recommended before moving on.

Let’s take a look at an example of each kind of column visualization. We’ll be working with the same data in all the charts, but displaying them differently in each. In all 3 visualizations, we want to analyze the new Facebook reactions for the profiles: Love, Wow, Haha, Sad, & Angry.

Creating a basic column chart

For this basic column chart, we will be looking at the total number of new Facebook Reactions. To do this, we simply sum up the columns for each reaction from the facebook table. Be sure to select 'Column Chart' as the visualization type.

The QQL Code will look as follows:

SELECT 'Reactions' AS dim1, profileId AS dim2, (ownPostsLove + ownPostsWow + ownPostsHaha + ownPostsSad + ownPostsAngry) FROM facebook

Screen_Shot_2017-09-03_at_5.31.01_PM.png

As you can see, the chart displays the total value from our calculation we have in the QQL code.

Creating a stacked column chart

Stacked column charts are good to use when you want to visualize multiple values for each profile. When writing the QQL Code, you simply need to add a UNION query for each metric you want to analyze. Be sure to select 'Stacked Column Chart' as the visualization type.

Unlike our previous example where we summed up the different reactions, we now will have each reaction in its own query, joined by UNIONs.

The QQL Code will look as follows:

SELECT "Love" AS dim1, profileId AS dim2, ownPostsLove FROM facebook UNION SELECT "Wow" AS dim1, profileId AS dim2, ownPostsWow FROM facebook UNION SELECT "Haha" AS dim1, profileId AS dim2, ownPostsHaha FROM facebook UNION SELECT "Sad" AS dim1, profileId AS dim2, ownPostsSad FROM facebook UNION SELECT "Angry" AS dim1, profileId AS dim2, ownPostsAngry FROM facebook

Screen_Shot_2017-09-03_at_5.35.10_PM.png

Now we are seeing the new reactions broken down by each type of reaction. By hovering over the bars, you can see the different values for each reaction per profile. For example, Wendy’s garnered more Wow reactions than the other profiles at 1,692.

Creating a stacked column % chart

While stacked column charts show the actual numbers of each metric, a stacked column % chart displays the percentage each metric makes up of the total per column. The sum of the bars in each column will always add up to 100%. Be sure to select 'Stacked Column Percent Chart' as the visualization type.

The QQL Code remains unchanged from the previous example:

SELECT "Love" AS dim1, profileId AS dim2, ownPostsLove FROM facebook UNION SELECT "Wow" AS dim1, profileId AS dim2, ownPostsWow FROM facebook UNION SELECT "Haha" AS dim1, profileId AS dim2, ownPostsHaha FROM facebook UNION SELECT "Sad" AS dim1, profileId AS dim2, ownPostsSad FROM facebook UNION SELECT "Angry" AS dim1, profileId AS dim2, ownPostsAngry FROM facebook

Screen_Shot_2017-09-03_at_5.35.16_PM.png

Here we see that all columns go up to the 100% mark. If we hover over the Wow bar again for Wendy’s, it will show both the raw value of 1,692 posts, as well as the percentage of the total new reactions, 10.1480%.

Conclusion

So what have we learned today? Basic column charts are simple, yet effective, visualizations to compare a single metric between profiles. Stacked column charts allow us to analyze the raw values of multiple metrics between profiles, while stacked column % charts allow us to analyze those same metrics but normalized. Once you know what data you wish to visualize, you can decide which of these charts would best display that information.

Did this answer your question?