我想从此XYPlot图表中删除水平线:

android - 如何在AndroidPlot的XYPlot上隐藏水平范围线?-LMLPHP

我已经尝试过这样做:

plot.getGraph().getGridBackgroundPaint().setColor(Color.TRANSPARENT);


并将其添加到XYPlot的xml描述中:

ap:rangeLineColor="@color/ap_transparent"

最佳答案

您需要调用这两个方法(同时删除两个背景线),如果您只需要删除水平方法,则只需调用第二个方法即可。

//this removes the vertical lines
plot.getGraph().setDomainGridLinePaint(null)

//this removes the horizontal lines
plot.getGraph().setRangeGridLinePaint(null)



  PS:显然,您可以传递与null不同的参数作为参数,以获得不同的结果。例如,您可以根据需要传递自定义Paint对象。


这是两个都设置为null的结果:

android - 如何在AndroidPlot的XYPlot上隐藏水平范围线?-LMLPHP

09-10 06:12
查看更多