仅在线图之间的背景颜色(GraphView)

时间:2016-11-10 18:22:27

标签: android android-graphview

图书馆:graphview 版本:4.2.1

是否可以在两条曲线之间设置背景颜色?像这样:

enter image description here

setDrawBackground改变曲线和坐标线之间的颜色,这不是我需要的:

enter image description here

exaple代码:

        LineGraphSeries<DataPoint> seriesUp = new LineGraphSeries<>(new DataPoint[]{
            new DataPoint(0, 3),
            new DataPoint(1, 7),
            new DataPoint(2, 5),
            new DataPoint(3, 4),
            new DataPoint(4, 8)
    });
    graph.addSeries(seriesUp);
    seriesUp.setDrawBackground(false);
    seriesUp.setColor(Color.MAGENTA);
    seriesUp.setDrawBackground(true);


    LineGraphSeries<DataPoint> series = new LineGraphSeries<>(new DataPoint[]{
            new DataPoint(0, 2),
            new DataPoint(1, 6),
            new DataPoint(2, 4),
            new DataPoint(3, 3),
            new DataPoint(4, 7)
    });
    graph.addSeries(series);
    graph.getViewport().setScalableY(true);
    series.setThickness(5);
    series.setColor(Color.RED);
    series.setAnimated(true);
    series.setDrawDataPoints(true);
    series.setDataPointsRadius(10);
    series.setBackgroundColor(Color.CYAN);
    series.setDrawBackground(false);

0 个答案:

没有答案