Hi, I've got some code similar to the following:
DefaultCategoryDataset dataset = new DefaultCategoryDataset(data);
dataset.setSeriesNames(chartSeriesNames);
dataset.setCategories(ChartXAxisLabels);
HorizontalCategoryAxis xAxisObject = new HorizontalCategoryAxis(xAxis);
VerticalNumberAxis yAxisObject = new VerticalNumberAxis(yAxis);
OverlaidVerticalCategoryPlot plot = new OverlaidVerticalCategoryPlot(xAxisObject, yAxisObject, ChartXAxisLabels);
VerticalBarRenderer barRenderer = null;
barRenderer = new VerticalBarRenderer();
VerticalCategoryPlot bars = null;
bars = new VerticalCategoryPlot(dataset, null, null, barRenderer);
LineAndShapeRenderer dotRenderer = null;
dotRenderer = new LineAndShapeRenderer(LineAndShapeRenderer.LINES);
VerticalCategoryPlot dots = null;
dots = new VerticalCategoryPlot(dataset, null, null, dotRenderer);
plot.add(bars);
plot.add(dots);
JFreeChart chart = new JFreeChart(xAxis + " vs " + yAxis + " for " + theProduct, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
For some reason the background color of the plot is light grey (not the default white), so basically the whole chart is grey. How can I change the color of the plot, I've tried doing :
chart.getPlot().setBackgroundPaint(Color.white);
But it has no effect. I can change the color of the whole chart by doing:
chart.setBackgroundPaint(Color.white);
But this changes the background color of the axis as well, which I don't want to do.
Thanks.
p.s I know I'm using the same dataset for the bar and line plots, it's just for testing.
OverlaidVerticalCategoryPlot Color
Re: OverlaidVerticalCategoryPlot Color
Hi Luke,
There's a bug in the OverlaidVerticalCategoryPlot class - I had one look at fixing it a while back, but it wasn't a straightforward fix (as far as I could tell) and I had only limited time so I had to give up on it. I hope to get back to it some time...
Regards,
Dave Gilbert
There's a bug in the OverlaidVerticalCategoryPlot class - I had one look at fixing it a while back, but it wasn't a straightforward fix (as far as I could tell) and I had only limited time so I had to give up on it. I hope to get back to it some time...
Regards,
Dave Gilbert