I have a scenario where, the data (both x and y coordinates) comes dynamically. I have to start drawing the graph from the time when i receive the first point. So the graph should be automatically updated every time a new data point comes in.This should continue for a period of time (Note: here both x and y coordinates are double variables and time is not considered as variable at all. We don't know at what time data comes in). I have tried to redraw the total graph after adding a data point to the existing dataset. It worked successfully. But i noticed a flaw in it. I i have a dataset (say at particular time t) in the following order {(1,1)(2,3)(3,5)(4,7)(2.5,1)}. This plot should have a line from point (4,7) to (2.5,1). But the point (2.5,1) is connected from (2,3) and (3,5), which i don't want. So please suggest any way of automatically updating the graph whenever a new data point comes in.
質問する
448 次
1 に答える
1
を使用していると仮定するとXYSeries
、並べ替えをオフにしてみました
private static XYDataset createDataset() {
XYSeries dataset = new XYSeries("A",false,true);
dataset.add(1,1);
dataset.add(2,3);
dataset.add(3,5);
dataset.add(4,7);
dataset.add(2.5,1);
XYSeriesCollection ds = new XYSeriesCollection();
ds.addSeries(dataset);
return ds;
}
そして、次のようなチャートを作成できる必要があります。
于 2012-10-08T13:27:49.787 に答える