//>>built
define("dojox/dgauges/MultiLinearScaler",["dojo/_base/declare","dojo/Stateful"],function(k,l){return k("dojox.dgauges.MultiLinearScaler",l,{majorTickValues:null,minorTickCount:4,majorTicks:null,minorTicks:null,_snapIntervalPrecision:null,_snapCount:4,_snapIntervalPrecision:6,constructor:function(){this.watchedProperties=["majorTickValues","snapCount","minorTickCount"]},computeTicks:function(){this.majorTicks=[];this.minorTicks=[];for(var b,a=1/(this.majorTickValues.length-1),e=a/(this.minorTickCount+
1),f=0,c,d,g=0;g<this.majorTickValues.length;g++){c=this.majorTickValues[g];b={scaler:this};b.position=f*a;b.value=c;b.isMinor=!1;this.majorTicks.push(b);if(f<this.majorTickValues.length-1){d=Number(c);c=(Number(this.majorTickValues[g+1])-d)/(this.minorTickCount+1);for(var h=1;h<=this.minorTickCount;h++)b={scaler:this,isMinor:!0},b.position=f*a+h*e,b.value=d+c*h,this.minorTicks.push(b)}f++}return this.majorTicks.concat(this.minorTicks)},positionForValue:function(b){if(!this.majorTickValues)return 0;
this.majorTicks||this.computeTicks();var a=this._getMinMax(b);return a[0].position+(b-a[0].value)/(a[1].value-a[0].value)*(a[1].position-a[0].position)},valueForPosition:function(b){if(null==this.majorTicks)return 0;var a=this._getMinMax(b,"position");return a[0].value+(b-a[0].position)/(a[1].position-a[0].position)*(a[1].value-a[0].value)},_getMinMax:function(b,a){a||(a="value");var e=[],f=0,c=this.majorTicks.length-1;if(b<=this.majorTicks[0][a]||b>=this.majorTicks[c][a])return e[0]=this.majorTicks[0],
e[1]=this.majorTicks[c],e;for(;;){var d=Math.floor((f+c)/2);if(this.majorTicks[d][a]<=b){if(this.majorTicks[d+1][a]>=b)return e[0]=this.majorTicks[d],e[1]=this.majorTicks[d+1],e;f=d+1}else c=d}}})});