XY Annotations and their Chart Entities

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
mickish
Posts: 29
Joined: Tue Jan 08, 2008 11:15 pm
Location: Venice, Florida

XY Annotations and their Chart Entities

Post by mickish » Wed Mar 26, 2008 7:21 pm

As a workaround to my main problem, I am post-processing my annotations, explicitly drawing them directly to the PDF file after drawing the chart.

I rely on the entities accummulated in the ChartRenderingInfo during the regular chart drawing as a source of annotations to draw.

However, I see that annotations are sometimes added as entities, and sometimes not. In particular, XYShapeAnnotation.draw() always adds a corresponding entity, but XYLineAnnotation.draw() and most other annotation draw methods only add an annotation if it has a toolTip or url.

Is this difference intentional? I would like to see entities added for all annotations, regardless of whether they have toolTips or urls.

mickish
Posts: 29
Joined: Tue Jan 08, 2008 11:15 pm
Location: Venice, Florida

Post by mickish » Wed Mar 26, 2008 8:53 pm

Given an XYAnnotationEntity, I want to explicitly invoke the draw() method on the XYDrawableAnnotation that it was created for, to write it into my PDF file.

How do I get a reference to the original XYDrawableAnnotation from the XYAnnotationEntity?

(Please let me know if there is an easier way to do this...)

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

Re: XY Annotations and their Chart Entities

Post by david.gilbert » Thu Mar 27, 2008 3:05 pm

mickish wrote:Is this difference intentional? I would like to see entities added for all annotations, regardless of whether they have toolTips or urls.
Not intentional. Within the limitations of the whole ChartRenderingInfo mess, all the annotations should have an entity generated, because they (entities) can be used for more than just toolTips and urls. So that needs to get fixed.
David Gilbert
JFreeChart Project Leader

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

Locked