1

I'm trying to migrate androidplot from API 0.6 to 1.5, and found all equivalent methods, except one, XYPlot.graphWidget.setGridPadding(float left, float top, float right, float bottom)

This was removed from version 0.9.8 to 1.0.0, in this commit.

I created a sample project that shows the usage of the API. The repository has two branches, AndroidPlot0.6.1 and AndroidPlot1.5.6 that show's the migration process and the solutions I tried without success.

Here is one screenshot with the grid padding, that show's the label in all points.

screenshot with grid padding

And here is one screenshot without the grid padding, that don't show the label in all points.

screenshot without grid padding

Does anyone know's how to solve this?

Thanks

Bruno Coelho
  • 926
  • 13
  • 25

1 Answers1

2

This is unfortunately not an exact replacement for what you had as the padding is expressed in native units and not screen units, but it should allow you to achieve close to the same effect.

Add 1 "native unit" of space on each edge of a plot:

plot.calculateMinMaxVals();
RectRegion bounds = plot.getBounds();

plot.setRangeBoundaries(
    bounds.getMinY().doubleValue() - 1, BoundaryMode.FIXED,
    bounds.getMaxY().doubleValue() + 1, BoundaryMode.FIXED);

plot.setDomainBoundaries(
    bounds.getMinX().doubleValue() - 1, BoundaryMode.FIXED,
    bounds.getMaxX().doubleValue() + 1, BoundaryMode.FIXED);

If you absolutely need to express that space in pixels, there is a way to do it using XYPlot's screenToSeries conversion methods, but it's much less straightforward.

Nick
  • 8,181
  • 4
  • 38
  • 63