在我的应用程序中我使用HelloChart
,我的问题是在下面的屏幕截图中绘制单行红色
以下代码是我试图绘制的:
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));