List of usage examples for org.jfree.data.general DatasetChangeEvent DatasetChangeEvent
public DatasetChangeEvent(Object source, Dataset dataset)
From source file:org.jfree.data.statistics.SimpleHistogramDataset.java
/** * Adds a set of values to the dataset and sends a * {@link DatasetChangeEvent} to all registered listeners. * * @param values the values (<code>null</code> not permitted). * * @see #clearObservations()//from w w w . j av a 2 s.c om */ public void addObservations(double[] values) { for (int i = 0; i < values.length; i++) { addObservation(values[i], false); } notifyListeners(new DatasetChangeEvent(this, this)); }
From source file:org.jfree.data.statistics.SimpleHistogramDataset.java
/** * Removes all current observation data and sends a * {@link DatasetChangeEvent} to all registered listeners. * * @since 1.0.6/*w w w. j av a 2s . c o m*/ * * @see #addObservations(double[]) * @see #removeAllBins() */ public void clearObservations() { Iterator iterator = this.bins.iterator(); while (iterator.hasNext()) { SimpleHistogramBin bin = (SimpleHistogramBin) iterator.next(); bin.setItemCount(0); } notifyListeners(new DatasetChangeEvent(this, this)); }
From source file:org.jfree.data.statistics.SimpleHistogramDataset.java
/** * Removes all bins and sends a {@link DatasetChangeEvent} to all * registered listeners./*from ww w .j ava 2 s . c om*/ * * @since 1.0.6 * * @see #addBin(SimpleHistogramBin) */ public void removeAllBins() { this.bins = new ArrayList(); notifyListeners(new DatasetChangeEvent(this, this)); }
From source file:org.jfree.data.xy.DefaultXYDataset.java
/** * Adds a series or if a series with the same key already exists replaces * the data for that series, then sends a {@link DatasetChangeEvent} to * all registered listeners.//from w w w . j a va 2s.c o m * * @param seriesKey the series key (<code>null</code> not permitted). * @param data the data (must be an array with length 2, containing two * arrays of equal length, the first containing the x-values and the * second containing the y-values). */ public void addSeries(Comparable seriesKey, double[][] data) { if (seriesKey == null) { throw new IllegalArgumentException("The 'seriesKey' cannot be null."); } if (data == null) { throw new IllegalArgumentException("The 'data' is null."); } if (data.length != 2) { throw new IllegalArgumentException("The 'data' array must have length == 2."); } if (data[0].length != data[1].length) { throw new IllegalArgumentException("The 'data' array must contain two arrays with equal length."); } int seriesIndex = indexOf(seriesKey); if (seriesIndex == -1) { // add a new series this.seriesKeys.add(seriesKey); this.seriesList.add(data); } else { // replace an existing series this.seriesList.remove(seriesIndex); this.seriesList.add(seriesIndex, data); } notifyListeners(new DatasetChangeEvent(this, this)); }
From source file:edu.dlnu.liuwenpeng.Time.TimeSeriesCollection.java
/** * Sets a flag that controls whether the domain is treated as 'points in * time', or time periods. /*from w w w. j a va2s .c o m*/ * * @param flag the flag. * * @deprecated This flag is no longer used, as of 1.0.1. The * <code>includeInterval</code> flag in methods such as * {@link #getDomainBounds(boolean)} makes this unnecessary. */ public void setDomainIsPointsInTime(boolean flag) { this.domainIsPointsInTime = flag; notifyListeners(new DatasetChangeEvent(this, this)); }
From source file:org.jfree.data.xy.DefaultXYDataset.java
/** * Removes a series from the dataset, then sends a * {@link DatasetChangeEvent} to all registered listeners. * * @param seriesKey the series key (<code>null</code> not permitted). * */// w w w. ja va 2 s. c o m public void removeSeries(Comparable seriesKey) { int seriesIndex = indexOf(seriesKey); if (seriesIndex >= 0) { this.seriesKeys.remove(seriesIndex); this.seriesList.remove(seriesIndex); notifyListeners(new DatasetChangeEvent(this, this)); } }
From source file:org.jfree.experimental.chart.plot.dial.DialPlot.java
/** * Sets a dataset for the plot./*from ww w . j a v a 2s . co m*/ * * @param index the dataset index. * @param dataset the dataset (<code>null</code> permitted). */ public void setDataset(int index, ValueDataset dataset) { ValueDataset existing = (ValueDataset) this.datasets.get(index); if (existing != null) { existing.removeChangeListener(this); } this.datasets.set(index, dataset); if (dataset != null) { dataset.addChangeListener(this); } // send a dataset change event to self... DatasetChangeEvent event = new DatasetChangeEvent(this, dataset); datasetChanged(event); }
From source file:org.cds06.speleograph.data.Series.java
/** * Notify listeners about something changed into the series. *//*from w w w. j av a 2 s .co m*/ public void notifyListeners() { final DatasetChangeEvent event = new DatasetChangeEvent(this, this); if (graphPanel != null) graphPanel.datasetChanged(event); for (DatasetChangeListener listener : staticListeners) { listener.datasetChanged(event); } for (DatasetChangeListener listener : listeners) { listener.datasetChanged(event); } }
From source file:edu.dlnu.liuwenpeng.Time.TimeSeriesCollection.java
/** * Sets the position within each time period that is used for the X values * when the collection is used as an {@link XYDataset}, then sends a * {@link DatasetChangeEvent} is sent to all registered listeners. * //from ww w . j av a2 s. co m * @param anchor the anchor position (<code>null</code> not permitted). */ public void setXPosition(TimePeriodAnchor anchor) { if (anchor == null) { throw new IllegalArgumentException("Null 'anchor' argument."); } this.xPosition = anchor; notifyListeners(new DatasetChangeEvent(this, this)); }
From source file:org.jfree.data.xy.DefaultXYZDataset.java
/** * Adds a series or if a series with the same key already exists replaces * the data for that series, then sends a {@link DatasetChangeEvent} to * all registered listeners.// w w w .j a v a 2 s .c o m * * @param seriesKey the series key (<code>null</code> not permitted). * @param data the data (must be an array with length 3, containing three * arrays of equal length, the first containing the x-values, the * second containing the y-values and the third containing the * z-values). */ public void addSeries(Comparable seriesKey, double[][] data) { ParamChecks.nullNotPermitted(seriesKey, "seriesKey"); ParamChecks.nullNotPermitted(data, "data"); if (data.length != 3) { throw new IllegalArgumentException("The 'data' array must have length == 3."); } if (data[0].length != data[1].length || data[0].length != data[2].length) { throw new IllegalArgumentException( "The 'data' array must contain " + "three arrays all having the same length."); } int seriesIndex = indexOf(seriesKey); if (seriesIndex == -1) { // add a new series this.seriesKeys.add(seriesKey); this.seriesList.add(data); } else { // replace an existing series this.seriesList.remove(seriesIndex); this.seriesList.add(seriesIndex, data); } notifyListeners(new DatasetChangeEvent(this, this)); }