List of usage examples for org.jfree.data.statistics HistogramDataset getSeriesCount
@Override public int getSeriesCount()
From source file:sim.util.media.chart.HistogramGenerator.java
/** Adds a series, plus a (possibly null) SeriesChangeListener which will receive a <i>single</i> event if/when the series is deleted from the chart by the user. Returns the series attributes. */ public SeriesAttributes addSeries(double[] vals, int bins, String name, SeriesChangeListener stopper) { if (vals == null || vals.length == 0) vals = new double[] { 0 }; // ya gotta have at least one val HistogramDataset dataset = (HistogramDataset) (getSeriesDataset()); int i = dataset.getSeriesCount(); dataset.setType(histogramType); // It looks like the histograms reset dataset.addSeries(new UniqueString(name), vals, bins); // need to have added the dataset BEFORE calling this since it'll try to change the name of the series HistogramSeriesAttributes csa = new HistogramSeriesAttributes(this, name, i, vals, bins, stopper); seriesAttributes.add(csa);/*from w w w. j a va2s.co m*/ revalidate(); // display the new series panel update(); // won't update properly unless I force it here by letting all the existing scheduled events to go through. Dumb design. :-( SwingUtilities.invokeLater(new Runnable() { public void run() { update(); } }); return csa; }
From source file:edu.gmu.cs.sim.util.media.chart.HistogramGenerator.java
/** Adds a series, plus a (possibly null) SeriesChangeListener which will receive a <i>single</i> event if/when the series is deleted from the chart by the user. Returns the series attributes. */ public SeriesAttributes addSeries(double[] vals, int bins, String name, SeriesChangeListener stopper) { if (vals == null || vals.length == 0) { vals = new double[] { 0 }; // ya gotta have at least one val }/*from w w w . j a v a2 s.c o m*/ HistogramDataset dataset = (HistogramDataset) (getSeriesDataset()); int i = dataset.getSeriesCount(); dataset.setType(histogramType); // It looks like the histograms reset dataset.addSeries(new UniqueString(name), vals, bins); // need to have added the dataset BEFORE calling this since it'll try to change the name of the series HistogramSeriesAttributes csa = new HistogramSeriesAttributes(this, name, i, vals, bins, stopper); seriesAttributes.add(csa); revalidate(); // display the new series panel update(); // won't update properly unless I force it here by letting all the existing scheduled events to go through. Dumb design. :-( SwingUtilities.invokeLater(new Runnable() { public void run() { update(); } }); return csa; }
From source file:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.SingleCellAnalysisController.java
/** * Create a polar series for a well, given the data we want to make the * series (and downstream the plot) for. * * @param singleCellWellDataHolder/*from w w w. j a va 2s . c o m*/ * @param data * @return the series. */ private XYSeries createPolarSeries(SingleCellConditionDataHolder singleCellConditionDataHolder) { XYSeries series = new XYSeries(singleCellConditionDataHolder.getPlateCondition().toString(), false); HistogramDataset histogramDataset = getHistogramDatasetForACondition(singleCellConditionDataHolder, singleCellConditionDataHolder.getPlateCondition().toString(), getNumberOfBins(singleCellConditionDataHolder)); // iterate through the series, even though we normally only have one here for (int i = 0; i < histogramDataset.getSeriesCount(); i++) { int itemCount = histogramDataset.getItemCount(i); // this is the number of bins for (int j = 0; j < itemCount; j++) { double startX = (double) histogramDataset.getStartX(i, j); double endX = (double) histogramDataset.getEndX(i, j); // the angle in the middle of the bin double theta = (startX + endX) / 2; // the frequency of this angle in the histogram Double radius = (Double) histogramDataset.getY(i, j); series.add(theta, radius); } } return series; }
From source file:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.AngleDirectController.java
/** * Create a polar series for a well, given the data we want to make the * series (and downstream the plot) for. * * @param singleCellWellDataHolder//from www . j av a 2 s .com * @param data * @return the series. */ private XYSeries createPolarSeries(SingleCellWellDataHolder singleCellWellDataHolder, Double[] data) { XYSeries series = new XYSeries(singleCellWellDataHolder.getWell().toString(), false); HistogramDataset histogramDataset = getHistogramDatasetForAWell( singleCellWellDataHolder.getWell().toString(), data, getNumberOfBins(singleCellWellDataHolder), HistogramType.FREQUENCY, true); // iterate through the series, even though we normally only have one here for (int i = 0; i < histogramDataset.getSeriesCount(); i++) { int itemCount = histogramDataset.getItemCount(i); // this is the number of bins for (int j = 0; j < itemCount; j++) { double startX = (double) histogramDataset.getStartX(i, j); double endX = (double) histogramDataset.getEndX(i, j); // the angle in the middle of the bin double theta = (startX + endX) / 2; // the frequency of this angle in the histogram Double radius = (Double) histogramDataset.getY(i, j); series.add(theta, radius); } } return series; }