Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Vary data point color depending on condition in chart

I have a line chart. In one of the expressions I use symbols (Points) to represent it. I want each of these points (symbols) to be painted with one color or another depending on some conditions.

So I defined background color for the expression as below:

$(target_orders)

which is a variable that I have defined as below:

if($(numOrders) < 10, Green(), If($(numOrders) >= 10 and $(numOrders) <= 50, Yellow(), Red()))

and numOrders is another variable as below:

sum({$<[Order Type] = {'A'}>}if([quantity] > 20000.0, 1,0))

What is happening is that all points are being painted with the same color and the correct would be (based on conditions) some red and some green.

Any ideas?

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

I am not sure whether you should be setting the foreground or background colour.

Having tested that, test your logic by creating a straight table with the same dimension as your chart, and with the expressions:

=sum({$<[Order Type] = {'A'}>}if([quantity] > 20000.0, 1,0))

=f($(numOrders) < 10, Green(), If($(numOrders) >= 10 and $(numOrders) <= 50, 'Yellow', 'Red'))


The results of this table should give an insight into the problem.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
jonathandienst
Partner - Champion III
Partner - Champion III

Another thought occurred to me - Are the expression defined with a leading = sign? If so, then they are expanded and evaluated before the chart is constructed and have no knowledge of the chart dimensions. Try removing the = sign so that they can be expanded and evaluated within the chart.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

I am not using = sign.