GraphView Android,如何改变原始x轴和y轴的粗细?
GraphView Android, How to change thickness of original x-axis and y-axis?
我正在使用 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);
基本上我想改变这个:
对此:
提前致谢!
详细请查找折线图系列:
//造型系列
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);
GridLabelRenderer class 有一个 setHighlightZeroLines
方法,默认为 true
。代码如下:
graphView.getGridLabelRenderer().setHighlightZeroLines(false);
应该做你想做的。
我正在使用 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);
基本上我想改变这个:
对此:
提前致谢!
详细请查找折线图系列:
//造型系列
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);
GridLabelRenderer class 有一个 setHighlightZeroLines
方法,默认为 true
。代码如下:
graphView.getGridLabelRenderer().setHighlightZeroLines(false);
应该做你想做的。