Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
gouthamkk
Creator
Creator

Creating Reference Line for Each Expression in a Bar Chart

Hi,

I have 2 expressions in a Bar Chart and these 2 expressions are Grouped. I trying to create a Reference line for each expression.

When a user selects first expression the reference line should display and when a user selects second expression the chart has to display second reference line.

Please Advise

3 Replies
rahulpawarb
Specialist III
Specialist III

Hello Goutham,

Trust that you are doing well!

I have created a sample application showing bar chart with Month as dimension & two expressions - Tax Amount & Freight. Also added two different reference lines for each expression.

To show these reference lines conditionally I have created two variables vTaxAmt & vFreight and set them using document triggers (refer below steps):


1. Go to the document properties Alt + Ctrl + D

2. Go to the Triggers tab and select field PickMetric from Field event trigger

3. Added Set variable action for both the variables as below:

vFreight

=If(GetFieldSelections(PickMetric)='Freight Amount', 1, 0)

vTaxAmt

=If(GetFieldSelections(PickMetric)='Tax Amount', 1, 0)

4. Go to the chart properties & edit reference lines in Presentation tab

5. For Tax Amount & Freight reference line set the conditional variables vTaxAmt & vFreight respectively.

Refer the sample application attached herewith.

P.S.: I have used data island to hold expression names.

Regards!

Rahul

gouthamkk
Creator
Creator
Author

Hi Rahul,

Thanks for Work around. I am trying to see if there is a way by using Group expressions(using Cyclic objects) and achieve it, Instead of a drop down list box in data model.

rahulpawarb
Specialist III
Specialist III

Hello Goutham,

Please find the updated application attached herewith.

Let me know if you have any queries.

References:

Identifying which cyclic group value is being v... | Qlik Community

Read John Witherspoon's comment.

Regards!

Rahul