- QlikView for Developers Cookbook
- Stephen Redmond
- 398字
- 2021-08-13 17:08:25
Using redundant encoding with a scatter chart
It is very typical to display values for categorical dimensions using a bar chart. This is a very powerful and simple way to understand a chart. The length of the bars models the values in a very intuitive way.
Sometimes, however, it can be valuable to add an additional level of encoding to gain additional insight.
In this example, we are going to add space as an additional encoding. We can do this using a scatter chart.
Getting ready
Load the following script:
LOAD * INLINE [ Country, Sales USA, 100000 UK, 60000 Germany, 50000 France, 45000 Canada, 30000 Mexico, 20000 Japan, 15000 ];
How to do it…
Use the following steps to create a scatter chart demonstrating redundant encoding:
- Create a new scatter chart.
- Add a calculated dimension with the following expression:
=ValueList(1,2)
- Deselect the Label and Show Legend options for this dimension.
- Add
Country
as the second dimension. - On the Expressions tab, add two expressions:
Sum(Sales) If(ValueList(1,2)=1, 0, Sum(Sales))
- Both expressions can be labeled as Sales $:
- On the Sort tab, select the Country dimension and turn on the Expression option. Enter the expression:
Sum(Sales)
- The direction should be Descending.
- Go onto the Axes tab and select Hide Axis under the X Axis options.
- On the Numbers tab, format both expressions as Integer.
- Click on Finish.
- The chart displays with apparent bars and spacing between them. We can quickly see how much bigger the gap is between the USA and other countries. We can also identify clusters of similarly performing countries.
How it works…
If a scatter chart has two dimensions, it will change from displaying bubbles to displaying lines between the values in the first dimension.
The first expression here positions where the bars will exist. It is our space encoding.
The second expression has a test to see if it is ValueList = 1, which sets a value of 0, or ValueList = 2, which sets the Sales $
value.
There's more…
This is an example of the use of pseudo dimensions using ValueList
. This can be a very powerful function in dimensions.
The more frequent first dimension of a multidimensional scatter chart would be a date dimension, such as a year. This gives you the option to show lines going from year to year. Additional options in Presentation allow such items as arrows.
- 自愿審計動機與質量研究:基于我國中期財務報告審計的經驗證據
- Microsoft Dynamics NAV Financial Management
- 會計信息化基礎(金蝶版)
- 企業能源審計與節能規劃
- Business Intelligence with MicroStrategy Cookbook
- Securing Hadoop
- 陜西國家統計調查專題研究集萃(2006—2015)
- Salesforce Essentials for Administrators
- Business Intelligence Cookbook:A Project Lifecycle Approach Using Oracle Technology
- 內部控制審計功能與質量
- 統計學理論前沿(谷臻小簡·AI導讀版)
- 汪博士解讀PMP?考試(第6版)
- 審計實務
- 2014年注冊會計師(CPA)全國統考專用輔導教材系列:審計(名師解讀版)
- 房產稅征收對區域經濟的影響:以新都區為例