I am trying to get the pixel position of a values in my AndroidPlot, but I can\'t get it to work. The idea is to place the cursor at the exact point showed on the plot, at s
i`ve found a solution. My intent was to find the value for a given pixel (for example by tapping on the plot, i wanted the representing value). So, after a bit of searching i found the helper-class ValPixConverter. It provides a few methods that fit my needs. Unfortunately there is no documentation of the methods, but i found a solution:
private float pixelToValueY(float y) {
//Parameters: 1=input y-value, 2=minmal y-value that is shown, 3=maximal y-value that is shown, 4=Hight of the view, 5=flip
return (float) ValPixConverter.pixToVal(y, minXY.y, maxXY.y, mySimpleXYPlot.getHeight(), false);
}
private float pixelToValueX(float x) {
//Parameters: 1=input y-value, 2=minmal y-value that is shown, 3=maximal y-value that is shown, 4=Hight of the view, 5=flip
return (float) ValPixConverter.pixToVal(x, minXY.x, maxXY.x, mySimpleXYPlot.getWidth(), false);
}
You need just the other way. The method valToPix() will do this. It`s then very similar with the Code above.