ichartjs.base.js 49 KB

1
  1. (function(f){var b=navigator.userAgent.toLowerCase(),c=Object.prototype.toString,e=/opera/.test(b),i=/\bchrome\b/.test(b),k=/webkit/.test(b),m=!i&&/safari/.test(b),p=!e&&/msie/.test(b),y=!!document.createElement("canvas").getContext,u=!k&&/gecko/.test(b),r=/ipod|ipad|iphone|android/gi.test(b),q=function(b,c,e,a){return e*b/a+c},t={easeIn:function(b,c,e,a){return e*(b/=a)*b*b+c},easeOut:function(b,c,e,a){return e*((b=b/a-1)*b*b+1)+c},easeInOut:function(b,c,e,a){return 1>(b/=a/2)?e/2*b*b*b+c:e/2*((b-=2)*b*b+2)+c}},n=function(b){var f=!1,C=!1,a=[],g=function(){if(document.addEventListener)return function(){document.removeEventListener("DOMContentLoaded",g,!1);d()};if(document.attachEvent)return function(){"complete"===document.readyState&&(document.detachEvent("onreadystatechange",g),d())}}(),h=function(){if(!f){try{document.documentElement.doScroll("left")}catch(a){setTimeout(h,1);return}d()}},d=function(){if(!f){f=!0;for(var b=0;b<a.length;b++)a[b].call(document);a=[]}},B=function(){if(!C){C=!0;if("complete"===document.readyState)return setTimeout(d,1);if(document.addEventListener)document.addEventListener("DOMContentLoaded",g,!1),b.addEventListener("load",d,!1);else if(document.attachEvent){document.attachEvent("onreadystatechange",g);b.attachEvent("onload",d);var a=!1;try{a=null==b.frameElement}catch(T){}document.documentElement.doScroll&&a&&h()}}},z=function(b){B();f?b.call(document,l):a.push(function(){return b.call(this)})},l=function(a){if(!a||a.nodeType)return a;if("string"===typeof a)return-1!=a.indexOf("#")&&(a=a.substring(1)),document.getElementById(a);"function"===typeof a&&z(a)};l.apply=function(a,b){if(a&&b&&"object"==typeof b)for(var g in b)"undefined"!=typeof b[g]&&(a[g]=b[g]);if(!b&&a){var h={};for(g in a)h[g]=a[g];return h}return a};l.apply(l,{version:"1.0",email:"taylor@ichartjs.com",isEmpty:function(a,b){return null===a||void 0===a||l.isArray(a)&&!a.length||(!b?""===a:!1)},isArray:function(a){return"[object Array]"===c.apply(a)},isDate:function(a){return"[object Date]"===c.apply(a)},isObject:function(a){return!!a&&"[object Object]"===c.apply(a)},isFunction:function(a){return"[object Function]"===c.apply(a)},isNumber:function(a){return"number"===typeof a&&isFinite(a)},isString:function(a){return"string"===typeof a},isBoolean:function(a){return"boolean"===typeof a},isFalse:function(a){return"boolean"===typeof a&&!a},isElement:function(a){return a?!!a.tagName:!1},isDefined:function(a){return"undefined"!==typeof a}});l.applyIf=function(a,b){if(a&&l.isObject(b))for(var g in b)l.isDefined(b[g])&&!l.isDefined(a[g])&&(a[g]=b[g]);return!b&&a?l.apply(a):a};l.merge=function(a,b,g){if(a&&l.isObject(b)){for(var h in b)l.isDefined(b[h])&&(l.isObject(b[h])?l.isObject(a[h])?l.merge(a[h],b[h]):a[h]=l.clone(b[h],!0):a[h]=b[h]);if(l.isObject(g))return l.merge(a,g)}return a};l.clone=function(a,b,g){var h={};if(l.isArray(a)&&l.isObject(b))for(var d=0;d<a.length;d++)h[a[d]]=g&&l.isObject(b[a[d]])?l.clone(b[a[d]],g):b[a[d]];else if(l.isObject(a))for(d in a)h[d]=b&&l.isObject(a[d])&&!a[d].ICHARTJS_OBJECT?l.clone(a[d],b):a[d];return h};l.override=function(a,b){if(a&&b){var g=a.prototype;l.apply(g,b);l.isIE&&b.hasOwnProperty("toString")&&(g.toString=b.toString)}};l.extend=function(){var a=function(a){for(var b in a)this[b]=a[b]},b=Object.prototype.constructor;return function(g,h){var d=function(){g.apply(this,arguments)},c=function(){},j=g.prototype;c.prototype=j;c=d.prototype=new c;c.constructor=d;d.superclass=j;j.constructor==b&&(j.constructor=g);d.override=function(a){l.override(d,a)};c.superclass=c.supr=function(){return j};c.override=a;l.override(d,h);d.extend=function(a){return l.extend(d,a)};d.plugin_={};d.plugin=function(a,b){l.isString(a)&&l.isFunction(b)&&(d.plugin_[a]=b)};return d}}();var v=Math.sin,K=Math.cos,j=Math.atan,w=Math.sqrt,o=Math.abs,s=Math.PI,A=2*s,L=Math.ceil,D=Math.round,G=Math.floor,M=Math.max,N=Math.min,x=parseFloat,E={},H={},O=function(a,b){if(0==a)return a;var g=o(a),h=0.1;if(1<g){for(;1<g;)g/=10,h*=10;return G(a/h+b)*h}for(h=1;1>g;)g*=10,h*=10;return D(a*h+b)/h},P={white:"rgb(255,255,255)",green:"rgb(0,128,0)",gray:"rgb(80,80,80)",red:"rgb(255,0,0)",blue:"rgb(0,0,255)",yellow:"rgb(255,255,0)",black:"rgb(0,0,0)"},Q=function(a){var b=/rgb\((\w*),(\w*),(\w*)\)/.exec(a);if(b)return[b[1],b[2],b[3]];if(b=/rgba\((\w*),(\w*),(\w*),(.*)\)/.exec(a))return[b[1],b[2],b[3],b[4]];throw Error("invalid colors value '"+a+"'");},I=function(a){if(!a)return a;a=a.replace(/\s/g,"").toLowerCase();if(/^rgb\([0-9]{1,3},[0-9]{1,3},[0-9]{1,3}\)$/.exec(a)||/^rgba\([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},(0(\.[0-9])?|1(\.0)?)\)$/.exec(a))return a;if(/^#(([a-fA-F0-9]{6,7})|([a-fA-F0-9]{3}))$/.exec(a))return a=a.replace(/#/g,"").replace(/^(\w)(\w)(\w)$/,"$1$1$2$2$3$3"),(7==a.length?"rgba(":"rgb(")+parseInt(a.substring(0,2),16)+","+parseInt(a.substring(2,4),16)+","+parseInt(a.substring(4,6),16)+(7==a.length?",0."+a.substring(6,7)+")":")");if(P[a])return P[a];throw Error("invalid colors value '"+a+"'");},R=function(a,b){b=b||0.14;return 0.5<a?b-(1-a)/10:0.1<a?b-0.16+a/5:a>b?b:a/2},S=function(a,b,g,h){if(!b)return b;var b=Q(I(b)),d;d=b;var c=void 0,j=void 0;l.isArray(d)&&(c=d[1],j=d[2],d=d[0]);d/=255;var c=c/255,j=j/255,e=M(M(d,c),j),B=N(N(d,c),j),B=e-B;if(0==B)d=[0,0,e];else{var z;d==e?z=(c-j)/B:c==e?z=(j-d)/B+2:j==e&&(z=(d-c)/B+4);z*=60;0>z&&(z+=360);d=[z,B/e,e]}d[1]-=0!=h?h||0.05:h;a?(d[2]-=R(d[2],g),d[1]=l.upTo(d[1],1),d[2]=l.lowTo(d[2],0)):(d[2]+=R(1-d[2],g),d[1]=l.lowTo(d[1],0),d[2]=l.upTo(d[2],1));h=b[3];a=b=void 0;l.isArray(d)&&(a=h,h=d[1],b=d[2],d=d[0]);var v,f,i,g=G(d/60)%6,j=d/60-g;d=b*(1-h);c=b*(1-h*j);h=b*(1-h*(1-j));switch(g){case 0:v=b;f=h;i=d;break;case 1:v=c;f=b;i=d;break;case 2:v=d;f=b;i=h;break;case 3:v=d;f=c;i=b;break;case 4:v=h;f=d;i=b;break;case 5:v=b,f=d,i=c}return"rgb"+(a?"a":"")+"("+D(255*v)+","+D(255*f)+","+D(255*i)+(a?","+a+")":")")};l.apply(l,{getFont:function(a,b,g,d){return a+" "+b+(d||"px")+" "+g},getDoc:function(){return b.contentWindow?b.contentWindow.document:b.contentDocument?b.contentDocument:b.document},DefineAbstract:function(a,b){if(!b[a])throw Error("Cannot instantiate the type '"+b.type+"'.you must implements it with method '"+a+"'.");},getAA:function(a){return"linear"==a?q:"easeInOut"==a||"easeIn"==a||"easeOut"==a?t[a]:q},noConflict:function(){return n},plugin:function(a,b,g){l.isFunction(a)&&a.plugin(b,g)},parsePadding:function(a,b){a=a||0;if(l.isNumber(a))return[a,a,a,a];if(l.isArray(a))return a;b=b||0;a=a.replace(/^\s+|\s+$/g,"").replace(/\s{2,}/g,/\s/).replace(/\s/g,",").split(",");1==a.length?a[0]=a[1]=a[2]=a[3]=x(a[0])||b:2==a.length?(a[0]=a[2]=x(a[0])||b,a[1]=a[3]=x(a[1])||b):3==a.length?(a[0]=x(a[0])||b,a[1]=a[3]=x(a[1])||b,a[2]=x(a[2])||b):(a[0]=x(a[0])||b,a[1]=x(a[1])||b,a[2]=x(a[2])||b,a[3]=x(a[3])||b);return a},distanceP2P:function(a,b,g,d){return w((g-a)*(g-a)+(d-b)*(d-b))},atan2Radian:function(a,b,g,d){if(a==g)return d>b?s/2:3*s/2;if(b==d)return g>a?0:s;var h=l.quadrant(a,b,g,d),a=j(o((b-d)/(a-g)));return h?(3==h?A:s)+(2==h?a:-a):a},angle2Radian:function(a){return a*s/180},radian2Angle:function(a){return 180*a/s},quadrant:function(a,b,g,d){return a<g?b<d?0:3:b<d?1:2},toPI2:function(a){for(;0>a;)a+=A;return a},visible:function(a,b,g){if(a>=b)return[];var d=l.quadrantd(a),h=l.quadrantd(b);if((2==d||3==d)&&(2==h||3==h)&&b-a<s)return[];a=l.toPI2(a);b=l.toPI2(b);b<=a&&(b+=A);if(a>s)a=A;else{if(b>A)return[{s:a,e:s,f:g},{s:A,e:b,f:g}];b>s&&(b=s)}return{s:a,e:b,f:g}},quadrantd:function(a){if(0==a)return 0;if(0==a%A)return 3;for(;0>a;)a+=A;return L(2*(a%A)/s)-1},upTo:function(a,b){return b>a?a:b},lowTo:function(a,b){return b<a?a:b},between:function(a,b,g){return a>b?l.between(b,a,g):g>b?b:g<a?a:g},inRange:function(a,b,g){return b>g&&a<g},angleInRange:function(a,b,g){g-=a;g=0>g?g+A:g;g%=A;return b-a>g},angleZInRange:function(a,b,g){return b<a?g>a||g<b:b>g&&a<g},inRangeClosed:function(a,b,g){return b>=g&&a<=g},inEllipse:function(a,b,g,d){return 1>=a*a/g/g+b*b/d/d},p2Point:function(a,b,g,d){return{x:a+K(g)*d,y:b+v(g)*d}},toRgb:I,toRgba:function(a,b){var g=Q(I(a));return"rgba("+g[0]+","+g[1]+","+g[2]+","+b+")"},vectorP2P:function(a,b,g){g||(b=l.angle2Radian(b),a=l.angle2Radian(a));b=v(b);return{x:b*v(a),y:b*K(a)}},uid:function(a){return(a||"ichartjs")+"_"+L(1E4*Math.random())+(new Date).getTime().toString().substring(4)},register:function(a){if(l.isString(a))H[a.toLowerCase()]=a;else{var b=a.get("id");if(!b||""==b){for(b=l.uid(a.type);E[b];)b=l.uid(a.type);a.push("id",b)}if(E[b])throw Error("exist reduplicate id :"+b);a.id=b;E[b]=a}},create:function(a){if(!a.type||!H[a.type])throw Error("TypeNotFoundException["+a.type+"]");return new l[H[a.type]](a)},get:function(a){return E[a]},isPercent:function(a){return l.isString(a)&&a.match(/(.*)%/)},parsePercent:function(a,b){l.isString(a)&&(a=a.match(/(.*)%/))&&(a=b?G(x(a[1])*b/100):a[1]/100);return!a||0>=a||a>b?b:a},parseFloat:function(a,b){if(!l.isNumber(a)&&(a=x(a),!l.isNumber(a)))throw Error("["+b+"]="+a+"is not a valid number.");return a},ceil:function(a){return O(a,1)},floor:function(a){return O(a,-1)},_2D:"2d",_3D:"3d",light:function(a,b,g){return S(!1,a,b,g)},dark:function(a,b,g){return S(!0,a,b,g)},fixPixel:function(a){return l.isNumber(a)?a:x(a.replace("px",""))||0},toPixel:function(a){return l.isNumber(a)?a+"px":l.fixPixel(a)+"px"},emptyFn:function(){return!0},supportCanvas:y,isOpera:e,isWebKit:k,isChrome:i,isSafari:m,isIE:p,isGecko:u,isMobile:r,touch:"ontouchend"in document,FRAME:r?30:60});l.Assert={isTrue:function(a,b){if(!0!==a)throw Error(b);}};l.requestAnimFrame=function(){var a=b.requestAnimationFrame||b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||b.oRequestAnimationFrame||b.msRequestAnimationFrame||function(a){b.setTimeout(a,1E3/60)};return function(b){a(b)}}();l.Event={addEvent:function(a,b,g,d){a.addEventListener?a.addEventListener(b,g,d):a.attachEvent?a.attachEvent("on"+b,g):a["on"+b]=g},fix:function(a){"undefined"==typeof a&&(a=b.event);var g={target:a.target,pageX:a.pageX,pageY:a.pageY,offsetX:a.offsetX,offsetY:a.offsetY,stopPropagation:!1,event:a};if("undefined"==typeof a.offsetX){a.target||(g.target=a.srcElement||document);a.targetTouches&&(g.pageX=a.targetTouches[0].pageX,g.pageY=a.targetTouches[0].pageY);if(null==g.pageX&&null!=a.clientX){var d=document.documentElement,h=document.body;g.pageX=a.clientX+(d&&d.scrollLeft||h&&h.scrollLeft||0)-(d&&d.clientLeft||h&&h.clientLeft||0);g.pageY=a.clientY+(d&&d.scrollTop||h&&h.scrollTop||0)-(d&&d.clientTop||h&&h.clientTop||0)}for(var h=d=0,c=a.target;c!=document.body&&c;)d+=c.offsetLeft-(c.scrollLeft||0),h+=c.offsetTop,c=c.offsetParent;g.offsetX=g.pageX-d;g.offsetY=g.pageY-h}g.x=g.offsetX;g.y=g.offsetY;a.stopPropagation||(a.stopPropagation=function(){b.event.cancelBubble=true});return g}};return l}(f);Array.prototype.each=function(b,c){for(var e=this.length,a,g=0;g<e&&!(a=c?b.call(c,this[g],g):b(this[g],g),"boolean"===typeof a&&!a);g++);return this};Array.prototype.eachAll=function(b,c){this.each(function(e,a){return n.isArray(e)?e.eachAll(b,c):c?b.call(c,e,a):b(e,a)},c)};Array.prototype.sor=function(b){for(var c=this.length-1,e,a=0;a<c;a++)for(var g=c;g>a;g--)if(b?!b(this[g],this[g-1]):this[g]<this[g-1])e=this[g],this[g]=this[g-1],this[g-1]=e};f.iChart=n;f.$||(f.$=f.iChart)})(window);(function(f){f.Element=function(b){var c=this._();c.type="element";c.ICHARTJS_OBJECT=!0;f.DefineAbstract("configure",c);f.DefineAbstract("afterConfiguration",c);c.options={};c.set({border:{enable:!1,color:"#BCBCBC",style:"solid",width:1,radius:0},shadow:!1,shadow_color:"#666666",shadow_blur:4,shadow_offsetx:0,shadow_offsety:0});c.W="width";c.H="height";c.O="top";c.B="bottom";c.L="left";c.R="right";c.C="center";c.X="originx";c.Y="originy";c.variable={};c.events={mouseup:[],touchstart:[],touchmove:[],touchend:[],mousedown:[],dblclick:[]};c.registerEvent("initialize");c.initialization=!1;c.configure.apply(c,Array.prototype.slice.call(arguments,1));c.default_=f.clone(c.options,!0);c.set(b);c.afterConfiguration(c)};f.Element.prototype={_:function(){return this},afterConfiguration:function(b){if(f.isObject(b.get("listeners")))for(var c in b.get("listeners"))b.on(c,b.get("listeners")[c]);b.initialize();b.fireEvent(b,"initialize",[b])},registerEvent:function(){for(var b=0;b<arguments.length;b++)this.events[arguments[b]]=[]},fireString:function(b,c,e,i){b=this.fireEvent(b,c,e);return f.isString(b)?b:!0!==b&&f.isDefined(b)?b.toString():i},fireEvent:function(b,c,e){var f=this.events[c].length;if(1==f)return this.events[c][0].apply(b,e);for(var k=!0,m=0;m<f;m++)this.events[c][m].apply(b,e)||(k=!1);return k},on:function(b,c){f.isString(b)&&f.isArray(this.events[b])?this.events[b].push(c):f.isArray(b)&&b.each(function(b){this.on(b,c)},this);return this},getPlugin:function(b){return this.constructor.plugin_[b]},set:function(b){f.isObject(b)&&f.merge(this.options,b)},pushIf:function(b,c){return!f.isDefined(this.get(b))||null==this.get(b)?this.push(b,c):this.get(b)},push:function(b,c){for(var e=b.split("."),f=e.length-1,k=this.options,m=0;m<f;m++)k[e[m]]||(k[e[m]]={}),k=k[e[m]];return k[e[f]]=c},get:function(b){for(var b=b.split("."),c=this.options[b[0]],e=1;e<b.length;e++){if(!c)return null;c=c[b[e]]}return c}};f.Html=f.extend(f.Element,{configure:function(b){this.type="html";this.T=b;f.DefineAbstract("beforeshow",this);this.set({animation:!0,default_action:!0,width:0,height:0,style:"",index:999,offset_top:0,offset_left:0});this.transitions=""},initialize:function(){var b=this._();b.wrap=b.get("wrap");b.dom=document.createElement("div");b.get("shadow")&&b.css("boxShadow",b.get("shadow_offsetx")+"px "+b.get("shadow_offsety")+"px "+b.get("shadow_blur")+"px "+b.get("shadow_color"));b.get("border.enable")&&(b.css("border",b.get("border.width")+"px "+b.get("border.style")+" "+b.get("border.color")),b.css("borderRadius",b.get("border.radius")+"px"));b.css("position","absolute");b.css("zIndex",b.get("index"));b.applyStyle();b.wrap.appendChild(b.dom);b.style=b.dom.style;b.get("default_action")&&b.doAction(b)},width:function(){return this.dom.offsetWidth},height:function(){return this.dom.offsetHeight},onTransitionEnd:function(b,c){var e="transitionend";f.isWebKit?e="webkitTransitionEnd":f.isOpera&&(e="oTransitionEnd");f.Event.addEvent(this.dom,e,b,c)},destroy:function(){this.wrap.removeChild(this.dom);this.dom=null},transition:function(b){this.transitions=""==this.transitions?b:this.transitions+","+b;f.isWebKit?this.css("WebkitTransition",this.transitions):f.isGecko?this.css("MozTransition",this.transitions):f.isOpera?this.css("OTransition",this.transitions):this.css("transition",this.transitions)},beforeshow:function(b,c,e){e.follow(b,c,e)},show:function(b,c){this.beforeshow(b,c,this);this.css("visibility","visible");this.get("animation")&&this.css("opacity",1)},hidden:function(){this.css("visibility","hidden")},getDom:function(){return this.dom},css:function(b,c){if(f.isString(b))if(f.isDefined(c))this.dom.style[b]=c;else return this.dom.style[b]},applyStyle:function(){for(var b=this.get("style").split(";"),c,e=0;e<b.length;e++)c=b[e].split(":"),1<c.length&&this.css(c[0],c[1])}});f.Painter=f.extend(f.Element,{configure:function(){this.type="painter";this.dimension=f._2D;f.DefineAbstract("commonDraw",this);f.DefineAbstract("initialize",this);this.set({strokeStyle:"gray",padding:10,color:"black",offsetx:0,offsety:0,background_color:"#FEFEFE",color_factor:0.15,style:"",border:{enable:!0},gradient:!1,gradient_mode:"LinearGradientUpDown",z_index:0,listeners:null,originx:null,originy:null});this.variable.event={mouseover:!1};this.variable.animation={};this.registerEvent("click","mousemove","mouseover","mouseout","beforedraw","draw")},is3D:function(){return this.dimension==f._3D},applyGradient:function(b,c,e,f){var k=this._();k.get("gradient")&&k.get("f_color")&&(k.push("f_color",k.T.gradient(b||k.x||0,c||k.y||0,e||k.get(k.W),f||k.get(k.H),[k.get("dark_color"),k.get("light_color")],k.get("gradient_mode"))),k.push("light_color",k.T.gradient(b||k.x||0,c||k.y||0,e||k.get(k.W),f||k.get(k.H),[k.get("background_color"),k.get("light_color")],k.get("gradient_mode"))),k.push("f_color_",k.get("f_color")))},draw:function(b,c){if(c)this.root.draw(b);else{if(!this.fireEvent(this,"beforedraw",[this,b]))return this;this.commonDraw(this,b);this.fireEvent(this,"draw",[this,b])}},inject:function(b){b&&(this.root=b,this.target=this.T=b.T)},doConfig:function(){var b=this._(),c=f.parsePadding(b.get("padding")),e=b.get("border.enable"),e=e?f.parsePadding(b.get("border.width")):[0,0,0,0],i=f.toRgb(b.get("background_color")),k=b.get("color_factor"),m=b.get("gradient")?0:null;b.set({border_top:e[0],border_right:e[1],border_bottom:e[2],border_left:e[3],hborder:e[1]+e[3],vborder:e[0]+e[2],padding_top:c[0]+e[0],padding_right:c[1]+e[1],padding_bottom:c[2]+e[2],padding_left:c[3]+e[3],hpadding:c[1]+c[3]+e[1]+e[3],vpadding:c[0]+c[2]+e[0]+e[2]});!0===b.get("shadow")&&b.push("shadow",{color:b.get("shadow_color"),blur:b.get("shadow_blur"),offsetx:b.get("shadow_offsetx"),offsety:b.get("shadow_offsety")});b.push("f_color",i);b.push("f_color_",i);b.push("light_color",f.light(i,k,m));b.push("dark_color",f.dark(i,0.8*k,m));b.push("light_color2",f.light(i,2*k,m));b.is3D()&&!b.get("xAngle_")&&(c=f.vectorP2P(b.get("xAngle"),b.get("yAngle")),b.push("xAngle_",c.x),b.push("yAngle_",c.y))}});f.Component=f.extend(f.Painter,{configure:function(b){f.Component.superclass.configure.apply(this,arguments);this.type="component";this.set({fontsize:12,font:"Verdana",fontweight:"normal",fontunit:"px",tip:{enable:!1,border:{width:2}}});this.ICHARTJS_CHART=this.proxy=this.atomic=!1;this.inject(b)},initialize:function(){f.DefineAbstract("isEventValid",this);f.DefineAbstract("doDraw",this);this.doConfig();this.initialization=!0},getDimension:function(){return{x:this.x,y:this.y,width:this.get("width"),height:this.get("height")}},destroy:function(){this.tip&&this.tip.destroy()},doConfig:function(){f.Component.superclass.doConfig.call(this);var b=this._(),c=b.get(b.W),e=b.get("maxwidth"),i=b.get(b.X);if(c&&e&&(c=b.push(b.W,f.parsePercent(c,e)),c>e&&(c=b.push("width",e)),e>c)){var k=b.get("align")||b.C;k==b.C?i+=(e-c)/2:k==b.R&&(i+=e-c)}b.x=b.push(b.X,i+b.get("offsetx"));b.y=b.push(b.Y,b.get(b.Y)+b.get("offsety"));b.push("fontStyle",f.getFont(b.get("fontweight"),b.get("fontsize"),b.get("font"),b.get("fontunit")));b.data=b.get("data");b.get("tip.enable")&&(b.pushIf("tip.border.color",b.get("f_color")),f.isFunction(b.get("tip.invokeOffset"))||b.push("tip.invokeOffset",b.tipInvoke()))},isMouseOver:function(b){return this.isEventValid(b,this)},redraw:function(b){this.root.draw(b,this.root.Combination)},last:f.emptyFn,commonDraw:function(b){b.proxy||b.doDraw.call(b,b)}});f.Custom=f.extend(f.Component,{configure:function(){f.Custom.superclass.configure.apply(this,arguments);this.type="custom";this.set({drawFn:f.emptyFn,configFn:f.emptyFn,eventValid:void 0,animating_draw:!0})},doDraw:function(b){b.get("drawFn").call(b,b)},isEventValid:function(b,c){return f.isFunction(this.get("eventValid"))?this.get("eventValid").call(this,b,c):{valid:!1}},doConfig:function(){f.Custom.superclass.doConfig.call(this);var b=this._();b.A_draw=b.get("animating_draw");b.variable.animation={animating:!1,time:0};b.duration=0;b.get("configFn").call(b,b)}});(function(b){function c(a){"string"===typeof a&&(a=b(a));if(!a||!a.tagName||"canvas"!=a.tagName.toLowerCase())throw Error("there not a canvas element");this.canvas=a;this.c=this.canvas.getContext("2d")}var e=Math.PI,f=e/90,k=f/2,m=Math.ceil,p=Math.floor,y=2*e,u=Math.max,r=Math.min,q=Math.sin,t=Math.cos,n=function(a,b){return 1==a?p(b)+0.5:Math.round(b)},J=function(a,b,h,d){var c=b.x,e=b.y,l=a[h-1],f=a[h+1],i,j;if(h<a.length-1){var a=l.y,h=f.y,k;i=(d*c+l.x)/(d+1);j=(d*e+a)/(d+1);f=(d*c+f.x)/(d+1);d=(d*e+h)/(d+1);k=(d-j)*(f-c)/(f-i)+e-d;j+=k;d+=k;j>a&&j>e?(j=u(a,e),d=2*e-j):j<a&&j<e&&(j=r(a,e),d=2*e-j);d>h&&d>e?(d=u(h,e),j=2*e-d):d<h&&d<e&&(d=r(h,e),j=2*e-d);b.rcx=f;b.rcy=d}return[l.rcx||l.x,l.rcy||l.y,i||c,j||e,c,e]},F=function(a){return b.isNumber(a)?a:b.parseFloat(a,a)},C=function(a,g){var h,d=0,c,e=0,l=!1,f=g.get("labels");g.data=a;if("simple"==g.dataType)g.total=0,a.each(function(a){a.background_color=a.color;d=a.value||0;if(b.isArray(d)){var j=0;e=d.length>e?d.length:e;for(var f=0;f<d.length;f++)d[f]=F(d[f]),j+=d[f],l||(h=c=d[f],l=!0),h=u(d[f],h),c=r(d[f],c);a.total=j}else d=F(d),a.value=d,g.total+=d,l||(h=c=d,l=!0),h=u(d,h),c=r(d,c)},g),b.isArray(f)&&(e=f.length>e?f.length:e),g.push("maxItemSize",e);else if("stacked"==g.dataType||"complex"==g.dataType){var i=f.length,j,k,o,m="stacked"==g.dataType;if(0==i)for(var i=a[0].value.length,n=0;n<i;n++)f.push("");g.columns=[];for(n=0;n<i;n++)j=[],k=0,a.each(function(g,e){if(d=g.value[n])g.value[n]=d=F(d,d),k+=d,m?o=a[e].color:(o=g.color,l||(h=c=d,l=!0),h=u(d,h),c=r(d,c)),j.push(b.applyIf({name:g.name,value:g.value[n],background_color:o,color:o},b.isArray(g.extra)?g.extra[n]||{}:g))}),m&&(l||(h=c=d,l=!0),h=u(k,h),c=r(k,c)),g.columns.push({total:k,name:f[n],item:j})}g.push("minValue",c);g.push("maxValue",h);g.doConfig();g.initialization=!0};c.prototype={getContext:function(){return this.c},css:function(a,g){if(b.isDefined(g))this.canvas.style[a]=g;else return this.canvas.style[a]},ellipse:function(a,b,h,d,c,e,l,v,k,j,n,o,m,p){m=!!m;this.save().gCo(p).strokeStyle(v,k,j).shadowOn(n).fillStyle(l).moveTo(a,b).beginPath();for(m&&this.moveTo(a,b);c<=e;)this.lineTo(a+h*t(c),b+d*q(c)),c+=f;return this.lineTo(a+h*t(e),b+d*q(e)).closePath().stroke(v).fill(l).restore()},arc:function(a,b,h,d,c,e,l,f,i,j,k,o,n,m){f&&(h-=p(i/2));if(0>=h)return this;this.save().gCo(m).strokeStyle(f,i,j).fillStyle(l).beginPath();d?(this.moveTo(a+t(c)*(h-d),b+q(c)*(h-d)).lineTo(a+t(c)*h,b+q(c)*h),this.c.arc(a,b,h,c,e,o),this.lineTo(a+t(e)*(h-d),b+q(e)*(h-d)),this.c.arc(a,b,h-d,e,c,!o)):(this.c.arc(a,b,h,c,e,o),n&&this.lineTo(a,b));this.closePath();f?this.shadowOn(k).stroke(f).shadowOff().fill(l):this.shadowOn(k).fill(l);return this.restore()},sector:function(a,b,h,d,c,e,l,f,i,j,k,o,n,m){k&&this.arc(a,b,h,d,c,e,l,f,i,j,k,o,!n,!m);return this.arc(a,b,h,d,c,e,l,f,i,j,!1,o,!n)},sector3D:function(){var a=function(a,g,d,h,c,e,k,o,n){var k=function(b,c){this.lineTo(a+d*t(b),g+(c||0)+h*q(b))},m=c;for(this.fillStyle(b.dark(n)).moveTo(a+d*t(c),g+h*q(c)).beginPath();m<=e;)k.call(this,m),m+=f;k.call(this,e);this.lineTo(a+d*t(e),g+o+h*q(e));for(m=e;m>=c;)k.call(this,m,o),m-=f;k.call(this,c,o);this.lineTo(a+d*t(c),g+h*q(c)).closePath().fill(!0)},g=function(a,b,g,d,h,c,e,f){g=a+g*t(e);d=b+c+d*q(e);this.moveTo(a,b).beginPath().fillStyle(f).lineTo(a,b+c).lineTo(g,d).lineTo(g,d-c).lineTo(a,b).closePath().fill(!0)},h=function(a,d,h,c,e,j,f,i,k){var m=b.quadrantd(e),n=b.quadrantd(j),k=b.dark(k);(1==m||2==m)&&g.call(this,a,d,h,c,f,i,e,k);(0==n||3==n)&&g.call(this,a,d,h,c,f,i,j,k)},d=function(b,g,d,c,e,j,f,i,k,m,n,p,q){this.ellipse(b,g+f,d,c,e,j,i,k,m,n,p,q,!0);h.call(this,b,g,d,c,e,j,q,f,i);this.ellipse(b,g,d,c,e,j,i,k,m,n,!1,q,!0);a.call(this,b,g,d,c,e,j,q,f,i);return this};d.layerPaint=h;d.sPaint=a;d.layerDraw=g;return d}(),textStyle:function(a,b,h){return this.textAlign(a).textBaseline(b).textFont(h)},strokeStyle:function(a,b,h,d){if(a&&(b&&(this.c.lineWidth=b),h&&(this.c.strokeStyle=h),d))this.c.lineJoin=d;return this},globalAlpha:function(a){a&&(this.c.globalAlpha=a);return this},fillStyle:function(a){a&&(this.c.fillStyle=a);return this},arc2:function(a,b,h,d,c,e){h&&this.c.arc(a,b,h,d,c,e);return this},textAlign:function(a){a&&(this.c.textAlign=a);return this},textBaseline:function(a){a&&(this.c.textBaseline=a);return this},textFont:function(a){a&&(this.c.font=a);return this},shadowOn:function(a){a&&(this.c.shadowColor=a.color,this.c.shadowBlur=a.blur,this.c.shadowOffsetX=a.offsetx,this.c.shadowOffsetY=a.offsety);return this},shadowOff:function(){this.c.shadowColor="white";this.c.shadowBlur=this.c.shadowOffsetX=this.c.shadowOffsetY=0;return this},gradient:function(a,b,h,d,c,e,l){var e=e.toLowerCase(),f=a,i=b,j=!e.indexOf("linear"),e=e.substring(14);if(j){switch(e){case "updown":i+=d;break;case "downup":b+=d;break;case "leftright":f+=h;break;case "rightleft":a+=h;break;default:return c[0]}return this.avgLinearGradient(a,b,f,i,c)}a+=h/2;b+=d/2;return this.avgRadialGradient(a,b,l||0,a,b,h>d?d:h,"outin"==e?c.reverse():c)},avgLinearGradient:function(a,b,h,d,c){a=this.createLinearGradient(a,b,h,d);for(b=0;b<c.length;b++)a.addColorStop(b/(c.length-1),c[b]);return a},createLinearGradient:function(a,b,h,d){return this.c.createLinearGradient(a,b,h,d)},avgRadialGradient:function(a,b,h,d,c,e,f){a=this.createRadialGradient(a,b,h,d,c,e);for(b=0;b<f.length;b++)a.addColorStop(b/(f.length-1),f[b]);return a},createRadialGradient:function(a,b,h,d,c,e){return this.c.createRadialGradient(a,b,h,d,c,e)},text:function(a,b,h,d,c,e,f,i,k,j,m,n){return this.save().textStyle(e,f,i).fillText(a,b,h,d,c,k,j,m,n).restore()},fillText:function(a,b,h,d,c,e,f,i,m){a=a.toString();if(!a||!a.length)return this;d=d||!1;e=e||"lr";f=f||16;b=n(0,b);h=n(0,h);a=a.split("tb"==e?"":"\n");1<a.length&&("middle"==this.c.textBaseline?h-=(a.length-1)*f/2:"bottom"==this.c.textBaseline&&(h-=(a.length-1)*f));this.save().fillStyle(c).translate(b,h).rotate(k*m).shadowOn(i);a.each(function(a,c){try{d&&0<d?this.c.fillText(a,0,c*f,d):this.c.fillText(a,0,c*f)}catch(e){console.log(e.message+"["+a+","+b+","+h+"]")}},this);return this.restore()},measureText:function(a){var a=a.split("\n"),b=0;a.each(function(a){b=u(this.measureText(a).width,b)},this.c);return b},moveTo:function(a,b){this.c.moveTo(a||0,b||0);return this},lineTo:function(a,b){this.c.lineTo(a||0,b||0);return this},save:function(){this.c.save();return this},restore:function(){this.c.restore();return this},beginPath:function(){this.c.beginPath();return this},closePath:function(){this.c.closePath();return this},stroke:function(a){a&&this.c.stroke();return this},fill:function(a){a&&this.c.fill();return this},cube:function(a,g,h,d,c,e,f,i,k,j,m,o){a=n(j,a);g=n(j,g);f=f&&0<f?f:c;d=g-f*d;h=n(j,a+f*h);d=n(j,d);o&&(this.polygon(i,k,j,m,o,!1,[{x:a,y:g},{x:h,y:d},{x:h+c,y:d},{x:a+c,y:g}]),this.polygon(i,k,j,m,o,!1,[{x:a,y:g},{x:a,y:g+e},{x:a+c,y:g+e},{x:a+c,y:g}]),this.polygon(i,k,j,m,o,!1,[{x:a+c,y:g},{x:h+c,y:d},{x:h+c,y:d+e},{x:a+c,y:g+e}]));this.polygon(b.dark(i),k,j,m,!1,!1,[{x:a,y:g},{x:h,y:d},{x:h+c,y:d},{x:a+c,y:g}]);this.polygon(i,k,j,m,!1,!1,[{x:a,y:g},{x:a,y:g+e},{x:a+c,y:g+e},{x:a+c,y:g}]);this.polygon(b.dark(i),k,j,m,!1,!1,[{x:a+c,y:g},{x:h+c,y:d},{x:h+c,y:d+e},{x:a+c,y:g+e}]);return this},cube3D:function(a,g,c,d,e,f,l,i,k,j,m,o){a=n(j,a);g=n(j,g);i=!i||0==i?f:i;e?(d=b.vectorP2P(c,d),c=a+i*d.x,d=g-i*d.y):(c=a+i*c,d=g-i*d);for(;6>o.length;)o.push(!1);c=n(j,c);d=n(j,d);i=[];0>d?b.isObject(o[4])&&i.push(b.applyIf({points:[{x:a,y:g-l},{x:c,y:d-l},{x:c+f,y:d-l},{x:a+f,y:g-l}]},o[4])):b.isObject(o[0])&&i.push(b.applyIf({points:[{x:a,y:g},{x:c,y:d},{x:c+f,y:d},{x:a+f,y:g}]},o[0]));b.isObject(o[1])&&i.push(b.applyIf({points:[{x:c,y:d},{x:c,y:d-l},{x:c+f,y:d-l},{x:c+f,y:d}]},o[1]));b.isObject(o[2])&&i.push(b.applyIf({points:[{x:a,y:g},{x:a,y:g-l},{x:c,y:d-l},{x:c,y:d}]},o[2]));b.isObject(o[3])&&i.push(b.applyIf({points:[{x:a+f,y:g},{x:a+f,y:g-l},{x:c+f,y:d-l},{x:c+f,y:d}]},o[3]));0>d?b.isObject(o[0])&&i.push(b.applyIf({points:[{x:a,y:g},{x:c,y:d},{x:c+f,y:d},{x:a+f,y:g}]},o[0])):b.isObject(o[4])&&i.push(b.applyIf({points:[{x:a,y:g-l},{x:c,y:d-l},{x:c+f,y:d-l},{x:a+f,y:g-l}]},o[4]));b.isObject(o[5])&&i.push(b.applyIf({points:[{x:a,y:g},{x:a,y:g-l},{x:a+f,y:g-l},{x:a+f,y:g}]},o[5]));i.each(function(a){this.polygon(a.color,k,j,m,a.shadow,a.alpha,a.points)},this);return this},polygon:function(a,b,c,d,e,f,i,k,m,j){this.save().strokeStyle(b,c,d).beginPath().fillStyle(a).globalAlpha(f).shadowOn(e).moveTo(i[0].x,i[0].y);if(k){this.moveTo(n(c,j[0].x),n(c,j[0].y)).lineTo(n(c,i[0].x),n(c,i[0].y));for(d=1;d<i.length;d++)this.bezierCurveTo(J(i,i[d],d,m));this.lineTo(n(c,j[1].x),n(c,j[1].y))}else for(d=1;d<i.length;d++)this.lineTo(n(c,i[d].x),n(c,i[d].y));return this.closePath().stroke(b).fill(a).restore()},lines:function(a,b,c,d){if(!b)return this;this.save().gCo(d).beginPath().strokeStyle(!0,b,c).moveTo(n(b,a[0]),n(b,a[1]));for(c=2;c<a.length-1;c+=2)this.lineTo(n(b,a[c]),n(b,a[c+1]));return this.stroke(!0).restore()},bezierCurveTo:function(a){this.c.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);return this},label:function(a,b,c){return this.save().beginPath().strokeStyle(!0,b,c).moveTo(n(b,a[0].x),n(b,a[0].y)).bezierCurveTo([a[1].x,a[1].y,a[2].x,a[2].y,a[3].x,a[3].y]).stroke(!0).restore()},lineArray:function(a,b,c,d,e){if(!b)return this;this.save().beginPath().strokeStyle(!0,b,c).moveTo(n(b,a[0].x),n(b,a[0].y));for(c=1;c<a.length;c++)d?this.bezierCurveTo(J(a,a[c],c,e||1.5)):this.lineTo(n(b,a[c].x),n(b,a[c].y));return this.stroke(!0).restore()},dotted:function(a,g,c,d,e,f,i,k,m){if(!e)return this;var a=n(e,a),g=n(e,g),c=n(e,c),d=n(e,d),j=b.distanceP2P(a,g,c,d),q;if(0>=i||j<=i||a!=c&&g!=d)return this.line(a,g,c,d,e,f,m);if(a>c||g>d)q=a,a=c,c=q,q=g,g=d,d=q;this.save().gCo(m).strokeStyle(!0,e,f).beginPath().moveTo(a,g);e=i*(k||1);f=p(j/(i+e));j=j-f*(i+e)>i;k=g==d;f=j?f+1:f;for(m=1;m<=f;m++)this.lineTo(k?a+i*m+e*(m-1):a,k?g:g+i*m+e*(m-1)).moveTo(k?a+(i+e)*m:a,k?g:g+(i+e)*m);j||this.lineTo(c,d);return this.stroke(!0).restore()},line:function(a,b,c,d,e,f,i){if(!e)return this;this.save().gCo(i);return this.beginPath().strokeStyle(!0,e,f).moveTo(n(e,a),n(e,b)).lineTo(n(e,c),n(e,d)).stroke(!0).restore()},round:function(a,b,c,d,e,f){return this.arc(a,b,c,0,0,y,d,!!f,e,f)},round0:function(a,b,c,d,e){return this.arc(a.x,a.y,b,0,0,y,c,!!e,d,e)},fillRect:function(a,b,c,d){this.c.fillRect(a,b,c,d);return this},translate:function(a,b){this.c.translate(a,b);return this},rotate:function(a){this.c.rotate(a);return this},clearRect:function(a,b,c,d){c=c||this.canvas.width;d=d||this.canvas.height;this.c.clearRect(a||0,b||0,c,d);return this},gCo:function(a){return a?this.gCO(a):this},gCO:function(a){this.c.globalCompositeOperation=a?"destination-over":"source-over";return this},box:function(a,c,h,d,f,i,k,q,r){f=f||{enable:0};if(f.enable){var j=f.width,w=f.color,o=f.radius,s=b.isNumber(j),j=b.parsePadding(j);j[0]==j[1]&&j[1]==j[2]&&j[2]==j[3]&&(s=!0);q=q?1:-1;h+=q*(j[1]+j[3])/2;d+=q*(j[0]+j[2])/2;a-=q*(j[3]/2);c-=q*(j[0]/2);j=s?j[0]:j;o=!s||!o||0==o||"0"==o?0:b.parsePadding(o)}this.save().gCo(r).fillStyle(i).strokeStyle(s,j,w);o?this.beginPath().moveTo(n(j,a+o[0]),n(j,c)).lineTo(n(j,a+h-o[1]),n(j,c)).arc2(n(j,a+h-o[1]),n(j,c+o[1]),o[1],3*e/2,y).lineTo(n(j,a+h),n(j,c+d-o[2])).arc2(n(j,a+h-o[2]),n(j,c+d-o[2]),o[2],0,e/2).lineTo(n(j,a+o[3]),n(j,c+d)).arc2(n(j,a+o[3]),n(j,c+d-o[3]),o[3],e/2,e).lineTo(n(j,a),n(j,c+o[0])).arc2(n(j,a+o[0]),n(j,c+o[0]),o[0],e,3*e/2).closePath().shadowOn(k).stroke(j).shadowOff().fill(i):!f.enable||s?(j&&f.enable&&(this.shadowOn(k).c.strokeRect(a,c,h,d),this.shadowOff()),i&&this.fillRect(a,c,h,d)):(j&&(w=b.isArray(w)?w:[w,w,w,w],this.shadowOn(k).line(a+h,c+j[0]/2,a+h,c+d-j[0]/2,j[1],w[1],0).line(a,c+j[0]/2,a,c+d-j[0]/2,j[3],w[3],0).line(p(a-j[3]/2),c,a+h+j[1]/2,c,j[0],w[0],0).line(p(a-j[3]/2),c+d,a+h+j[1]/2,c+d,j[2],w[2],0).shadowOff()),i&&this.beginPath().moveTo(p(a+j[3]/2),p(c+j[0]/2)).lineTo(m(a+h-j[1]/2),c+j[0]/2).lineTo(m(a+h-j[1]/2),m(c+d-j[2]/2)).lineTo(p(a+j[3]/2),m(c+d-j[2]/2)).lineTo(p(a+j[3]/2),p(c+j[0]/2)).closePath().fill(i));return this.restore()},toDataURL:function(a){return this.canvas.toDataURL(a||"image/png")},addEvent:function(a,c,e){b.Event.addEvent(this.canvas,a,c,e)}};b.taylor={light:function(a,b){b.highlight=!1;a.on("mouseover",function(){b.highlight=!0;a.redraw("mouseover")}).on("mouseout",function(){b.highlight=!1;a.redraw("mouseout")}).on("beforedraw",function(){a.push("f_color",b.highlight?a.get("light_color"):a.get("f_color_"));return!0})}};b.Chart=b.extend(b.Painter,{configure:function(){b.Chart.superclass.configure.apply(this,arguments);this.type="chart";this.dataType="simple";this.set({id:"",render:"",data:[],width:void 0,height:void 0,lineJoin:"round",align:"center",default_mouseover_css:!0,turn_off_touchmove:!1,showpercent:!1,decimalsnum:1,title:{text:"",fontweight:"bold",fontsize:20,height:30},subtitle:{text:"",fontweight:"bold",fontsize:16,height:20},footnote:{text:"",color:"#5d7f97",textAlign:"right",height:20},animation:!1,doAnimation:null,animation_timing_function:"easeInOut",animation_duration:1E3,z_index:999,legend:{enable:!1},tip:{enable:!1}});this.registerEvent("beforeAnimation","afterAnimation","resize","animating");this.T=null;this.show=this.Animationed=this.Combination=this.Rendered=!1;this.data=[];this.plugins=[];this.components=[];this.oneways=[];this.total=0;this.ICHARTJS_CHART=!0},toDataURL:function(a){return this.T.toDataURL(a)},segmentRect:function(){this.Combination||this.T.clearRect()},resetCanvas:function(){this.Combination||this.T.box(this.get("l_originx"),this.get("t_originy"),this.get("client_width"),this.get("client_height"),0,this.get("f_color"),0,0,!0)},animation:function(a){a.segmentRect();a.coo&&!a.ILLUSIVE_COO&&a.coo.draw();a.doAnimation(a.variable.animation.time,a.duration,a);a.plugins.each(function(b){b.A_draw&&(b.variable.animation.animating=!0,b.variable.animation.time=a.variable.animation.time,b.draw(),b.variable.animation.animating=!1)});a.Combination||(a.oneways.each(function(a){a.draw()}),a.variable.animation.time<a.duration?(a.variable.animation.time++,b.requestAnimFrame(function(){a.animation(a)})):b.requestAnimFrame(function(){a.Animationed=!0;a.plugins.each(function(a){a.Animationed=!0});a.processAnimation=!1;a.draw();a.plugins.each(function(a){a.processAnimation=!1});a.fireEvent(a,"afterAnimation",[a])}))},runAnimation:function(a){a.fireEvent(a,"beforeAnimation",[a]);a.A_draw||(a.variable.animation={type:0,time:0,queue:[]});a.processAnimation=!0;a.animation(a)},doSort:function(){var a=function(a,c){return(b.isArray(a)?a.zIndex||0:a.get("z_index"))>(b.isArray(c)?c.zIndex||0:c.get("z_index"))};this.components.sor(a);this.oneways.sor(a)},commonDraw:function(a,c){a.show=!1;a.redraw||(b.Assert.isTrue(a.Rendered,a.type+" has not rendered"),b.Assert.isTrue(a.data&&0<a.data.length,a.type+"'s data is empty"),b.Assert.isTrue(a.initialization,a.type+" Failed to initialize"),a.doSort());a.redraw=!0;!a.Animationed&&a.get("animation")?a.runAnimation(a):(a.segmentRect(),a.components.eachAll(function(a){a.draw(c)}),a.components.eachAll(function(a){a.last&&a.last(a)}),a.oneways.each(function(a){a.draw()}),a.show=!0)},plugin:function(a){var b=this._();a.inject(b);a.ICHARTJS_CHART&&(a.Combination=!0,a.setUp());b.get("animation")||a.push("animation",!1);a.duration=b.duration;b.register(a);b.plugins.push(a)},destroy:function(a){a.components.eachAll(function(a){a.destroy()});a.oneways.each(function(a){a.destroy()})},getTitle:function(){return this.title},getSubTitle:function(){return this.subtitle},getFootNote:function(){return this.footnote},getDrawingArea:function(){return{x:this.get("l_originx"),x:this.get("t_originy"),width:this.get("client_width"),height:this.get("client_height")}},create:function(a,e){if(a.get("fit")){var f=window.innerWidth,d=window.innerHeight,i=b.getDoc().body.style;i.padding="0px";i.margin="0px";i.overflow="hidden";a.push(a.W,f);a.push(a.H,d)}a.canvasid=b.uid(a.type);a.shellid="shell-"+a.canvasid;f=[];f.push("<div id='");f.push(a.shellid);f.push("' style='padding:0px;margin:0px;overflow:hidden;position:relative;'>");f.push("<canvas id= '");f.push(a.canvasid);f.push("' style='-webkit-text-size-adjust: none;'>");f.push("<p>Your browser does not support the canvas element</p></canvas>");f.push("</div>");e.innerHTML=f.join("");a.shell=b(a.shellid);a.T=a.target=new c(a.canvasid);a.size(a);a.Rendered=!0},setUp:function(){var a=this._();a.redraw=!1;a.T.clearRect();a.initialization=!1;a.initialize()},load:function(a){var b=this._();b.push("data",a||[]);b.setUp();(b.Combination?b.root:b).draw()},resize:function(a,c){var a=b.parseFloat(a),c=b.parseFloat(c),e=this._();e.Combination||(e.width=e.push(e.W,a),e.height=e.push(e.H,c),e.size(e));e.set(e.fireEvent(e,"resize",[a,c]));e.setUp();e.plugins.eachAll(function(b){b.Combination&&b.resize(a,c)});e.Combination||e.draw()},size:function(a){a.T.canvas.width=a.width=a.pushIf(a.W,400);a.T.canvas.height=a.height=a.pushIf(a.H,300);a.shell.style.width=a.width+"px";a.shell.style.height=a.height+"px"},initialize:function(){var a=this._(),c=a.get("data"),e=a.get("render");a.push(a.X,null);a.push(a.Y,null);a.Combination?(b.apply(a.options,b.clone([a.W,a.H,"padding","border","client_height","client_width","minDistance","maxDistance","centerx","centery","l_originx","r_originx","t_originy","b_originy"],a.root.options,!0)),a.width=a.get(a.W),a.height=a.get(a.H),a.shell=a.root.shell,a.Rendered=!0):a.Rendered||e&&a.create(a,b(e));a.Rendered&&!a.initialization&&(c&&0<c.length?C.call(a,c,a):b.isString(a.get("url"))&&a.ajax.call(a,a.get("url"),function(b){a.push("data",b);a.initialize();a.draw()}))},eventOff:function(){this.stopEvent=!0},eventOn:function(){this.stopEvent=!1},oneWay:function(a){a.T.strokeStyle(!0,0,a.get("strokeStyle"),a.get("lineJoin"));a.processAnimation=a.get("animation");b.isFunction(a.get("doAnimation"))&&(a.doAnimation=a.get("doAnimation"));a.animationArithmetic=b.getAA(a.get("animation_timing_function"));var c=a.variable.event,e=a.Combination,d=!a.get("turn_off_touchmove")&&!e,f=!b.touch&&a.get("default_mouseover_css")&&!e,i,k=b.touch?["touchstart","touchmove"]:["click","mousemove"];a.stopEvent=!1;a.A_draw=e&&a.processAnimation;b.register(a);e||k.each(function(c){a.T.addEvent(c,function(d){a.processAnimation||a.stopEvent||d.targetTouches&&d.targetTouches.length!=1||a.fireEvent(a,c,[a,b.Event.fix(d)])},false)});a.on(k[0],function(a,b){a.components.eachAll(function(a){if(a.ICHARTJS_CHART){if(a.fireEvent(a,k[0],[a,b])){c.click=true;return false}}else{var d=a.isMouseOver(b);if(d.valid){c.click=true;a.fireEvent(a,"click",[a,b,d]);return!b.stopPropagation}}});if(c.click){d&&b.event.preventDefault();c.click=false;return true}});if(!b.touch||d)if(a.on(k[1],function(a,b){i=false;a.components.eachAll(function(a){if(a.ICHARTJS_CHART){if(a.fireEvent(a,k[1],[a,b])){i=true;return false}}else{var c=a.variable.event,d=a.isMouseOver(b);if(d.valid){i=i||a.atomic;if(!c.mouseover){c.mouseover=true;a.fireEvent(a,"mouseover",[a,b,d])}a.fireEvent(a,"mousemove",[a,b,d]);if(d.stop)return false}else if(c.mouseover){c.mouseover=false;a.fireEvent(a,"mouseout",[a,b,d])}return!b.stopPropagation}});if(c.mouseover){b.event.preventDefault();if(!i){c.mouseover=false;a.fireEvent(a,"mouseout",[a,b])}return c.mouseover}if(i){c.mouseover=i;a.fireEvent(a,"mouseover",[a,b])}}),f)a.on("mouseover",function(){a.T.css("cursor","pointer")}).on("mouseout",function(){a.T.css("cursor","default")});b.applyIf(a.get("sub_option"),b.clone(["shadow","tip"],a.options,!0));a.Combination||(a.bg=new b.Custom({z_index:-1,drawFn:function(){a.T.box(0,0,a.width,a.height,a.get("border"),a.get("f_color"),0,0,true)}}),a.duration=m(a.get("animation_duration")*b.FRAME/1E3));a.oneWay=b.emptyFn},originXY:function(a,b,c){var d=a.get("align");d==a.L?a.pushIf(a.X,b[0]):d==a.R?a.pushIf(a.X,b[1]):a.pushIf(a.X,b[2]);a.x=a.push(a.X,a.get(a.X)+a.get("offsetx"));a.y=a.push(a.Y,c[0]+a.get("offsety"));return{x:a.x,y:a.y}},getPercent:function(a,b){return this.get("showpercent")?(100*(a/(b||this.total||1))).toFixed(this.get("decimalsnum"))+"%":a},doActing:function(a,c,e,d,f){var i=!!a.get("communal_acting"),k=a.getPercent(c.value,c.total);a.push(i?"sub_option":"communal_acting",b.clone(a.get(i?"communal_acting":"sub_option"),!0));b.merge(a.get("sub_option"),c);b.merge(a.get("sub_option"),e);a.push("sub_option.value",k);a.push("sub_option.value_",c.value);a.get("sub_option.tip.enable")&&(a.push("sub_option.tip.text",f||c.name+" "+k),a.push("sub_option.tip.name",c.name),a.push("sub_option.tip.index",d),a.push("sub_option.tip.value",c.value),a.push("sub_option.tip.total",c.total||a.total))},register:function(a){a.id=b.uid(a.type);this.components.push(a);return a},remove:function(a,b){b&&a.components.each(function(c,d){if(b.id==c.id)return a.components.splice(d,1),!1})},doConfig:function(){b.Chart.superclass.doConfig.call(this);var a=this._();a.destroy(a);a.oneways.length=0;a.oneWay(a);a.push("communal_acting",0);if(!a.Combination){a.oneways.push(a.bg);a.push("r_originx",a.width-a.get("padding_right"));a.push("b_originy",a.height-a.get("padding_bottom"));a.applyGradient();b.isString(a.get("title"))&&a.push("title",b.applyIf({text:a.get("title")},a.default_.title));b.isString(a.get("subtitle"))&&a.push("subtitle",b.applyIf({text:a.get("subtitle")},a.default_.subtitle));b.isString(a.get("footnote"))&&a.push("footnote",b.applyIf({text:a.get("footnote")},a.default_.footnote));var c=0,e=a.push("l_originx",a.get("padding_left")),d=a.push("t_originy",a.get("padding_top")),f=a.push("client_width",a.width-a.get("hpadding"));if(""!=a.get("title.text")){var i=""!=a.get("subtitle.text"),c=i?a.get("title.height")+a.get("subtitle.height"):a.get("title.height"),d=a.push("t_originy",d+c);a.push("title.originx",e);a.push("title.originy",a.get("padding_top"));a.push("title.maxwidth",f);a.pushIf("title.width",f);a.title=new b.Text(a.get("title"),a);a.oneways.push(a.title);i&&(a.push("subtitle.originx",e),a.push("subtitle.originy",a.get("padding_top")+a.get("title.height")),a.pushIf("subtitle.width",f),a.push("subtitle.maxwidth",f),a.subtitle=new b.Text(a.get("subtitle"),a),a.oneways.push(a.subtitle))}""!=a.get("footnote.text")&&(i=a.get("footnote.height"),c+=i,a.push("b_originy",a.get("b_originy")-i),a.push("footnote.originx",e),a.push("footnote.originy",a.get("b_originy")),a.push("footnote.maxwidth",f),a.pushIf("footnote.width",f),a.footnote=new b.Text(a.get("footnote"),a),a.oneways.push(a.footnote));c=a.push("client_height",a.get(a.H)-a.get("vpadding")-a.pushIf("other_height",c));a.push("minDistance",r(f,c));a.push("maxDistance",u(f,c));a.push("centerx",e+f/2);a.push("centery",d+c/2)}a.get("legend.enable")&&(a.legend=new b.Legend(b.apply({maxwidth:a.get("client_width"),data:a.data},a.get("legend")),a),a.oneways.push(a.legend));a.push("sub_option.tip.wrap",a.push("tip.wrap",a.shell))}})})(f);f.Legend=f.extend(f.Component,{configure:function(){f.Legend.superclass.configure.apply(this,arguments);this.type="legend";this.set({data:void 0,width:"auto",column:1,row:"max",maxwidth:0,line_height:16,sign:"square",sign_size:10,sign_space:5,legend_space:5,z_index:1009,text_with_sign_color:!1,align:"right",valign:"middle"});this.atomic=!0;this.registerEvent("parse")},isEventValid:function(b,c){var e={valid:!1};b.x>this.x&&b.x<c.x+c.width&&b.y>c.y&&b.y<c.y+c.height&&c.data.each(function(f,k){if(b.x>f.x&&b.x<f.x+f.width_+c.get("signwidth")&&b.y>f.y&&b.y<f.y+c.get("line_height"))return e={valid:!0,index:k,target:f},!1},c);return e},drawCell:function(b,c,e,f,k,m){var p=m.get("sign_size"),y=m.getPlugin("sign");if(!y||!y.call(m,m.T,k,{x:b+p/2,y:c},p,f))-1!=k.indexOf("bar")&&m.T.box(b,c-p/12,p,p/6,0,f),"round"==k?m.T.round(b+p/2,c,p/2,f):"round-bar"==k?m.T.round(b+p/2,c,p/4,f):"square-bar"==k?m.T.box(b+p/4,c-p/4,p/2,p/2,0,f):"square"==k&&m.T.box(b,c-p/2,p,p,0,f);m.T.fillText(e,b+m.get("signwidth"),c,0,m.get("text_with_sign_color")?f:m.get("color"),"lr",m.get("line_height"))},doDraw:function(b){b.T.box(b.x,b.y,b.width,b.height,b.get("border"),b.get("f_color"),!1,b.get("shadow"));b.T.textStyle(b.L,"middle",f.getFont(b.get("fontweight"),b.get("fontsize"),b.get("font")));b.data.each(function(c){b.drawCell(c.x,c.y,c.text,c.color,c.sign,b)})},doLayout:function(b,c){var e=b.get("sign_size"),i=0,k=0,m=0,p=b.get("column"),y=b.get("row"),u=b.data.length;b.T.textFont(b.get("fontStyle"));b.get("line_height")<e&&b.push("line_height",e+e/5);b.push("signwidth",e+b.get("sign_space"));b.data.each(function(c){c.width_=b.T.measureText(c.text)},b);for(var r=0;r<p;r++){for(var m=0,q=r;q<u;q+=p)m=Math.max(m,b.data[q].width_);b.columnwidth[r]=m;i+=m}for(r=0;r<y;r++){m=0;for(q=r*p;q<u;q++)m=Math.max(m,b.data[q].text.split("\n").length);b.columnheight[r]=m;k+=m}i=b.push(b.W,i+b.get("hpadding")+b.get("signwidth")*p+(p-1)*b.get("legend_space"));if(i>b.get("maxwidth")&&(e=Math.floor(b.get("fontsize")*(b.get("maxwidth")/i)),!(10>e&&1==p))){9<e?b.push("fontStyle",f.getFont(b.get("fontweight"),b.push("fontsize",e),b.get("font"))):1<p&&b.push("row",Math.ceil(u/b.push("column",p-1)));b.doLayout(b,c);return}var t;b.width=i;b.height=k=b.push(b.H,k*b.get("line_height")+b.get("vpadding"));b.y=b.get("valign")==b.O?c.get("t_originy"):b.get("valign")==b.B?c.get("b_originy")-k:c.get("centery")-k/2;b.x=b.get("align")==b.L?c.get("l_originx"):b.get("align")==b.C?c.get("centerx")-i/2:c.get("r_originx")-i;b.x=b.push(b.X,(0>b.x?c.get("l_originx"):b.x)+b.get("offsetx"));b.y=b.push(b.Y,(0>b.y?c.get("t_originy"):b.y)+b.get("offsety"));m=b.y+b.get("padding_top");e=b.get("legend_space")+b.get("signwidth");for(r=0;r<y;r++){k=b.x+b.get("padding_left");t=b.columnheight[r]/2*b.get("line_height");m+=t;for(q=0;q<p&&r*p+q<u;q++)i=b.data[r*p+q],i.y=m,i.x=k,k+=b.columnwidth[q]+e;m+=t}},doConfig:function(){f.Legend.superclass.doConfig.call(this);var b=this._(),c=b.root,e=f.isNumber(b.get("column")),i=f.isNumber(b.get("row")),k=b.data.length;b.get("align")==b.C&&"middle"==b.get("valign")&&b.push("valign",b.O);c.get("align")==b.L&&"middle"==b.get("valign")&&b.push("align",b.R);b.data.each(function(c,e){f.merge(c,b.fireEvent(b,"parse",[b,c.name,e]));c.text=c.text||c.name||"";c.sign=c.sign||b.get("sign")},b);!e&&!i&&(e=b.push("column",1));e&&!i&&(i=b.push("row",Math.ceil(k/b.get("column"))));!e&&i&&(e=b.push("column",Math.ceil(k/b.get("row"))));e=b.get("column");i=b.get("row");k>i*e&&(i+=Math.ceil((k-i*e)/e),i=b.push("row",i));b.columnwidth=[];b.columnheight=[];b.doLayout(b,c)}});f.CrossHair=f.extend(f.Html,{configure:function(){f.CrossHair.superclass.configure.apply(this,arguments);this.type="crosshair";this.set({top:0,left:0,hcross:!0,vcross:!0,invokeOffset:null,line_width:1,line_color:"#1A1A1A",delay:200})},follow:function(b,c,e){e.get("invokeOffset")?(b=e.get("invokeOffset")(b,c))&&b.hit?(e.o_valid=!0,e.position(b.top-e.top,b.left-e.left,e)):(!b||!e.o_valid)&&e.position(e.owidth,e.oheight,e):e.position(b.y-e.top-1,b.x-e.left-1,e)},position:function(b,c,e){e.horizontal.style.top=b-e.size+"px";e.vertical.style.left=c-e.size+"px"},doCreate:function(b,c,e){var i=document.createElement("div");i.style.width=f.toPixel(c);i.style.height=f.toPixel(e);i.style.backgroundColor=b.get("line_color");i.style.position="absolute";b.dom.appendChild(i);return i},doAction:function(b){b.T.on("mouseover",function(c,e,f){b.show(e,f)}).on("mouseout",function(c,e,f){b.hidden(e,f)}).on("mousemove",function(c,e,f){b.follow(e,f,b)})},initialize:function(){f.CrossHair.superclass.initialize.call(this);var b=this._(),c=f.toPixel(b.get("line_width"));b.size=b.get("line_width")/2;b.top=f.fixPixel(b.get(b.O));b.left=f.fixPixel(b.get(b.L));b.owidth=-b.T.root.width;b.oheight=-b.T.root.height;b.o_valid=!1;b.css("width","0px");b.css("height","0px");b.css("top",b.top+"px");b.css("left",b.left+"px");b.css("visibility","hidden");b.horizontal=b.doCreate(b,b.get("hcross")?f.toPixel(b.get(b.W)):"0px",c);b.vertical=b.doCreate(b,c,b.get("vcross")?f.toPixel(b.get(b.H)):"0px")}});f.Tip=f.extend(f.Html,{configure:function(){f.Tip.superclass.configure.apply(this,arguments);this.type="tip";this.set({name:"",index:0,value:"",text:"",showType:"follow",invokeOffset:null,fade_duration:300,move_duration:100,timing_function:"ease-out",invokeOffsetDynamic:!1,style:"textAlign:left;padding:4px 5px;cursor:pointer;backgroundColor:rgba(239,239,239,.85);fontSize:12px;color:black;",border:{enable:!0,radius:5},delay:200});this.registerEvent("parseText")},position:function(b,c,e){e.style.top=(0>b?0:b)+"px";e.style.left=(0>c?0:c)+"px"},follow:function(b,c,e){e.get("invokeOffsetDynamic")?c.hit&&((f.isString(c.text)||f.isNumber(c.text))&&e.text(c.name,c.value,c.text,c.i,e),b=e.get("invokeOffset")(e.width(),e.height(),c),e.position(b.top,b.left,e)):"follow"!=e.get("showType")&&f.isFunction(e.get("invokeOffset"))?(b=e.get("invokeOffset")(e.width(),e.height(),c),e.position(b.top,b.left,e)):e.position(b.y-1.1*e.height()-2,b.x+2,e)},text:function(b,c,e,f,k){k.dom.innerHTML=k.fireString(k,"parseText",[k,b,c,e,f],e)},hidden:function(){this.get("animation")?this.css("opacity",0):this.css("visibility","hidden")},doAction:function(b){b.T.on("mouseover",function(c,e,f){b.show(e,f)}).on("mouseout",function(c,e){b.hidden(e)});if("follow"==b.get("showType"))b.T.on("mousemove",function(c,e,f){b.T.variable.event.mouseover&&setTimeout(function(){b.T.variable.event.mouseover&&b.follow(e,f,b)},b.get("delay"))})},initialize:function(){f.Tip.superclass.initialize.call(this);var b=this._();b.text(b.get("name"),b.get("value"),b.get("text"),b.get("index"),b);b.hidden();if(b.get("animation")){var c=b.get("move_duration")/1E3+"s "+b.get("timing_function")+" 0s";b.transition("opacity "+b.get("fade_duration")/1E3+"s "+b.get("timing_function")+" 0s");b.transition("top "+c);b.transition("left "+c);b.onTransitionEnd(function(){0==b.css("opacity")&&b.css("visibility","hidden")},!1)}}});f.Text=f.extend(f.Component,{configure:function(){f.Text.superclass.configure.apply(this,arguments);this.type="text";this.set({text:"",textAlign:"center",align:"center",background_color:0,textBaseline:"top",border:{enable:!1},width:0,height:0,padding:0,writingmode:"lr",line_height:16,rotate:0});this.registerEvent()},doDraw:function(b){b.get("box_feature")&&b.T.box(b.x,b.y,b.get(b.W),b.get(b.H),b.get("border"),b.get("f_color"));b.T.text(b.get("text"),b.get("textx"),b.get("texty"),b.get(b.W)-b.get("hpadding"),b.get("color"),b.get("textAlign"),b.get("textBaseline"),b.get("fontStyle"),b.get("writingmode"),b.get("line_height"),b.get("shadow"),b.get("rotate"))},isEventValid:function(){return{valid:!1}},doLayout:function(b,c,e,f){f.x=f.push(f.X,f.x+b);f.y=f.push(f.Y,f.y+c);f.push("textx",f.get("textx")+b);f.push("texty",f.get("texty")+c)},doConfig:function(){f.Text.superclass.doConfig.call(this);var b=this._(),c=b.x,e=b.y+b.get("padding_top"),i=b.get(b.W),k=b.get(b.H),m=b.get("textAlign"),c=c+(m==b.C?i/2:m==b.R?i-b.get("padding_right"):b.get("padding_left"));k&&(e+=k/2,b.push("textBaseline","middle"));b.push("textx",c);b.push("texty",e);b.push("box_feature",i&&k);b.applyGradient()}})})(iChart);