yuxinburen / achartengine

Automatically exported from code.google.com/p/achartengine
0 stars 0 forks source link

[patch] way to get data point coordinates for screen coordinates #104

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When a user clicks on the graph, it can be useful to know what the data xy 
coordinates of the clicked point are.

I'm attaching a patch which adds this feature.

Original issue reported on code.google.com by candrews...@gmail.com on 25 Jul 2011 at 6:13

Attachments:

GoogleCodeExporter commented 9 years ago
expand scope of xPixelsPerUnit, yPixelsPerUnit, minX, and minY from default to 
protected to be consistent with other variables.

Original comment by candrews...@gmail.com on 25 Jul 2011 at 7:41

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the code. However, I provided an easier solution for this as some of 
the needed APIs already existed. See SVN rev. r261.

Original comment by dandrome...@gmail.com on 26 Jul 2011 at 2:27

GoogleCodeExporter commented 9 years ago
Awesome - your solution does seem nicer than mine. Thank you very much!

Original comment by candrews...@gmail.com on 26 Jul 2011 at 6:45

GoogleCodeExporter commented 9 years ago
So has this fix been incorporated? What's the solution - how can I transform 
screen to graph coordinates (for normal line charts)?

Original comment by hira...@gmail.com on 6 Jun 2012 at 7:30

GoogleCodeExporter commented 9 years ago
I checked the code in the trunk -

public double[] toRealPoint(int scale) {
    if (mChart instanceof XYChart) {
        XYChart chart = (XYChart) mChart;
        return chart.toRealPoint(oldX, oldY, scale);
    }
    return null;
}

Shouldn't it be instead -

public double[] toRealPoint(double x, double y, scale) {
    if (mChart instanceof XYChart) {
        XYChart chart = (XYChart) mChart;
        return chart.toRealPoint(x, y, scale);
    }
    return null;
}

Also what exactly is scale? If I want to get graphical coordinates from screen 
coordinates - ideally I should not have to enter any other parameter than the 
coordinates manually.

Original comment by hira...@gmail.com on 6 Jun 2012 at 7:45