G'day all,
I want to mainly do non-category bar charts, and many data point line plots, but I need the ability to easily set the colour of all the bars to red for example, and then set one particular bar to be blue. I would also like to be able to change the shape of the plot points to all be the same except one or more etc...
Is this easily doable in JFreeChart, and if not would it take long for me to add such a feature?
Thanks,
Mof.
Arbitrary colours for bar, and plot graphs.
Re: Arbitrary colours for bar, and plot graphs.
Hi Mof,
The easiest way to do that would be to create your own renderer. Take a look at the drawItem(...) method in the VerticalBarRenderer.java source file, you'll see the following code:
Paint itemPaint = null;
if (!getUseCategoriesPaint()) {
itemPaint = getFillPaint(0, row);
}
else {
itemPaint = getCategoryPaint(column);
}
g2.setPaint(itemPaint);
g2.fill(bar);
You could change this code to set the colors to whatever you wanted...
Regards,
Dave Gilbert
The easiest way to do that would be to create your own renderer. Take a look at the drawItem(...) method in the VerticalBarRenderer.java source file, you'll see the following code:
Paint itemPaint = null;
if (!getUseCategoriesPaint()) {
itemPaint = getFillPaint(0, row);
}
else {
itemPaint = getCategoryPaint(column);
}
g2.setPaint(itemPaint);
g2.fill(bar);
You could change this code to set the colors to whatever you wanted...
Regards,
Dave Gilbert
Re: Arbitrary colours for bar, and plot graphs.
Would this mean that I would need to create my own render for each chart type that I wish to use ?
Mof.
Mof.