Line charts without shape
Line charts without shape
I'm trying to drop the shapes from a line chart I've created. It looks like I need to change the default renderer, from what I'm reading, but I can't locate a good example of how to implement that. I've looked through the API, and even the source from the demo program. Any pointers?
Re: Line charts without shape
Hi Pat,
This would be easier if LinePlot had the following methods in it (which it will from the next version):
/**
* Returns the renderer for the plot.
* @return The renderer for the plot.
*/
public CategoryItemRenderer getRenderer() {
return this.renderer;
}
/**
* Sets the renderer for this plot.
* <P>
* For now, the LineAndShapeRenderer class is the only available renderer for the LinePlot
* class.
* @param renderer The new renderer.
*/
public void setRenderer(CategoryItemRenderer renderer) {
// check arguments...
if (renderer==null) {
throw new IllegalArgumentException("LinePlot.setRenderer(...): "
+"null not permitted.");
}
// make the change...
this.renderer = renderer;
notifyListeners(new PlotChangeEvent(this));
}
Then, you can do the following:
LinePlot plot = (LinePlot)chart.getPlot();
plot.setRenderer(new LineAndShapeRenderer(LineAndShapeRenderer.LINES));
Hope that helps,
DG.
This would be easier if LinePlot had the following methods in it (which it will from the next version):
/**
* Returns the renderer for the plot.
* @return The renderer for the plot.
*/
public CategoryItemRenderer getRenderer() {
return this.renderer;
}
/**
* Sets the renderer for this plot.
* <P>
* For now, the LineAndShapeRenderer class is the only available renderer for the LinePlot
* class.
* @param renderer The new renderer.
*/
public void setRenderer(CategoryItemRenderer renderer) {
// check arguments...
if (renderer==null) {
throw new IllegalArgumentException("LinePlot.setRenderer(...): "
+"null not permitted.");
}
// make the change...
this.renderer = renderer;
notifyListeners(new PlotChangeEvent(this));
}
Then, you can do the following:
LinePlot plot = (LinePlot)chart.getPlot();
plot.setRenderer(new LineAndShapeRenderer(LineAndShapeRenderer.LINES));
Hope that helps,
DG.