@Override protected void autoAdjustRange(){
  Plot plot=getPlot();
  if (plot == null) {
    return;
  }
  if (plot instanceof ValueAxisPlot) {
    ValueAxisPlot vap=(ValueAxisPlot)plot;
    Range r=vap.getDataRange(this);
    if (r == null) {
      r=getDefaultAutoRange();
    }
    double upper=r.getUpperBound();
    double lower=r.getLowerBound();
    if (this.rangeType == RangeType.POSITIVE) {
      lower=Math.max(0.0,lower);
      upper=Math.max(0.0,upper);
    }
 else     if (this.rangeType == RangeType.NEGATIVE) {
      lower=Math.min(0.0,lower);
      upper=Math.min(0.0,upper);
    }
    if (getAutoRangeIncludesZero()) {
      lower=Math.min(lower,0.0);
      upper=Math.max(upper,0.0);
    }
    double range=upper - lower;
    double fixedAutoRange=getFixedAutoRange();
    if (fixedAutoRange > 0.0) {
      lower=upper - fixedAutoRange;
    }
 else {
      double minRange=getAutoRangeMinimumSize();
      if (range < minRange) {
        double expand=(minRange - range) / 2;
        upper=upper + expand;
        lower=lower - expand;
        if (lower == upper) {
          double adjust=Math.abs(lower) / 10.0;
          lower=lower - adjust;
          upper=upper + adjust;
        }
        if (this.rangeType == RangeType.POSITIVE) {
          if (lower < 0.0) {
            upper=upper - lower;
            lower=0.0;
          }
        }
 else         if (this.rangeType == RangeType.NEGATIVE) {
          if (upper > 0.0) {
            lower=lower - upper;
            upper=0.0;
          }
        }
      }
      if (getAutoRangeStickyZero()) {
        if (upper <= 0.0) {
          upper=Math.min(0.0,upper + getUpperMargin() * range);
        }
 else {
          upper=upper + getUpperMargin() * range;
        }
        if (lower >= 0.0) {
          lower=Math.max(0.0,lower - getLowerMargin() * range);
        }
 else {
          lower=lower - getLowerMargin() * range;
        }
      }
 else {
        upper=upper + getUpperMargin() * range;
        lower=lower - getLowerMargin() * range;
      }
    }
    setRange(new Range(lower,upper),false,false);
  }
}

@ Override protected void autoAdjustRange ( ) { Plot plot = getPlot ( ) ; if ( plot == null ) { return ; } if ( plot instanceof ValueAxisPlot ) { ValueAxisPlot vap = ( ValueAxisPlot ) plot ; Range r = vap . getDataRange ( this ) ; if ( r == null ) { r = getDefaultAutoRange ( ) ; } double upper = r . getUpperBound ( ) ; double lower = r . getLowerBound ( ) ; if ( this . rangeType == RangeType . POSITIVE ) { lower = Math . max ( 0.0 , lower ) ; upper = Math . max ( 0.0 , upper ) ; } else if ( this . rangeType == RangeType . NEGATIVE ) { lower = Math . min ( 0.0 , lower ) ; upper = Math . min ( 0.0 , upper ) ; } if ( getAutoRangeIncludesZero ( ) ) { lower = Math . min ( lower , 0.0 ) ; upper = Math . max ( upper , 0.0 ) ; } double range = upper - lower ; double fixedAutoRange = getFixedAutoRange ( ) ; if ( fixedAutoRange > 0.0 ) { lower = upper - fixedAutoRange ; } else { double minRange = getAutoRangeMinimumSize ( ) ; if ( range < minRange ) { double expand = ( minRange - range ) / 2 ; upper = upper + expand ; lower = lower - expand ; if ( lower == upper ) { double adjust = Math . abs ( lower ) / 10.0 ; lower = lower - adjust ; upper = upper + adjust ; } if ( this . rangeType == RangeType . POSITIVE ) { if ( lower < 0.0 ) { upper = upper - lower ; lower = 0.0 ; } } else if ( this . rangeType == RangeType . NEGATIVE ) { if ( upper > 0.0 ) { lower = lower - upper ; upper = 0.0 ; } } } if ( getAutoRangeStickyZero ( ) ) { if ( upper <= 0.0 ) { upper = Math . min ( 0.0 , upper + getUpperMargin ( ) * range ) ; } else { upper = upper + getUpperMargin ( ) * range ; } if ( lower >= 0.0 ) { lower = Math . max ( 0.0 , lower - getLowerMargin ( ) * range ) ; } else { lower = lower - getLowerMargin ( ) * range ; } } else { upper = upper + getUpperMargin ( ) * range ; lower = lower - getLowerMargin ( ) * range ; } } setRange ( new Range ( lower , upper ) , false , false ) ; } }
rescales the axis to ensure that all data is visible .
