如何从 androidplot 0.6 迁移到 1.4?

how to migrate from androidplot 0.6 to 1.4?

我刚刚将 androidplot 更新到 1.4,来自老式的 0.6 :o 我发现很难迁移我的代码....这些行的正确功能是什么?:

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());
}

谢谢!! 再见 菲尔

看起来您在此处 运行 的主要区别是增加了对绘图任何边缘标签的支持;不再使用单一域标签 Paint 或 orientation,现在图表的顶部和底部边缘都有一个。

默认情况下,顶部和右侧边缘标签是隐藏的,因此您只需将上面的设置应用到 BOTTOM 边缘:

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

变为:

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

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

变为:

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

有关更多详细信息,请查看 XYPlot documentation 的域和范围标签部分。