svahidhoss
svahidhoss

Reputation: 599

GraphView Android, How to change thickness of original x-axis and y-axis?

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!

Upvotes: 3

Views: 2238

Answers (2)

Anne Gunn
Anne Gunn

Reputation: 2447

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.

Upvotes: 4

Chetan Joshi
Chetan Joshi

Reputation: 5711

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);

Upvotes: 1

Related Questions