James
James

Reputation: 1780

Customise rendering of individual series with JFreeChart?

I'd like to use a different LineAndShapeRenderer for each series on a JFreeChart TimeSeries graph. Has anyone accomplished this before? It seems the Renderer is owned by the Plot where each JFreeChart has a single Plot object hence the rendering is applicable to all series rather than individual ones.

Upvotes: 1

Views: 3335

Answers (2)

James
James

Reputation: 1780

Thanks very much, there is a similar method for the shape of a series:

XYItemRenderer renderer = chart.getXYPlot().getRenderer();
renderer.setSeriesShape(int series, java.awt.Shape shape) 

Upvotes: 1

YuppieNetworking
YuppieNetworking

Reputation: 8851

I have not tried a case like that. However, I have changed the rendering properties of an specific Series with:

// chart is a JFreeChart object
XYItemRenderer renderer = chart.getXYPlot().getRenderer();
renderer.setSeriesStroke(index, new BasicStroke(DEFAULT_LINE_WIDTH));
                        renderer.setSeriesPaint(/* index of series */, /*some color*/);

Upvotes: 6

Related Questions