Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Not applicable

Problems with custom colouring a line chart

Hello everybody,

I've been using a solution when custom colouring measures in a bar chart (see "How to set custom colors by measures in a bar chart") which was created by this guy called Ian Wilson. It's been working just fine. However, now I'm trying to do the same thing with a line chart, but it doesnät work. It's s if the expression seems too complex or something. Take a look.


I have 2 dimensions; Month and Type. In the Type dimension I created a valueList to create temporary dimension and I wrote it like this: ValueList ('Result', 'Revenue PY', 'Budget').

MEASURE! The measure I have is called Amount and the expression I wrote is:


if(ValueList('Result','Revenue PY', 'Budget')='Result'

  ,Sum({1<%Restaurang=P(%Restaurang), [RR Grupp]={'Revenue PY'}, ÅrNum={'$(=Max(ÅrNum))'}, ÅrMånad={'<=$(=Max(ÅrMånad))'}>}Result)

  ,if(ValueList('Result','Revenue PY', 'Budget')='Revenue PY'

   ,Sum({1<%Restaurang=P(%Restaurang), [RR Grupp]={'Revenue PY'}, ÅrNum={'$(=Max(ÅrNum))'}, ÅrMånad={'<=$(=Max(ÅrMånad))'}>}Result)

   ,Sum({1<%Restaurang=P(%Restaurang), [RR Grupp]={'Revenue PY'}, ÅrNum={'$(=Max(ÅrNum))'}>}Budget)

     )

  )

In the appearance section i went to the coloring section and wrote the following expression:

if(ValueList('Result','Revenue PY','Budget')='Result'

  ,rgb(0,192,0)

  ,if(ValueList('Result','Revenue PY','Budget')='Revenue PY'

     ,rgb(0,0,192)

     ,rgb(192,0,0)

     )

  )

The colors only appear when the measure expressions aren't that complex. If I would've written this instead it works:

if(ValueList('Result','Revenue PY', 'Budget')='Result'

  ,Sum(Result)

  ,if(ValueList('Result','Revenue PY', 'Budget')='Revenue PY'

   ,Sum(Result)

   ,Sum(Budget)

     )

  )

Can someone help me understand how to make Ian Wilsons trick work on this? How can I make it work with my expression?

Sincerely,

Betty




5 Replies

Re: Problems with custom colouring a line chart

Do the lines show with the automatic coloring enabled?

Can you post an example qlik sense app that illustrates the problem?

Not applicable

Re: Problems with custom colouring a line chart

Okay, so I managed to kind of change the colours on the line chart, but I'm not fully satisfied. This is what the Line Chart looks like when it's with standard colours:

Line Chart standard Colour.PNG

And this is what it looks with my customized colour:

Line Chart Custom Colour.PNG

As you can see, only the lines get the colours. I can live with that, but what's strange is that if I choose a month, all the other months look like this:

Line Chart Chosen Month.PNG

The other months and their lines get the same value as the "result" amount, which is weird. I've looked through the expressions, but they look fine. Is this something that sometimes can happen when trying to customize colours?

Sincerely,

Betty

Not applicable

Re: Problems with custom colouring a line chart

Nevermind, I fixed the last problem (see the 3d picture). Maybe I shouldn't be that quick in writing, haha! The problem was in fact in the expression. There was somehthing missing.

However, there seems to be no way in colouring inbetween the lines. It looks quite boring with only coloured lines =/ Do you know if there is a way to achieve this? Maybe I've missed something.

Sincerely,

Betty

undergrinder
Valued Contributor II

Re: Problems with custom colouring a line chart

Hi Betty,

As in the thread below shows, this issue will be fixed in the next release.

Custom color in area chart

G.

Not applicable

Re: Problems with custom colouring a line chart

Okay, thank you! =)