public static Range iterateToFindDomainBounds(XYDataset dataset,List visibleSeriesKeys,boolean includeInterval){
  ParamChecks.nullNotPermitted(dataset,"dataset");
  ParamChecks.nullNotPermitted(visibleSeriesKeys,"visibleSeriesKeys");
  double minimum=Double.POSITIVE_INFINITY;
  double maximum=Double.NEGATIVE_INFINITY;
  if (includeInterval && dataset instanceof IntervalXYDataset) {
    IntervalXYDataset ixyd=(IntervalXYDataset)dataset;
    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 xvalue=ixyd.getXValue(series,item);
        double lvalue=ixyd.getStartXValue(series,item);
        double uvalue=ixyd.getEndXValue(series,item);
        if (!Double.isNaN(xvalue)) {
          minimum=Math.min(minimum,xvalue);
          maximum=Math.max(maximum,xvalue);
        }
        if (!Double.isNaN(lvalue)) {
          minimum=Math.min(minimum,lvalue);
        }
        if (!Double.isNaN(uvalue)) {
          maximum=Math.max(maximum,uvalue);
        }
      }
    }
  }
 else {
    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);
        if (!Double.isNaN(x)) {
          minimum=Math.min(minimum,x);
          maximum=Math.max(maximum,x);
        }
      }
    }
  }
  if (minimum == Double.POSITIVE_INFINITY) {
    return null;
  }
 else {
    return new Range(minimum,maximum);
  }
}

public static Range iterateToFindDomainBounds ( XYDataset dataset , List visibleSeriesKeys , boolean includeInterval ) { ParamChecks . nullNotPermitted ( dataset , "dataset" ) ; ParamChecks . nullNotPermitted ( visibleSeriesKeys , "visibleSeriesKeys" ) ; double minimum = Double . POSITIVE_INFINITY ; double maximum = Double . NEGATIVE_INFINITY ; if ( includeInterval && dataset instanceof IntervalXYDataset ) { IntervalXYDataset ixyd = ( IntervalXYDataset ) dataset ; 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 xvalue = ixyd . getXValue ( series , item ) ; double lvalue = ixyd . getStartXValue ( series , item ) ; double uvalue = ixyd . getEndXValue ( series , item ) ; if ( ! Double . isNaN ( xvalue ) ) { minimum = Math . min ( minimum , xvalue ) ; maximum = Math . max ( maximum , xvalue ) ; } if ( ! Double . isNaN ( lvalue ) ) { minimum = Math . min ( minimum , lvalue ) ; } if ( ! Double . isNaN ( uvalue ) ) { maximum = Math . max ( maximum , uvalue ) ; } } } } else { 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 ) ; if ( ! Double . isNaN ( x ) ) { minimum = Math . min ( minimum , x ) ; maximum = Math . max ( maximum , x ) ; } } } } if ( minimum == Double . POSITIVE_INFINITY ) { return null ; } else { return new Range ( minimum , maximum ) ; } }
returns the range of x - values in the specified dataset for the data items belonging to the visible series .
