public static Range iterateToFindZBounds(XYZDataset dataset,List visibleSeriesKeys,Range xRange,boolean includeInterval){
  ParamChecks.nullNotPermitted(dataset,"dataset");
  ParamChecks.nullNotPermitted(visibleSeriesKeys,"visibleSeriesKeys");
  ParamChecks.nullNotPermitted(xRange,"xRange");
  double minimum=Double.POSITIVE_INFINITY;
  double maximum=Double.NEGATIVE_INFINITY;
  Iterator iterator=visibleSeriesKeys.iterator();
  while (iterator.hasNext()) {
    Comparable seriesKey=(Comparable)iterator.next();
    int series=dataset.indexOf(seriesKey);
    int itemCount=dataset.getItemCount(series);
    for (int item=0; item < itemCount; item++) {
      double x=dataset.getXValue(series,item);
      double z=dataset.getZValue(series,item);
      if (xRange.contains(x)) {
        if (!Double.isNaN(z)) {
          minimum=Math.min(minimum,z);
          maximum=Math.max(maximum,z);
        }
      }
    }
  }
  if (minimum == Double.POSITIVE_INFINITY) {
    return null;
  }
 else {
    return new Range(minimum,maximum);
  }
}

public static Range iterateToFindZBounds ( XYZDataset dataset , List visibleSeriesKeys , Range xRange , boolean includeInterval ) { ParamChecks . nullNotPermitted ( dataset , "dataset" ) ; ParamChecks . nullNotPermitted ( visibleSeriesKeys , "visibleSeriesKeys" ) ; ParamChecks . nullNotPermitted ( xRange , "xRange" ) ; double minimum = Double . POSITIVE_INFINITY ; double maximum = Double . NEGATIVE_INFINITY ; Iterator iterator = visibleSeriesKeys . iterator ( ) ; while ( iterator . hasNext ( ) ) { Comparable seriesKey = ( Comparable ) iterator . next ( ) ; int series = dataset . indexOf ( seriesKey ) ; int itemCount = dataset . getItemCount ( series ) ; for ( int item = 0 ; item < itemCount ; item ++ ) { double x = dataset . getXValue ( series , item ) ; double z = dataset . getZValue ( series , item ) ; if ( xRange . contains ( x ) ) { if ( ! Double . isNaN ( z ) ) { minimum = Math . min ( minimum , z ) ; maximum = Math . max ( maximum , z ) ; } } } } if ( minimum == Double . POSITIVE_INFINITY ) { return null ; } else { return new Range ( minimum , maximum ) ; } }
returns the range of z - values in the specified dataset for the data items belonging to the visible series and with x - values in the given range .
