Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jtay
Contributor III
Contributor III

coloring lines in chart

I have a chart that shows a count by month with overlapping years.

I've been asked to specify the line color by year.

2015 = blue

2016 = yellow

2017 = red

I've been trying to color by dimension and by expression but I'm missing something.

This color by expression gives me yellow for all lines:

if(Year(Date)='2015'

  ,blue()

  ,if(Year(Date)='2016'

     ,yellow()

     ,red()

     )

  )

If I don't try and specify anything, and color by dimension using   =Year(Date) then this is what the chart looks like.

I could use a little help.  thanks.

Labels (1)
1 Solution

Accepted Solutions
jtay
Contributor III
Contributor III
Author

I had this just about right... my problem was with taking a derivative of a field in the if statement.

I added Year(Date) as ydate  to the load script and got this working correctly.

if(ydate='2015' ,blue(),

if(ydate='2016' ,'#f0e68c','#ff0000'))

View solution in original post

3 Replies
Vasiliy_Beshentsev
Creator III
Creator III

Can you please provide soma part of your app, so then i will help you.

Or you just can see how i make that already in this topic How to color the monthly bar for each year diff color , for easy visulisation purpose. It must work same way.

jtay
Contributor III
Contributor III
Author

I had this just about right... my problem was with taking a derivative of a field in the if statement.

I added Year(Date) as ydate  to the load script and got this working correctly.

if(ydate='2015' ,blue(),

if(ydate='2016' ,'#f0e68c','#ff0000'))

Vasiliy_Beshentsev
Creator III
Creator III

Well good. Mark some post as helpful if you got yuor solution.