Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
pbaenen
Contributor III
Contributor III

Variable Color for Line Chart

Is it possible to dynamically change the color of the line in a line chart?

For example, can I have the first x values be red, and the rest be black?

1 Solution

Accepted Solutions
Not applicable

One other option:

Go to Expression Tab.

Expand the expression.

Select the Background color

Add a condition if(rowno()<10 ,RGB(0,236,0),RGB(255,100,255))

Note: This won't work if the graph is sorted according to y value.

View solution in original post

4 Replies
Not applicable

Yes, go to the Colors tab of your chart properties, click on one of the colors and put in a calculated color. You have a separate color for the first 18 lines, so you would have to define all the ones you wanted as red to be red and the rest black. You could use a variable to make the number of red lines be dynamic,

pbaenen
Contributor III
Contributor III
Author

I've tried the Calculated color, but I'm not sure what to put in for the formula to give me, for example, the first 5 values of the chart.

I assume I should be using an If statement here.

Not applicable

One other option:

Go to Expression Tab.

Expand the expression.

Select the Background color

Add a condition if(rowno()<10 ,RGB(0,236,0),RGB(255,100,255))

Note: This won't work if the graph is sorted according to y value.

pbaenen
Contributor III
Contributor III
Author

Thank you, this was exactly what I was looking for.