5

I just want to show only X Y axes and labels on these axes and don't want to show grid lines in Android GraphView. How can I do that?

Thanks in advance.

YakovL
  • 7,557
  • 12
  • 62
  • 102
Red Devil
  • 61
  • 1
  • 7

3 Answers3

5

I believe the following call should do the trick :

your_graph.getGridLabelRenderer().setGridStyle( GridLabelRenderer.GridStyle.NONE );

Please do note I haven't tested the above call :)

Cyril C.
  • 112
  • 8
  • 3
    this command will also remove both horizontal and vertical axis also :) – Red Devil Jul 12 '15 at 05:36
  • Have you tried running this command and then explicitly asking for the X and Y axis to be visible (maybe via your_graph.getGridLabelRenderer().setHighlightZeroLines( true ); or your_graph.getGridLabelRenderer().setVerticalLabelsVisible( true );) ? – Cyril C. Jul 15 '15 at 09:02
  • 1
    i created an issue for this topic, will be fixed in future https://github.com/jjoe64/GraphView/issues/398 – appsthatmatter Apr 28 '16 at 20:49
4

If you use this all the grid lines will be Removed

your_graph.getGridLabelRenderer().setGridStyle( GridLabelRenderer.GridStyle.NONE );

For Setting Horizontal Line visible

your_graph.getGridLabelRenderer().setGridStyle(GridLabelRenderer.GridStyle.HORIZONTAL);

For Vertical Line visible

your_graph.getGridLabelRenderer().setGridStyle( GridLabelRenderer.GridStyle.VERTICAL);
kiran kumar
  • 1,402
  • 17
  • 34
2

The following code will remove the grid and then show the X and Y axis

graph.getGridLabelRenderer().setGridStyle(GridLabelRenderer.GridStyle.NONE);
graph.getViewport().setDrawBorder(true);
DSM
  • 31
  • 3