I'm using a DatasetChangeListener to monitor the modification of some XYSeriesCol开发者_JS百科lection because a change in one series must be reflected to other series of my application's charts.
public void datasetChanged(DatasetChangeEvent arg0) {
XYSeriesCollection d = (XYSeriesCollection)arg0.getDataset();
System.out.println(d.getGroup().getID());
}
I'm using DatasetGroup to store a string that uniquely identify the dataset.
Now the point is, I would like to know only the single entry of the dataset on which the changed occured, otherwise I am forced to iterate through all the dataset and inspect all datas. Is there any way to do that?
For example I would like to know that a changed occured for the series 1 in the collection, on the y value of the third element. Is that possible?
The Dataset returned by getDataset() is probably not useful in this context. Instead, look at the source of a SeriesChangeEvent. You'll probably have to override one or more of the add() methods in a subclass of XYSeries to track the change details.
I partially solved using SeriesChangeListener and adding a description String to each serie, but I still need to inspect all the values inside the serie. It's a better solution than using a DatasetChangeListener (I don't need to inspect all values of all series in the dataset) but it's not perfect.
加载中,请稍侯......
精彩评论