/* Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.widget.BarGauge"]){dojo._hasResource["dojox.widget.BarGauge"]=true;dojo.provide("dojox.widget.BarGauge");dojo.require("dojox.gfx");dojo.require("dojox.widget.gauge._Gauge");dojo.experimental("dojox.widget.BarGauge");dojo.declare("dojox.widget.gauge.BarLineIndicator",[dojox.widget.gauge._Indicator],{width:1,_getShapes:function(){if(!this._gauge){return null;}var v=this.value;if(vthis._gauge.max){v=this._gauge.max;}var _1=this._gauge._getPosition(v);var _2=[];if(this.width>1){_2[0]=this._gauge.surface.createRect({x:_1,y:this._gauge.dataY+this.offset,width:this.width,height:this.length});_2[0].setStroke({color:this.color});_2[0].setFill(this.color);}else{_2[0]=this._gauge.surface.createLine({x1:_1,y1:this._gauge.dataY+this.offset,x2:_1,y2:this._gauge.dataY+this.offset+this.length});_2[0].setStroke({color:this.color});}return _2;},draw:function(_3){var i;if(this.shapes){this._move(_3);}else{if(this.shapes){for(i=0;ithis._gauge.max){v=this._gauge.max;}var _4=this._gauge._getPosition(v);this.text=this._gauge.drawText(""+this.label,_4,this._gauge.dataY+this.offset-5,"middle","top",this.color,this.font);}for(i=0;ithis.max){v=this.max;}var c=this._gauge._getPosition(this.currentValue);this.currentValue=v;v=this._gauge._getPosition(v)-this._gauge.dataX;if(_5){this.shapes[0].applyTransform(dojox.gfx.matrix.translate(v-(this.shapes[0].matrix?this.shapes[0].matrix.dx:0),0));}else{var _6=new dojo.Animation({curve:[c,v],duration:this.duration,easing:this.easing});dojo.connect(_6,"onAnimate",dojo.hitch(this,function(_7){this.shapes[0].applyTransform(dojox.gfx.matrix.translate(_7-(this.shapes[0].matrix?this.shapes[0].matrix.dx:0),0));}));_6.play();}}});dojo.declare("dojox.widget.BarGauge",dojox.widget.gauge._Gauge,{dataX:5,dataY:5,dataWidth:0,dataHeight:0,_defaultIndicator:dojox.widget.gauge.BarLineIndicator,startup:function(){if(this.getChildren){dojo.forEach(this.getChildren(),function(_8){_8.startup();});}if(!this.dataWidth){this.dataWidth=this.gaugeWidth-10;}if(!this.dataHeight){this.dataHeight=this.gaugeHeight-10;}this.inherited(arguments);},_getPosition:function(_9){return this.dataX+Math.floor((_9-this.min)/(this.max-this.min)*this.dataWidth);},_getValueForPosition:function(_a){return (_a-this.dataX)*(this.max-this.min)/this.dataWidth+this.min;},draw:function(){if(!this.surface){this.createSurface();}var i;if(this._rangeData){for(i=0;i=_10)){_e=this._rangeData[i];}}}return _e;},_dragIndicator:function(_11,_12){var pos=dojo.coords(_11.gaugeContent);var x=_12.clientX-pos.x;var _13=_11._getValueForPosition(x);if(_13<_11.min){_13=_11.min;}if(_13>_11.max){_13=_11.max;}_11._drag.value=_13;_11._drag.onDragMove(_11._drag);_11._drag.draw(true);dojo.stopEvent(_12);}});}