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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
chaorenzhu
Creator II
Creator II

Color expression for histogram

Hi,

I am plotting a histogram using the field "value" and below is a sample data:

load * inline [

value

90

80

70

60

50

40

30]

 

Is it possible to use color expression for the histogram, so that value>=50 will be in blue and value<50 in red. Currently when I check the color option it only allows a single color to be used.

Thanks!

Labels (1)
1 Solution

Accepted Solutions
Ivan_Bozov
Luminary
Luminary

I don't think you can do this with the native histogram chart as it does not have color options.

Alternatively, you can use a bar chart with the following settings:

Dimension: CLASS(value, 5)
Measure: COUNT(value)
Color expression: IF(value < 50, RED(), BLUE())

Also go to Presentation > Styling and play with the bar width to make it look more like a histogram.

vizmind.eu

View solution in original post

3 Replies
Ivan_Bozov
Luminary
Luminary

I don't think you can do this with the native histogram chart as it does not have color options.

Alternatively, you can use a bar chart with the following settings:

Dimension: CLASS(value, 5)
Measure: COUNT(value)
Color expression: IF(value < 50, RED(), BLUE())

Also go to Presentation > Styling and play with the bar width to make it look more like a histogram.

vizmind.eu
chaorenzhu
Creator II
Creator II
Author

Thanks @Ivan_Bozov , nice workaround

chaorenzhu
Creator II
Creator II
Author

Hi @Ivan_Bozov , something strange pops up when I set the color expression

You can refer to attached sample data. Following your method only value<30 are in red (see attached picture), even though I used  IF(value < 50, RED(), BLUE())

Any idea where went wrong? Thanks