Time axis annotations

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
cabarete_cub
Posts: 4
Joined: Fri Sep 11, 2015 2:23 pm
antibot: No, of course not.

Time axis annotations

Post by cabarete_cub » Fri Sep 11, 2015 2:45 pm

I want to annotate my population growth chart by placing event names on the time axis.
What would be a right way to do it?
Thank you.

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

Re: Time axis annotations

Post by paradoxoff » Fri Sep 11, 2015 4:14 pm

Have you looked at the ValueMarker class?

cabarete_cub
Posts: 4
Joined: Fri Sep 11, 2015 2:23 pm
antibot: No, of course not.

Re: Time axis annotations

Post by cabarete_cub » Fri Sep 11, 2015 4:57 pm

Yes, and I somehow overlooked the setLabel(String) method.
Thank you.

cabarete_cub
Posts: 4
Joined: Fri Sep 11, 2015 2:23 pm
antibot: No, of course not.

Re: Time axis annotations

Post by cabarete_cub » Sun Sep 13, 2015 3:48 am

Err, I'm looking at it again and can't find it, and neither in the source code.
Just to be sure, the following image illustrates what I'm trying to achieve:
Image

Would it be possible to add another date axis to the plot and make it render labels on the other side?

Naxter
Posts: 45
Joined: Thu Jun 26, 2014 8:24 am
antibot: No, of course not.
Location: Germany, Aachen

Re: Time axis annotations

Post by Naxter » Mon Sep 14, 2015 8:33 am

And how far have you been? So just the labeling is missing?

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

Re: Time axis annotations

Post by paradoxoff » Mon Sep 14, 2015 6:50 pm

Markers do not support rotated text, nor do they support the marking of a value in form of a shape. Adding these functions will not be trivial, as markers do not have a dedicated draw-method that could be overriden, but are drawn by the renderers,
Please have a look at the annotation classes presented in this thread.

cabarete_cub
Posts: 4
Joined: Fri Sep 11, 2015 2:23 pm
antibot: No, of course not.

Re: Time axis annotations

Post by cabarete_cub » Tue Sep 15, 2015 2:26 am

@paradoxoff
Thank you. Annotations was definitely a way to go. I'm still a bit puzzled with setLabel(String) method in ValueMarker class. Latest version of the API docs doesn't have it, but I'm pretty positive I saw it someplace. Anyway, simple XYTextAnnotation did it for me, and, while I didn't need it for the task at hand, overriding paint method to make it draw dots or whatever on the range axis shouldn't be very difficult.

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

Re: Time axis annotations

Post by paradoxoff » Tue Sep 15, 2015 8:28 am

cabarete_cub wrote:I'm still a bit puzzled with setLabel(String) method in ValueMarker class. Latest version of the API docs doesn't have it, but I'm pretty positive I saw it someplace.
You probably saw that in the Marker class. :)

Locked