//>>built
define("dojox/charting/plot2d/Indicator","dojo/_base/lang dojo/_base/array dojo/_base/declare ./CartesianBase ./_PlotEvents ./common ../axis2d/common dojox/gfx dojox/lang/utils dojox/gfx/fx dojo/has".split(" "),function(B,J,E,O,P,u,Q,F,M,R,K){var S=function(b,c){var d=b.declaredClass;if(-1!=d.indexOf("svg"))try{return B.mixin({},b.rawNode.getBBox())}catch(x){}else{if(-1!=d.indexOf("vml")){var a=b.rawNode,e=a.style.display;a.style.display="inline";d=F.pt2px(parseFloat(a.currentStyle.width));var g=
F.pt2px(parseFloat(a.currentStyle.height));d={x:0,y:0,width:d,height:g};L(b,d);a.style.display=e;return d}if(-1!=d.indexOf("silverlight"))return L(b,{width:b.rawNode.actualWidth,height:b.rawNode.actualHeight},.75);if(b.getTextWidth)return d=b.getTextWidth(),a=b.getFont(),g=F.normalizedLength(a?a.size:F.defaultFont.size),d={width:d,height:g},L(b,d,.75),d}return null},L=function(b,c,d){var a=c.width,e=c.height;b=b.getShape();switch(b.align){case "end":c.x=b.x-a;break;case "middle":c.x=b.x-a/2;break;
default:c.x=b.x}c.y=b.y-e*(d||1);return c};E=E("dojox.charting.plot2d.Indicator",[O,P],{defaultParams:{vertical:!0,fixed:!0,precision:0,lines:!0,labels:"line",markers:!0},optionalParams:{lineStroke:{},outlineStroke:{},shadowStroke:{},lineFill:{},stroke:{},outline:{},shadow:{},fill:{},fillFunc:null,labelFunc:null,font:"",fontColor:"",markerStroke:{},markerOutline:{},markerShadow:{},markerFill:{},markerSymbol:"",values:[],offset:{},start:!1,animate:!1},constructor:function(b,c){this.opt=B.clone(this.defaultParams);
M.updateWithObject(this.opt,c);"number"==typeof c.values&&(c.values=[c.values]);M.updateWithPattern(this.opt,c,this.optionalParams);this.animate=this.opt.animate},render:function(b,c){if(this.zoom)return this.performZoom(b,c);if(!this.isDirty())return this;this.cleanGroup(null,!0);if(!this.opt.values)return this;this._updateIndicator();return this},_updateIndicator:function(){var b=this.chart.theme,c=this._hAxis.name,d=this._vAxis.name,a=this._hAxis.getScaler().bounds,e=this._vAxis.getScaler().bounds,
g={};g[c]=a.from;g[d]=e.from;var x=this.toPage(g);g[c]=a.to;g[d]=e.to;var y=this.toPage(g),l=this.events();a=J.map(this.opt.values,function(p,f){return this._renderIndicator(p,f,c,d,x,y,l,this.animate)},this);e=a.length;if("trend"==this.opt.labels){g=this.opt.vertical;var h=this._data[0][0],k=this._data[e-1][0]-h;h=this.opt.labelFunc?this.opt.labelFunc(-1,this.values,this._data,this.opt.fixed,this.opt.precision):u.getLabel(k,this.opt.fixed,this.opt.precision)+" ("+u.getLabel(100*k/h,!0,2)+"%)";this._renderText(this.getGroup(),
h,this.chart.theme,g?(a[0].x+a[e-1].x)/2:a[1].x,g?a[0].y:(a[1].y+a[e-1].y)/2,-1,this.opt.values,this._data)}(b=void 0!=this.opt.lineFill?this.opt.lineFill:b.indicator.lineFill)&&1<e&&(g=Math.min(a[0].x1,a[e-1].x1),h=Math.min(a[0].y1,a[e-1].y1),this.getGroup().createRect({x:g,y:h,width:Math.max(a[0].x2,a[e-1].x2)-g,height:Math.max(a[0].y2,a[e-1].y2)-h}).setFill(b).moveToBack())},_renderIndicator:function(b,c,d,a,e,g,x,y){var l=this.chart.theme,h=this.chart.getCoords(),k=this.opt.vertical,p=this.getGroup().createGroup(),
f={};f[d]=k?b:0;f[a]=k?0:b;K("dojo-bidi")&&(f.x=this._getMarkX(f.x));f=this.toPage(f);var q=k?f.x>=e.x&&f.x<=g.x:f.y>=g.y&&f.y<=e.y,G=f.x-h.x,H=f.y-h.y,r=k?G:e.x-h.x,t=k?e.y-h.y:H,z=k?r:g.x-h.x,v=k?g.y-h.y:t;if(this.opt.lines&&q){var n=this.opt.hasOwnProperty("lineShadow")?this.opt.lineShadow:l.indicator.lineShadow,w=this.opt.hasOwnProperty("lineStroke")?this.opt.lineStroke:l.indicator.lineStroke,m=this.opt.hasOwnProperty("lineOutline")?this.opt.lineOutline:l.indicator.lineOutline;n&&p.createLine({x1:r+
n.dx,y1:t+n.dy,x2:z+n.dx,y2:v+n.dy}).setStroke(n);m&&(m=u.makeStroke(m),m.width=2*m.width+(w?w.width:0),p.createLine({x1:r,y1:t,x2:z,y2:v}).setStroke(m));p.createLine({x1:r,y1:t,x2:z,y2:v}).setStroke(w)}var N;if(this.opt.markers&&q){var A=this._data[c],T=this;A&&(N=J.map(A,function(C,U){f[d]=k?b:C;f[a]=k?C:b;K("dojo-bidi")&&(f.x=T._getMarkX(f.x));f=this.toPage(f);if(k?f.y<=e.y&&f.y>=g.y:f.x>=e.x&&f.x<=g.x){G=f.x-h.x;H=f.y-h.y;var D=this.opt.markerSymbol?this.opt.markerSymbol:l.indicator.markerSymbol,
I="M"+G+" "+H+" "+D;n=void 0!=this.opt.markerShadow?this.opt.markerShadow:l.indicator.markerShadow;w=void 0!=this.opt.markerStroke?this.opt.markerStroke:l.indicator.markerStroke;m=void 0!=this.opt.markerOutline?this.opt.markerOutline:l.indicator.markerOutline;n&&p.createPath("M"+(G+n.dx)+" "+(H+n.dy)+" "+D).setFill(n.color).setStroke(n);m&&(m=u.makeStroke(m),m.width=2*m.width+(w?w.width:0),p.createPath(I).setStroke(m));D=p.createPath(I);I=this._shapeFill(void 0!=this.opt.markerFill?this.opt.markerFill:
l.indicator.markerFill,D.getBoundingBox());D.setFill(I).setStroke(w)}return C},this))}A=this.opt.start?{x:r,y:k?t:v}:{x:k?r:z,y:k?v:t};this.opt.labels&&"trend"!=this.opt.labels&&q&&(this.opt.labelFunc?q=this.opt.labelFunc(c,this.opt.values,this._data,this.opt.fixed,this.opt.precision,this.opt.labels):"markers"==this.opt.labels?(q=J.map(N,function(C){return u.getLabel(C,this.opt.fixed,this.opt.precision)},this),q=1!=q.length?"[ "+q.join(", ")+" ]":q[0]):q=u.getLabel(b,this.opt.fixed,this.opt.precision),
this._renderText(p,q,l,A.x,A.y,c,this.opt.values,this._data));x&&this._connectEvents({element:"indicator",run:this.run?this.run[c]:void 0,shape:p,value:b});y&&this._animateIndicator(p,k,k?t:r,k?t+v:r+z,y);return B.mixin(A,{x1:r,y1:t,x2:z,y2:v})},_animateIndicator:function(b,c,d,a,e){R.animateTransform(B.delegate({shape:b,duration:1200,transform:[{name:"translate",start:c?[0,d]:[d,0],end:[0,0]},{name:"scale",start:c?[1,1/a]:[1/a,1],end:[1,1]},{name:"original"}]},e)).play()},clear:function(){this.inherited(arguments);
this._data=[]},addSeries:function(b){this.inherited(arguments);this._data.push(b.data)},_renderText:function(b,c,d,a,e,g,x,y){this.opt.offset&&(a+=this.opt.offset.x,e+=this.opt.offset.y);c=Q.createText.gfx(this.chart,b,a,e,this.opt.vertical?"middle":this.opt.start?"start":"end",c,this.opt.font?this.opt.font:d.indicator.font,this.opt.fontColor?this.opt.fontColor:d.indicator.fontColor);a=S(c,c.getShape().text);this.opt.vertical&&!this.opt.start&&(a.y+=a.height/2,c.setShape({y:e+a.height/2}));a.x-=2;
--a.y;a.width+=4;a.height+=2;a.r=this.opt.radius?this.opt.radius:d.indicator.radius;var l=void 0!=this.opt.shadow?this.opt.shadow:d.indicator.shadow;e=void 0!=this.opt.stroke?this.opt.stroke:d.indicator.stroke;var h=void 0!=this.opt.outline?this.opt.outline:d.indicator.outline;l&&b.createRect(a).setFill(l.color).setStroke(l);h&&(h=u.makeStroke(h),h.width=2*h.width+(e?e.width:0),b.createRect(a).setStroke(h));d=this.opt.fillFunc?this.opt.fillFunc(g,x,y):void 0!=this.opt.fill?this.opt.fill:d.indicator.fill;
b.createRect(a).setFill(this._shapeFill(d,a)).setStroke(e);c.moveToFront()},getSeriesStats:function(){return B.delegate(u.defaultStats)}});K("dojo-bidi")&&E.extend({_getMarkX:function(b){return this.chart.isRightToLeft()?this.chart.axes.x.scaler.bounds.to+this.chart.axes.x.scaler.bounds.from-b:b}});return E});