#215 plot.addAnnotation( ann, layer )

open
nobody
None
5
2012-11-27
2008-05-02
Andrew Mickish
No

I want to add shaded box annotations behind XYPlot series lines.

It would be nice if there was an XYPlot.addAnnotation() method that took a Layer parameter, that caused BACKGROUND annotations to be drawn before the series lines.

I have a workaround that uses the XYItemRenderer.addAnnotation(ann,layer) to add BACKGROUND annotations directly to the primary renderer:

final Layer layer = annotationConfig.layer;
if\( layer == Layer.background \) \{
    plot.getRenderer\(\).addAnnotation\( annotation,
        org.jfree.chart.util.Layer.BACKGROUND \);
\} else \{
    plot.addAnnotation\( annotation \);
\}

But this is an asymmetric handling of annotations. It would be more elegant to provide the Layer parameter to the XYPlot.addAnnotation() method.

Discussion