public static Range findStackedRangeBounds(TableXYDataset dataset,double base){
  ParamChecks.nullNotPermitted(dataset,"dataset");
  double minimum=base;
  double maximum=base;
  for (int itemNo=0; itemNo < dataset.getItemCount(); itemNo++) {
    double positive=base;
    double negative=base;
    int seriesCount=dataset.getSeriesCount();
    for (int seriesNo=0; seriesNo < seriesCount; seriesNo++) {
      double y=dataset.getYValue(seriesNo,itemNo);
      if (!Double.isNaN(y)) {
        if (y > 0.0) {
          positive+=y;
        }
 else {
          negative+=y;
        }
      }
    }
    if (positive > maximum) {
      maximum=positive;
    }
    if (negative < minimum) {
      minimum=negative;
    }
  }
  if (minimum <= maximum) {
    return new Range(minimum,maximum);
  }
 else {
    return null;
  }
}

public static Range findStackedRangeBounds ( TableXYDataset dataset , double base ) { ParamChecks . nullNotPermitted ( dataset , "dataset" ) ; double minimum = base ; double maximum = base ; for ( int itemNo = 0 ; itemNo < dataset . getItemCount ( ) ; itemNo ++ ) { double positive = base ; double negative = base ; int seriesCount = dataset . getSeriesCount ( ) ; for ( int seriesNo = 0 ; seriesNo < seriesCount ; seriesNo ++ ) { double y = dataset . getYValue ( seriesNo , itemNo ) ; if ( ! Double . isNaN ( y ) ) { if ( y > 0.0 ) { positive += y ; } else { negative += y ; } } } if ( positive > maximum ) { maximum = positive ; } if ( negative < minimum ) { minimum = negative ; } } if ( minimum <= maximum ) { return new Range ( minimum , maximum ) ; } else { return null ; } }
returns the minimum and maximum values for the dataset ' s range , assuming that the series are stacked , using the specified base value .
