text: /**
   * VCharts v0.7.5
   * license MIT (c) 2013 vcharts.cn/license
   */
  !function(t){function h(t,i){for(var e in i)t[e]=i[e];return t}function f(t){return"string"==typeof t}function _(t){var i=null;try{i=a.getElementById(t)}catch(e){}return i}function v(t,i){for(var e in i)t.setAttribute(e,i[e])}var i={},e=function(){function t(){}return function(i,e){var h,a,s=i.prototype;t.prototype=e.prototype,a=i.prototype=new t;for(h in s)a[h]=s[h];return i.prototype.constructor=i,i.superClass=e.prototype,i}}(),a=document,s=t,n="0.7.5",o=navigator.userAgent,l=s.opera,c=/msie/i.test(o)&&!l,d="http://www.w3.org/2000/svg",p=!!a.createElementNS&&!!a.createElementNS(d,"svg").createSVGRect,u=null,m=h,A=u={type:"svg",_newNode:function(t){var i=a.createElementNS(d,t);return i},newDocument:function(t){var i=this._newNode("svg");return i.style.position="relative",i.style.width="100%",i.style.height="100%",v(i,{version:"1.1"}),t&&i.appendChild(this._newNode("desc")).appendChild(a.createTextNode(t)),i},newGroup:function(){var t=this._newNode("g");return t},newPath:function(){var t=this._newNode("path");return t.style.fillRule="evenodd",t},newText:function(){var t=this._newNode("text"),i={"font-family":"Verdana, Console, Arial, 微软雅黑, 宋体","font-size":12,fill:"#666666","text-anchor":"start"};return v(t,i),t},setAttr:function(t){var i=t._dom,e=[],h={};h.visibility=t.visible?"visible":"hidden",t._alpha!=t.alpha&&(h.opacity=t.alpha),(t._x!=t.x||t._y!=t.y)&&e.push("translate("+t.x+", "+t.y+")"),t._rotate!=t.rotation&&e.push("rotate("+t.rotation+")"),e.length>0&&(h.transform=e.join(" ")),t.mask&&(h["clip-path"]="url(#"+t.mask.id+")"),v(i,h)},getRect:function(t){var i=t._dom.getBoundingClientRect(),e={x:t.x,y:t.y,left:i.left,right:i.right,top:i.top,bottom:i.bottom,width:i.width,height:i.height};return e},draw:function(t){var i={stroke:t._drawLine?t.lineColor:"none","stroke-dasharray":t.lineDash?5:"none","stroke-width":t.lineWidth,"stroke-opacity":t.lineAlpha,fill:t._drawFill?t.fillColor:"none","fill-opacity":t.fillAlpha};if("linear"==t.gradientType||"rad"==t.gradientType){if("linear"==t.gradientType)var e=t.appendChild(this._newNode("linearGradient"));for(var h=0;h<t.colors.length;h++){var a=e.appendChild(this._newNode("stop"));v(a,{offset:100*t.ratios[h]+"%","stop-color":t.colors[h],"stop-opacity":t.alphas[h]})}}v(t._dom,{d:t.dataArr.join(" ")}),v(t._dom,i)},curveTo:function(t,i,e,h,a,s){var r=["C",t,i,e,h,a,s];return r},arc:function(t,i,e,h,a,s,r){var n=e,o=h,l=a,c=t+Math.cos(o)*n,d=i+Math.sin(o)*n,p=t+Math.cos(l)*n,u=i+Math.sin(l)*n,f=Math.abs(a-h)>Math.PI?1:0,g=s?0:1,_=[r?"M":"L",c,d,"A",n,n,0,f,g,p,u];return _},circle:function(t,i,e){var a,h=e;return a=["M",t+h,i,"a",h,h,0,0,1,-2*h,0,"a",h,h,0,0,1,2*h,0]},rect:function(t,i,e,h,a){var l,s=e,r=h,n=Math.min(s,r),o=Math.min(n/2,a);if(o>0){var c=s-2*o,d=r-2*o;l=["M",t+o,i,"h",c,"q",o,0,o,o,"v",d,"q",0,o,-o,o,"h",-c,"q",-o,0,-o,-o,"v",-d,"q",0,-o,o,-o]}else l=["M",t,i,"h",s,"v",r,"h",-s,"v",-r];return l},setText:function(t){for(var i=t._dom,e=t.fontSize,h=Math.max(-t.fontSize,t.lineHeight),s=t.text.split(/<br>/gi),r=0;r<s.length;r++){var n=i.childNodes[r];if(n)n.firstChild.nodeValue=s[r];else{n=this._newNode("tspan");{n.appendChild(a.createTextNode(s[r]))}i.appendChild(n)}v(n,{"font-size":e,x:0,y:r*(e+h),dy:e})}for(;i.childNodes.length>r;)i.removeChild(i.lastChild)},setTextFormat:function(t){var i=t._dom,e={"font-family":t.font,"letter-spacing":t.letterSpacing,fill:t.color};v(i,e)}},w={type:"vml",_newNode:function(t){var i="<v:"+t;N&&(i+=' style="behavior:url(#default#VML);display:inline-block;"'),i+=" />";var e=a.createElement(i);return e.style.position="absolute",e},_newSubNode:function(t){var i="<v:"+t;N&&(i+=' style="behavior:url(#default#VML);"'),i+=" />";var e=a.createElement(i);return e},newDocument:function(){var t=this._newNode("g");return t.style.position="relative",t.style.width="100%",t.style.height="100%",t},newGroup:function(){var t=this._newNode("g");return t},newPath:function(){var t=this._newNode("shape");return t.coordsize="1, 1",t.style.width="1px",t.style.height="1px",t},newText:function(){var t=a.createElement("div");return t.style.position="absolute",t.style.whiteSpace="nowrap",t},setAttr:function(t){var i=t._dom,e=i.style;e.left=t.x,e.top=t.y,e.rotation=t.rotation,e.visibility=t.visible?"visible":"hidden"},getRect:function(t){var i=t._dom,e=i.getBoundingClientRect(),h={x:t.x,y:t.y,left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.right-e.left,height:e.bottom-e.top};return h},draw:function(t){var i=t._dom;i.stroked=t._drawLine,i.filled=t._drawFill,t._drawLine?(t.stroke=t.stroke||this._newSubNode("stroke"),t.stroke.opacity=t.lineAlpha,t.stroke.weight=t.lineWidth,t.stroke.color=t.lineColor,t.stroke.dashStyle=t.lineDash?"dash":"solid",i.appendChild(t.stroke)):t.stroke&&i.contains(t.stroke)&&i.removeChild(t.stroke),t._drawFill?(t.fill=t.fill||this._newSubNode("fill"),t.fill.opacity=t.fillAlpha,t.fill.color=t.fillColor,i.appendChild(t.fill)):t.fill&&i.contains(t.fill)&&i.removeChild(t.fill);for(var e in t.dataArr)"number"==typeof t.dataArr[e]&&(t.dataArr[e]=Math.round(t.dataArr[e]));i.path=t.dataArr.join(" ")},curveTo:function(t,i,e,h,a,s){var r=["c",t,i,e,h,a,s];return r},arc:function(t,i,e,h,a,s,r){var n=e,o=h,l=a,c=t+Math.cos(o)*n,d=i+Math.sin(o)*n,p=t+Math.cos(l)*n,u=i+Math.sin(l)*n,f=[s?r?"ar":"at":r?"wr":"wa",t-n,i-n,t+n,i+n,c,d,p,u];return f},circle:function(t,i,e){var a,h=e;return a=["wr",t-h,i-h,t+h,i+h,t+h,i,t+h,i,"x"]},rect:function(t,i,e,h,a){var l,s=e,r=h,n=Math.min(s,r),o=Math.min(n/2,a);return l=o>0?["M",t+o,i,"L",t+s-o,i,"QX",t+s,i+o,"L",t+s,i+r-o,"QY",t+s-o,i+r,"L",t+o,i+r,"QX",t,i+r-o,"L",t,i+o,"QY",t+o,i]:["M",t,i,"L",t+s,i,"L",t+s,i+r,"L",t,i+r,"L",t,i]},setText:function(t){for(var i=t._dom,s=(t.fontSize,t.text.split(/<br>/gi)),r=0;r<s.length;r++){var n=i.childNodes[r];n?n.firstChild.nodeValue=s[r]:(n=a.createElement("p"),n.appendChild(a.createTextNode(s[r])),i.appendChild(n)),n.style.position="static",n.style.margin="0 0"}for(;i.childNodes.length>r;)i.removeChild(i.lastChild)},setTextFormat:function(t){var i=t._dom,e=i.style;e.letterSpacing=t.letterSpacing,e.lineHeight=Math.max(t.fontSize+t.lineHeight,0)+"px",e.fontFamily=t.font,e.fontSize=t.fontSize,e.color=t.color}},M="M",S="L",k="C",L="Q",T="A",I="Z";if(p)u=A;else{if(!c)throw"抱歉，vcharts不支持此浏览器！";var N=o.indexOf("MSIE 8.0")>-1;a.namespaces.v||(document.namespaces.add("v","urn:schemas-microsoft-com:vml"),document.createStyleSheet().cssText="v\\: * { behavior:url(#default#VML); display: inline-block; } "),L="qb",T="ar",I="x",h(u,w)}var D=function(t,i){this.x=null==t?0:t,this.y=null==i?0:i};h(D.prototype,{clone:function(){return new D(this.x,this.y)}});var j=function(t,i,e,h){this.left=null==t?0:t,this.top=null==i?0:i,this.right=null==e?0:e,this.bottom=null==h?0:h};h(j.prototype,{check:function(){this.right<this.left&&(this.right=this.left),this.bottom<this.top&&(this.bottom=this.top)},getWidth:function(){return this.right-this.left},getHeight:function(){return this.bottom-this.top},clone:function(){return new j(this.left,this.top,this.right,this.bottom)}});var P={createHueColors:function(t){for(var i=[],e=360/t,h=0;t>h;h++)i.push(P.toString(P.fromHSB(h*e,70,90)));return i},fromString:function(t){if(!t)return 0;var i=t.match(/[0-9a-fA-F]{6}/g);return i.length?parseInt(i[0],16):0},fromRGB:function(t,i,e){return t<<16|i<<8|e},fromHSB:function(t,i,e){var h,a,s,r,n,o,l,c,d,p,u;return h=t/360,a=i/100,s=e/100,0==i?(r=255*s,n=255*s,o=255*s):(l=6*h,6==l&&(l=0),c=l,d=s*(1-a),p=s*(1-a*(l-c)),u=s*(1-a*(1-(l-c))),0==c?(r=s,n=u,o=d):1==c?(r=p,n=s,o=d):2==c?(r=d,n=s,o=u):3==c?(r=d,n=p,o=s):4==c?(r=u,n=d,o=s):(r=s,n=d,o=p)),255*r<<16|255*n<<8|255*o},adjustBrightness:function(t,i){t=P.fromString(t);var e=Math.max(Math.min((t>>16&255)+i,255),0),h=Math.max(Math.min((t>>8&255)+i,255),0),a=Math.max(Math.min((255&t)+i,255),0);return P.toString(P.fromRGB(e,h,a))},toString:function(t){for(var t=t.toString(16);t.length<6;)t="0"+t;return"#"+t}},R={addHandler:function(t,i,e){t.addEventListener?t.addEventListener(i,e,!1):t.attachEvent?t.attachEvent("on"+i,e):t["on"+i]=e},removeHandler:function(t,i,e){t.removeEventListener?t.removeEventListener(i,e,!1):t.detachEvent?t.detachEvent("on"+i,e):t["on"+i]=null},getEvent:function(t){return t=t||s.event,!s.addEventListener&&s.attachEvent&&(i.event=i.event||{},t=h(i.event,t)),t},getTarget:function(t){return t.target||t.srcElement},preventDefault:function(t){t.preventDefault?t.preventDefault():t.returnValue=!1},stopPropagation:function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}},O={roundToPrecision:function(t,i){var e=Math.pow(10,i||0);return Math.round(e*t)/e},roundPath:function(t){return t.replace(/[-+]?\d*\.?\d+/g,function(){return Math.round(Number(arguments[0]))})}},E={title:{display:!1,text:"vcharts",font:"微软雅黑, 黑体, Verdana, Arial, Console",size:20,color:"#333333",offset:12},graph:{display:!0,name:"某数据",lineThickness:1,lineAlpha:1,lineColor:null,fillColor:null,fillAlpha:1},pieGraph:{type:"slice",radius:100,innerRadius:0,gap:0},serialGraph:{lineThickness:2,useDifferentColor:!1,valueKey:"value",maxBarWidth:50},xyGraph:{xKey:"x",yKey:"y"},axis:{display:!0,offset:0,axisThickness:1,axisColor:"#333333",gridThickness:1,gridColor:"#333333",gridType:"line",tickLength:5,titleText:"",titleOffset:0,labelColor:"#777777",labelFont:"微软雅黑, 黑体, Verdana, Arial, Console",labelSize:12,labelInside:!1,labelFormatter:function(t){return t},labelPosition:"middle",labelOffset:8,labelRotation:0,opposite:!1},serialAxis:{},valueAxis:{valueKeys:"auto",minValue:0/0,maxValue:0/0,autoGridCount:!0,gridCount:5,onlyInteger:!1,unit:"",unitPosition:"right"},plot:{display:!0,backgroundColor:"#ffffff",backgroundAlpha:1,borderThickness:1,borderColor:"#cacaca",borderAlpha:1},legend:{display:!1,margin:10,offset:10,lineAlpha:1,lineThickness:1,lineColor:null,lineAlpha:1},tooltip:{display:!0,type:"auto",text:"",font:"微软雅黑, 黑体, Verdana, Arial, Console",size:12,color:"#777777",lineThickness:1,lineColor:"#333333",lineAlpha:.5,backgroundAlpha:.8,backgroundColor:"#ffffff",borderThickness:2,borderColor:"#333333",borderAlpha:.6},chart:{colors:["#EE3300","#FFD300","#99DD33","#33DDFF","#9933FF","#EE0099"],backgroundColor:"#ffffff",backgroundAlpha:1},pie:{labelKey:"label",valueKey:"value"},coordinate:{graphs:[],valueAxes:[]},rectangular:{autoMargins:!0,marginTop:0,marginBottom:0,marginLeft:0,marginRight:0},serial:{reverse:!1,serialKey:"label",autoSerialCount:!0,minSerialCount:1,useSerialColor:!1},newValueAxis:function(){var t={};return m(t,E.axis),m(t,E.valueAxis),t.offset=10,t},newSerialGraph:function(){var t={};return m(t,E.graph),m(t,E.serialGraph),t},newPieConfig:function(){var t={};return m(t,E.chart),m(t,E.pie),t.title={},m(t.title,E.title),t.graph={},m(t.graph,E.graph),m(t.graph,E.pieGraph),t.tooltip={},m(t.tooltip,E.tooltip),t},newSerialConfig:function(){var t={};m(t,E.chart),m(t,E.coordinate),m(t,E.rectangular),m(t,E.serial),t.title={},m(t.title,E.title);var i={};return m(i,E.axis),m(i,E.serialAxis),t.serialAxis=i,t.graphs[0]=E.newSerialGraph(),t.graphs[0].type="line",t.valueAxes[0]=E.newValueAxis(),t.plot={},m(t.plot,E.plot),t.legend={},m(t.legend,E.legend),t.tooltip={},m(t.tooltip,E.tooltip),t}},V=function(t){this.config=t,this.axisData=null};h(V.prototype,{parseData:function(t,i,e,h){this.__searchMinAndMax(t,i,e||0,h||Number.MAX_VALUE),isNaN(this.config.minValue)||(this.minimum=Math.min(this.minimum,this.config.minValue)),this.__checkMinAndMax();var a=this.maximum-this.minimum,s=this.config.gridCount,r=a/s;this.__calculateUnit(r),this.__adjustMin(),this.__adjustMax(),this.axisData=this.__calculateAxisData(!0)},__searchMinAndMax:function(t,i,e,h){var a,s;h=Math.min(t.length,h);for(var r=e;h>=r;r++){var n=t[r];for(var o in i){var l=n[i[o]];isNaN(l)||(a=isNaN(a)?l:Math.min(l,a),s=isNaN(s)?l:Math.max(l,s))}}this.minimum=this.dataMininum=a,this.maximum=this.dataMaxinum=s},__calculateUnit:function(t){var i=Math.ceil(Math.log(t)*Math.LOG10E);if(this.config.onlyInteger||0==i)t=Math.pow(10,i);else{var e=Math.ceil(t/Math.pow(10,i-1));t=e*Math.pow(10,i-1)}this.majorUnit=O.roundToPrecision(t,10)},__checkMinAndMax:function(){if(this.minimum>this.maximum){var t=this.minimum;this.minimum=this.maximum,this.maximum=t}else this.minimum==this.maximum&&(this.maximum=this.maximum+1)},__adjustMin:function(){if(0!=this.minimum){var t=this.dataMininum;this.minimum=Math.floor(this.dataMininum/this.majorUnit)*this.majorUnit,t==this.minimum&&(this.minimum-=this.majorUnit)}this.minimum=O.roundToPrecision(this.minimum,10)},__adjustMax:function(){if(0!=this.maximum){var t=this.dataMaxinum;this.maximum=Math.ceil(this.dataMaxinum/this.majorUnit)*this.majorUnit,t==this.maximum&&(this.maximum+=this.majorUnit)}this.maximum=O.roundToPrecision(this.maximum,10)},__calculateAxisData:function(t){var i=this.majorUnit;if(0==i)return[];var e=this.minimum;if(t){for(var h=this.config.autoGridCount?1:this.config.gridCount,a=0;e<this.maximum||h>a;a++)e=O.roundToPrecision(e+i,10);this.maximum=e}e=this.minimum;for(var s=[e];e<this.maximum;)e=O.roundToPrecision(e+i,10),s.push(e);return s}});var G=function(){this._dom=this._newNode()};h(G.prototype,{_newNode:function(){return null},parent:function(){return this._dom.parent()}});var z=e(function(){G.call(this),this._visible=this.visible=!0,this._alpha=this.alpha=1,this._x=this.x=0,this._y=this.y=0,this._rotate=this.rotation=0,this.mask=null},G);h(z.prototype,{addEventListener:function(t,i){R.addHandler(this._dom,t,i)},removeEventListener:function(t,i){R.removeHandler(this._dom,t,i)},getRect:function(){var t=u.getRect(this);return t},update:function(){u.setAttr(this)}});var F=e(function(){z.call(this),this._drawLine=!1,this.lineDash=!1,this.lineWidth=1,this.lineColor="#333333",this.lineAlpha=1,this._drawFill=!1,this.fillColor="#ffeeff",this.fillAlpha=1,this.gradientType="solid",this.colors=["#ffffff","#ffffff"],this.alphas=[1,1],this.ratios=[0,1],this.dataArr=[M,0,0]},z);h(F.prototype,{_newNode:function(){return u.newPath()},beginStroke:function(t,i,e){return this._drawLine=!0,this.lineWidth=t||this.lineWidth,this.lineColor=i||this.lineColor,this.lineAlpha=e||this.lineAlpha,this},stopStroke:function(){return this._drawLine=!1,this},beginFill:function(t,i){return this._drawFill=!0,this.fillColor=t||this.fillColor,this.fillAlpha=i||this.fillAlpha,this},stopFill:function(){return this._drawFill=!1,this},clear:function(){return this.dataArr=[M,0,0],this},close:function(){return this.dataArr.length>1&&this.dataArr[this.dataArr.length]!=I&&this.dataArr.push(I),this},moveTo:function(t,i){return this.dataArr.push(M,t,i),this},lineTo:function(t,i){return this.dataArr.push(S,t,i),this},curveTo:function(t,i,e,h,a,s){return this.dataArr.push(k,t,i,e,h,a,s),this},arc:function(t,i,e,h,a,s,r){return s=!!s,r=!!r,this.dataArr=this.dataArr.concat(u.arc.apply(this,arguments)),this},drawRect:function(){return this.dataArr=this.dataArr.concat(u.rect.apply(this,arguments)),this},drawCircle:function(){return this.dataArr=this.dataArr.concat(u.circle.apply(this,arguments)),this},update:function(){return z.prototype.update.call(this),u.draw(this),this}});var H=e(function(t){z.call(this),this.font="微软雅黑, 黑体, Verdana, Arial, Console",this.fontSize=12,this.letterSpacing=1,this.lineHeight=3,this.color="#666666",this.text=t||""},z);h(H.prototype,{_newNode:function(){return u.newText()},update:function(){z.prototype.update.call(this),u.setText(this),u.setTextFormat(this)}});var K=e(function(){z.call(this),this._elist=[]},z);h(K.prototype,{_newNode:function(){return u.newGroup()},length:function(){return this._elist.length},addChild:function(t){return t&&(this._dom.appendChild(t._dom),this._elist.push(t)),t},getChildAt:function(t){return this._elist[t]},removeChild:function(t){if(t)for(var i in this._elist)if(this._elist[i]===t){this._elist.splice(i,1),this._dom.removeChild(t._dom);break}return t},removeChildren:function(){for(this._elist=[];this._dom.lastChild;)this._dom.removeChild(this._dom.lastChild)}}),"vml"==u.type&&(K.prototype.getRect=function(){for(var t in this._elist){var i=this._elist[t].getRect();if(isNaN(e))var e=i.left;else e=Math.min(e,i.left);if(isNaN(h))var h=i.right;else h=Math.max(h,i.right);if(isNaN(a))var a=i.top;else a=Math.min(a,i.top);if(isNaN(s))var s=i.bottom;else s=Math.max(s,i.bottom)}return this._elist.length>0?{left:e,right:h,top:a,bottom:s,width:h-e,height:s-a}:{left:0,right:0,top:0,bottom:0,width:0,height:0}});var W=e(function(){K.call(this)},K);h(W.prototype,{_newNode:function(){return u.newDocument()}});var B=function(t,i){this._parent=t,this._SpriteClass=i,this._intelList=[],this._currentIndex=-1};h(B.prototype,{getLength:function(){return this._intelList.length},setLength:function(t){for(;this._intelList.length>t;)this._pop()},getChildAt:function(t){return this._intelList[t]},getChildIndex:function(t){return this._intelList.indexOf(t)},begin:function(t){this._SpriteClass=t||this._SpriteClass,this._currentIndex=0},hasNext:function(){return this._currentIndex<this.getLength()-1},next:function(){return this.getChildAt(this._currentIndex++)||this._push()},end:function(){this.setLength(this._currentIndex)},_push:function(){var t=new this._SpriteClass;return this._parent.addChild(t),this._intelList.push(t),t},_pop:function(){var t=this._intelList.pop();return null!=t&&this._parent.removeChild(t),t}});var U=e(function(){K.call(this),this.direction=null,this.axisLength,this.blockWidth=0/0,this.frontSpace=0,this.backSpace=0,this.title,this._ticks=this.addChild(new F)},K);h(U.prototype,{refresh:function(){{var i=(this.config,this._ticks);this.axisLength}"x"==this.direction?(i.rotation=0,i.update()):"y"==this.direction&&(i.rotation=90,i.update())},_transformLabel:function(t,i){var e=this.config,h=t.getRect();this._ticks.beginStroke(e.axisThickness,e.axisColor),"x"==this.direction?(e.labelInside,t.x=i-h.width/2,t.y=e.labelOffset,t.update(),h=t.getRect(),this.frontSpace=Math.max(this.frontSpace,-h.x)):"y"==this.direction&&(e.labelInside,t.x=-(e.labelOffset+h.width),t.y=i-h.height/2,t.update(),h=t.getRect(),this.frontSpace=Math.max(this.frontSpace,h.y+h.height-this.axisLength),this.backSpace=Math.max(this.backSpace,-h.y))}});var X=e(function(t){U.call(this),this.chart=t,this.gridCount=5,this.labelContainer=new K,this.addChild(this.labelContainer),this.labelsPool=new B(this.labelContainer,H)},U);h(X.prototype,{getPosition:function(t){var i=this.data,e=i.min,h=i.max,a=(h-t)/(h-e);return a*this.axisLength},refresh:function(){U.prototype.refresh.call(this);var t=this.config,i=this.data,e=i.dataArr,h=e.length;this.labelsPool.begin(),t.labelOffset=0;for(var a=0;h>a;a++){var s=e[a],r=s.toString(),n=this.getPosition(s),o=this.labelsPool.next();o.font=t.labelFont,o.color=t.labelColor,o.text=null!=this.labelFormatter?this.labelFormatter(r):this.labelText?StringUtil.replaceValue(this.labelText,r):r,this._transformLabel(o,n)}this.labelsPool.end()}});var Y=e(function(t){U.call(this),this.chart=t,this.touchSide=!1,this.labelsPool=new B(this)},U);h(Y.prototype,{getPosition:function(t){if(null==this.chart._dataSource)return 0/0;var e=(this.chart._chartConfig,this.chart._chartData),h=e.serialLength,a=this.touchSide?h-1:h,s=this.axisLength*(t/a);return s},getIndex:function(t,i){var e=this.chart.plotArea,h=e.right-e.left,a=e.bottom-e.top;if(t>0&&i>0&&h>t&&a>i){var s=t/this.blockWidth;return this.touchSide?Math.round(s):Math.floor(s)}return-1},refresh:function(){U.prototype.refresh.call(this);var t=this.chart._dataSource,i=this.chart._chartConfig,e=this.config,h=this.chart._chartData,a=h.startIndex,s=h.endIndex,r=h.serialLength;this.blockWidth=this.touchSide&&r>1?this.axisLength/(r-1):this.axisLength/r,_maxLength=0/0,_labels=[],this.labelsPool.begin(H),this._ticks.clear();for(var n=-45,l=(n*Math.PI/180,a);s>=l;l++){var c=this.labelsPool.next(),d=t[l][i.serialKey];c.text=d,c.fontSize=e.labelSize,c.color=e.labelColor;var p=this.getPosition(l);this._ticks.moveTo(p,0),this._ticks.lineTo(p,e.tickLength),0==this.touchSide&&(p+=this.blockWidth/2),this._transformLabel(c,p)}this._ticks.update(),this.labelsPool.end()}});var q=e(function(){K.call(this)},K);h(q.prototype,{});var Q=e(function(t){q.call(this),this.chart=t,this.pool=new B(this)},q);h(Q.prototype,{refresh:function(){var t=this.chart._chartConfig,i=t.colors,e=this.config,h=this.chart._chartData.graphArr,a=this.chart._chartData.graphTotalNum,s=this.chart._dataSource.length,r=s>1?-Math.PI/2:-Math.PI,n=r;this.pool.begin(si);for(var o=0;s>o;o++){var l=i[o%i.length],d=(this.pool.length==o,this.pool.next());d.index=o,d.config={lineThickness:e.lineThickness,lineColor:e.lineColor||P.adjustBrightness(l,-20),lineAlpha:e.lineAlpha,fillColor:l,fillAlpha:e.fillAlpha,margin:e.gap};var p=2*Math.PI*(h[o]/a),u=n+p;u=Math.max(u,n),u=Math.min(u,r+2*Math.PI);var f=e.radius,g=e.radius*e.innerRadius;d.radius=f,d.radiusIn=g,d.startAngle=n,d.endAngle=u,d.update(),n=u}this.pool.end()}});var Z=e(function(t,i){K.call(this),this.type="column",this.chart=t,this.graphIndex=0,this.graphCount=1,this.valueAxis=i,this.pool=new B(this)},K);h(Z.prototype,{refresh:function(){var t=this.chart._chartConfig,i=this.config,e=this.chart._dataSource,h=this.chart._chartData,a=this.chart.serialAxis.blockWidth,s=h.startIndex,r=h.endIndex,o=(h.serialLength,.7*a/this.graphCount);if(o=Math.min(o,i.maxBarWidth),1==this.graphCount)var l=0;else l=0*o;var c=a-o*this.graphCount-l*(this.graphCount-1),d=c/2+this.graphIndex*(o+l);this.pool.begin(ri);for(var p=s;r>=p;p++){var u=e[p][i.valueKey];if(!isNaN(u)){var f=!this.pool.hasNext(),g=this.pool.next();if(g.graph=this,g.index=p,g.label=u,i.useDifferentColor)var _=t.colors[p%t.colors.length];else _=i.fillColor;g.config={lineAlpha:i.lineAlpha,lineThickness:i.lineThickness,lineColor:i.lineColor||P.adjustBrightness(i.fillColor,-50),fillAlpha:i.fillAlpha,fillColor:_};var v=this.chart.serialAxis.getPosition(p)+d,m=this.valueAxis.getPosition(0),b=o,x=this.valueAxis.getPosition(e[p][i.valueKey])-m;v=Math.round(v),m=Math.round(m),b=Math.round(b),x=Math.round(x),f&&(g.width=b,g.height=0),g.width=b,g.height=x,g.x=v,g.y=m,g.focusX=Math.round(v+b/2),g.focusY=m+x,g.update()}}this.pool.end()}});var J=e(function(t,i){q.call(this),this.type="line",this.chart=t,this.valueAxis=i,this.lineShape=this.addChild(new F),this.dotContainer=this.addChild(new K),this.pool=new B(this.dotContainer)},q);h(J.prototype,{refresh:function(){var t=this.config,i=this.chart.plotArea,e=this.chart._chartData,h=e.startIndex,a=e.endIndex,r=(e.serialLength,this.chart.serialAxis.touchSide?0:this.chart.serialAxis.blockWidth/2);this.pool.begin(ni);for(var n=h;a>=n;n++){var o=this.chart._dataSource[n][t.valueKey];if(!isNaN(o)){var c=(this.pool.hasNext(),this.pool.next());c.graph=this,c.index=n,c.label=this.chart._dataSource[n][t.valueKey],c.config={lineAlpha:t.lineAlpha,lineThickness:t.lineThickness,lineColor:t.lineColor||t.fillColor,fillAlpha:1,fillColor:"#ffffff"};var d=this.chart.serialAxis.getPosition(n)+r,p=this.valueAxis.getPosition(this.chart._dataSource[n][t.valueKey]);c.focusX=d,c.focusY=p,c.x=d,c.y=i.bottom-i.top,c.y=p,c.update()}}this.pool.end(),this.__refreshLines()},__refreshLines:function(){var t=this.config;this.lineShape.clear(),this.lineShape.beginStroke(t.lineThickness,t.lineColor||t.fillColor),this.pool.begin();var i=this.pool.getChildAt(0);i&&this.lineShape.moveTo(i.x,i.y);for(var e=0;e<this.pool.getLength();e++){var h=this.pool.next();a&&a.index+1==h.index?this.lineShape.lineTo(h.x,h.y):this.lineShape.moveTo(h.x,h.y);var a=h}this.lineShape.update()}});var $=e(function(t){K.call(this),this.chart=t,this._bg=this.addChild(new F),this._grid=this.addChild(new F),this._basicGrid=this.addChild(new F)},K);h($.prototype,{refresh:function(){var t=this.config,i=this.chart.plotArea,e=i.left,h=i.top,a=i.right-i.left,r=(i.bottom-i.top,this.chart._chartData),n=this.chart.valueAxis,o=r.valueAxes[0].dataArr;this._grid.clear(),this._grid.beginStroke(t.borderThicknesss,t.borderColor,t.borderAlpha),this._basicGrid.clear(),this._basicGrid.beginStroke(4,t.borderColor,t.borderAlpha);for(var l=0;l<o.length;l++){var c=o[l],d=Math.round(n.getPosition(c)+h);0==c?(this._basicGrid.moveTo(Math.round(e),d),this._basicGrid.lineTo(Math.round(e+a),d)):(this._grid.moveTo(Math.round(e),d),this._grid.lineTo(Math.round(e+a),d))}this._grid.lineDash=!0,this._grid.update(),this._basicGrid.update()}});var ti=e(function(t){K.call(this),this.chart=t,this.pool=new B(this)},K);h(ti.prototype,{refresh:function(){var t=this.chart._chartConfig,i=t.colors,e=this.config,h=this.chart._chartData.legendArr,a=0,s=0;this.pool.begin(oi);for(var r=0;r<h.length;r++){var n=this.pool.next(),o=i[r%i.length],l=h[r];n.text=l.name,n.type=l.type,n.config={fillColor:o,fillAlpha:e.fillAlpha,lineThickness:e.lineThickness,lineColor:e.lineColor||P.adjustBrightness(o,-50),lineAlpha:e.lineAlpha},n.update();var c=n.getRect();a+c.width>this.chart.stageWidth?(a=0,s+=c.height+5,n.x=Math.round(a),n.y=Math.round(s)):(n.x=Math.round(a),n.y=Math.round(s),a+=c.width+e.margin),n.update()}this.pool.end()}});var ii=e(function(){K.call(this)},K);h(ii.prototype,{});var ei=e(function(t){this.chart=t,ii.call(this),this._lines=this.addChild(new F)},ii);h(ei.prototype,{destroy:function(){for(_tips=null,this._lines.clear();this.numChildren>0;)this.removeChildAt(0)},refresh:function(){var t=this.chart._dataSource,i=this.chart._chartConfig,e=this.config,h=this.chart._chartData,a=h.graphArr,s=h.graphTotalNum,r=this.chart.graphs[0],n=r.pool,o=n.getLength();this._tips=[],n.begin();for(var l=0;o>l;l++){var d=(n.next(),Math.round(a[l]/s*1e3)/10),p=t[l][i.labelKey],f=(t[l][i.valueKey],p+": "+d+"%"),g=new H(f);g.font=e.font,g.fontSize=e.size,g.color=e.color,g.update(),this.addChild(g),this._tips[l]=g}this.moving()},moving:function(){var i=(this.chart._chartConfig,this.config),e=this.chart.graphs[0],h=e.pool,a=[],s=[];h.begin();for(var r=0;r<this._tips.length;r++){var n=h.next(),o=this._tips[r],l=o.getRect(),c=(n.startAngle+n.endAngle)/2,d=Math.abs(Math.sin(c))*n.radius/3,p=Math.abs(Math.sin(c))*n.radius/4,u=n.x+Math.cos(c)*(n.radius+d),f=n.y+Math.sin(c)*(n.radius+d);Math.cos(c)>0?(s.push({sector:n,tip:o}),o.x=u+p,o.y=f-l.height/2):(a.unshift({sector:n,tip:o}),o.x=u-l.width-p,o.y=f-l.height/2),o.update()}this._lines.clear(),this._lines.beginStroke(i.lineThickness,i.lineColor,i.lineAlpha),this.repareTips(a),this.repareTips(s)},repareTips:function(t){var i=0;for(i=0;i<t.length;i++){var e=t[i].sector,h=t[i].tip,a=h.getRect(),s=(e.startAngle+e.endAngle)/2,r=Math.min((e.radius-e.radiusIn)/2,5),n=Math.abs(Math.sin(s))*e.radius/3,o=Math.abs(Math.sin(s))*e.radius/4,l=e.x+Math.cos(s)*(e.radius-r),c=e.y+Math.sin(s)*(e.radius-r),d=e.x+Math.cos(s)*(e.radius+n),p=h.y+a.height/2;this._lines.moveTo(l,c),this._lines.lineTo(d,p),Math.cos(s)>0?this._lines.lineTo(d+o,p):this._lines.lineTo(d-o,p)}this._lines.update()}});var hi=e(function(t){ii.call(this),this.chart=t,this._lines=this.addChild(new F),this._tip=this.addChild(new H),this._tip.visible=!1,this._tip.update(),this._lastItem=null,this._dotItems=[];var e=this;this._over=!1,this.overListener=function(t){t=R.getEvent(t),i.event=null,"sprite"==t.targetType?(e._over=!0,e._offLast(),e._onItem(t.element)):e._over=!1},this.moveListener=function(t){e._over||(t=R.getEvent(t),e._findNearest(t))},this.chart.addEventListener("mouseover",this.overListener),this.chart.addEventListener("mousemove",this.moveListener)},ii);h(hi.prototype,{destroy:function(){},refresh:function(){this._lastItem=null,this._dotItems=[]},_onItem:function(t){var i=t.graph,e=this.chart,h=e.plotArea,a=e._dataSource[t.index][i.config.valueKey];this._tip.text=a+"",this._tip.update();var s=this._tip.getRect(),r=8;this._tip.x=h.left+t.focusX-s.width/2,this._tip.y=h.top+t.focusY,"column"==i.type&&this._tip.height>0?this._tip.y+=r:this._tip.y-=r+s.height,this._tip.visible=!0,this._tip.update(),t.activated=!0,t.update(),this._lastItem=t},_offLast:function(){this._lastItem&&(this._lastItem.activated=!1,this._lastItem.update(),this._lastItem=null),this._tip.visible=!1,this._tip.update()},_findNearest:function(t){function p(t,i,e,h){if(h>=e){if(i.getChildAt(e).index==t)return e;if(i.getChildAt(h).index==t)return h;var a=Math.ceil((h+e)/2);return i.getChildAt(a).index==t?a:i.getChildAt(a).index>t?p(t,i,e,a-1):p(t,i,a+1,h)}return-1}var i=this.chart,e=i.getRect(),h=i.plotArea,a=t.clientX-e.left-h.left,s=t.clientY-e.top-h.top,r=i.serialAxis.getIndex(a,s);if(-1==r)return this._offLast(),void 0;this._dotItems=[];for(var n=0;n<i.graphs.length;n++){var o=i.graphs[n];if("line"==o.type){var l=p(r,o.pool,0,Math.min(r,o.pool.getLength()-1)),c=o.pool.getChildAt(l);c&&this._dotItems.push(c)}}for(n=0;n<this._dotItems.length;n++)if(c=this._dotItems[n],!d&&c)var d=c;else Math.abs(c.y-s)<Math.abs(d.y-s)&&(d=c);this._lastItem!=d&&(this._offLast(),d&&this._onItem(d))}});var ai=e(function(t){function h(t){var e=i.chart.getRect();i.stageX=t.clientX-e.left,i.stageY=t.clientY-e.top,i.refresh()}ii.call(this),this.chart=t,this.stageX=0,this.stageY=0,this._directionH=!0,this._directionV=!0,this._lastIndex=-1,this.lastItems=[],this._first=!0,this._balloon=this.addChild(new li),this.chart.addEventListener("mouseover",h),this.chart.addEventListener("mouseout",h),this.chart.addEventListener("mousemove",h);var i=this},ii);h(ai.prototype,{destroy:function(){this.resetLastItems()},refresh:function(){var t=this.chart,i=t.plotArea,e=this.stageX,h=this.stageY,a=t.serialAxis.getIndex(e-i.left,h-i.top),s=t._dataSource,r=t._chartConfig,n=t._chartData,o=t.graphs;if(this._balloon.config=this.config,-1==a||a>n.endIndex-n.startIndex)return this.resetLastItems(),this._lastIndex=a,this._balloon.visible=!1,Tween.to(this._balloon,.5,{alpha:0,onUpdate:"update"}),void 0;if(a!=this._lastIndex){this.resetLastItems();for(var l=s[a][r.serialKey],c=0;c<o.length;c++){var d=o[c],p=d.config,u=s[a][p.valueKey],f=d.pool.getChildAt(a);l+="<br>"+p.name+"："+u,f.activated=!0,f.update(),this.lastItems.push(f)}this._balloon.text=l,this._balloon.update()}var g=this._balloon.getRect(),_=g.width,v=g.height,m=t.serialAxis.getPosition(a)+i.left,b=h,x=8,C=x,y=x,A=t.width-x,w=t.height-x;t.serialAxis.touchSide||(m+=t.serialAxis.blockWidth/2),this._directionH?m+_>A?(m=m-_-x,this._directionH=!1):m+=x:C>m-_?(m+=x,this._directionH=!0):m=m-_-x,this._directionV?b+v>w?(b=b-v-x,this._directionV=!1):b+=x:y>b-v?(b+=x,this._directionV=!0):b=b-v-x,this._balloon.visible=!1,this._first?(this._first=!1,this._balloon.x=m,this._balloon.alpha=0):Tween.to(this._balloon,.1,{x:m,onUpdate:"update"}),this._balloon.y=b,this._balloon.update(),Tween.to(this._balloon,.8,{alpha:1,onUpdate:"update"}),this._lastIndex=a},resetLastItems:function(){for(;this.lastItems.length>0;){var t=this.lastItems.pop();t.activated=!1,t.update()}}});var si=e(function(){function i(i){t._onOver="mouseover"==i.type,t.update()}K.call(this),this._border=this.addChild(new F),this._bg=this.addChild(new F),this.borderAlpha=.8,this.startAngle=0,this.endAngle=0,this.radiusIn=30,this.radius=120,this._onOver=!1,this.addEventListener("mouseover",i),this.addEventListener("mouseout",i);var t=this},K);h(si.prototype,{update:function(){K.prototype.update.call(this);var t=this.config,i=t.fillColor;(this.activated||this._onOver)&&(i=P.adjustBrightness(i,25)),this._border.clear(),this._border.beginFill(t.lineColor,t.lineAlpha),this._drawSector(this._border,0),this._border.update(),this._bg.clear(),this._bg.beginFill(i,t.fillAlpha),this._drawSector(this._bg,t.lineThickness),this._bg.update()},_drawSector:function(t,i){var a,h=(this.config,0),s=h+i,r=(this.endAngle-this.startAngle)/2,n=s/Math.sin(r),o=this.radius-i,l=Math.max(n,this.radiusIn+i);a=Math.asin(s/o);var c=this.startAngle+a,d=this.endAngle-a;if(!(isNaN(a)||0>a||c>=d)){a=l>0?Math.asin(s/l):0;var p=this.startAngle+a,u=this.endAngle-a;isNaN(a)||0>a||c>=d||(t.arc(0,0,o,c,d,!1,!0),t.arc(0,0,l,u,p,!0,!1),t.close())}}});var ri=e(function(){function i(i){i=R.getEvent(i),i.element=t,i.targetType="sprite"}K.call(this),this.activated=!1,this.onOver=!1,this._bg=this.addChild(new F),this._light=this.addChild(new F),this.addEventListener("mouseover",i);var t=this},K);
  h(ri.prototype,{update:function(){K.prototype.update.call(this);var t=this.config,i=t.fillColor,e=Math.min(this.width,0),h=Math.min(this.height,0),a=Math.abs(this.width),s=Math.abs(this.height);this.activated&&(i=P.adjustBrightness(t.fillColor,25)),this._bg.clear(),this._bg.beginFill(i,t.fillAlpha),this._bg.drawRect(e,h,a,s),this._bg.update(),this._light.clear(),this._light.beginStroke(1,t.lineColor,t.lineAlpha),this._light.beginFill(i),this._light.drawRect(e,h,a,s),this._light.update()}});var ni=e(function(){K.call(this),this.activated=!1,this._bg=this.addChild(new F)},K);h(ni.prototype,{update:function(){var t=this.config;this.visible=this.activated,this._bg.clear(),this.activated&&(this._bg.beginStroke(t.lineThickness,t.lineColor,t.lineAlpha),this._bg.beginFill(t.fillColor),this._bg.drawCircle(0,0,4)),this._bg.update(),K.prototype.update.call(this)}});var oi=e(function(){K.call(this),this._bg=this.addChild(new F),this._labelObject=this.addChild(new H),this.onOver=!1},K);h(oi.prototype,{update:function(){K.prototype.update.call(this);var t=this.config;this._labelObject.text=this.text,this._labelObject.x=18,this._labelObject.update();var h,i=this._labelObject.getRect(),e=9;this._bg.clear(),"line"==this.type?(this._bg.beginStroke(2,t.fillColor,t.fillAlpha),h=Math.round(i.height/2),this._bg.moveTo(0,h),this._bg.lineTo(12,h)):(this._bg.beginStroke(t.lineThickness,t.lineColor,t.lineAlpha),this._bg.beginFill(t.fillColor,t.fillAlpha),h=Math.max(0,Math.round((i.height-e)/2)),this._bg.drawRect(h,h,e,e)),this._bg.update()}});var li=e(function(){K.call(this),this.text="",this._bg=this.addChild(new F),this._labelObject=this.addChild(new H)},K);h(li.prototype,{update:function(){K.prototype.update.call(this),this._labelObject.text=this.text,this._labelObject.update();var t=this.config,i=this._labelObject.getRect(),e=10,h=Math.max(i.width+2*e,18),a=Math.max(i.height+2*e,12);this._labelObject.x=e,this._labelObject.y=e,this._labelObject.update(),this._bg.clear(),this._bg.beginStroke(t.borderThickness,t.borderColor,t.borderAlpha),this._bg.beginFill(t.backgroundColor,t.backgroundAlpha),this._bg.drawRect(0,0,h,a,5),this._bg.update()}});var ci=e(function(){K.call(this),"svg"==u.type&&this._svgDefs(),this.title,this.lengend,this.tooltip,this.graphs=[],this.graphContainer=new K},K);h(ci.prototype,{_newNode:function(){return u.newDocument("VCharts v"+n)},_svgDefs:function(){this.defs=this._dom.appendChild(u._newNode("defs"));var t=this.defs.appendChild(u._newNode("linearGradient"));t.id="gradient",v(t.appendChild(u._newNode("stop")),{offset:"0%","stop-color":"#ffffff","stop-opacity":.5}),v(t.appendChild(u._newNode("stop")),{offset:"70%","stop-color":"#ffffff","stop-opacity":0})},setSize:function(t,i){this.stageWidth=t,this.stageHeight=i},setDataSource:function(t){this._dataSource=t},setConfig:function(t){this._chartConfig=t},setData:function(t){this._chartData=t},updateChart:function(){if(this._dataSource)this._helper&&(this.removeChild(this._helper),this._helper=null),this._configChart(),this._refreshChart();else if(null==this._helper){this._helper=this.addChild(new H("No data")),this._helper.update();var t=this._helper.getRect();this._helper.x=(this.stageWidth-t.width)/2,this._helper.y=(this.stageHeight-t.height)/2,this._helper.update()}},_configChart:function(){var i,t=this._chartConfig;null==t.title?this.titleObject&&(this.removeChild(this.titleObject),this.titleObject=null):t.title&&(this.titleObject||(this.titleObject=new H,this.addChild(this.titleObject)),i=t.title,this.titleObject.text=i.text,this.titleObject.font=i.font,this.titleObject.fontSize=i.size,this.titleObject.color=i.color,this.titleObject.update()),null==t.legend?this.legend&&(this.removeChild(this.legend),this.legend=null):t.legend&&(this.legend||(this.legend=new ti(this),this.addChild(this.legend)),this.legend.config=t.legend)},_refreshChart:function(){this.graphArea=new j(0,0,this.stageWidth,this.stageHeight);var i,a,t=this._chartConfig;this.titleObject&&(i=t.title,this.titleObject.update(),a=this.titleObject.getRect(),this.graphArea.top=a.height+i.offset,this.titleObject.x=(this.stageWidth-a.width)/2,this.titleObject.y=0,this.titleObject.update(),this.legend&&(this.legend.refresh(),i=this.legend.config,a=this.legend.getRect(),this.graphArea.bottom-=a.height+i.offset))},_refreshLegend:function(){if(this.legend){var t=this.legend.config,i=this.legend.getRect(),e=(this.stageWidth-i.width)/2,h=this.graphArea.bottom+t.offset;this.legend.x=Math.round(e)+.5,this.legend.y=Math.round(h)+.5,this.legend.update()}}});var di=e(function(){ci.call(this),this.plot,this.plot=this.addChild(this._newPlot()),this.plot.x=.5,this.plot.y=.5,this.plot.update(),this.axisContainer=this.addChild(new K),this.axisContainer.x=.5,this.axisContainer.y=.5,this.axisContainer.update(),this.addChild(this.graphContainer)},ci);h(di.prototype,{_newPlot:function(){return null},_configChart:function(){ci.prototype._configChart.call(this);var t=this._chartConfig;this.plot.config=t.plot}});var pi=e(function(){di.call(this),this.repeatCount=0,this._top=0,this._bottom=0,this._left=0,this._right=0},di);h(pi.prototype,{_newPlot:function(){return new $(this)},_svgDefs:function(){di.prototype._svgDefs.call(this),this.graphClip=u._newNode("clipPath"),this.graphClip.id="vcharts-graph-clip",this.defs.appendChild(this.graphClip),this.clipRect=new F,this.graphClip.appendChild(this.clipRect._dom)},_adjustAxes:function(t,i,e){for(var h=0,a=0,s=0,r=0;r<t.length;r++){var n=t[r];n.axisLength=this.plotArea.bottom-this.plotArea.top,n.refresh(),h=Math.max(h,n.backSpace,0),a=Math.max(a,n.frontSpace,0),0==n.config.labelInside&&(s+=n.config.offset+n.getRect().width),n.x=Math.round(this.plotArea.left-n.config.offset),n.y=Math.round(this.plotArea.top),n.update()}var o=0;for(r=0;r<i.length;r++)n=i[r],n.axisLength=this.plotArea.bottom-this.plotArea.top,n.refresh(),h=Math.max(h,n.backSpace,0),a=Math.max(a,n.frontSpace,0),0==n.config.labelInside&&(o+=n.config.offset+n.getRect().width),n.x=Math.round(this.plotArea.right+n.config.offset),n.y=Math.round(this.plotArea.top),n.update();var l=0,c=0,d=0,p=0;for(r=0;r<e.length;r++)n=e[r],n.axisLength=this.plotArea.right-this.plotArea.left,n.refresh(),l=Math.max(l,n.frontSpace,0),c=Math.max(c,n.backSpace,0),0==n.config.labelInside&&(p+=n.config.offset+n.getRect().height),n.x=Math.round(this.plotArea.left),n.y=Math.round(this.plotArea.bottom+n.config.offset),n.update();this._top=Math.max(d,h),this._bottom=Math.max(p,a),this._left=Math.max(s,l),this._right=Math.max(o,c)},_adjustPlotArea:function(t,i,e){var h=this._chartConfig;this._adjustAxes(t,i,e);var a=!1;this.plotArea.top<this.graphArea.top+this._top&&(this.plotArea.top=this.graphArea.top+this._top,a=!0),this.plotArea.left<this.graphArea.left+this._left&&(this.plotArea.left=this.graphArea.left+this._left,a=!0),this.plotArea.right>this.graphArea.right-this._right&&(this.plotArea.right=this.graphArea.right-this._right,this.plotArea.right<this.plotArea.left?(this.plotArea.right=this.plotArea.left,this.graphArea.right=this.plotArea.bottom+this._right,a=!1):a=!0),this.plotArea.bottom>this.graphArea.bottom-this._bottom&&(this.plotArea.bottom=this.graphArea.bottom-this._bottom,this.plotArea.bottom<this.plotArea.top?(this.plotArea.bottom=this.plotArea.top,this.graphArea.bottom=this.plotArea.bottom+this._bottom,a=!1):a=!0),h.autoMargins&&a&&this.repeatCount++<5?this._adjustPlotArea(t,i,e):(this._adjustAxes(t,i,e),this.repeatCount=0)},_adjustGraphArea:function(){var t=this.plotArea;this.clipRect&&(this.clipRect.clear(),this.clipRect.drawRect(0,0,t.right-t.left,t.bottom-t.top),this.clipRect.update())}});var ui=e(function(){ci.call(this),this._legendData=null,this.addChild(this.graphContainer)},ci);h(ui.prototype,{__init__:function(){ci.prototype.__init__.call(this)},_configChart:function(){ci.prototype._configChart.call(this);var t=this._chartConfig;this.graphs[0]||(this.graphs[0]=new Q(this),this.graphContainer.addChild(this.graphs[0])),this.graphs[0].config=t.graph;var i=t.tooltip;this.tooltip&&(null==i||i&&i.type==this.tooltip.config.type),i&&(null==this.tooltip&&(this.tooltip=new ei(this),this.addChild(this.tooltip)),this.tooltip.config=i)},_refreshChart:function(){ci.prototype._refreshChart.call(this),this.graphArea.bottom-=1;var t=this.graphs[0],i=t.config,e=this.graphArea,h=Math.min((e.right-e.left)/2,(e.bottom-e.top)/2);i.radius=2.1*h/3;var a=Math.round(this.stageWidth/2),s=Math.round((this.graphArea.bottom+this.graphArea.top)/2);t.x=a,t.y=s,t.update(),t.refresh(),this._refreshLegend(),this.tooltip&&(this.tooltip.x=a,this.tooltip.y=s,this.tooltip.update(),this.tooltip.refresh())}});var fi=e(function(){pi.call(this),this.serialAxis=null,this.areaGraphs=[],this.barGraphs=[],this.lineGraphs=[]},pi);h(fi.prototype,{_configChart:function(){pi.prototype._configChart.call(this);var t=this._chartConfig,e=(this._dataSource,this._chartData);this.serialAxis||(this.serialAxis=new Y(this),this.axisContainer.addChild(this.serialAxis)),this.serialAxis.config=t.serialAxis,this.valueAxis||(this.valueAxis=new X(this),this.axisContainer.addChild(this.valueAxis)),this.valueAxis.config=t.valueAxes[0],this.valueAxis.data=e.valueAxes[0];this.serialAxis,t.serialKey;this.graphContainer.removeChildren(),this.graphs=[];for(var s=[],r=[],n=0;n<t.graphs.length;n++){var o;switch(t.graphs[n].type){case"column":case"bar":o=this.barGraphs.shift()||new Z(this,this.valueAxis),s.push(o);break;case"line":o=this.lineGraphs.shift()||new J(this,this.valueAxis),r.push(o);break;default:continue}o.config=t.graphs[n],this.graphs.push(o)}for(this.barGraphs=s,this.lineGraphs=r,n=0;n<this.barGraphs.length;n++){var l=this.barGraphs[n];l.graphCount=this.barGraphs.length,l.graphIndex=n,this.graphContainer.addChild(l)}for(n=0;n<this.lineGraphs.length;n++)o=this.lineGraphs[n],this.graphContainer.addChild(o);for(n=0;n<this.graphs.length;n++)o=this.graphs[n],o.config.fillColor=o.config.fillColor||t.colors[n%this.graphs.length];this.tooltip&&(this.tooltip.destroy(),this.removeChild(this.tooltip),this.tooltip=null),t.tooltip&&(null==this.tooltip&&(this.tooltip=new hi(this),this.tooltip.x=.5,this.tooltip.y=.5,this.tooltip.update(),this.addChild(this.tooltip)),this.tooltip.config=t.tooltip)},_refreshChart:function(){pi.prototype._refreshChart.call(this);var t=this._chartConfig;if(t.inverted)i=this.serialAxis,e=this.valueAxis;else var i=this.serialAxis,e=this.valueAxis;i.direction="x",e.direction="y",this.plotArea=this.graphArea.clone(),this.plotArea.bottom-=1,this.plotArea.right-=1,this._adjustPlotArea([e],[],[i]),this._adjustGraphArea(),this.plot.refresh();var h=this.plotArea,a=Math.round(h.left)+.5,s=Math.round(h.top)+.5;this.graphContainer.x=a,this.graphContainer.y=s,this.graphContainer.update();for(var r=0;r<this.graphs.length;r++){var n=this.graphs[r];n.refresh()}this._refreshLegend(),this.tooltip&&this.tooltip.refresh()}});var gi=function(t){this.context=t};h(gi.prototype,{onStage:function(){if(this.initialized)return console.log("已初始化！"),void 0;var t=this.context.element;for(this._chartView=this._newChart(this.context.type);t.lastChild;)t.removeChild(t.lastChild);t.appendChild(this._chartView._dom),t=null,this.initialized=!0,this._readyCallback()},_newChart:function(t){switch(t){case"pie":return new ui;case"serial":return new fi}return null},_readyCallback:function(){function e(){(t._width!=i.clientWidth||t._height!=i.clientHeight)&&(t._width=i.clientWidth,t._height=i.clientHeight,t._chartView.setSize(i.clientWidth,i.clientHeight),t._chartView.updateChart())}var t=this,i=this.context.element;this._width=i.clientWidth,this._height=i.clientHeight,this._chartView.setSize(i.clientWidth,i.clientHeight),setInterval(e,2e3),this._dataSource&&(this._chartView.setDataSource(this._dataSource),this._dataSource=null),this._chartConfig&&(this._chartView.setConfig(this._chartConfig),this._chartConfig=null),this._chartData&&(this._chartView.setData(this._chartData),this._chartData=null),this._needRefresh&&(this._chartView.updateChart(),this._needRefresh=!1)},setDataSource:function(t){this.initialized?this._chartView.setDataSource(t):this._dataSource=t},setConfig:function(t){this.initialized?this._chartView.setConfig(t):this._chartConfig=t},setData:function(t){this.initialized&&this._chartView.setData(t)},update:function(){this.initialized?this._chartView.updateChart():this._needRefresh=!0}});var _i=function(t){function e(){f(t)&&(i.element=_(t)),i.element&&(i.initialized=!0,i.setSize(i._width||i.element.style.width||320,i._height||i.element.style.height||160),i._viewProxy.onStage())}this.element=t,this._viewProxy=new gi(this);var i=this;a.body?e():R.addHandler(s,"load",e)};h(_i.prototype,{setData:function(t){return this._dataSource=t,this._render(),this},setConfig:function(t){for(var i in t)switch(i){case"title":case"legend":case"serialAxis":case"tooltip":case"plot":this._chartConfig[i]&&null!=t[i]?m(this._chartConfig[i],t[i]):this._chartConfig[i]=t[i];break;case"graph":this._chartConfig[i]?m(this._chartConfig[i],t[i]):this._chartConfig[i]=t[i];break;case"valueAxes":for(var e=0;e<t[i].length;e++){var h=E.newValueAxis();m(h,t[i][e]),this._chartConfig[i][e]=h}for(;this._chartConfig[i].length>e;)this._chartConfig[i].pop();break;case"graphs":for(var e=0;e<t[i].length;e++)h=E.newSerialGraph(),m(h,t[i][e]),this._chartConfig[i][e]=h;for(;this._chartConfig[i].length>e;)this._chartConfig[i].pop();break;default:this._chartConfig[i]=t[i]}return this._render(),this},setSize:function(t,i){return this._width=t,this._height=i,this.initialized&&("number"==typeof t&&(t+="px"),"number"==typeof i&&(i+="px"),this.element.style.width=t,this.element.style.height=i),this._render(),this},_render:function(){if(this.initialized&&void 0==this.timerIndex){var t=this;this.timerIndex=setTimeout(function(){t.__onTimer()},33)}},__onTimer:function(){clearTimeout(this.timerIndex),this.timerIndex=void 0,this._parseConfig(),this._dataSource&&this._parseData(),this._viewProxy.setDataSource(this._dataSource),this._viewProxy.setConfig(this._chartConfig),this._viewProxy.update()},_parseConfig:function(){},_parseData:function(){}});var vi=e(function(t){_i.call(this,t)},_i);h(vi.prototype,{_parseConfig:function(){_i.prototype._parseConfig.call(this);var t=this._chartConfig;t.colors&&t.colors.length>0||(t.colors=P.createHueColors(t.graphs.length))},_parseData:function(){_i.prototype._parseData.call(this);var t=this._chartConfig,i=t.graphs;this._legendData=[];for(var e=0;e<i.length;e++)this._legendData.push({name:i[e].name,type:i[e].type,color:t.colors[e%t.colors.length]})}});var mi=e(function(t){vi.call(this,t)},vi);h(mi.prototype,{});var bi=e(function(t){this.type="pie",this._chartConfig=E.newPieConfig(),_i.call(this,t),this.graph=null},_i);h(bi.prototype,{_parseConfig:function(){_i.prototype._parseConfig.call(this);var t=this._chartConfig,i=this._dataSource;t.colors&&t.colors.length>0||(t.colors=P.createHueColors(i.length))},_parseData:function(){_i.prototype._parseData.call(this);var t=this._chartConfig,i=this._dataSource,e=0,h=[],a=0,s=[];for(var r in i){var n=i[r][t.valueKey]=Number(i[r][t.valueKey]);e+=n}if(e>0)for(r in i){var l,n=i[r][t.valueKey],o=n/e;l=o>0&&.01>o?.01*e:n,a+=l,h.push(l)}for(r=0;r<i.length;r++)s.push({name:i[r][t.labelKey],color:t.colors[r%t.colors.length]});this._viewProxy.setData({graphArr:h,graphTotalNum:a,legendArr:s})}});var xi=e(function(t){this.type="serial",this._chartConfig=E.newSerialConfig(),mi.call(this,t),this._startIndex=0,this._endIndex=Number.MAX_VALUE,this._serialCount=1},mi);h(xi.prototype,{_parseConfig:function(){mi.prototype._parseConfig.call(this);var t=this._chartConfig,i=t.valueAxes,e=t.graphs;if(1==i.length){i[0].valueKeys=[];for(var h=0;h<e.length;h++)switch(i[0].valueKeys[h]=e[h].valueKey,e[h].type){case"column":case"bar":i[0].minValue=0}}},_parseData:function(){mi.prototype._parseData.call(this);var t=this._chartConfig,i=this._dataSource;if(i){this._startIndex=0,this._endIndex=Math.max(this._startIndex,i.length-1),this._serialCount=Math.max(t.minSerialCount,i.length-this._startIndex);var e=new V(t.valueAxes[0]);e.parseData(i,t.valueAxes[0].valueKeys,this._startIndex,this._endIndex),this._viewProxy.setData({startIndex:this._startIndex,endIndex:this._endIndex,serialLength:this._serialCount,valueAxes:[{dataArr:e.axisData,min:e.minimum,max:e.maximum}],valueLines:e.axisData,legendArr:this._legendData})}}}),i.PieChart=bi,i.SerialChart=xi,i.version=n,t.vcharts=i}(window);