Displaying external information on chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Filoche
Posts: 26
Joined: Sat Jul 28, 2007 7:23 pm

Displaying external information on chart

Post by Filoche » Fri Nov 30, 2007 8:54 pm

Hi all.

I'm using a LineChart and I want to display external information on it (like the R^2) of a regression.

My quesiton is : is it possible to write (display) texte at x,y position in my chart?

Best regards, and have a neci day.

Phil

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Re: Displaying external information on chart

Post by RichardWest » Fri Nov 30, 2007 10:16 pm

Filoche wrote:My quesiton is : is it possible to write (display) texte at x,y position in my chart?
Use a XYTextAnnotation.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

Filoche
Posts: 26
Joined: Sat Jul 28, 2007 7:23 pm

Post by Filoche » Fri Nov 30, 2007 11:35 pm

Thank you for the fast respons.

It is almost working prefectly. But from what I understand, the xy coords are based on data in the chart ?

Is there a way to set x and y as relative coords (like 0,0 the upper corner left) ?

Phil

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Post by RichardWest » Fri Nov 30, 2007 11:44 pm

Take a look at Title/legend and combined plots. The post is a bit old, but the spirit of it matches your goal. You will need to include the experimental jar to use the XYTitleAnnotation class.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

Filoche
Posts: 26
Joined: Sat Jul 28, 2007 7:23 pm

Post by Filoche » Fri Nov 30, 2007 11:46 pm

Ty sir.

Looks like it was what I was looking for.

One more question. Is it possible to get the min and max values for a d ataset? If so I could transpose these value between 0, and 1.

Tx

RichardWest
Posts: 844
Joined: Fri Oct 13, 2006 9:29 pm
Location: Sunnyvale, CA

Post by RichardWest » Fri Nov 30, 2007 11:52 pm

Filoche wrote:Is it possible to get the min and max values for a d ataset?
Take a look at DatasetUtilities.
Filoche wrote:If so I could transpose these value between 0, and 1.
Create a custom dataset that extends the XYDataset and override the getY and getYValue methods to return super version divided by the maximum. This would effectively render the data as percentage of maximum. I think that is what you are asking about.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA

Filoche
Posts: 26
Joined: Sat Jul 28, 2007 7:23 pm

Post by Filoche » Fri Nov 30, 2007 11:55 pm

Everything working fine.

I appreciated your help.

Best regards, and have a ncie week-end.

Locked