/** * You guessed it..remove from the chart all series that are a) baseCounters, and b), have the * baseCounter name of calcName. This happens when the user toggles off the check box associated * with the named calculator. * * @param calcName */ public void removeSeriesByCalculatorName(String calcName) { List<AbstractSeries> activeSeries = chart.getAllSeries(); for (AbstractSeries series : activeSeries) { if (series instanceof BaseCounterSeries) { String name = ((BaseCounterSeries) series).getCalculator().getName(); if (name.equals(calcName)) { chart.removeSeries(series); } } } }
/** * Remove all series associated with the class specified * * @param toRemove */ public void removeSeriesByClass(Class toRemove) { List<AbstractSeries> activeSeries = chart.getAllSeries(); for (AbstractSeries series : activeSeries) { if (series instanceof BaseCounterSeries) { BaseCounter bc = ((BaseCounterSeries) series).getCalculator(); if (bc.getClass() == toRemove) { chart.removeSeries(series); } } } }