Example usage for org.jfree.data.general SeriesChangeListener seriesChanged

List of usage examples for org.jfree.data.general SeriesChangeListener seriesChanged

Introduction

In this page you can find the example usage for org.jfree.data.general SeriesChangeListener seriesChanged.

Prototype

public void seriesChanged(SeriesChangeEvent event);

Source Link

Document

Called when an observed series changes in some way.

Usage

From source file:edu.gmu.cs.sim.util.media.chart.ChartGenerator.java

/** Override this to remove a series from the chart.  Be sure to call super(...) first. */
public void removeSeries(int index) {
    // stop the inspector....
    SeriesAttributes[] c = getSeriesAttributes();
    SeriesChangeListener tmpObj = c[index].getStoppable();
    if (tmpObj != null) {
        tmpObj.seriesChanged(new SeriesChangeEvent(this));
    }/*from   w  w w .j a v  a  2s .c o  m*/

    // for good measure, set the index of the component to something crazy just in case a stoppable tries to continue pulsing it
    Component comp = seriesAttributes.getComponent(index);
    ((SeriesAttributes) comp).setSeriesIndex(-1);

    // remove the attribute and rebuild indices
    seriesAttributes.remove(index);
    rebuildAttributeIndices();
    revalidate();
}