flotr2.nolibs.js
function () {

    if (!this.used) return;

    var axis  = this,
      o       = axis.options,
      min     = o.min !== null ? o.min : axis.datamin,
      max     = o.max !== null ? o.max : axis.datamax,
      margin  = o.autoscaleMargin;
        
    if (o.scaling == 'logarithmic') {
      if (min <= 0) min = axis.datamin;

      // Let it widen later on
      if (max <= 0) max = min;
    }

    if (max == min) {
      var widen = max ? 0.01 : 1.00;
      if (o.min === null) min -= widen;
      if (o.max === null) max += widen;
    }

    if (o.scaling === 'logarithmic') {
      if (min < 0) min = max / o.base;  // Could be the result of widening

      var maxexp = Math.log(max);
      if (o.base != Math.E) maxexp /= Math.log(o.base);
      maxexp = Math.ceil(maxexp);

      var minexp = Math.log(min);
      if (o.base != Math.E) minexp /= Math.log(o.base);
      minexp = Math.ceil(minexp);
      
      axis.tickSize = Flotr.getTickSize(o.noTicks, minexp, maxexp, o.tickDecimals === null ? 0 : o.tickDecimals);
                        
      // Try to determine a suitable amount of miniticks based on the length of a decade
      if (o.minorTickFreq === null) {
        if (maxexp - minexp > 10)
          o.minorTickFreq = 0;
        else if (maxexp - minexp > 5)
          o.minorTickFreq = 2;
        else
          o.minorTickFreq = 5;
      }
    } else {
      axis.tickSize = Flotr.getTickSize(o.noTicks, min, max, o.tickDecimals);
    }

    axis.min = min;
    axis.max = max; //extendRange may use axis.min or axis.max, so it should be set before it is caled

    // Autoscaling. @todo This probably fails with log scale. Find a testcase and fix it
    if(o.min === null && o.autoscale){
      axis.min -= axis.tickSize * margin;
      // Make sure we don't go below zero if all values are positive.
      if(axis.min < 0 && axis.datamin >= 0) axis.min = 0;
      axis.min = axis.tickSize * Math.floor(axis.min / axis.tickSize);
    }
    
    if(o.max === null && o.autoscale){
      axis.max += axis.tickSize * margin;
      if(axis.max > 0 && axis.datamax <= 0 && axis.datamax != axis.datamin) axis.max = 0;        
      axis.max = axis.tickSize * Math.ceil(axis.max / axis.tickSize);
    }

    if (axis.min == axis.max) axis.max = axis.min + 1;
  }
function () {

    if (!this.used) return;

    var axis  = this,
      o       = axis.options,
      min     = o.min !== null ? o.min : axis.datamin,
      max     = o.max !== null ? o.max : axis.datamax,
      margin  = o.autoscaleMargin;
        
    if (o.scaling == 'logarithmic') {
      if (min <= 0) min = axis.datamin;

      // Let it widen later on
      if (max <= 0) max = min;
    }

    if (max == min) {
      var widen = max ? 0.01 : 1.00;
      if (o.min === null) min -= widen;
      if (o.max === null) max += widen;
    }

    if (o.scaling === 'logarithmic') {
      if (min < 0) min = max / o.base;  // Could be the result of widening

      var maxexp = Math.log(max);
      if (o.base != Math.E) maxexp /= Math.log(o.base);
      maxexp = Math.ceil(maxexp);

      var minexp = Math.log(min);
      if (o.base != Math.E) minexp /= Math.log(o.base);
      minexp = Math.ceil(minexp);
      
      axis.tickSize = Flotr.getTickSize(o.noTicks, minexp, maxexp, o.tickDecimals === null ? 0 : o.tickDecimals);
                        
      // Try to determine a suitable amount of miniticks based on the length of a decade
      if (o.minorTickFreq === null) {
        if (maxexp - minexp > 10)
          o.minorTickFreq = 0;
        else if (maxexp - minexp > 5)
          o.minorTickFreq = 2;
        else
          o.minorTickFreq = 5;
      }
    } else {
      axis.tickSize = Flotr.getTickSize(o.noTicks, min, max, o.tickDecimals);
    }

    axis.min = min;
    axis.max = max; //extendRange may use axis.min or axis.max, so it should be set before it is caled

    // Autoscaling. @todo This probably fails with log scale. Find a testcase and fix it
    if(o.min === null && o.autoscale){
      axis.min -= axis.tickSize * margin;
      // Make sure we don't go below zero if all values are positive.
      if(axis.min < 0 && axis.datamin >= 0) axis.min = 0;
      axis.min = axis.tickSize * Math.floor(axis.min / axis.tickSize);
    }
    
    if(o.max === null && o.autoscale){
      axis.max += axis.tickSize * margin;
      if(axis.max > 0 && axis.datamax <= 0 && axis.datamax != axis.datamin) axis.max = 0;        
      axis.max = axis.tickSize * Math.ceil(axis.max / axis.tickSize);
    }

    if (axis.min == axis.max) axis.max = axis.min + 1;
  }
function ( ) { if ( ! this . used ) return ; var axis = this , o = axis . options , min = o . min !== null ? o . min : axis . datamin , max = o . max !== null ? o . max : axis . datamax , margin = o . autoscaleMargin ; if ( o . scaling == 'logarithmic' ) { if ( min <= 0 ) min = axis . datamin ; // Let it widen later on if ( max <= 0 ) max = min ; } if ( max == min ) { var widen = max ? 0.01 : 1.00 ; if ( o . min === null ) min -= widen ; if ( o . max === null ) max += widen ; } if ( o . scaling === 'logarithmic' ) { if ( min < 0 ) min = max / o . base ; // Could be the result of widening var maxexp = Math . log ( max ) ; if ( o . base != Math . E ) maxexp /= Math . log ( o . base ) ; maxexp = Math . ceil ( maxexp ) ; var minexp = Math . log ( min ) ; if ( o . base != Math . E ) minexp /= Math . log ( o . base ) ; minexp = Math . ceil ( minexp ) ; axis . tickSize = Flotr . getTickSize ( o . noTicks , minexp , maxexp , o . tickDecimals === null ? 0 : o . tickDecimals ) ; // Try to determine a suitable amount of miniticks based on the length of a decade if ( o . minorTickFreq === null ) { if ( maxexp - minexp > 10 ) o . minorTickFreq = 0 ; else if ( maxexp - minexp > 5 ) o . minorTickFreq = 2 ; else o . minorTickFreq = 5 ; } } else { axis . tickSize = Flotr . getTickSize ( o . noTicks , min , max , o . tickDecimals ) ; } axis . min = min ; axis . max = max ; //extendRange may use axis.min or axis.max, so it should be set before it is caled // Autoscaling. @todo This probably fails with log scale. Find a testcase and fix it if ( o . min === null && o . autoscale ) { axis . min -= axis . tickSize * margin ; // Make sure we don't go below zero if all values are positive. if ( axis . min < 0 && axis . datamin >= 0 ) axis . min = 0 ; axis . min = axis . tickSize * Math . floor ( axis . min / axis . tickSize ) ; } if ( o . max === null && o . autoscale ) { axis . max += axis . tickSize * margin ; if ( axis . max > 0 && axis . datamax <= 0 && axis . datamax != axis . datamin ) axis . max = 0 ; axis . max = axis . tickSize * Math . ceil ( axis . max / axis . tickSize ) ; } if ( axis . min == axis . max ) axis . max = axis . min + 1 ; }
Calculates the range of an axis to apply autoscaling.
Calculates the range of an axis to apply autoscaling .