Just Qlik it: Electoral Gauge Chart

Hey everyone! Ready for another installment of our beloved section Just Qlik It? What? You forgot about that section? Well, for nearly two years so did I, but don’t worry, because it’s time to bring it back!

When I started this blog in 2014, I wrote a couple of posts under a category called Just Qlik It. These were supposed to be small recipes that everyone could just copy and paste in their apps. My idea was to contribute to your personal Qlik library (that messy file we all have where we store cool visualizations and useful chunks of code to reuse them later on). However, for some reason I forgot about that concept and kept going with other kind of posts… up until now!

Today’s snippet is a chart that you’ve seen a thousand times in the last few days: the electoral gauge chart. Even though it is really simple, its rectangular shape makes it very flexible when it comes to fitting into difficult spaces (you can make it wider or taller without impacting its aesthetics or functionality).


It is also one of those noble visualizations that go well with almost any other object, just like a white collared shirt in your wardrobe (or so says my girlfriend). By mixing it with some images and text objects, it can become a great way to display the most relevant metrics in your dashboards.

As usual, you can download all the related files here or here, and the comment section is ready for your enquiries. On to the recipe!

Electoral Gauge Chart

1.- Create a new gauge chart. Don’t include any dimension and use a dummy expression like this:


2.- Go to the Presentation tab and select the “Reggae Flag” option (do these have an official name?). Also, change the orientation to horizontal.


3.- As it always happens with gauge charts, all the magic resides in the Presentation tab. First, let’s define the object’s size by changing the Min and Max values. In this case, I’ll use a variable called Total_EVs.


4.- Time to delete all those things that we don’t actually need! Get rid of the scales, segment boundaries, gauge outlines, pop-up labels and even the gauge’s indicator by changing the following options:


5.- Now, we need to define our three blocks: Republican, Democrat and the “empty space”. Don’t forget to uncheck the Autowidth Segments option in the lower left part of the screen so we can modify the lower bounds.


Our three segments will have the following definitions for their respective lower bounds:


6.- Add a reference line to define the number of votes that the candidate needs to win the elections:


7.- We’re almost done! Let’s take some time to clean up our visualization by unchecking the following options:

  • General: Show Title in Chart
  • Layout: Use Borders
  • Caption: Show Caption

8.- And for the finishing touches let’s add some text objects. Remember, the important thing when including labels, images or dynamic KPIs is to create a visual hierarchy that guides the user through your dashboard. Think of it as if you were telling a story: start with the big numbers, and give more details (explanations or granularity) on demand.


Don’t be afraid of using several colors, sizes, styles and alignments. But also, try to control yourself. If you create too many objects, your tab will become a nightmare to maintain! Just try to be consistent with the rest of your app and don’t clutter your visualization too much. You can try adding more metrics or even some icons instead of static labels. For example:


(When I give this kind of instructions I feel like a strange mix between Martha Stewart, an Art Attack host and one of those chefs in the cooking channel… but anyways…)

In the end, a good visualization means nothing if you don’t accompany it by some other charts and tables that let you take your analyses to the next level. In this case, we can add a straight table with the number of popular and electoral votes per state (the interactive sort feature will be very useful here). And, if you want to go even further, you can include a tile grid map that highlights the winning party:


If you don’t remember how to create these charts, you can rely on this post, where you could also learn how to use the colormix2 function to build a heat map like this one:


Or even go back to one of our original Just Qlik It posts and add a choropleth map (no extensions needed):


I hope you liked today’s recipe. I’ll try to create more of these Just Qlik It snippets in the future. As an inexperienced developer, I found them very useful a couple of years ago! If you have any comments or ideas for our next posts, be sure to leave them in the section below.

Until next time!

9 thoughts on “Just Qlik it: Electoral Gauge Chart

  1. Aaron Couron says:

    Pretty professional looking on the visualization. Just wish it didn’t take so much dev to make something look good, you know? Loving your posts Julian!

    • Thanks a lot Robert, I’m glad you liked these apps. By the way, I saw you recently started a blog. Good luck with QlikSteps!!!

  2. Bhavesh Jain says:

    Great Work!!
    I want to try making the same but not able to search for proper data over internet. Can you please tell me from where did you get it??

    • I got the info from Wikipedia, but if you donwload the materials, you’ll find an Excel file with all the states and their results!

Leave a Reply to Robert Mika Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s