public static Range iterateRangeBounds(XYDataset dataset,boolean includeInterval){
  double minimum=Double.POSITIVE_INFINITY;
  double maximum=Double.NEGATIVE_INFINITY;
  int seriesCount=dataset.getSeriesCount();
  if (includeInterval && dataset instanceof IntervalXYDataset) {
    IntervalXYDataset ixyd=(IntervalXYDataset)dataset;
    for (int series=0; series < seriesCount; series++) {
      int itemCount=dataset.getItemCount(series);
      for (int item=0; item < itemCount; item++) {
        double value=ixyd.getYValue(series,item);
        double lvalue=ixyd.getStartYValue(series,item);
        double uvalue=ixyd.getEndYValue(series,item);
        if (!Double.isNaN(value)) {
          minimum=Math.min(minimum,value);
          maximum=Math.max(maximum,value);
        }
        if (!Double.isNaN(lvalue)) {
          minimum=Math.min(minimum,lvalue);
          maximum=Math.max(maximum,lvalue);
        }
        if (!Double.isNaN(uvalue)) {
          minimum=Math.min(minimum,uvalue);
          maximum=Math.max(maximum,uvalue);
        }
      }
    }
  }
 else   if (includeInterval && dataset instanceof OHLCDataset) {
    OHLCDataset ohlc=(OHLCDataset)dataset;
    for (int series=0; series < seriesCount; series++) {
      int itemCount=dataset.getItemCount(series);
      for (int item=0; item < itemCount; item++) {
        double lvalue=ohlc.getLowValue(series,item);
        double uvalue=ohlc.getHighValue(series,item);
        if (!Double.isNaN(lvalue)) {
          minimum=Math.min(minimum,lvalue);
        }
        if (!Double.isNaN(uvalue)) {
          maximum=Math.max(maximum,uvalue);
        }
      }
    }
  }
 else {
    for (int series=0; series < seriesCount; series++) {
      int itemCount=dataset.getItemCount(series);
      for (int item=0; item < itemCount; item++) {
        double value=dataset.getYValue(series,item);
        if (!Double.isNaN(value)) {
          minimum=Math.min(minimum,value);
          maximum=Math.max(maximum,value);
        }
      }
    }
  }
  if (minimum == Double.POSITIVE_INFINITY) {
    return null;
  }
 else {
    return new Range(minimum,maximum);
  }
}

public static Range iterateRangeBounds ( XYDataset dataset , boolean includeInterval ) { double minimum = Double . POSITIVE_INFINITY ; double maximum = Double . NEGATIVE_INFINITY ; int seriesCount = dataset . getSeriesCount ( ) ; if ( includeInterval && dataset instanceof IntervalXYDataset ) { IntervalXYDataset ixyd = ( IntervalXYDataset ) dataset ; for ( int series = 0 ; series < seriesCount ; series ++ ) { int itemCount = dataset . getItemCount ( series ) ; for ( int item = 0 ; item < itemCount ; item ++ ) { double value = ixyd . getYValue ( series , item ) ; double lvalue = ixyd . getStartYValue ( series , item ) ; double uvalue = ixyd . getEndYValue ( series , item ) ; if ( ! Double . isNaN ( value ) ) { minimum = Math . min ( minimum , value ) ; maximum = Math . max ( maximum , value ) ; } if ( ! Double . isNaN ( lvalue ) ) { minimum = Math . min ( minimum , lvalue ) ; maximum = Math . max ( maximum , lvalue ) ; } if ( ! Double . isNaN ( uvalue ) ) { minimum = Math . min ( minimum , uvalue ) ; maximum = Math . max ( maximum , uvalue ) ; } } } } else if ( includeInterval && dataset instanceof OHLCDataset ) { OHLCDataset ohlc = ( OHLCDataset ) dataset ; for ( int series = 0 ; series < seriesCount ; series ++ ) { int itemCount = dataset . getItemCount ( series ) ; for ( int item = 0 ; item < itemCount ; item ++ ) { double lvalue = ohlc . getLowValue ( series , item ) ; double uvalue = ohlc . getHighValue ( series , item ) ; if ( ! Double . isNaN ( lvalue ) ) { minimum = Math . min ( minimum , lvalue ) ; } if ( ! Double . isNaN ( uvalue ) ) { maximum = Math . max ( maximum , uvalue ) ; } } } } else { for ( int series = 0 ; series < seriesCount ; series ++ ) { int itemCount = dataset . getItemCount ( series ) ; for ( int item = 0 ; item < itemCount ; item ++ ) { double value = dataset . getYValue ( series , item ) ; if ( ! Double . isNaN ( value ) ) { minimum = Math . min ( minimum , value ) ; maximum = Math . max ( maximum , value ) ; } } } } if ( minimum == Double . POSITIVE_INFINITY ) { return null ; } else { return new Range ( minimum , maximum ) ; } }
iterates over the data items of the xy dataset to find the range bounds .
