我想要一条虚线,如the official documentation:
中所述 futureSeries.setDrawDataPoints(true);
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(10);
paint.setPathEffect(new DashPathEffect(new float[]{8, 5}, 0));
futureSeries.setCustomPaint(paint);
graph.addSeries(futureSeries);
的build.gradle:
compile 'com.jjoe64:graphview:4.2.1'
结果不是虚线:
这样的事情就可以了:
答案 0 :(得分:5)
只需应用LineGraphSeries#setDrawAsPath(true)
。
Paint paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(10);
paint.setPathEffect(new DashPathEffect(new float[]{8, 5}, 0));
LineGraphSeries<DataPoint> series = ... // init
series.setDrawAsPath(true);
series.setCustomPaint(paint);
graphView.addSeries(series);
结果: