getScreenDataArea() in ChartViewer

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
dragondgold
Posts: 2
Joined: Thu Jul 10, 2014 2:38 am
antibot: No, of course not.

getScreenDataArea() in ChartViewer

Post by dragondgold » Sat Jul 12, 2014 5:03 pm

Hello! I have this code from an app using JFreeChart with Swing that returns an xy coordinate from the chart when I click with the mouse:

Code: Select all

double pointX = event.getTrigger().getX();
                double pointY = event.getTrigger().getY();

                Rectangle2D plotArea = chartPanel.getScreenDataArea();
                XYPlot plot = (XYPlot) chart.getPlot(); // the XY Plot.
                double chartX = plot.getDomainAxis().java2DToValue(pointX, plotArea, plot.getDomainAxisEdge());
                double chartY = plot.getRangeAxis().java2DToValue(pointY, plotArea, plot.getRangeAxisEdge());
                System.out.println("JFreeChart: current point: X= "+ chartX +", Y= "+ chartY);
Now I'm porting this to JavaFX using ChartViewer but I don't have getScreenDataArea() method here. Is this still not available for JavaFX? Or is there any workaround?

Locked