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

Brushing parallel coordinates


Parallel coordinates is a long established method of visualizing multivariate data. QlikView will display a parallel coordinate chart and a user can interact with the data, but sometimes it is useful to allow the user to "brush" the data, selecting different values and seeing those values versus the whole of the data.

We can do this by using two almost identical charts with one being transparent and sitting over the other.

Getting ready

We need to download some data for this from the United States Census QuickFacts website. Go to http://quickfacts.census.gov/qfd/download_data.html and download the first three files on offer:

Files

Description

DataSet.txt

Raw data

DataDict.txt

Information on the different metrics in the raw data

FIPS_CountyName.txt

List of the U.S. counties

Load the following script:

// Cross table the raw data into a temp table
Temp_Data:
CrossTable(MetricCode, Value)
LOAD *
FROM
DataSet.txt
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

// Load the temp table into our data table.
// Only load county information.
// Only load RHI data (Resident Population).
Data:
NoConcatenate
Load
  fips,
  MetricCode,
  Value
Resident Temp_Data
Where Mod(fips, 1000) <> 0  // Only County
And MetricCode Like 'RHI*'; // Only RHI

// Drop the temporary table
Drop Table Temp_Data;

// Load the location information.
// Use LEFT to only load locations that match Data.
Location:
Left Keep (Data)
LOAD @1:5 as fips, 
     @6:n as Location
FROM
FIPS_CountyName.txt
(fix, codepage is 1252);

// Load the Metric information
// Use LEFT to only load metrics that match Data.
Metrics:
Left Keep (Data)
LOAD @1:10 As MetricCode, 
     Trim(SubField(SubField(@11:115, ':', 2), ',', 1)) as Metric, 
     @116:119 as Unit, 
     @120:128 as Decimal, 
     @129:140 as US_Total, 
     @141:152 as Minimum, 
     @153:164 as Maximum, 
     @165:n as Source
FROM
DataDict.txt
(fix, codepage is 1252, embedded labels);

How to do itā€¦

To create a parallel coordinates chart with brushing, perform the following steps:

  1. Add a list box for Location onto the layout.

  2. Create a new line chart. Add Metric and Location as dimensions.

  3. Add the following expression:

    Avg({<Location={*}>} Value)
  4. Label the expression as %.

  5. Click on the + sign beside the expression and enter the following expression for Background Color:

    LightGray()
  6. On the Sort tab, set the sort for the Metric dimension to Load Order and Original as shown in the following screenshot:

  7. On the Presentation tab, turn off the Suppress Zero-Values and Suppress Missing options. Also, turn off the Show Legend option:

  8. On the Axes tab, turn on the Static Max option and set it to 101. Set the Primary Dimension Labels option to /. Turn on the Show Grid option under Dimension Axis:

  9. Click on Finish.

  10. Right-click on the chart and select Clone from the menu. Position the new chart so it exactly overlaps the first. Edit the properties.

  11. On the Expressions tab, modify the expression:

    Avg(Value)
  12. Click on the + sign beside the expression and change the Background Color property to:

    Blue()
  13. On the Colors tab, set the Transparency option to 100%.

  14. On the Layout tab, set the Layer option to Top. Set the Show option to Conditional and enter the following expression:

    GetSelectedCount(Location)>0
  15. Click on OK.

    Note

    Note that when you make a selection on the chart or in the list box, the selection is highlighted or "brushed".

How it worksā€¦

The transparent chart with the slightly different color and expression is the trick here. When a selection is made, our chart overlays the first chart and displays the "brush". The underlying chart will remain the same as we have a set that excludes selections in the Location field.

As far as the user is concerned, there is only one chart being displayed.

There's moreā€¦

Using transparent charts to overlay another chart is a great technique to use when the particular visualization is just not available in QlikView.

See also

  • The Creating a "Stephen Few" bullet chart 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