Remove series from DefaultBoxAndWhiskerCategoryDataset?
Remove series from DefaultBoxAndWhiskerCategoryDataset?
I would like to remove a series from a DefaultBoxAndWhiskerCategoryDataset, but there appears to be no way to do this. Any suggestions? In other datasets like TimeSeriesCollection there's methods to get the index of a particular series and remove it, but not so for this particular dataset. I'd prefer not to resort to creating a new dataset for each series, as it sort of defeats the purpose of having a dataset in the first place.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
It would be possible to add removeColumn() and removeRow() methods as in DefaultCategoryDataset, but it will also need the cached minimumRangeValue and maximumRangeValue attributes to be updated. I added the following feature request, and will hopefully get to it eventually (patches are welcome in the mean time, of course):
http://sourceforge.net/tracker/index.ph ... tid=365494
http://sourceforge.net/tracker/index.ph ... tid=365494
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Thanks, I'll keep an eye out for those methods in future versions. In the meantime I'm storing each series in a HashMap which represents a dataset. When I add a series to the chart it's added to the HashMap, after which the map is sent to a function called remakeDataset(), which constructs and returns a new dataset. I chose to do this because I'm actually working with several different types of datasets (four, to be exact), and each one handles the removal of series somewhat differently. It's not terribly elegant, but it works. The key for each HashMap entry is a description of the series, which makes it easy to locate the specific series I want to remove.