3

I am using the GraphView library for drawing graphs in an Android app and I am very pleased with the library so far. I am using it in a fixed frame realtime scenario and have noticed that the x-axis and y-axis grid lines are thicker thatn the other unit grid lines. Is there any way I can make them similar to the other lines?

GraphView graph = (GraphView) cardView.findViewById(R.id.graph);

// Set manual X bounds
graph.getViewport().setXAxisBoundsManual(true);
graph.getViewport().setMinX(0);
graph.getViewport().setMaxX(40);

// Set manual Y bounds
graph.getViewport().setYAxisBoundsManual(true);
graph.getViewport().setMinY(-40);
graph.getViewport().setMaxY(60);

// Draw a border between between labels and viewport
graph.getViewport().setDrawBorder(false);

graph.getGridLabelRenderer().setHumanRounding(false);
graph.getGridLabelRenderer().setNumHorizontalLabels(11);
graph.getGridLabelRenderer().setNumVerticalLabels(6);

Basically I would like to change this:

enter image description here

to this:

enter image description here

Thanks in advance!

svahidhoss
  • 333
  • 2
  • 11

2 Answers2

4

There is a setHighlightZeroLines method for the GridLabelRenderer class that is true by default. Code something like:

graphView.getGridLabelRenderer().setHighlightZeroLines(false);

should do what you want.

Anne Gunn
  • 2,347
  • 1
  • 28
  • 42
1

Please find Line Graph Series in detail:

Line Graph Series in detail

// styling series

series.setTitle("Random Curve 1");
series.setColor(Color.GREEN);
series.setDrawDataPoints(true);
series.setDataPointsRadius(10);
series.setThickness(8);

// custom paint to make a dotted line

Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(10);
paint.setPathEffect(new DashPathEffect(new float[]{8, 5}, 0));
series2.setCustomPaint(paint);
Chetan Joshi
  • 5,582
  • 4
  • 30
  • 43
  • Thanks for the response but what you mentioned is used for modifying the data series (graph traces) not the grid-lines that I am looking for. I edited the images for clarification. – svahidhoss Feb 24 '17 at 18:01