org.jfree.data.statistics.HistogramType Java Examples

The following examples show how to use org.jfree.data.statistics.HistogramType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HistogramPlotDataset.java    From mzmine3 with GNU General Public License v2.0 6 votes vote down vote up
public HistogramPlotDataset(PeakList peakList, RawDataFile[] rawDataFiles, int numOfBins,
    HistogramDataType dataType, Range<Double> range) {

  this.list = new Vector<HashMap<?, ?>>();
  this.type = HistogramType.FREQUENCY;
  this.dataType = dataType;
  this.peakList = peakList;
  this.numOfBins = numOfBins;
  this.rawDataFiles = rawDataFiles;

  minimum = range.lowerEndpoint();
  maximum = range.upperEndpoint();

  updateHistogramDataset();

}
 
Example #2
Source File: HistogramPlotDataset.java    From mzmine3 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the y-value for a bin (calculated to take into account the histogram type).
 *
 * @param series the series index (in the range <code>0</code> to
 *        <code>getSeriesCount() - 1</code>).
 * @param item the item index (zero based).
 *
 * @return The y-value.
 *
 * @throws IndexOutOfBoundsException if <code>series</code> is outside the specified range.
 */
@Override
public Number getY(int series, int item) {
  List<?> bins = getBins(series);
  HistogramBin bin = (HistogramBin) bins.get(item);
  double total = getTotal(series);
  double binWidth = getBinWidth(series);

  if (this.type == HistogramType.FREQUENCY) {
    return new Double(bin.getCount());
  } else if (this.type == HistogramType.RELATIVE_FREQUENCY) {
    return new Double(bin.getCount() / total);
  } else if (this.type == HistogramType.SCALE_AREA_TO_1) {
    return new Double(bin.getCount() / (binWidth * total));
  } else { // pretty sure this shouldn't ever happen
    throw new IllegalStateException();
  }
}
 
Example #3
Source File: HistogramPlotDataset.java    From mzmine2 with GNU General Public License v2.0 6 votes vote down vote up
public HistogramPlotDataset(PeakList peakList, RawDataFile[] rawDataFiles, int numOfBins,
    HistogramDataType dataType, Range<Double> range) {

  this.list = new Vector<HashMap<?, ?>>();
  this.type = HistogramType.FREQUENCY;
  this.dataType = dataType;
  this.peakList = peakList;
  this.numOfBins = numOfBins;
  this.rawDataFiles = rawDataFiles;

  minimum = range.lowerEndpoint();
  maximum = range.upperEndpoint();

  updateHistogramDataset();

}
 
Example #4
Source File: HistogramPlotDataset.java    From mzmine2 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the y-value for a bin (calculated to take into account the histogram type).
 * 
 * @param series the series index (in the range <code>0</code> to
 *        <code>getSeriesCount() - 1</code>).
 * @param item the item index (zero based).
 * 
 * @return The y-value.
 * 
 * @throws IndexOutOfBoundsException if <code>series</code> is outside the specified range.
 */
public Number getY(int series, int item) {
  List<?> bins = getBins(series);
  HistogramBin bin = (HistogramBin) bins.get(item);
  double total = getTotal(series);
  double binWidth = getBinWidth(series);

  if (this.type == HistogramType.FREQUENCY) {
    return new Double(bin.getCount());
  } else if (this.type == HistogramType.RELATIVE_FREQUENCY) {
    return new Double(bin.getCount() / total);
  } else if (this.type == HistogramType.SCALE_AREA_TO_1) {
    return new Double(bin.getCount() / (binWidth * total));
  } else { // pretty sure this shouldn't ever happen
    throw new IllegalStateException();
  }
}
 
Example #5
Source File: HistogramPlotDataset.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the histogram type and sends a {@link DatasetChangeEvent} to all registered listeners.
 *
 * @param type the type (<code>null</code> not permitted).
 */
public void setType(HistogramType type) {
  if (type == null) {
    throw new IllegalArgumentException("Null 'type' argument");
  }
  this.type = type;
  notifyListeners(new DatasetChangeEvent(this, this));
}
 
Example #6
Source File: HistogramPlotDataset.java    From mzmine2 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the histogram type and sends a {@link DatasetChangeEvent} to all registered listeners.
 * 
 * @param type the type (<code>null</code> not permitted).
 */
public void setType(HistogramType type) {
  if (type == null) {
    throw new IllegalArgumentException("Null 'type' argument");
  }
  this.type = type;
  notifyListeners(new DatasetChangeEvent(this, this));
}
 
Example #7
Source File: DataTupleHistogramDataset.java    From nmonvisualizer with Apache License 2.0 5 votes vote down vote up
@Override
public Number getY(int series, int item) {
    Number toReturn = super.getY(series, item);

    // default implementation uses a 0 to 1 scale; we want 0 to 100
    if (getType() == HistogramType.RELATIVE_FREQUENCY) {
        return new Double((Double) toReturn * 100);
    }
    else {
        return toReturn;
    }
}
 
Example #8
Source File: HistogramPlotDataset.java    From mzmine3 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the histogram type.
 *
 * @return The type (never <code>null</code>).
 */
public HistogramType getType() {
  return this.type;
}
 
Example #9
Source File: HistogramPlotDataset.java    From mzmine2 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the histogram type.
 * 
 * @return The type (never <code>null</code>).
 */
public HistogramType getType() {
  return this.type;
}