Labeling a pie chart to replace the legend
Standard pie charts in QlikView suffer from a legendary problem – the legend. The problem is that the eye needs to move back and forth between the chart and the legend to help make sense of the data.
In this recipe, we are going to remove the legend and use the Dual function to replace it with text besides each segment that identifies the information.
Getting ready
Load the following script:
LOAD * INLINE [ Country, Sales USA, 1000 Mexico, 600 Canada, 700 UK, 900 Germany, 800 ];
How to do it…
These steps show you how to label a pie chart to replace the legend:
Create a pie chart with
Country
as the dimension. Add the following expression:=Dual( if(Len(Only(Country))>0, Country, 'Others') & chr(10) & Num(Sum(Sales), '#,##0') ,Sum(Sales) )
On the Expression tab, label the expression as
Sales $
and turn on the Values on Data Points option.On the Sort tab, turn on the Y-Value option.
On the Presentation tab, turn off...