Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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
ArturoMuñoz
Employee
Employee

I see I mixed two ideas in my post. Just to make it clear, we don't need 2 expressions to have the label close to the line, just need to use dual(). To create a chart like in my example you still need 2 expressions.

The main benefit of having 2 expressions rather than just one is to be able to increase the data-density of your line chart by controlling last value color. This could help you to indicate change or variation vs previous period. It's basically a sparkline.

Sparkline - Wikipedia, the free encyclopedia

0 Likes
2,013 Views
Not applicable

Hi Rebecaa, your chart is nice.

0 Likes
2,013 Views
NareshGuntur
Partner - Specialist
Partner - Specialist

Hi Arturo,

I am still unable to figure out how the legend can be brought down the chart with single row. I already know that using Ctrl+Shift, we can move the legend. But even after moving the legend, I still get 6 rows of legends which I want to make into 1 or 2 rows. Can you help?

Cheers,

Naresh

0 Likes
1,990 Views
ArturoMuñoz
Employee
Employee

Naresh, you need to resize the legend rectangle and make it thinner.

0 Likes
1,990 Views
NareshGuntur
Partner - Specialist
Partner - Specialist

Hi Arturo,

Thanks for the response. Please observe the below screenshot. I have tried making the legend thinner but it is not adjusting itself into multiple columns but showing a scroll bar which an end user may not be interested. Am I missing anything else here?

Cheers,

Naresh

legend.jpg

0 Likes
1,990 Views
Not applicable

Hi Naresh

I try it work . in case still cannot , may be you should post your QVW file on forum , believe some one will help you up.

legend below 1 row.png

0 Likes
1,990 Views
NareshGuntur
Partner - Specialist
Partner - Specialist

Hi Paul,

Sadly, I am unable to attach the qvw here. It is showing options only to attach an image.

Cheers,

Naresh

0 Likes
1,990 Views
ArturoMuñoz
Employee
Employee

It all depends on how long your labels are, as in Paul's screenshot you can see short legends being displayed in one row. You could try to limit the legend length in Chart's properties window.

0 Likes
1,990 Views
NareshGuntur
Partner - Specialist
Partner - Specialist

Hey Arturo,

That worked like a charm once I limit the length of the legend.

Bit it would have been nice if QlikView itself decides the length and classify into the columns.

Thank You Very much.

Cheers,

Naresh

0 Likes
1,960 Views
Not applicable

Hey guys, 

I am given a task to calculate the frequency of calls across a territory. If the rep called a physician regarding the sale of the product 5 times, then frequency is 5 and HCP count is 1....I generated frequencies from 1 to 124 in my pivot table using a calculated dimension which is working fine. But my concern is :

My manager wants frequencies till 19 in order from 1..2..3..4...5..6.....19...

And from the frequency 21-124 as 20+.

I would be grateful if someone helps me with this.....Eager for the reply....

0 Likes
1,960 Views