我已经做到了,但是它的静态数据存储在两个数组中。
private void GetGraph() {
LineGraphSeries<DataPoint> series = new LineGraphSeries<DataPoint>(new DataPoint[]{
new DataPoint(first[0], second[0]),
new DataPoint(first[1], second[1]),
new DataPoint(first[2], second[2]),
new DataPoint(first[3], second[3]),
new DataPoint(first[4], second[4]),
new DataPoint(first[5], second[5]),
new DataPoint(first[6], second[6]),
new DataPoint(first[7], second[7]),
new DataPoint(first[8], second[8]),
new DataPoint(first[9], second[9]),
});
graph.getViewport().setScalable(true);
graph.addSeries(series);
答案 0 :(得分:0)
您可以使用随机函数生成一组可以传递给DataPoint的随机数。这是教程:- https://dzone.com/articles/random-number-generation-in-java