Android如何在HelloChart上绘制单行

时间:2017-02-27 08:12:26

标签: android

在我的应用程序中我使用HelloChart,我的问题是在下面的屏幕截图中绘制单行红色

enter image description here

以下代码是我试图绘制的:

private void generateLineChart1Data() {
    lines = new ArrayList<>();

    for (int i = 0; i < numberOfLines; ++i) {

        List<PointValue> values = new ArrayList<>();

        for (int j = 0; j < numberOfPoints; ++j) {
            values.add(new PointValue(j, 100f));
        }

        Line line = new Line(values);
        line.setColor(ChartUtils.COLORS[i]);
        line.setShape(shape);
        line.setCubic(isCubic);
        line.setFilled(isFilled);
        line.setHasLabels(hasLabels);
        line.setHasLabelsOnlyForSelected(hasLabelForSelected);
        line.setHasLines(hasLines);
        line.setHasPoints(hasPoints);

        if (pointsHaveDifferentColor) {
            line.setPointColor(Color.BLUE);
        }

        lines.add(line);
    }

    data = new LineChartData(lines);
    data.setBaseValue(Float.NEGATIVE_INFINITY);
    lineChartView1.setLineChartData(data);
}

问题是这行代码:

values.add(new PointValue(j, 100f));

0 个答案:

没有答案