Example usage for org.jfree.data.category CategoryDataset addChangeListener

List of usage examples for org.jfree.data.category CategoryDataset addChangeListener

Introduction

In this page you can find the example usage for org.jfree.data.category CategoryDataset addChangeListener.

Prototype

public void addChangeListener(DatasetChangeListener listener);

Source Link

Document

Registers an object for notification of changes to the dataset.

Usage

From source file:genlab.gui.jfreechart.EnhancedSpiderWebPlot.java

/**
 * Creates a new spider web plot with the given dataset.
 *
 * @param dataset  the dataset.// w w w.  j a  v  a2  s .c  o  m
 * @param extract  controls how data is extracted ({@link TableOrder#BY_ROW}
 *                 or {@link TableOrder#BY_COLUMN}).
 */
public EnhancedSpiderWebPlot(CategoryDataset dataset, TableOrder extract) {
    super();
    if (extract == null) {
        throw new IllegalArgumentException("Null 'extract' argument.");
    }
    this.dataset = dataset;
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    this.dataExtractOrder = extract;
    this.headPercent = DEFAULT_HEAD;
    this.axisLabelGap = DEFAULT_AXIS_LABEL_GAP;
    this.axisLinePaint = Color.black;
    this.axisLineStroke = new BasicStroke(1.0f);

    this.interiorGap = DEFAULT_INTERIOR_GAP;
    this.startAngle = DEFAULT_START_ANGLE;
    this.direction = Rotation.CLOCKWISE;
    this.maxValue = DEFAULT_MAX_VALUE;

    this.seriesPaint = null;
    this.seriesPaintList = new PaintList();
    this.baseSeriesPaint = null;

    this.seriesOutlinePaint = null;
    this.seriesOutlinePaintList = new PaintList();
    this.baseSeriesOutlinePaint = DEFAULT_OUTLINE_PAINT;

    this.seriesOutlineStroke = null;
    this.seriesOutlineStrokeList = new StrokeList();
    this.baseSeriesOutlineStroke = DEFAULT_OUTLINE_STROKE;

    this.labelFont = DEFAULT_LABEL_FONT;
    this.labelPaint = DEFAULT_LABEL_PAINT;
    this.labelGenerator = new StandardCategoryItemLabelGenerator();

    this.legendItemShape = DEFAULT_LEGEND_ITEM_CIRCLE;
}

From source file:genlab.gui.jfreechart.EnhancedSpiderWebPlot.java

/**
 * Sets the dataset used by the plot and sends a {@link PlotChangeEvent}
 * to all registered listeners.//  w  ww  . j a va 2 s .c o  m
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @see #getDataset()
 */
public void setDataset(CategoryDataset dataset) {
    // if there is an existing dataset, remove the plot from the list of
    // change listeners...
    if (this.dataset != null) {
        this.dataset.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 to trigger plot change event
    datasetChanged(new DatasetChangeEvent(this, dataset));
}

From source file:spinworld.gui.RadarPlot.java

/**
 * Creates a new spider web plot with the given dataset.
 *
 * @param dataset  the dataset.//from   w  w  w  .  ja va2s.co m
 * @param extract  controls how data is extracted ({@link TableOrder#BY_ROW}
 *                 or {@link TableOrder#BY_COLUMN}).
 */
public RadarPlot(CategoryDataset dataset, TableOrder extract) {
    super();
    if (extract == null) {
        throw new IllegalArgumentException("Null 'extract' argument.");
    }
    this.dataset = dataset;
    if (dataset != null) {
        dataset.addChangeListener(this);
    }

    this.dataExtractOrder = extract;
    this.headPercent = DEFAULT_HEAD;
    this.axisLabelGap = DEFAULT_AXIS_LABEL_GAP;
    this.axisLinePaint = Color.black;
    this.axisLineStroke = new BasicStroke(1.0f);

    this.interiorGap = DEFAULT_INTERIOR_GAP;
    this.startAngle = DEFAULT_START_ANGLE;
    this.direction = Rotation.CLOCKWISE;

    this.seriesPaint = null;
    this.seriesPaintList = new PaintList();
    this.baseSeriesPaint = null;

    this.seriesOutlinePaint = null;
    this.seriesOutlinePaintList = new PaintList();
    this.baseSeriesOutlinePaint = DEFAULT_OUTLINE_PAINT;

    this.seriesOutlineStroke = null;
    this.seriesOutlineStrokeList = new StrokeList();
    this.baseSeriesOutlineStroke = DEFAULT_OUTLINE_STROKE;

    this.labelFont = DEFAULT_LABEL_FONT;
    this.labelPaint = DEFAULT_LABEL_PAINT;
    this.labelGenerator = new StandardCategoryItemLabelGenerator();

    this.legendItemShape = DEFAULT_LEGEND_ITEM_CIRCLE;

    this.origins = new HashMap<Integer, Double>();
    this.maxValues = new HashMap<Integer, Double>();
}

From source file:spinworld.gui.RadarPlot.java

/**
 * Sets the dataset used by the plot and sends a {@link PlotChangeEvent}
 * to all registered listeners./*w  w w.  j  a  v  a 2  s  . com*/
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 *
 * @see #getDataset()
 */
public void setDataset(CategoryDataset dataset) {
    // if there is an existing dataset, remove the plot from the list of
    // change listeners...
    if (this.dataset != null) {
        this.dataset.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);
    }

    resetBoundaryValues();

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