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