/** * Adds a data item to the series and sends a {@link SeriesChangeEvent} to * all registered listeners. * * @param x the x-value. * @param y the y-value. * @param xLow the lower bound of the y-interval. * @param xHigh the upper bound of the y-interval. */ public void add(double x, double xLow, double xHigh, double y) { add(new XIntervalDataItem(x, xLow, xHigh, y), true); }
/** * Returns the y-value for the specified item. * * @param index the item index. * * @return The y-value. */ public double getYValue(int index) { XIntervalDataItem item = (XIntervalDataItem) getDataItem(index); return item.getYValue(); }
/** * Returns the end x-value (as a double primitive) for an item within a * series. * * @param series the series (zero-based index). * @param item the item (zero-based index). * * @return The value. */ public double getEndXValue(int series, int item) { XIntervalSeries s = (XIntervalSeries) this.data.get(series); return s.getXHighValue(item); }
private JPanel createStatPanel(Stx stx, final Mask mask) { final Histogram histogram = stx.getHistogram(); XIntervalSeries histogramSeries = new XIntervalSeries("Histogram"); int[] bins = histogram.getBins(0); for (int j = 0; j < bins.length; j++) { histogramSeries.add(histogram.getBinLowValue(0, j), histogram.getBinLowValue(0, j), j < bins.length - 1 ? histogram.getBinLowValue(0, j + 1) : histogram.getHighValue(0), XIntervalSeries percentileSeries = new XIntervalSeries("Percentile"); percentileSeries.add(0, 0, 1, histogram.getLowValue(0)); for (int j = 1; j < 99; j++) { percentileSeries.add(j, j, j + 1, histogram.getPTileThreshold(j / 100.0)[0]); percentileSeries.add(99, 99, 100,
/** * Removes all the series from the collection and sends a * {@link DatasetChangeEvent} to all registered listeners. * * @since 1.0.10 */ public void removeAllSeries() { // Unregister the collection as a change listener to each series in // the collection. for (int i = 0; i < this.data.size(); i++) { XIntervalSeries series = (XIntervalSeries) this.data.get(i); series.removeChangeListener(this); } this.data.clear(); fireDatasetChanged(); }
/** * Adds a series to the collection and sends a {@link DatasetChangeEvent} * to all registered listeners. * * @param series the series (<code>null</code> not permitted). */ public void addSeries(XIntervalSeries series) { if (series == null) { throw new IllegalArgumentException("Null 'series' argument."); } this.data.add(series); series.addChangeListener(this); fireDatasetChanged(); }
/** * Returns the start x-value (as a double primitive) for an item within a * series. * * @param series the series index (zero-based). * @param item the item index (zero-based). * * @return The value. */ @Override public double getStartXValue(int series, int item) { XIntervalSeries s = (XIntervalSeries) this.data.get(series); return s.getXLowValue(item); }
/** * Returns the y-value (as a double primitive) for an item within a * series. * * @param series the series index (zero-based). * @param item the item index (zero-based). * * @return The value. */ @Override public double getYValue(int series, int item) { XIntervalSeries s = (XIntervalSeries) this.data.get(series); return s.getYValue(item); }
/** * Returns the key for a series. * * @param series the series index (in the range {@code 0} to * {@code getSeriesCount() - 1}). * * @return The key for a series. * * @throws IllegalArgumentException if {@code series} is not in the * specified range. */ @Override public Comparable getSeriesKey(int series) { // defer argument checking return getSeries(series).getKey(); }
/** * Returns the number of items in the specified series. * * @param series the series (zero-based index). * * @return The item count. * * @throws IllegalArgumentException if <code>series</code> is not in the * range <code>0</code> to <code>getSeriesCount() - 1</code>. */ public int getItemCount(int series) { // defer argument checking return getSeries(series).getItemCount(); }
private JPanel createStatPanel(Stx stx, final Mask mask) { final Histogram histogram = stx.getHistogram(); XIntervalSeries histogramSeries = new XIntervalSeries("Histogram"); int[] bins = histogram.getBins(0); for (int j = 0; j < bins.length; j++) { histogramSeries.add(histogram.getBinLowValue(0, j), histogram.getBinLowValue(0, j), j < bins.length - 1 ? histogram.getBinLowValue(0, j + 1) : histogram.getHighValue(0), XIntervalSeries percentileSeries = new XIntervalSeries("Percentile"); percentileSeries.add(0, 0, 1, histogram.getLowValue(0)); for (int j = 1; j < 99; j++) { percentileSeries.add(j, j, j + 1, histogram.getPTileThreshold(j / 100.0)[0]); percentileSeries.add(99, 99, 100,
/** * Removes all the series from the collection and sends a * {@link DatasetChangeEvent} to all registered listeners. * * @since 1.0.10 */ public void removeAllSeries() { // Unregister the collection as a change listener to each series in // the collection. for (int i = 0; i < this.data.size(); i++) { XIntervalSeries series = (XIntervalSeries) this.data.get(i); series.removeChangeListener(this); } this.data.clear(); fireDatasetChanged(); }
/** * Adds a series to the collection and sends a {@link DatasetChangeEvent} * to all registered listeners. * * @param series the series ({@code null} not permitted). */ public void addSeries(XIntervalSeries series) { Args.nullNotPermitted(series, "series"); this.data.add(series); series.addChangeListener(this); fireDatasetChanged(); }
/** * Returns the start x-value (as a double primitive) for an item within a * series. * * @param series the series index (zero-based). * @param item the item index (zero-based). * * @return The value. */ public double getStartXValue(int series, int item) { XIntervalSeries s = (XIntervalSeries) this.data.get(series); return s.getXLowValue(item); }
/** * Returns the y-value (as a double primitive) for an item within a * series. * * @param series the series index (zero-based). * @param item the item index (zero-based). * * @return The value. */ public double getYValue(int series, int item) { XIntervalSeries s = (XIntervalSeries) this.data.get(series); return s.getYValue(item); }
/** * Returns the key for a series. * * @param series the series index (in the range <code>0</code> to * <code>getSeriesCount() - 1</code>). * * @return The key for a series. * * @throws IllegalArgumentException if <code>series</code> is not in the * specified range. */ public Comparable getSeriesKey(int series) { // defer argument checking return getSeries(series).getKey(); }
/** * Returns the number of items in the specified series. * * @param series the series (zero-based index). * * @return The item count. * * @throws IllegalArgumentException if {@code series} is not in the * range {@code 0} to {@code getSeriesCount() - 1}. */ @Override public int getItemCount(int series) { // defer argument checking return getSeries(series).getItemCount(); }
private void setStx(Stx stx) { if (stx != null) { HistogramPanelModel.HistogramConfig config = createHistogramConfig(); if (config == null) { return; } if (!model.hasStx(config)) { model.setStx(config, stx); } dataset = new XIntervalSeriesCollection(); final int[] binCounts = stx.getHistogramBins(); final RasterDataNode raster = getRaster(); final XIntervalSeries series = new XIntervalSeries(raster.getName()); final Histogram histogram = stx.getHistogram(); for (int i = 0; i < binCounts.length; i++) { final double xMin = histogram.getBinLowValue(0, i); final double xMax = i < binCounts.length - 1 ? histogram.getBinLowValue(0, i + 1) : histogram.getHighValue(0); series.add(xMin, xMin, xMax, binCounts[i]); } dataset.addSeries(series); } handleStxChange(); }
/** * Returns the y-value for the specified item. * * @param index the item index. * * @return The y-value. */ public double getYValue(int index) { XIntervalDataItem item = (XIntervalDataItem) getDataItem(index); return item.getYValue(); }
/** * Removes a series from the collection and sends a * {@link DatasetChangeEvent} to all registered listeners. * * @param series the series (<code>null</code> not permitted). * * @since 1.0.10 */ public void removeSeries(XIntervalSeries series) { if (series == null) { throw new IllegalArgumentException("Null 'series' argument."); } if (this.data.contains(series)) { series.removeChangeListener(this); this.data.remove(series); fireDatasetChanged(); } }