Label a line on an Overlaid Chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
BS

Label a line on an Overlaid Chart

Post by BS » Thu Aug 22, 2002 9:40 pm

We need to label our individual lines (ie. 5th, 10th, 25th, 50th, etc) to look like this:

http://www.cdc.gov/nchs/about/major/nha ... hart01.pdf


Is this possible? If so, how do we do this? If not, can we expect it as a future enhancement?




Thanks,

BS

David Gilbert

Re: Label a line on an Overlaid Chart

Post by David Gilbert » Fri Aug 23, 2002 7:18 am

It's not possible. It is one of the things that I'd like to cover with a 'chart annotations' facility. You should be able to add an annotation (text item, or shape, or image) to a list maintained by XYPlot along with the location (in terms of data values). Then the plot would draw these items on the chart after it has finished drawing all the lines.

For example, you might have something like this:

XYPlot plot = myChart.getXYPlot();
plot.addAnnotation("97th", 37, 39.5);
plot.addAnnotation("95th", 37, 38.5);
...

The 37 is the value on the x-axis, the 39.5/38.5 is the value on the y-axis.

This would be really easy to implement, I'll see if I can get something in for 0.9.3.

Regards,

DG.

BS

Re: Label a line on an Overlaid Chart

Post by BS » Thu Sep 05, 2002 8:32 pm

>Re: Version 0.9.3 released...
>Author: David Gilbert
>Date: 09-04-02 23:08

>Hi BS,

>I put together a very basic annotation framework in this release. The >AnnotationDemo1.java file is provided as an example.

>Regards,

>DG.



Hi DG,

This works and looks great! Thanks for your help and quick delivery. ;-)



Sincerely,

BS

aurorean

Re: Label a line on an Overlaid Chart

Post by aurorean » Sat Sep 14, 2002 4:19 am

If I want to add XYTextAnnotation to TimeSeriesChart, how to set the value of x-coordinate in constructor of XYTextAnnontation.

Thanks,

Aurorean.

aurorean

Re: Label a line on an Overlaid Chart

Post by aurorean » Sat Sep 14, 2002 6:44 am


Locked