Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to show legend/data label directly in chart area?

Hi, I want to show Data Label in the chart like this:

Gold at 1970 prices.gif

tried the trick with second expression as value data point but didn't work correctly. If that second expression is enabled, the chart won't show correctly in categories.

Untitled.png

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi

In my example:

Dual(If(Date=Max(total Date), Country, ''),Sum(Sales))

The Dual function will only return a text value when the date matches the maximum date. Otherwise, it is blank. So, when we enable the Values on Data Points option, it only displays  a value for the last data point.

Syntax:

Dual(text, number)

The dual() function allows us to specify the individual text and number parts to be combined into a single dual value:



https://help.qlik.com/en-US/qlikview/12.0/Subsystems/Client/Content/Scripting/FormattingFunctions/Du...


Qlik Tips: Using Dual



dual function() | Qlik Community

View solution in original post

7 Replies
ThornOfCrowns
Specialist II
Specialist II

You can either add the Text to the chart using the Presentation Tab or use DUAL if you have very dynamic information.

Anonymous
Not applicable
Author

  1. Hi
  2. try this

  1. Add a new line chart. Add two dimensions, Date and Country.
  2. Add the following expression:

Dual(

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

   Sum(Sales)

}

  1. On the Expressions tab, ensure that the Values on Data Points option is checked.
  2. Click on Next until you get to the Presentation tab. Deselect the Show  Legend option
Anonymous
Not applicable
Author

Dual seems promising. Looked around in the forum but I need help to explain the logic of the Dual statement.

Can you provide example?

I've checked this: Dual Function in a line graph

Anonymous
Not applicable
Author

Hi

In my example:

Dual(If(Date=Max(total Date), Country, ''),Sum(Sales))

The Dual function will only return a text value when the date matches the maximum date. Otherwise, it is blank. So, when we enable the Values on Data Points option, it only displays  a value for the last data point.

Syntax:

Dual(text, number)

The dual() function allows us to specify the individual text and number parts to be combined into a single dual value:



https://help.qlik.com/en-US/qlikview/12.0/Subsystems/Client/Content/Scripting/FormattingFunctions/Du...


Qlik Tips: Using Dual



dual function() | Qlik Community

MarcoWedel

Anonymous
Not applicable
Author

Your explanation really helps. Thanks!

Unfortunately it only works on something that has maximum value, the original content of period is something like Q1, Q2, etc so I had to work around slightly to get what I want. May be I can enhance the script a bit later, it's not very urgent now.

Lastly the overlying text, I recall reading somewhere in the community that we can't do anything about it, can we?

Anonymous
Not applicable
Author

Hi,

If you expand(drag) your graph , this overlaying of text will be minimized .

It seems you need   'country name' on maximum sales ??

would you please post your examplet data or qvw file .

so that , I can help you ..

Regards

Allu