This will throw the operation unsupport exception because the getData() returns a unmodifiableList, why is that? How can I remove items from the List from the the chart?
For anyone looking at removing a DataSeries, this was my approach (right or wrong):
public void removeListSeries(String seriesName)
{
List<Series> s = new ArrayList<Series>();
// Use another list - the configuration sends an unmodifiable list, so initialize with a copy of it
for (Series i : chart.getConfiguration().getSeries())
s.add(i);
for (int i=0;i<s.size();i++)
{
DataSeries ds = (DataSeries) chart.getConfiguration().getSeries().get(i);
if (ds.getName().equalsIgnoreCase(seriesName))
{
s.remove(i);
// Update the chart with the new list
chart.getConfiguration().setSeries(s);
chart.drawChart();
break;
}
}
}