how to migrate from androidplot 0.6 to 1.4?

203 views Asked by At

i just updated androidplot to 1.4 and came from an old-school 0.6 :o i find it difficult to migrate my code.... what are the correct functions for these lines?:

plot = (XYPlot) view.findViewById(R.id.mySimpleXYPlot);

plot.getGraphWidget().setDomainValueFormat(new PlotDomainFormat(.......
plot.setGridPadding(0, 0, 0, 0);
plot.getGraphWidget().setDomainLabelOrientation(-45);
plot.getGraphWidget().getDomainLabelPaint().setTextSize(20);
plot.getLegendWidget().setVisible(false);

if (act.minXY.x == 0f) {
   act.minXY = new PointF(plot.getCalculatedMaxX().floatValue() - 30, plot.getCalculatedMinY().floatValue());
   act.maxXY = new PointF(plot.getCalculatedMaxX().floatValue(), plot.getCalculatedMaxY().floatValue());
}

thanks!! bye phil

1

There are 1 answers

0
Nick On BEST ANSWER

It looks like the main difference you're running into here is the added support for labels on any edge of the plot; instead of a single domain label Paint or orientation, there's now one for both the top and bottom edge of the graph.

By default the top and right edge labels are hidden so you should only need to apply your settings above to the BOTTOM edge:

plot.getGraphWidget().getDomainLabelPaint().setTextSize(20);

Becomes:

plot.getGraph().getLineLabelStyle(XYGraphWidget.Edge.BOTTOM).getPaint()
    .setTextSize(20);

And

plot.getGraphWidget().setDomainLabelOrientation(-45);

Becomes:

plot.getGraph().getLineLabelStyle(XYGraphWidget.Edge.BOTTOM)
    .setRotation(-45);

For additional detail check out the Domain & Range Labels section of theXYPlot documentation.