Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Conditional coloring to line chart based on reference line in line chart

Hi,

I have a line chart where I am using reference line. what I need to do in chart is Lines which are above reference 0 should be red & lines below should be green. I am attaching a test report so you might get a better idea.

Thanks

1 Solution
14 Replies
whiteline
Master II
Master II

Hi.

You can't do it directly.

The line and color belongs to the data point (the start of the segment).

The only way is to calculate the middles and add zero point appropriately.

The solution depends on weather you want to use continuous x-axis or not.

Not applicable
Author

Hi,

Thanks for your reply... Adding zero points will be like adding dummy records which is not a comfortable way to have.

Can we have background of chart like background above 0 will be of red color & below it can be green? Color doesn't matters just distinguishing areas above & below reference lines needed. Any help?

Thanks

Not applicable
Author

Hi,

You can do something like this

Please find the attached file...

Not applicable
Author

Or, maybe like this...

Not applicable
Author

Hi,

Thanks but position of reference line will chages depending on the data.

Ex: depends on customer filter data changes and so position of reference line changes.  So I can't go with putting text boxes on background.. Any other workaround?

Thanks

whiteline
Master II
Master II

Hi.

You can try to use a background image with two areas of equal height.

Then set the expressions for Min/Max properly. They should be equal modulo and change dynamically according to the data selected.

Not applicable
Author

Hi,

Can you please give a sample report ?..  it will give me better understanding.

Thanks

whiteline
Master II
Master II

Hi.

Something like this.

Notice expressions for min and max.

Not applicable
Author


Hi,

This solution is good when reference axis is not moving .. but with my data reference axis is moving... sometimes if there are all -ve values then reference line appear at top with no +ve values on y-axis.. so this solution has limited scope in my scenario.. Any other suggestion?