2017-02-24 112 views
1

我正在使用GraphView库在Android应用程序中绘制图表,我对该库至今感到非常满意。我在固定帧实时情况下使用它,并注意到x轴和y轴网格线比其他单元网格线厚。有什么办法可以让它们与其他线路类似吗?GraphView Android,如何更改原始x轴和y轴的厚度?

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

基本上我想改变这一点:

enter image description here

这件事:提前

enter image description here

谢谢!

回答

1

有GridLabelRenderer类的setHighlightZeroLines方法默认情况下为true。代码是这样的:

graphView.getGridLabelRenderer().setHighlightZeroLines(false);

应该做你想要什么。

1

请详细找到线图系列:

Line Graph Series in detail

//造型系列

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

//定制油漆做出虚线

Paint paint = new Paint(); 
paint.setStyle(Paint.Style.STROKE); 
paint.setStrokeWidth(10); 
paint.setPathEffect(new DashPathEffect(new float[]{8, 5}, 0)); 
series2.setCustomPaint(paint); 
+0

感谢您的回应,但您提到的是用于修改数据系列(图形轨迹),而不是我正在寻找的网格线。我编辑了图像以供澄清。 – svahidhoss