Example usage for org.jfree.data.general ValueDataset getGroup

List of usage examples for org.jfree.data.general ValueDataset getGroup

Introduction

In this page you can find the example usage for org.jfree.data.general ValueDataset getGroup.

Prototype

public DatasetGroup getGroup();

Source Link

Document

Returns the dataset group.

Usage

From source file:de.laures.cewolf.jfree.ThermometerPlot.java

/**
 * Sets the dataset for the plot, replacing the existing dataset if there
 * is one, and sends a {@link PlotChangeEvent} to all registered listeners.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @see #getDataset()//ww  w. j  a  v  a 2 s  .c  o  m
 */
public void setDataset(ValueDataset dataset) {

    // if there is an existing dataset, remove the plot from the list of change listeners...
    ValueDataset existing = this.dataset;
    if (existing != null) {
        existing.removeChangeListener(this);
    }

    // set the new dataset, and register the chart as a change listener...
    this.dataset = dataset;
    if (dataset != null) {
        setDatasetGroup(dataset.getGroup());
        dataset.addChangeListener(this);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}