如何在 android 上使用 graphviz 在折线图中绘制范围线?

How can i draw lines of ranges in a line graph using grahpview on android?

我是 GraphView 库的新手,但我需要显示如下所示的图表

我曾尝试从 GraphView 修改一些演示,但不知道该怎么做 https://drive.google.com/file/d/1qi4HAPqBeewZ9bHfsRjuc0lmWhW9SbxU/view?usp=sharing

我使用下面的代码编写了一个变通解决方案。

我只是隐藏了默认的网格线并绘制直线来改变他的颜色

@Override
public void initGraph(GraphView graph) {
    DataPoint[] minPoints = new DataPoint[30];
    DataPoint[] maxPoints = new DataPoint[30];
    DataPoint[] teoricPoints = new DataPoint[30];
    DataPoint[] basePoint = new DataPoint[1];
    for (int i = 0; i < 30; i++) {
        //points[i] = new DataPoint(i, Math.sin(i*0.5) * 20*(Math.random()*10+1));
        minPoints[i] = new DataPoint(i, 20);
        maxPoints[i] = new DataPoint(i, 45);
        teoricPoints[i] = new DataPoint(i, 30);
    }
    basePoint[0] = new DataPoint(0, 0);
    LineGraphSeries<DataPoint> series = new LineGraphSeries<>(minPoints);
    LineGraphSeries<DataPoint> series2 = new LineGraphSeries<>(maxPoints);
    LineGraphSeries<DataPoint> series3 = new LineGraphSeries<>(teoricPoints);
    LineGraphSeries<DataPoint> series4 = new LineGraphSeries<>(basePoint);

    graph.getGridLabelRenderer().setGridColor(Color.RED);
    graph.getGridLabelRenderer().setHighlightZeroLines(false);
    graph.getGridLabelRenderer().setHorizontalLabelsColor(Color.GREEN);
    graph.getGridLabelRenderer().setVerticalLabelsColor(Color.RED);
    graph.getGridLabelRenderer().setVerticalLabelsVAlign(GridLabelRenderer.VerticalLabelsVAlign.ABOVE);
    graph.getGridLabelRenderer().setGridStyle(GridLabelRenderer.GridStyle.NONE);
    graph.getGridLabelRenderer().reloadStyles();


    // styling viewport
    graph.getViewport().setBackgroundColor(Color.argb(255, 222, 222, 222));
    graph.getViewport().setDrawBorder(true);
    graph.getViewport().setBorderColor(Color.BLUE);

    // styling series
    series.setTitle("Random Curve 1");
    series.setColor(Color.GREEN);

    series.setThickness(8);

    series2.setTitle("Random Curve 2");
    series2.setColor(Color.GREEN);

    series2.setThickness(8);

    series3.setTitle("Random Curve 3");
    series3.setColor(Color.GREEN);

    series3.setThickness(8);

    series4.setTitle("Random Curve 4");
    series4.setColor(Color.GREEN);

    series4.setThickness(8);

    graph.getLegendRenderer().setFixedPosition(150, 0);



    graph.addSeries(series);
    graph.addSeries(series2);
    graph.addSeries(series3);
    graph.addSeries(series4);

}