CategoryTextAnnotaion for CategoryPlot

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jaypee
Posts: 32
Joined: Fri Mar 24, 2006 2:35 am

CategoryTextAnnotaion for CategoryPlot

Post by jaypee » Tue May 09, 2006 4:48 am

Hi there. I was wondering if you guys could help me out on this.

I tried using the CategoryTextAnnotation however the annotation does not show up where I want it to show.

I don't know how to go about this. How do I get the x and y value for the point in the the dataset so I could put the annotation?

I used this:

Code: Select all

plot.addAnnotation(new CategoryTextAnnotation("This is a test annotation","Line",0.184));
the 0.184 value was hard coded. but this should be dynamic....

thanks for the help :-)

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue May 09, 2006 9:50 am

Annotations are placed at fixed points on the chart. There's nothing to stop you querying your dataset to determine the position, but once placed the annotation won't move if the dataset is modified.

Perhaps you need to use item labels rather than annotations. These are drawn by the renderer, and automatically get placed relative to the data value.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked