1

I’m using StepMode.INCREMENT_BY_PIXELS to create my plot for I need the grids to stay in the same size even on different Android devices, and it works quite well. However, I need to know the height in pixels of the y-axis of the plot, so that I can use setRangeBoundaries for the correct labeling. As shown in the picture, what I want to know is the yellow length in pixels, any suggestion will be helpful, thanks!

enter image description here

Alison
  • 431
  • 6
  • 19

1 Answers1

0

To my knowledge there is no way of directing getting the size in pixels of the yellow line.

Something to try would be to grab the size of the plot and then subtract the margin/padding to figure out the area.

plot = view.findViewById(R.id.graph);
plot.getWidth(); //width in pixels
plot.getHeight(); //width in pixels
//Subtract margins/padding to approximate dimensions of yellow line
Jameson
  • 190
  • 1
  • 11