#710 DefaultXYDataset & replacing series data

closed-duplicate
General (896)
5
2007-01-29
2007-01-26
Anonymous
No

The documentation says DefaultXYDataset.addValues() "Adds a series or if a series with the same key already exists replaces the data for that series..."

If replacing data in a list, shouldn't you call "set(index, data)" instead of calling "add(index, data)" ?

See
addSeries(Comparable seriesKey, double data[][]) {

...

if(seriesIndex == -1){
seriesKeys.add(seriesKey);
seriesList.add(data);
} else {
seriesList.add(seriesIndex, data); <-- inserts
}

Testing: Create a chart and enable the legend. Add a couple of datasets. Replace one or more datasets. You should see an exception thrown.

Discussion

  • David Gilbert

    David Gilbert - 2007-01-29
    • labels: --> General
    • assigned_to: nobody --> mungady
    • status: open --> open-duplicate
     
  • David Gilbert

    David Gilbert - 2007-01-29
    • status: open-duplicate --> closed-duplicate
     

Log in to post a comment.