本文整理汇总了Java中org.jfree.data.statistics.HistogramType.FREQUENCY属性的典型用法代码示例。如果您正苦于以下问题:Java HistogramType.FREQUENCY属性的具体用法?Java HistogramType.FREQUENCY怎么用?Java HistogramType.FREQUENCY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.jfree.data.statistics.HistogramType
的用法示例。
在下文中一共展示了HistogramType.FREQUENCY属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getY
/**
* Returns the y-value for a bin
* (calculated to take into account the histogram type).
*
* @param seriesIndex the series index (zero based)
* @param binIndex the bin index (zero based)
* @return the y value
*/
public Number getY( int seriesIndex, int binIndex ) {
PhetHistogramSeries series = getSeries( seriesIndex );
final double totalObservations = series.getNumberOfObservations();
final double binObservations = series.getNumberOfObservations( binIndex );
final double binWidth = series.getBinWidth();
double y = 0;
if ( histogramType == HistogramType.FREQUENCY ) {
y = binObservations;
}
else if ( histogramType == HistogramType.RELATIVE_FREQUENCY ) {
y = binObservations / totalObservations;
}
else if ( histogramType == HistogramType.SCALE_AREA_TO_1 ) {
y = binObservations / ( binWidth * totalObservations );
}
else {
throw new IllegalStateException( "unsupported HistogramType: " + histogramType );
}
return new Double( y );
}
示例2: HistogramPlotDataset
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();
}
示例3: getY
/**
* 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();
}
}
示例4: PhetHistogramDataset
/**
* Creates an empty dataset of type HistogramType.FREQUENCY.
*/
public PhetHistogramDataset() {
this( HistogramType.FREQUENCY );
}