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.
XY Annotations and their Chart Entities
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...)
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...)
-
- 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
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.mickish wrote:Is this difference intentional? I would like to see entities added for all annotations, regardless of whether they have toolTips or urls.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

