Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
QlikView for Developers Cookbook

You're reading from   QlikView for Developers Cookbook Take your QlikView training to the next level with this brilliant book that's packed with recipes which progress from intermediate to advanced. The step-by step-approach makes learning easy and enjoyable.

Arrow left icon
Product type Paperback
Published in Jun 2013
Publisher Packt
ISBN-13 9781782179733
Length 290 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Stephen Redmond Stephen Redmond
Author Profile Icon Stephen Redmond
Stephen Redmond
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

QlikView for Developers Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Charts 2. Layout FREE CHAPTER 3. Set Analysis 4. Advanced Aggregations 5. Advanced Coding 6. Data Modeling 7. Extensions 8. Useful Functions 9. Script 10. Improving Performance 11. Security Index

Creating a "Stephen Few" bullet chart


Stephen Few designed the bullet chart as a replacement for a traditional gauge.

A traditional gauge takes up a large amount of space to encode, usually, only one value. A bullet chart is linear and can encode more than one value.

The main components of a bullet chart (from Stephen Few's perceptualedge.com) are as follows:

  • A text label

  • A quantitative scale along a single linear axis

  • The featured measure

  • One or two comparative measures (optional)

  • From two to five ranges along the quantitative scale to declare the featured measure's qualitative state (optional)

There is no native bullet chart in QlikView. However, we can create one by combining a couple of objects.

Items 1, 2, 4, and 5 can be achieved with a linear gauge chart. The bar, item 3, can then be overlaid using a separate and transparent bar chart.

Getting ready

Load the following script:

LOAD * INLINE [
    Country, Sales, Target
    USA, 1000, 1100
    UK, 800, 1000
    Germany, 800, 700
    Japan, 1000, 1000
];

How to do it…

Perform the following steps to create a Stephen Few bullet chart:

  1. Add a new gauge chart. You should add a title and enter text for Title in chart. Click on Next.

  2. There is no dimension in this chart. Click on Next.

  3. Enter the following expression:

    Sum(Target)
  4. Click on Next.

  5. There is no sorting (because there is no dimension), so click on Next.

  6. On the Style tab, select a linear gauge and set the orientation to horizontal. Click on Next.

  7. There are a few changes needed in the Presentation tab:

    Gauge Settings, Max

    Sum(Target) * 1.2

    Indicator, Mode

    Show Needle

    Indicator, Style

    Line

    Show Scale,

    Show Labels on Every

    1

    Autowidth Segments

    Off

    Hide Segment Boundaries

    On

    Hide Gauge Outlines

    On

  8. There should be two segments by default, add a third segment by clicking on the Add button. The settings for each segment are as follows:

    Segment 1, Lower Bound

    0.0

    Segment 2, Lower Bound

    Sum(Target) * 0.5

    Segment 3, Lower Bound

    Sum(Target) * 0.9

  9. Apply appropriate colors for each segment (for example, RAG or Dark/Medium/Light gray).

  10. Click on Finish.

  11. Most of the bullet chart elements are now in place. In fact, this type of linear chart may be enough for some uses. Now we need to add the bar chart.

  12. Add a new bar chart. Don't worry about the title (it will be hidden). Turn off Show Title in Chart. Click on Next.

  13. There is no dimension in this chart either. Click on Next.

  14. Add the following expression:

    Sum(Sales)
  15. Click on Next.

  16. There is no sort (as there is no dimension). Click on Next.

  17. Select a plain bar type. The orientation should be horizontal. Leave the style at the default of Minimal. Click on Next.

  18. Set the following axis settings:

    Hide Axis

    On

    Static Max

    On

    Static Max Expression

    Sum(Target)*1.2

  19. Click on Next.

  20. On the Color tab, set Transparency to 100%. Set the first color to a dark color. Click on Next.

  21. Continue to click on Next until you get to the Layout tab. Set the shadow to No Shadow and the border width to 0. Set the Layer to Top. Click on Next.

  22. Turn off the Show Caption option. Click on Finish.

  23. Position the bar chart over the gauge so that the scales match (Ctrl + arrow keys are useful here). The bullet chart is created.

How it works…

By matching the Static Max setting of the bar and the gauge (to the sum of target * 1.2), we ensure that the two charts will always size the same. The 1.2 factor makes the area beyond the target point of 20 percent of the length of the area before it. This might need to be adjusted for different implementations.

It is also crucial to ensure that the layer setting of the bar chart is at least one above the layer of the gauge chart. The default layer (on the Layout tab) for charts is Normal so, in that situation, you should change the bar chart's layer to Top. Otherwise, use the Custom option to set the layers.

There's more…

Using techniques such as this to combine multiple QlikView objects can help us create many other visualizations.

See also

  • The Brushing parallel coordinates recipe

  • The Creating a modified bullet chart in a straight table recipe

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image