Hi David,
I use a TimeSeriesChart graphic to display events occurring within a time frame.
I show a horizontal line (with method addRangeMarker from XYPlot class) to indicate a average value.
I would like to put a "Annotation" over this average value line.
Do you have any idea of when you're going to have it avaliable?
Thanks,
Antonio Lopes
Text Annotation
Re: Text Annotation
Hi Antonio,
If you want to add the text manually, you can create an XYTextAnnotation object at some (x, y) coordinate, and add it to the XYPlot.
Alternatively, you could modify the drawRangeMarker(...) method inherited from the AbstractXYItemRenderer class and get it to draw the value as well as the line.
Regards,
Dave Gilbert
If you want to add the text manually, you can create an XYTextAnnotation object at some (x, y) coordinate, and add it to the XYPlot.
Alternatively, you could modify the drawRangeMarker(...) method inherited from the AbstractXYItemRenderer class and get it to draw the value as well as the line.
Regards,
Dave Gilbert
Re: Text Annotation
There is currently *no* way to put a text annotation on a CategoryPlot. The annotations framework needs extending to cover this.
Regards,
Dave Gilbert
Regards,
Dave Gilbert
Re: Text Annotation
Back to the first reply to the TimeSeries Chart, Dave said,
"If you want to add the text manually, you can create an XYTextAnnotation object at some (x, y) coordinate, and add it to the XYPlot."
The Constructor for XYTextAnnotation is:
XYTextAnnotation(java.lang.String text, double x,
double y)
As in most cases we only know the data values, so we need to use:
translateValueToJava2D(double dataValue, java.awt.geom.Rectangle2D dataArea)
available in ValueAxis class, which is used to trnaslate data values to corrdinates.
My question is, how can I construct this dataArea object? Where do I get the bounds of this Rectangle2D ?
Thanks,
Xingfeng
"If you want to add the text manually, you can create an XYTextAnnotation object at some (x, y) coordinate, and add it to the XYPlot."
The Constructor for XYTextAnnotation is:
XYTextAnnotation(java.lang.String text, double x,
double y)
As in most cases we only know the data values, so we need to use:
translateValueToJava2D(double dataValue, java.awt.geom.Rectangle2D dataArea)
available in ValueAxis class, which is used to trnaslate data values to corrdinates.
My question is, how can I construct this dataArea object? Where do I get the bounds of this Rectangle2D ?
Thanks,
Xingfeng