Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 chaorenzhu
		
			chaorenzhu
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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!
 Ivan_Bozov
		
			Ivan_Bozov
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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.
 Ivan_Bozov
		
			Ivan_Bozov
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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.
 chaorenzhu
		
			chaorenzhu
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thanks @Ivan_Bozov , nice workaround
 chaorenzhu
		
			chaorenzhu
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		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
