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

How can we give two different colors for the data points in a line chart shown in Example below

Line chart.PNG.png

From the above example shown I need to keep two diferent colors for different years. Lets say all the data point values of 2013 (8.84,4.49,8.68,4.49,4.50,9.05,4.54) should be displayed in RED color and the data points for 2012 should be dispalyed in black.

Can Some one suggest me how to do this/

Thank you,

David. G

1 Solution

Accepted Solutions
Alexander_Thor
Employee
Employee

Here you go, no need for two expressions.

Edit: Change the text color expression for your expression..

View solution in original post

5 Replies
manas_bn
Creator
Creator

Hi David,

Create a Line chart. (Right click --> New sheet object --> Chart; then select line chart in the General options)

Add month as a dimension.

Add one expression as Sum({$<Year={2012}>} Sales).

Add another expression as Sum({$<Year={2013}>} Sales)

In the expression tab, check the "Symbol" and select circles from the dropdown. Select "Values on data points". (on both the expressions)

Go to Colors tab and change the first color to black and second color to red.

If you want the years to be dynamic, create a variable

vCurrentYear=Year(today())

vLastYear=Year(today())-1

In the expressions, use Sum({$<Year={$(vCurrentYear)}>} Sales) and Sum({$<Year={$(vLastYear)}>} Sales)

Cheers!

Not applicable
Author


Manas BN,

Thankyou for your response. I have already achieved this line chart with different colors for two years 2012 and 2013. But I would like to keep data points in two different colors for each of the years.

Not applicable
Author

Line chart.PNG.png
I ve tried changing the colors in Colors tab and change the first color to black and second color to red but its only changing the colors of lines but not data points.

Alexander_Thor
Employee
Employee

Here you go, no need for two expressions.

Edit: Change the text color expression for your expression..

Clever_Anjos
Employee
Employee

Expand your expression and set "Text Color"

Sem título.png