문제

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top