Skip to main content
ArturoMuñoz
Employee
Employee

QlikView Standard Visualization objects have much more to offer than standard out of the box settings. This is why data centric apps developers love QlikView so much, because you can dig into every object properties expanding their usage case scenarios.

This is the case of the line chart; probably one of the oldest visualization methods available. It´s a pretty simple and straightforward way to represent data - often used to visualize a trend in data over intervals of time.


In-Chart Legend


This is a simple space saver trick; it will help you to replace QlikView standard legend with a customized in-chart legend.

Look at the chart below. It represent sales in two countries US and UK. As you can see, we don't have too much space to plot the chart and the legend. QlikView will automatically adjust the chart area to the real state in the object. In this case that will make my chart area to be really small.

1.png

One approach could be to move the legend to the bottom. This will make my chart area much bigger, specially true for long label scenarios. On the other side, by reducing the Y axis the lines look much flatter, and in some situations that could mean that some users wont perceive small variations in the chart.

2.png

Remember: To move or/and size chart components as legends, text in charts, and chart area, press the Shift and Ctrl keys and keep them depressed while a chart is active. You will enter the chart layout edit mode.

In edit mode, thin red rectangles will appear around those components of the chart that can be sized or moved. Use the mouse drag and drop technique to move things around.

What can we do to get the best of both worlds?

Another alternative could be something like the chart below, where legends appear right next to the each line.

3.png

To tune a line chart to look like the image above, you will need to follow the next steps:

    1. Create a standard line chart as in the picture.

    2. Use one expression per line, we cannot use this method when the lines are created based on dimensions.
      4.png
    3. Use Dual()

      Duplicate each expression and set the definition to

      if(Num= max(totalNum),dual('US',[United States of America]))

      Where, Num is the dimension name,'US' will be the text displayed in the chart and [United States of America] is the number I calculated with my first expression.

    4. To finish, remember to check Symbol and Values on Data Points for the expression.
      5.png

Pros:

  • This method will allow you to create mini sparkline using standard line charts.
  • The most obvious advantage will be to get more space for your chart area.
  • Due to in context information, in-Chart legend style will allow users to quickly consume the chart. Users doesn't need to apart their eyes from the chart to read the legend.

Cons:

  • Lack of dynamism: you have to create one expression per line displayed, rather than letting QlikView to include new elements as they came to the data model.
  • In situations where multiple lines have to be displayed this method may create confusion by overlapping the legends labels.
  • Hard-coding expression is required.

I will post a second part on this topic with another trick soon, stay tuned!

Enjoy Qliking!

AMZ

PS: if you have tricks you want to share with our Community left us a comment

35 Comments
Not applicable

Hi

Nice One..

You can also see the below link for Silent Legend.

http://community.qlik.com/docs/DOC-3753

Hope it may help.

6,191 Views
datanibbler
Champion
Champion

Hi,

good trick indeed!

Works well only for line_charts, though. Going with the standard built-in legend and just abbreviating ("US" and "UK" like you did anyway in the end) usually does the trick and you can just stick with the standard and just make the "legend rectangle" much smaller, expanding the chart_area.

That DUAL thing is cool, though.

0 Likes
6,191 Views
ArturoMuñoz
Employee
Employee

That's true, standard legend and abbreviated legend labels would be good.

0 Likes
6,191 Views
MK_QSL
MVP
MVP

Good Post... Similar subject has been discussed in Developers COOKBOOK

0 Likes
6,191 Views
Anonymous
Not applicable

Great post!

Will you elaborate on what you mean by "we cannot use this method when the lines are created based on dimensions."?

I was able to recreate your example except the value displayed at the end of the line is the number rather than the text.

0 Likes
6,191 Views
Not applicable

Another design trick is to use the title as a legend.  This method is best suited for only a small number of hard-coded categories, but can save space and look nice when used correctly.  This effect is achieved by utilizing the background color expression to match a text box title of the same color.

Example:

Example.JPG.jpg

6,191 Views
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think you can do your example without any additional expressions. Country as Dimension and a single Expression:

=Dual(

If(Num=Max(total Num), Country, ''),

Sum(Expression2)

)

Stephen Redmond covers this example well in his  book "Qlikview Cookbook for Developers".

-Rob

5,499 Views
Anonymous
Not applicable

Nevermind......I figured it out. The expression's number format has to be set to "Expression Default".

Also - per Rob's comment - this is a link to a post where Stephen illustrates the same thing.

http://www.qliktips.com/2012/07/lose-legend-in-line-charts.html

0 Likes
5,499 Views
ArturoMuñoz
Employee
Employee

Good one Rebecca

0 Likes
5,499 Views
ArturoMuñoz
Employee
Employee

Hi Rob,

Thanks for the contribution! It's true that with just one expression you can have the in-chart legend. But you will need 2 expressions to create a mini sparkline chart as in the example. In some situations you may want a different color for the dot symbol and the line, then you will need additional expressions too.

0 Likes
5,499 Views