How to show the position when using traceline

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
asterix
Posts: 6
Joined: Sat Apr 05, 2008 3:35 pm

How to show the position when using traceline

Post by asterix » Thu Apr 10, 2008 5:48 pm

Hello,

I created a TimeSeries chart using ChartComposite. I set setVerticalAxisTrace(true) to show the traceline in the chart. How can I get the position of the traceline while moving the mouse ?

Thanks for your help.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Thu Apr 10, 2008 9:32 pm

When you say "the position of the traceline", I'm guessing you mean the corresponding data value along the axis? I'm not 100% sure how to derive it for the ChartComposite, but for ChartPanel it is slightly involved since you have to take into account the data area rectangle and any scaling that has been applied by the panel. MouseListenerDemo4.java shows how to do it (but, as I said, for a ChartPanel rather than a ChartComposite).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

asterix
Posts: 6
Joined: Sat Apr 05, 2008 3:35 pm

Post by asterix » Fri Apr 11, 2008 5:23 am

Thanks David. I'll try your suggestion with ChartComposite.

Locked