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

Dynamic line chart background colours

Hi gurus,

I have a line chart of historic data, volume plotted against 'Historic Week Start Date'. I want my line colour to change based on historic Fiscal Year.

I have currently achieved this by hard coding in the following in the Background Colour section of my expression:

=if(HistoricalFiscalYear='FY11',rgb(70,137,164),

  if(HistoricalFiscalYear='FY12',rgb(171,167,17),

  if(HistoricalFiscalYear='FY13',rgb(141,25,8),

  if(HistoricalFiscalYear='FY14',rgb(236,129,0),

  if(HistoricalFiscalYear='FY15',rgb(114,85,37))))))

This achieves the intended result:

However, to account for the possibility of the data being loaded in for more / different fiscal years, I would like to make this expression dynamic.

I have another field, 'HistoricalFYRow' which is a row count, which could potentially be used in the expression (as was finding it difficult to do max / min on the fiscal year field (FY11, FY12...).

Suggestions of how to modify this formula, perhaps with a variable?

Thanks!

Mel

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try =color(FieldIndex('HistoricalFiscalYear',HistoricalFiscalYear)).

Or read this blog for other options: Colors in charts


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar

Try =color(FieldIndex('HistoricalFiscalYear',HistoricalFiscalYear)).

Or read this blog for other options: Colors in charts


talk is cheap, supply exceeds demand
Not applicable
Author

Brilliant, thanks!