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

How to hide horizontal range lines on AndroidPlot's XYPlot?

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

我已经尝试这样做了:

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: Obviously you can pass as parameter something different than null to get different results. For example you can pass a custom Paint object based on your needs.

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