Qlik Community

Qlik Design Blog

All about product and Qlik solutions: scripting, data modeling, visual design, extensions, best practices, etc.

Announcements
Join “Do More With Qlik” with Mike Tarallo to get a first-hand look at the New Authoring Experience, June 29th: REGISTER HERE
ArturoMuñoz
Employee
Employee

It's been a while since I posted a tip about creating charts. I say roll up your sleeves and let's hack one of the standard charts to create a chart type that doesn’t exist in our chart library. Who's in?

We will be making a lollipop chart and something extra, because, well, why not.

First, let's describe what a lollipop chart is and why it can be useful.

What is a lollipop chart?

A lollipop chart is a variation of a bar chart. It differs from a traditional bar chart in two ways: bars are reduced to a line, and the bar tips are oversized in the shape of a circle. If you're a sweet tooth, it'll remind you of a lollipop.

One of the main benefits of a lollipop chart is that it can be used to represent a large set of tall bars in a less intimidating way. However, it is pertinent to emphasize that this chart is less accurate than a regular bar chart. This is mainly because the center of the circle at the end of the lollipop marks the value. In comparison to the straight edge of a bar, it is difficult to determine where the center is located. 

Hands on

We will use a combo chart and some of its not-so-new features to create a lollipop chart. Remember a bar chart needs at least one dimension and one measure.

Drag a combo chart and add a dimension and one measure

Nothing wrong with this chartNothing wrong with this chart

 

Next, let’s start messing with the chart settings. Go to Appearance, Presentation, and then Advance Styling. There you will be presented with a bunch of configuration options. What we want is to make the bar width really thin. Anything around 0.1 usually works well.

 

ArturoMuoz_1-1647996869113.png

 

Now our combo chart should look something like the one below.

ArturoMuoz_2-1647996869159.png

 

Next, is the time to add the candy on top of those lines. Since we are using a combo chart we can quickly add another measure to it and pick a marker as its representation. Simply add the same measurement you used for the bars again. It will be added as a line and the label will say height of line. Don’t panic, no yet. Next expand the new measure panel and scroll down to click on “More properties” button and pick “Marker” from the options displayed.

 

Your chart should be looking something like thisYour chart should be looking something like this

 

 

The next step is to get the colors of the bars and the marker in sync. Simply select the appropriate color in the menu option under the measure “More properties” panel.

 

ArturoMuoz_4-1647996869252.png

 

 

If you want your circle markers in sync with your bars, and you are using something more sophisticated than single color you can go a long way with colors by using expression instead of single color in the panel.

As a final step, make sure that neither the legend nor the tooltip ruin our little hack by showing both metrics. To do that just scroll to the very bottom of the combo chart Presentation properties panel deactivate the legend and change the tooltip properties from basic to custom to make sure you have control over it.

 

ArturoMuoz_5-1647996869423.png

 

EXTRA TIP:

After learning how to make a fancy lollipop chart using the combo chart, we can spend some time creating a bar chart with rounded corners as in the picture below.

ArturoMuoz_6-1647996869523.png

 

The process is simple, just adjust the bar width until it matches the circle diameter size and voila, your rounded corner bar chart is ready. There are some colors that work better than others at dissimulating marker borders (darker colors), keep that in mind if you are looking for perfection. 

 

Thank you for reading this post I hope you enjoyed it.

Arturo