translateJava2DToValue from ChartMouseEvent

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
zany
Posts: 20
Joined: Mon Mar 15, 2004 2:36 pm
Location: Germany

translateJava2DToValue from ChartMouseEvent

Post by zany » Mon Apr 05, 2004 4:06 pm

Hi,

I'm trying to use the axis translateJava2DToValue() from chartMouseClicked().
There seems to be one problem though. I can't figure a way of getting the right dataArea argument.

Code: Select all

double x = plot.getDomainAxis().translateJava2DToValue(getTrigger().getX(), dataArea, plot.getDomainAxisEdge());
ChartPanels getBounds() is not the rectangle we need here. The dataArea is calculated from within ChartPanels draw() and never actually stored anywhere?

Thank you for any pointers on this.

cu,
Christian

zany
Posts: 20
Joined: Mon Mar 15, 2004 2:36 pm
Location: Germany

Post by zany » Mon Apr 05, 2004 4:12 pm

Sorry. I meant to say that the dataArea is calculated from within the Plots draw() method (shrinking the chart area by the axis space).

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 » Mon Apr 05, 2004 10:17 pm

You can use the getChartRenderingInfo() method in the ChartPanel class to get the info for the most recent redraw. It contains the dataArea, among other things.
David Gilbert
JFreeChart Project Leader

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

Locked