1

I'd like to remove the horizontal lines from this XYPlot chart:

enter image description here

I've already tried doing this:

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

and added this in the XYPlot's xml description:

ap:rangeLineColor="@color/ap_transparent"
matdev
  • 4,115
  • 6
  • 35
  • 56
  • 1
    I just tested `ap:domainLineColor="@color/ap_transparent"` and `ap:rangeLineColor="@color/ap_transparent"` and both are working. – Nick Mar 06 '18 at 17:09
  • I solved my problem by removing the line plot.setLinesPerRangeLabel(5); For some reason, this line forces range grid lines to be visible. – matdev Mar 07 '18 at 09:37

1 Answers1

3

What you need is to call those two methods (to remove both background lines), if you need to remove only the horizontal ones just call the second one.

//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.

This is the result with both set to null:

XYZ Plot without the background grid

MatPag
  • 41,742
  • 14
  • 105
  • 114