afreechart/src/main/java/org/afree/data/general/DatasetUtilities.java
/**
     * Iterates over the data item of the category dataset to find the range
     * bounds.
     * 
     * @param dataset
     *            the dataset (<code>null</code> not permitted).
     * @param includeInterval
     *            a flag that determines whether or not the y-interval is taken
     *            into account.
     * 
     * @return The range (possibly <code>null</code>).
     * 
     * @since JFreeChart 1.0.10
     */
Iterates over the data item of the category dataset to find the range
bounds.

@param dataset
the dataset (null not permitted).
@param includeInterval
a flag that determines whether or not the y-interval is taken
into account.

@return The range (possibly null).


Iterates over the data item of the category dataset to find the range bounds . @param dataset the dataset ( null not permitted ) . @param includeInterval a flag that determines whether or not the y - interval is taken into account . @return The range ( possibly null ) .
public static Range iterateRangeBounds(CategoryDataset dataset,
            boolean includeInterval) {
        double minimum = Double.POSITIVE_INFINITY;
        double maximum = Double.NEGATIVE_INFINITY;
        int rowCount = dataset.getRowCount();
        int columnCount = dataset.getColumnCount();
        if (includeInterval && dataset instanceof IntervalCategoryDataset) {
            IntervalCategoryDataset icd = (IntervalCategoryDataset) dataset;
            Number lvalue, uvalue;
            for (int row = 0; row < rowCount; row++) {
                for (int column = 0; column < columnCount; column++) {
                    lvalue = icd.getStartValue(row, column);
                    uvalue = icd.getEndValue(row, column);
                    if (lvalue != null && !Double.isNaN(lvalue.doubleValue())) {
                        minimum = Math.min(minimum, lvalue.doubleValue());
                    }
                    if (uvalue != null && !Double.isNaN(uvalue.doubleValue())) {
                        maximum = Math.max(maximum, uvalue.doubleValue());
                    }
                }
            }
        } else {
            for (int row = 0; row < rowCount; row++) {
                for (int column = 0; column < columnCount; column++) {
                    Number value = dataset.getValue(row, column);
                    if (value != null) {
                        double v = value.doubleValue();
                        if (!Double.isNaN(v)) {
                            minimum = Math.min(minimum, v);
                            maximum = Math.max(maximum, v);
                        }
                    }
                }
            }
        }
        if (minimum == Double.POSITIVE_INFINITY) {
            return null;
        } else {
            return new Range(minimum, maximum);
        }
    }
public static Range iterateRangeBounds ( CategoryDataset dataset , boolean includeInterval ) { double minimum = Double . POSITIVE_INFINITY ; double maximum = Double . NEGATIVE_INFINITY ; int rowCount = dataset . getRowCount ( ) ; int columnCount = dataset . getColumnCount ( ) ; if ( includeInterval && dataset instanceof IntervalCategoryDataset ) { IntervalCategoryDataset icd = ( IntervalCategoryDataset ) dataset ; Number lvalue , uvalue ; for ( int row = 0 ; row < rowCount ; row ++ ) { for ( int column = 0 ; column < columnCount ; column ++ ) { lvalue = icd . getStartValue ( row , column ) ; uvalue = icd . getEndValue ( row , column ) ; if ( lvalue != null && ! Double . isNaN ( lvalue . doubleValue ( ) ) ) { minimum = Math . min ( minimum , lvalue . doubleValue ( ) ) ; } if ( uvalue != null && ! Double . isNaN ( uvalue . doubleValue ( ) ) ) { maximum = Math . max ( maximum , uvalue . doubleValue ( ) ) ; } } } } else { for ( int row = 0 ; row < rowCount ; row ++ ) { for ( int column = 0 ; column < columnCount ; column ++ ) { Number value = dataset . getValue ( row , column ) ; if ( value != null ) { double v = value . doubleValue ( ) ; if ( ! Double . isNaN ( v ) ) { minimum = Math . min ( minimum , v ) ; maximum = Math . max ( maximum , v ) ; } } } } } if ( minimum == Double . POSITIVE_INFINITY ) { return null ; } else { return new Range ( minimum , maximum ) ; } }
Iterates over the data item of the category dataset to find the range
 bounds.
Iterates over the data item of the category dataset to find the range bounds .
// handle the special case where the dataset has y-intervals that // we want to measure // handle the standard case (plain CategoryDataset)