Displaying the co-ordinates for the points on XY Line series

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Scarlett
Posts: 11
Joined: Fri Sep 29, 2006 11:21 am

Displaying the co-ordinates for the points on XY Line series

Post by Scarlett » Wed Oct 18, 2006 7:37 am

Hello All,

I want to display the co-ordinates of the points on the XYLine chart.

If anyone has any idea let me know.

Thanks,
Scarlett

Scarlett
Posts: 11
Joined: Fri Sep 29, 2006 11:21 am

Post by Scarlett » Wed Oct 18, 2006 9:24 am

I am using the following code to display the labels

XYItemLabelGenerator generator = new StandardXYItemLabelGenerator("{1}", new DecimalFormat("0.00"), new DecimalFormat("0.00")
);
renderer.setItemLabelGenerator(generator);

renderer.setItemLabelsVisible(true);

However using the above code you can display either the
'x' or the 'y' co-ordinate of the point. But I want to display both the 'x' and 'y' co-ordinate.

Is there a way to achieve it?

Thanks,
Scarlett

Scarlett
Posts: 11
Joined: Fri Sep 29, 2006 11:21 am

Post by Scarlett » Thu Oct 19, 2006 6:25 am

I did get it

Following is the code which I have used

XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();

XYItemLabelGenerator generator = new StandardXYItemLabelGenerator("( {1}, {2} )", new DecimalFormat("0.0"), new DecimalFormat("0.0"));

renderer.setItemLabelGenerator(generator);

The co-ordinates are displayed in the form of
(x, y)

Thanks,
Scarlett

Locked