paint series lines above annotations

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
shethab
Posts: 5
Joined: Wed Sep 30, 2015 9:23 pm
antibot: No, of course not.

paint series lines above annotations

Post by shethab » Mon Oct 05, 2015 10:14 pm

I wanted some custom behavior with ValueMarkers. I was told that it was not possible and i sould use these Annotation classes

http://sourceforge.net/p/jfreechart/patches/316/

Code: Select all

XYDomainValueAnnotation dva = new XYDomainValueAnnotation();
        dva.setLabel("Test Value Annotation");
        dva.setStroke(new BasicStroke(5.0f));
        dva.setValue(System.currentTimeMillis()+86400000L);
        dva.setLabelTextAnchor(TextAnchor.TOP_LEFT);
        dva.setLabelAnchor(RectangleAnchor.TOP_LEFT);
        dva.setRotationAnchor(TextAnchor.TOP_LEFT);
        plot.addAnnotation(dva)
So everything works now but the annotation lines appear on top of the Series lines. How can i move the annotation lines to the background.

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: paint series lines above annotations

Post by paradoxoff » Tue Oct 06, 2015 12:38 pm

You can add the annotation to the renderer instead of to the plot.
if you add the annotation to the renderer, you can specifiy a Layer attribute. Use Layer.BACKGROUND for your case.

Locked