Can someone guide me in the right direction with the following code?
XYItemRenderer r = plot.getRenderer();
if (r instanceof XYLineAndShapeRenderer) {
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
The plot is an XYPlot for a TimeSeriesCollection. It works if I replace XYLineAndShapeRenderer with StandardXYItemRenderer (as in the developers guide), but they both implement XYItemRenderer, so I don't see what the difference is.
I need to use the XYLineAndShapeRenderer cause I want to have some series with just shapes and other with just lines.
Any help would be greatly appreciated as it's driving me insane!
XYLineAndShapeRenderer help please.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
If you created a time series chart, the renderer will be a StandardXYItemRenderer. You can *replace* it with an XYLineAndShapeRenderer like this:
For later reference, I've added a "Usage" section to the XYLineAndShapeRenderer entry in the JFreeChart Developer Guide, with the above code example.
Code: Select all
XYPlot plot = (XYPlot) chart.getPlot();
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
plot.setRenderer(renderer);
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

