hello
my question is a little similar to some that have been
posted about the possibility to set colors of bars
(ex : #409711).
in my case I would like that all bars belonging to
the same category have the same color !
It seems that this is not yet implemented in jfreechart.jar.
Is it however possible to get this result by derivating
a particular method where I could control the color
for each bar by knowing the serie and the category
to which this bar belongs !
thanks for any answer
jean-marie
Bar chart color selection
RE: Bar chart color selection
Hi Jean-Marie,
In the VerticalBarPlot class, there is a private method getBars() that returns a list of bars for the plot. The color is set with the following line:
Paint paint = chart.getSeriesPaint(seriesIndex);
I think you could replace seriesIndex with currentCategoryIndex and you would get the effect you want (except maybe the chart legend would then be colored wrong).
Perhaps the best approach would be to create a new method chart.getItemPaint(series, category) and return whatever color you want from that method. In that case, though, I don't know what the legend should show...
Regards,
DG.
In the VerticalBarPlot class, there is a private method getBars() that returns a list of bars for the plot. The color is set with the following line:
Paint paint = chart.getSeriesPaint(seriesIndex);
I think you could replace seriesIndex with currentCategoryIndex and you would get the effect you want (except maybe the chart legend would then be colored wrong).
Perhaps the best approach would be to create a new method chart.getItemPaint(series, category) and return whatever color you want from that method. In that case, though, I don't know what the legend should show...
Regards,
DG.
RE: Bar chart color selection
thanks David !
I chose the first solution and it works fine !
jean-marie
I chose the first solution and it works fine !
jean-marie