I'm using a DatasetChangeListener
to monitor the modification of some XYSeriesCollection
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.