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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Skygal
Contributor II
Contributor II

Conditional color on a gauge chart

Hello,
I'd like to add conditional colors to a gauge chart. To do this, I created a container with three gauges inside:
- One red
- One yellow
- One green
And they display based on the data value. However, I have 10 gauges, so this requires a lot of calculations and my dashboard is slow to display.


Is there a more efficient way to color the gauges based on the data value?
On other charts, such as bar charts, it's much simpler with just a conditional color value.

 

Thank you!

Labels (3)
3 Replies
Chanty4u
MVP
MVP

Yes in appearance 

Colour sections use by expression 

IF(Sum(Sales) < 50, rgb(255,0,0), 

IF(Sum(Sales) < 100, rgb(255,255,0), 

rgb(0,255,0))) 

Skygal
Contributor II
Contributor II
Author

Thanks for your reply, I did this for other charts like bar charts, but this option does not exist on the gauge chart.

fe-c
Contributor III
Contributor III

This option is possible if you activate 'segments' in the presentation area. However, defining colors this way could be very annoying if you need more than 2 colors.

Another option could be to define the color by adding your KPI as master KPI and define the color at this point, e.g. KPI_1_red, KPI_1_yellow, KPI_1_red, KPI_2_red, … 

KPI_1 = sum(sales)
KPI_2 = avg(sales)

Then you can select your gauge color using endless if-statements …

=if(KPI_1 <= 50
  ,KPI_1_red
  ,if(KPI_1 <= 100
    ,KPI_1_yellow
    ,KPI_1_green
    )
  )

… but looks also a bit weird.