I have a verticalbar chart with values. Say, for example, it has values as follows:
double[][] data = new double[][] {
{ 10.0, 40.0, 30.0, 50.0, 60.0, 70.0, 90.0, 80.0 }};
My need is that i have to display the vertical bars with different colors.
Green if value is 100
Yellow if value is >=80
Red if value is <80
I have tried setting the series color , but it changes the whole color. Is there anyway i can do this?
Am creating chart using 'ChartFactory.createVerticalBarChart'
Thanks in advance
Siva
Help
Re: Help
Hi Siva,
If you want to change the color of a bar based on the current value, then you need to create a custom renderer. Take a look at the source code for the VerticalBarRenderer class - you'll see in the drawItem(...) method where the color is set, that's where you need to modify the code.
Regards,
Dave Gilbert
If you want to change the color of a bar based on the current value, then you need to create a custom renderer. Take a look at the source code for the VerticalBarRenderer class - you'll see in the drawItem(...) method where the color is set, that's where you need to modify the code.
Regards,
Dave Gilbert