Skip to content

Instantly share code, notes, and snippets.

@soumyasankarduttagit
Created November 29, 2019 08:20
Show Gist options
  • Save soumyasankarduttagit/8663bb2891781024ccbf2e3ddce7ffb0 to your computer and use it in GitHub Desktop.
Save soumyasankarduttagit/8663bb2891781024ccbf2e3ddce7ffb0 to your computer and use it in GitHub Desktop.
/*
FusionCharts JavaScript Library - KDtree
Copyright FusionCharts Technologies LLP
License Information at <http://www.fusioncharts.com/license>
@version 3.11.3
FusionCharts JavaScript Library
Copyright FusionCharts Technologies LLP
License Information at <http://www.fusioncharts.com/license>
@version 3.11.3
*/
(function(N,Y){"object"===typeof module&&module.exports?module.exports=N.document?Y(N):function(p){if(!p.document)throw Error("Window with document not present");return Y(p,!0)}:N.FusionCharts=Y(N,!0)})("undefined"!==typeof window?window:this,function(N,Y){FusionCharts.register("module",["private","modules.renderer.js-kdtree",function(){function p(l){this.configure(l)}var P=this.hcLib,w=function(l,n){return l.x-n.x},F=function(l,n){return l.y-n.y},X=function(l,n,z,x,p){return Math.pow(z-l,2)+Math.pow(x-
n,2)<=Math.pow(p,2)},O=Math.PI,l=Math.cos,U=Math.sin,u=Math.max,J=Math.min,n=O/180,T=function(l,n,z,x,p,w){return z<=u(l,p)&&z>=J(l,p)&&x<=u(n,w)&&x>=J(n,w)?!0:!1},Q=function(l,n,z,x,p,w){n=(x-n)*(p-z);l=(z-l)*(w-x);isNaN(n)&&(n=0);isNaN(l)&&(l=0);l=n-l;return 0===l?0:0<l?1:2};p.prototype={configure:function(l){this.validatorFn=l?this.shapeValidator():this.defaultValidator()},defaultValidator:function(){var l=this;return function(n){var z=l.mousePoint;return n&&1>=Math.pow((n.x-z.x)/l.xLimit,2)+Math.pow((n.y-
z.y)/l.yLimit,2)?!0:!1}},shapeValidator:function(){var p=this;return function(E){var z=p.mousePoint,x=E&&E.shapeInfo,w=!1,u,D=z.x,z=z.y,A;switch(x&&x.type){case "circle":u=x.radius;w=X(D,z,E.x,E.y,u);break;case "arc":w=x.innerradius;u=x.radius;w=!X(D,z,E.x,E.y,w)&&X(D,z,E.x,E.y,u);break;case "polygon":u=x.radius;A=x.startAngle;x=x.sides;a:{w=E.x;E=E.y;var G,C=0,H,I,K,F,P;G=!1;if(X(D,z,w,E,u)&&3<=x){G=void 0===A?.5*O:A%360*n;P=2*O/x;H=w+u*l(-G);F=E+u*U(-G);for(A=0;A<x;A++){G+=P;I=w+u*l(-G);K=E+u*U(-G);
var R=H,J=F,aa=I,M=K,ba=D,V=z,B=z,fa=Q(R,J,aa,M,ba,V),N=Q(R,J,aa,M,Infinity,B),ga=Q(ba,V,Infinity,B,R,J),da=Q(ba,V,Infinity,B,aa,M);if(fa!==N&&ga!==da||0===fa&&T(R,J,ba,V,aa,M)||0===N&&T(R,J,Infinity,B,aa,M)||0===ga&&T(ba,V,R,J,Infinity,B)||0===da&&T(ba,V,aa,M,Infinity,B)){if(0===Q(H,F,D,z,I,K)){w=T(H,F,D,z,I,K);break a}C++}H=I;F=K}G=0!==C%2}w=G}break;case "rect":w=E.x;u=E.y;E=w+(x.width||0);x=u+(x.height||0);w=D>=w&&D<=E&&z>=u&&z<=x;break;case "default":w=!1}return w}},buildKdTree:function(l){this.tree=
this._buildKdTree(l,!1)},getNeighbour:function(l){var n=this.tree,w={x1:l.x-this.xLimit,x2:l.x+this.xLimit,y1:l.y-this.yLimit,y2:l.y+this.yLimit},p=this.validatorFn;this.mousePoint=l;if(n)return this._searchBtwnLimit(w,n,!1,p)},_compair2closest:function(l,n){if(l){if(n)return n.i>l.i?n:l}else return n;return l},_searchBtwnLimit:function(l,n,w,p){var u,F,D,A;D=w?"x":"y";var G=w?l.x1:l.y1,C=w?l.x2:l.y2;if(n)return u=n.point1?n.point1[D]:C,F=n.point2?n.point2[D]:C,D=n.point3?n.point3[D]:C,p(n.point1)&&
(A=this._compair2closest(A,n.point1)),u>=G&&n.left&&(A=this._compair2closest(A,this._searchBtwnLimit(l,n.left,!w,p))),u<=C&&n.middle1&&(p(n.point2)&&(A=this._compair2closest(A,n.point2)),F>=G&&(A=this._compair2closest(A,this._searchBtwnLimit(l,n.middle1,!w,p))),F<=C&&n.middle2&&(p(n.point3)&&(A=this._compair2closest(A,n.point3)),D>=G&&(A=this._compair2closest(A,this._searchBtwnLimit(l,n.middle2,!w,p))),D<=C&&n.right&&(A=this._compair2closest(A,this._searchBtwnLimit(l,n.right,!w,p))))),A},_buildKdTree:function(l,
n){var p,u,J;if(p=l&&l.length)return l.sort(n?w:F),7<p?(p=Math.floor(p/4),u=2*(p+1)-1,J=3*(p+1)-1,{left:this._buildKdTree(l.slice(0,p),!n),point1:l[p],middle1:this._buildKdTree(l.slice(p+1,u),!n),point2:l[u],middle2:this._buildKdTree(l.slice(u+1,J),!n),point3:l[J],right:this._buildKdTree(l.slice(J+1),!n)}):{left:2<=p?{point1:l[0]}:void 0,point1:1<=p?1===p?l[0]:l[1]:void 0,middle1:3<=p?{point1:l[2]}:void 0,point2:4<=p?l[3]:void 0,middle2:5<=p?{point1:l[4]}:void 0,point3:6<=p?l[5]:void 0,right:7==p?
{point1:l[6]}:void 0}},_setSearchLimit:function(l,n){this.xLimit=l;this.yLimit=n}};p.prototype.constructor=p;P.KdTree=p}]);FusionCharts.register("module",["private","modules.renderer.js-gradientlegend",function(){function p(e,b){(function c(b,f){var h,g;for(g in b)ja.call(b,g)&&(h=b[g],void 0===f[g]?f[g]=h:"object"===typeof h&&c(h,f[g]))})(e,b);return b}function P(e){return ba(e?e:fa)||fa}function w(e){var b=e.fontSize+"";if(!b)return e;b=b.replace(/(\d+)(px)*/,"$1px");e.fontSize=b;return e}function F(e){return void 0===
e||"undefined"===typeof e||null===e||e!==e?!0:!1}function X(e,b){this.carpet=e;this._componentPool=b}function O(e){this.conf=e;this._id="GL_CARPET";this.compositionsByCategory={};this._lSpace=this.group=this.node=void 0;this.autoRecalculate=!1;this.groupName="fc-gradient-legend";this.moveInstructions={}}function l(){O.apply(this,arguments)}function U(e,b){this.rawText=e;this.conf=b;this._id="GL_CAPTION";this._lSpace=this.bound=this.node=void 0}function u(e,b,a){this.colorRange=e;this.conf=b;this.childTextConf=
a;this._id="GL_BODY";this.bound=void 0;this.compositionsByCategory={};this._lSpace=void 0}function J(){u.apply(this,arguments)}function n(e){this.conf=e;this._id="GL_LABELS"}function T(){n.apply(this,arguments)}function Q(){n.apply(this,arguments);this._id="GL_VALUES"}function N(){Q.apply(this,arguments);this._id="GL_VALUES"}function E(e){this.conf=e;this._id="FL_AXIS";this.markerLine=this.shadow=this.node=void 0;this.compositionsByCategory={}}function z(){E.apply(this,arguments)}function x(e){var b=
{};this._id="GL_SG1";this.conf=e;b.conf=e;this.extremes=[];this.sliders={};b.sliderGroup=this;this.valueRange=[];this.callbacks=[];this.sliders[!1]=new Z(!1,b,this._id+"_0");this.sliders[!0]=new Z(!0,b,this._id+"_1")}function Z(e,b,a){this.conf=b.conf;this.sliderIndex=e;this.rangeGroup=b.sliderGroup;this._id=a;this.tracker=this.node=void 0;this.currPos=0;this.swing=[]}function ca(e,b,a){a=a.components.numberFormatter;var c,d,f,h,g,k;this.data=e;this.options=b||{};k=this.mapByPercent=!!e.mapByPercent;
this.appender="";d=this.mapByPercent?0:b.min;b=this.mapByPercent?100:b.max;2===e.colorRange.length&&(c=e.colorRange[0],f=e.colorRange[1],h=c.value=F(c.value)?d:c.value,g=f.value=F(f.value)?b:f.value,h===g&&(h=c.value=d,g=f.value=b),c.displayValue=k?h+"%":a.legendValue(h),f.displayValue=k?g+"%":a.legendValue(g));F(d)&&F(c.value)||F(b)&&F(c.value)||!e.gradient?this._preparationGoneWrong=!0:this._preparationGoneWrong=!1;a=this.colorRange=e.colorRange.sort(function(a,b){return a.value-b.value});this.valueRatio=
void 0;this.values=[];e=0;for(c=a.length;e<c;e++)this.values.push(a[e].value)}function D(){X.apply(this,arguments)}var A=this,G=A.hcLib,C=G.pluckNumber,H=G.pluck,I=G.toRaphaelColor,K=G.graphics,Y=G.dehashify,ia=G.hashify,R=K.convertColor,ha=K.RGBtoHex,aa=K.HEXtoRGB,M=K.getLightColor,ba=K.getValidColor,V="rgba(192,192,192,"+(G.isIE?.002:1E-6)+")",B,fa=G.COLOR_BLACK,ja={}.hasOwnProperty,ga,da={};B=function(){function e(a){var c=b.numberFormatter,h,g,k;h=0;for(g=a.length;h<g;h++)if(k=a[h].maxvalue)a[h].maxvalue=
c.getCleanValue(k)}var b,a,c={legendCarpetConf:{spreadFactor:.85,allowDrag:!1,captionAlignment:"center",padding:{v:3,h:3},style:{fill:"#e4d9c1",stroke:"#c4b89d"}},legendCaptionConf:{spreadFactor:.2,padding:{v:2,h:2},style:{fill:"#786B50",fontFamily:"sans-serif",fontSize:"12px",fontWeight:"bold",fontStyle:"normal"},bound:{style:{stroke:"none"}}},legendBodyConf:{spreadFactor:.8,padding:{v:2,h:2},bound:{style:{stroke:"none"}}}};c.legendAxisConf={legendAxisHeight:11,spreadFactor:.4,padding:{v:1,h:1},
style:{stroke:"none","stroke-opacity":0,"stroke-width":1},line:{grooveLength:3,offset:8,style:{stroke:"rgba(255, 255, 255, 0.65)","stroke-width":1.5}},shadow:{style:{stroke:"none",fill:I({FCcolor:{alpha:"25,0,0",angle:360,color:"000000,FFFFFF,FFFFFF",ratio:"0,30,40"}})}},bound:{style:{stroke:"none"}}};c.sliderGroupConf={showTooltip:1,outerCircle:{rFactor:1.4,style:{fill:V,stroke:"#757575","stroke-width":3}},innerCircle:{rFactor:.65,style:{fill:V,stroke:"#FFFFFF"}}};c.axisTextItemConf={spreadFactor:.3,
padding:{v:1,h:1},style:{fill:"#786B50",fontFamily:"sans-serif",fontSize:"12px",fontWeight:"normal",fontStyle:"normal"}};return{init:function(c){a=c.chart;b=a.components},setConf:function(a){},legacyDataParser:function(a,c){var h={},g=b.numberFormatter,k,r,m,q,l,n,t,v,p;if(!a)return!1;h.mapByPercent=p=!!C(a.mapbypercent,0);k=a.color||[];void 0===a.minvalue&&(a.minvalue=void 0!==c.min?p?0:c.min:0);void 0===a.maxvalue&&(a.maxvalue=void 0!==c.max?p?100:c.max:100);n=!1;m=0;for(q=k.length;m<q;m++)if(k[m].maxvalue){n=
!0;break}n||(k=[]);m=a.code;n=h.colorRange=[];h.gradient=!!C(a.gradient,1);k.length?m=P(m):(m?(q=P(m),m=P()):(m=P(),q=M(m,1)),k.push({code:q,maxvalue:a.maxvalue,label:void 0}));e(k);k=k.sort(function(a,b){return a.maxvalue-b.maxvalue});t=v=a.minvalue&&g.getCleanValue(a.minvalue);v=(void 0!==t||null!==t)&&(p?t+"%":g.legendValue(t));n.push({code:Y(m),value:t,displayValue:v,label:a.startlabel});m=0;for(q=k.length;m<q;m++)r=k[m],l=P(r.code||r.color),t=v=r.maxvalue,isNaN(parseInt(t,10))||(v=(void 0!==
t||null!==t)&&(p?t+"%":g.legendValue(t)),n.push(Object({code:Y(l),value:t,displayValue:v,label:r.label||r.displayvalue})));n[n.length-1].label=a.endlabel||r.label;return h},getDefaultConf:function(a){return c[a]}}}();ga=function(e){var b=e.chartInstance.id,a=da[b]||(da[b]={});return function(){function c(){var b,c,d,f,h,e;for(b in a)for(c in d=a[b],d)if(f=d[c],f instanceof Array)for(h=0,e=f.length;h<e;h++)f[h]&&f[h].hide();else f.hide()}var d,f={},h;d={KEY_RECT:"rect",KEY_TEXT:"text",KEY_GROUP:"group",
KEY_CIRCLE:"circle",KEY_PATH:"path"};f[d.KEY_RECT]=function(a){return h.rect(a)};f[d.KEY_TEXT]=function(a,b){return h.text(a,b)};f[d.KEY_GROUP]=function(a,b){return h.group(a,b)};f[d.KEY_CIRCLE]=function(a){return h.circle(a)};f[d.KEY_PATH]=function(a,b){return h.path(a,b)};return{init:function(a){h=a;c()},emptyPool:function(){a=da[b]={}},getChart:function(){return e},getComponent:function(b,c,d){var h=a[b],e,l,n,t=0;h||(h=a[b]={});return(l=h[c])&&!(l instanceof Array)||l instanceof Array&&0<l.length?
function(){return d?(n=l[t++])?n.show():l[t]=f[c].apply(this,arguments):l.show()}:function(){return d?(e=h[c]||(h[c]=[]),l=f[c].apply(this,arguments),e.push(l),l.show()):h[c]=f[c].apply(this,arguments)}},hideAll:function(){c()},getKeys:function(){return d}}}()};X.prototype.constructor=X;X.prototype.draw=function(e){e.componentPool=this._componentPool;return this.carpet.draw(e)};X.prototype.getLogicalSpace=function(e,b){e.componentPool=this._componentPool;return this.carpet.getLogicalSpace(e,b)};X.prototype.dispose=
function(){this.carpet&&this.carpet.group&&this.carpet.group.remove();this._componentPool.emptyPool()};O.prototype.constructor=O;O.prototype.addCompositions=function(e,b){this.compositionsByCategory[b]=e};O.prototype.getBoundingBox=function(e){var b=this.conf,a=e.refSide,c=e.alignment,d=e.refOffset,f=e.x,h=e.y,b=b.width=a*b.spreadFactor;!c||void 0!==f&&null!==f||(f=(d+a)/2-b/2);return{width:b,height:e.maxOtherSide,x:f,y:h}};O.prototype.getPostCalcDecisions=function(e,b){var a=this.conf.padding,c,
d=0;for(c in b)d+=b[c].height||0;e.height=d+2*a.v};O.prototype.getLogicalSpace=function(e,b){var a=this._lSpace,c=this.conf.padding,d=this.compositionsByCategory,f,h,g;g=0;var k={},r,m=0;if(a&&!b)return a.isImpure=!0,a;a=this._lSpace=h=this.getBoundingBox(e);if(F(a.x)||F(a.y)||F(a.height)||F(a.width))this.autoRecalculate=!0;a=p(h,{});a.height-=2*c.v;a.width-=2*c.h;a.x+=c.h;a.y+=c.v;for(r in d)f=d[r],c=p(a,{}),c.y+=g,g=a.height*f.conf.spreadFactor,c.height=g+m,g=f.getLogicalSpace(p(c,{}),e,b),m=c.height-
g.height,k[r]=g,g=g.height;this.getPostCalcDecisions(h,k);return this._lSpace=h};O.prototype.setupDragging=function(){var e=this.group,b=0,a=0,c=0,d=0;e.css({cursor:"move"});e.drag(function(f,h){b=f;a=h;e.attr({transform:"t"+(c+b)+","+(d+a)})},function(){c+=b;d+=a},function(){})};O.prototype.draw=function(e){var b=this.conf,a=this.compositionsByCategory,c=e.paper,d=e.parentGroup,f=e.componentPool,h,g,k=f.getChart().get("config","animationObj").duration,r,m=f.getKeys();this.getLogicalSpace(e,this.autoRecalculate);
g=this._lSpace;r=f.getComponent(this._id,m.KEY_GROUP);this.group=d=r(this.groupName,d);d.attr({opacity:0});d.animate({opacity:1},k,"easeIn");r=f.getComponent(this._id,m.KEY_RECT);this.node=r(d).attr(g).css(b.style);for(h in a)f=a[h],f.draw(b.captionAlignment,g,{colorRange:e.colorRange,numberFormatter:e.numberFormatter,paper:c,parentLayer:d,smartLabel:e.smartLabel,moveInstructions:this.moveInstructions[h],componentPool:e.componentPool});b.allowDrag&&this.setupDragging();return this.node};l.prototype=
Object.create(O.prototype);l.prototype.constructor=l;l.prototype.getBoundingBox=function(e){var b=this.conf,a=e.refSide,c=e.alignment,d=e.refOffset,f=e.x,h=e.y,b=b.height=a*b.spreadFactor;!c||void 0!==h&&null!==h||(h=(d+a)/2-b/2);return{width:e.maxOtherSide,height:b,x:f,y:h}};l.prototype.getPostCalcDecisions=function(e,b){var a=this.conf.padding,c=Number.NEGATIVE_INFINITY,d,f,h=this.moveInstructions;O.prototype.getPostCalcDecisions.apply(this,arguments);for(f in b)d=b[f].width,c=c<d?d:c;e.width=c+
2*a.h;for(f in b)if(d=b[f].width,a=c-d)h[f]="t"+a/2+",0"};U.prototype.constructor=U;U.LEFT={x:function(e,b){return b.x+e.width/2+2}};U.RIGHT={x:function(e,b){return b.x+b.width-e.width/2-2}};U.CENTER={x:function(e,b){return b.x+b.width/2}};U.prototype.getLogicalSpace=function(e,b,a){var c=this.conf.padding,d=this._lSpace,f=this.rawText,h=b.componentPool.getChart();if(d&&!a)return d.isImpure=!0,d;d=this._lSpace={bound:{height:0,width:0},node:{logicArea:void 0,smartText:void 0}};a=b.smartLabel;if(!f)return d.bound;
b=p(e,{});b.height-=2*c.v;b.width-=2*c.h;b.x+=c.h;b.y+=c.v;a.useEllipsesOnOverflow(h.config.useEllipsesWhenOverflow);h=p(this.conf.style,{});w(h);a.setStyle(this._metaStyle=h);f=a.getSmartText(f,b.width,b.height);b.height=f.height;b.width=f.width;e.height=f.height+2*c.v;e.width=f.width+2*c.h;d.node.smartText=f;d.node.logicArea=b;return d.bound=e};U.prototype.draw=function(){var e=this.conf,b,a=e.bound||{},c,d,f,h,g,k,r;3<=arguments.length?(f=arguments[0],h=arguments[1],g=arguments[2]):2<=arguments.length&&
(f=arguments[0],g=arguments[1]);b=g.parentLayer;k=g.componentPool;r=k.getKeys();c=k.getComponent(this._id,r.KEY_GROUP);this.group=b=c("legend-caption",b).css(e.style);this.getLogicalSpace(h,g);c=this._lSpace;g=c.node;d=c.bound;c=k.getComponent(this._id,r.KEY_RECT);this.bound=a=c(b).attr(d).css(a.style);f="string"===typeof f?U[f.toUpperCase()].x(g.smartText,h||g.logicArea):f;c=k.getComponent(this._id,r.KEY_TEXT);this.node=c({},b).attr({text:g.smartText.text,x:f,y:g.logicArea.y+g.smartText.height/2,
lineHeight:this._metaStyle.lineHeight,fill:e.style.fill});return{group:b,bound:a,node:this.node}};u.SC_STACK=["LEGEND_LABEL","LEGEND_AXIS","AXIS_VALUE"];u.DARW_STACK=["AXIS_VALUE","LEGEND_AXIS","LEGEND_LABEL"];u.prototype.constructor=u;u.prototype.addCompositions=function(e,b){this.compositionsByCategory[b]=e};u.prototype.getCompositionPlotAreaFor=function(e){var b;b=p(e,{});return function(a,c){a=a||{};b.y+=a.height||0;b.height=e.height*c;return b}};u.prototype.getSpaceTaken=function(e){return e.height};
u.prototype.updateEffectivePlotArea=function(e,b,a){var c=this.conf.padding;b.height=a;e.height=a+2*c.v};u.prototype.getLogicalSpace=function(e,b,a){var c=this._lSpace,d=this.conf.padding,f=this.compositionsByCategory,h,g,k,r=0,m,q;if(c&&!a)return c.isImpure=!0,c;c=this._lSpace={bound:{height:0,width:0},node:{logicArea:void 0}};g=p(e,{});g.height-=2*d.v;g.width-=2*d.h;g.x+=d.h;g.y+=d.v;k=this.getCompositionPlotAreaFor(g);b.colorRange=this.colorRange;m=0;for(q=u.SC_STACK.length;m<q;m++)if(d=f[u.SC_STACK[m]])h=
k(h,d.conf.spreadFactor),h=d.getLogicalSpace(p(h,{}),b,a),r+=this.getSpaceTaken(h);this.updateEffectivePlotArea(e,g,r);c.node.logicArea=g;return c.bound=e};u.prototype.draw=function(){var e=this.childTextConf,b=this.conf.bound.style||{},a=this.compositionsByCategory,c,d,f,h,g,k,r;3<=arguments.length?(f=arguments[1],g=arguments[2]):2<=arguments.length&&(g=arguments[1]);c=g.parentLayer;h=g.componentPool;k=h.getKeys();this.getLogicalSpace(f,g);f=this._lSpace;r=h.getComponent(this._id,k.KEY_GROUP);e=
r("legend-body",c).attr({transform:"t0,0"}).css(e.style);r=h.getComponent(this._id,k.KEY_RECT);this.bound=b=r(e).attr(f.bound).css(b);g.colorRange=this.colorRange;g.parentLayer=e;h=0;for(k=u.DARW_STACK.length;h<k;h++)(d=a[u.DARW_STACK[h]])&&d.draw(g);g.moveInstructions&&e.attr({transform:g.moveInstructions});return{bound:b,group:e}};J.prototype=Object.create(u.prototype);J.prototype.constructor=J;J.prototype.getCompositionPlotAreaFor=function(e){var b;b=p(e,{});return function(a,c){a=a||{};b.x+=a.width||
0;b.width=e.width*c;return b}};J.prototype.updateEffectivePlotArea=function(e,b,a){var c=this.conf.padding;b.width=a;e.width=a+2*c.h};J.prototype.getSpaceTaken=function(e){return e.width};n.prototype.constructor=n;n.prototype.getEffectivePlotArea=function(e){var b=this.conf.padding;e.height-=2*b.v;e.width-=2*b.h;e.x+=b.h;e.y+=b.v;this.node=[];return e};n.prototype.getLogicalSpace=function(e,b,a){var c=this._lSpace,d=this.conf,f=d.padding,h,g,k=[],r,m,q,l,n,t=0,v,W,u;n=b.componentPool.getChart();var y=
[];if(c&&!a)return c.isImpure=!0,c;c=b.colorRange;b=b.smartLabel;a=c.getCumulativeValueRatio();h=c.colorRange;c=this._lSpace={bound:{height:0,width:0},node:{logicArea:void 0,smartTexts:[]}};l=c.node.smartTexts;r=p(e,{});r=this.getEffectivePlotArea(r);b.useEllipsesOnOverflow(n.config.useEllipsesWhenOverflow);d=p(d.style,{});w(this._metaStyle=d);b.setStyle(d);n=b.getSmartText("W");g=0;for(d=h.length;g<d;g++)(m=h[g].label)?(t++,y.push({oriIndex:g,label:m})):l[g]=void 0;d=y.length;if(0===d)return{height:0,
width:0};m=q=1<d?(a[y[d-1].oriIndex]-a[y[0].oriIndex])/2*r.width/100:Math.max(a[y[0].oriIndex],100-a[y[0].oriIndex])/2*r.width/100;t=b.getSmartText(y[0].label,m,r.height);t.x=a[y[0].oriIndex]*r.width/100;g=t.x+t.width;k.push(t.height);l[y[0].oriIndex]=t;t=b.getSmartText(y[d-1].label,m,r.height);t.x=a[y[d-1].oriIndex]*r.width/100;h=t.x-t.width;k.push(t.height);l[y[d-1].oriIndex]=t;W=g;for(g=1;g<d-1;g++)m=y[g].label,u=y[g].oriIndex,t=void 0,q=g+1===d-1?h:a[y[g+1].oriIndex]*r.width/100,v=a[y[g].oriIndex]*
r.width/100,q=Math.min(v-W,q-v),q>2*n.width&&(t=b.getSmartText(m,q,r.height),t.x=a[u]*r.width/100,W=q,k.push(t.height)),l[y[g].oriIndex]=t;k=Math.max.apply(Math,k);r.height=k;e.height=k+2*f.v;c.node.logicArea=r;return c.bound=e};n.prototype.draw=function(){var e,b,a=this.conf;b=a.bound&&a.bound.style||{stroke:"none"};var c,d,f,h,g,k,r,m;2<=arguments.length?(d=arguments[0],h=arguments[1]):1<=arguments.length&&(h=arguments[0]);e=h.parentLayer;h.colorRange.getCumulativeValueRatio();c=h.componentPool;
g=c.getKeys();this.getLogicalSpace(d,h);f=this._lSpace;d=f.node.logicArea;h=f.node.smartTexts;m=c.getComponent(this._id,g.KEY_GROUP);e=m("legend-labels",e);m=c.getComponent(this._id,g.KEY_RECT);this.bound=b=m(e).attr(f.bound).css(b);m=c.getComponent(this._id,g.KEY_TEXT,!0);g=0;for(f=h.length;g<f;g++)if(c=h[g])k=d.y+c.height/2,r=g===f-1?d.x+c.x-c.width/2:g?d.x+c.x:d.x+c.x+c.width/2,this.node.push(m({},e).attr({text:c.text,x:r,y:k,lineHeight:this._metaStyle.lineHeight,fill:a.style.fill}).transform("R0"));
return{group:e,bound:b,node:this.node}};T.prototype=Object.create(n.prototype);T.prototype.constructor=T;T.prototype.getLogicalSpace=function(e,b,a){var c=this._lSpace,d=this.conf,f=d.padding,h,g,k=[],r,m,q,l,n,t=0,v,W,u;n=b.componentPool.getChart();var y=[];if(c&&!a)return c.isImpure=!0,c;c=b.colorRange;b=b.smartLabel;a=c.getCumulativeValueRatio();h=c.colorRange;c=this._lSpace={bound:{height:0,width:0},node:{logicArea:void 0,smartTexts:[]}};l=c.node.smartTexts;r=p(e,{});r=this.getEffectivePlotArea(r);
b.useEllipsesOnOverflow(n.config.useEllipsesWhenOverflow);d=p(d.style,{});w(this._metaStyle=d);b.setStyle(d);n=b.getSmartText("W");g=0;for(d=h.length;g<d;g++)(m=h[g].label)?(t++,y.push({oriIndex:g,label:m})):l[g]=void 0;d=y.length;if(0===d)return{height:0,width:0};m=q=1<d?(a[y[d-1].oriIndex]-a[y[0].oriIndex])/2*r.height/100:Math.max(a[y[0].oriIndex],100-a[y[0].oriIndex])/2*r.height/100;t=b.getSmartText(y[0].label,m,r.width);t.y=a[y[0].oriIndex]*r.height/100;g=t.y+t.width;k.push(t.height);l[y[0].oriIndex]=
t;t=b.getSmartText(y[d-1].label,m,r.width);t.y=a[y[d-1].oriIndex]*r.height/100;h=t.y-t.width;k.push(t.height);l[y[d-1].oriIndex]=t;W=g;for(g=1;g<d-1;g++)m=y[g].label,u=y[g].oriIndex,t=void 0,q=g+1===d-1?h:a[y[g+1].oriIndex]*r.height/100,v=a[y[g].oriIndex]*r.height/100,q=Math.min(v-W,q-v),q>2*n.width&&(t=b.getSmartText(m,q,r.width),t.y=a[u]*r.height/100,W=q,k.push(t.height)),l[y[g].oriIndex]=t;k=Math.max.apply(Math,k);r.width=k;e.width=k+2*f.v;c.node.logicArea=r;return c.bound=e};T.prototype.draw=
function(){var e,b,a=this.conf;b=a.bound&&a.bound.style||{stroke:"none"};var c,d,f,h,g,k,r,m;2<=arguments.length?(d=arguments[0],h=arguments[1]):1<=arguments.length&&(h=arguments[0]);e=h.parentLayer;h.colorRange.getCumulativeValueRatio();c=h.componentPool;g=c.getKeys();this.getLogicalSpace(d,h);f=this._lSpace;d=f.node.logicArea;h=f.node.smartTexts;m=c.getComponent(this._id,g.KEY_GROUP);e=m("legend-labels",e);m=c.getComponent(this._id,g.KEY_RECT);this.bound=b=m(e).attr(f.bound).css(b);m=c.getComponent(this._id,
g.KEY_TEXT,!0);g=0;for(f=h.length;g<f;g++)if(c=h[g])k=d.x+c.height/2,r=g===f-1?d.y+c.y-c.width/2:g?d.y+c.y:d.y+c.y+c.width/2,this.node.push(m({},e).attr({text:c.text,x:k,y:r,lineHeight:this._metaStyle.lineHeight,fill:a.style.fill}).transform("R270,"+k+","+r));return{group:e,bound:b,node:this.node}};Q.prototype=Object.create(n.prototype);Q.prototype.constructor=Q;Q.prototype.getLogicalSpace=function(e,b,a){var c=this._lSpace,d=this.conf,f=d.padding,h=b.componentPool.getChart(),g,k,r,m,q,l,n=[],t,v,
W,u;if(c&&!a)return c.isImpure=!0,c;c=b.colorRange;b=b.smartLabel;a=c.colorRange;r=c.getCumulativeValueRatio();c=this._lSpace={bound:{height:0,width:0},node:{logicArea:void 0,smartTexts:[]}};u=c.node.smartTexts;v=p(e,{});v.height-=2*f.v;v.width-=2*f.h;v.x+=f.h;v.y+=f.v;b.useEllipsesOnOverflow(h.config.useEllipsesWhenOverflow);d=p(d.style,{});w(this._metaStyle=d);b.setStyle(d);h=b.getSmartText("W");d=a.length;l=(r[d-1]-r[0])/2*v.width/100;g=a[0].displayValue;g=b.getSmartText("string"!==typeof g&&void 0!==
g&&g.toString()||g,l,v.height);g.x=r[0]*v.width/100;k=g.x+g.width;n.push(g.height);u[0]=g;g=b.getSmartText(a[d-1].displayValue,l,v.height);g.x=r[d-1]*v.width/100;l=g.x-g.width;n.push(g.height);u[d-1]=g;t=k;for(k=1;k<d-1;k++)g=void 0,W=a[k].displayValue,m=k+1===d-1?l:r[k+1]*v.width/100,q=r[k]*v.width/100,m=Math.min(q-t,m-q),m>1.5*h.width&&(g=b.getSmartText(W,2*m,v.height),g.x=r[k]*v.width/100,t=m,n.push(g.height)),u[k]=g;n=Math.max.apply(Math,n);v.height=n;e.height=n+2*f.v;c.node.logicArea=v;return c.bound=
e};Q.prototype.draw=function(){var e=this.conf,b=e.bound&&e.bound.style||{stroke:"none"},a,c,d,f,h,g,k,r,m;2<=arguments.length?(h=arguments[0],k=arguments[1]):1<=arguments.length&&(k=arguments[0]);f=k.parentLayer;c=k.colorRange.getCumulativeValueRatio();d=k.componentPool;a=d.getKeys();this.getLogicalSpace(h,k);g=this._lSpace;h=g.node.logicArea;k=g.node.smartTexts;m=d.getComponent(this._id,a.KEY_GROUP);f=m("legend-values",f);m=d.getComponent(this._id,a.KEY_RECT);this.bound=b=m(f).attr(g.bound).css(b);
m=d.getComponent(this._id,a.KEY_TEXT,!0);a=0;for(g=c.length;a<g;a++)if(r=k[a])c=h.y+r.height/2,d=a===g-1?h.x+r.x-r.width/2:a?h.x+r.x:h.x+r.x+r.width/2,m({},f).attr({text:r.text,x:d,y:c,lineHeight:this._metaStyle.lineHeight,fill:e.style.fill});return{group:f,bound:b}};N.prototype=Object.create(Q.prototype);N.prototype.constructor=N;N.prototype.getLogicalSpace=function(e,b,a){var c=this._lSpace,d=this.conf,f=d.padding,h=b.componentPool.getChart(),g,k,r,m,q,l,n=[],t,v,W,u;if(c&&!a)return c.isImpure=
!0,c;c=b.colorRange;b=b.smartLabel;a=c.colorRange;k=c.getCumulativeValueRatio();c=this._lSpace={bound:{height:0,width:0},node:{logicArea:void 0,smartTexts:[]}};u=c.node.smartTexts;q=p(e,{});q.height-=2*f.v;q.width-=2*f.h;q.x+=f.h;q.y+=f.v;b.useEllipsesOnOverflow(h.config.useEllipsesWhenOverflow);d=p(d.style,{});w(d);b.setStyle(this._metaStyle=d);W=b.getSmartText("W");h=a.length;l=(k[h-1]-k[0])/2*q.height/100;d=b.getSmartText(a[0].displayValue,q.width,l);d.y=k[0]*q.height/100;g=d.y+d.width;n.push(d.width);
u[0]=d;d=b.getSmartText(a[h-1].displayValue,q.width,l);d.y=k[h-1]*q.height/100;l=d.y-d.height;n.push(d.width);u[h-1]=d;t=g;for(g=1;g<h-1;g++)d=void 0,v=a[g].displayValue,r=g+1===h-1?l:k[g+1]*q.height/100,m=k[g]*q.height/100,r=Math.min(m-t,r-m),r>2*W.height&&(d=b.getSmartText(v,q.width,2*r),d.y=k[g]*q.height/100,t=r,n.push(d.width)),u[g]=d;n=Math.max.apply(Math,n);q.width=n;e.width=n+2*f.h;c.node.logicArea=q;return c.bound=e};N.prototype.draw=function(){var e,b,a=this.conf;b=a.bound&&a.bound.style||
{stroke:"none"};var c,d,f,h,g,k,r,m;2<=arguments.length?(c=arguments[0],f=arguments[1]):1<=arguments.length&&(f=arguments[0]);e=f.parentLayer;h=f.colorRange.getCumulativeValueRatio();g=f.componentPool;k=g.getKeys();this.getLogicalSpace(c,f);d=this._lSpace;c=d.node.logicArea;f=d.node.smartTexts;m=g.getComponent(this._id,k.KEY_GROUP);e=m("legend-values",e);m=g.getComponent(this._id,k.KEY_RECT);this.bound=b=m(e).attr(d.bound).css(b);m=g.getComponent(this._id,k.KEY_TEXT,!0);g=0;for(k=h.length;g<k;g++)if(h=
f[g])d=c.x+h.width/2,r=g===k-1?c.y+h.y-h.height/2:g?c.y+h.y:c.y+h.y+h.height/2,m({},e).attr({text:h.text,x:d,y:r,lineHeight:this._metaStyle.lineHeight,fill:a.style.fill});return{group:e,bound:b}};E.prototype.constructor=E;E.prototype.addCompositions=function(e,b){this.compositionsByCategory[b]=e};E.prototype.getLogicalSpace=function(e,b,a){b=this._lSpace;var c=this.conf,d=c.padding,f,h;h=c.legendAxisHeight;var g=this.compositionsByCategory,k;k=0;if(b&&!a)return b.isImpure=!0,b;b=this._lSpace={bound:{height:0,
width:0},node:{logicArea:void 0}};a=p(e,{});a.height-=2*d.v;a.width-=2*d.h;a.x+=d.h;a.y+=d.v;c=h/2+c.line.offset;f=h/2;if(g=g.RANGE)k=g.sliders[!1],k=k.conf.outerCircle.rFactor*h,f+=k=Math.max(k/2-h/2,0);a.y+=k;a.height=h=f+c+k;e.height=h+2*d.v;b.node.logicArea=a;return b.bound=e};E.prototype.getDrawableAxisArea=function(e){var b=this.conf;return{x:e.x,y:e.y,width:e.width,height:b.legendAxisHeight,r:b.legendAxisHeight/2}};E.prototype.preDrawingRangeParam=function(e){return{y:e.y+e.height/2,calculationBase:e.height,
rangeStart:e.x,rangeEnd:e.x+e.width,prop:"y"}};E.prototype.getScaleMarkerPathStr=function(e,b){var a=p(e,{}),c=this.conf.line,d,f,h,g,k="";a.x+=a.r;a.width-=2*a.r;g=a.y+a.height;d=0;for(f=b.length;d<f;d++)h=b[d],h=a.x+h*a.width/100,k+="M"+h+","+(g-c.grooveLength)+"L"+h+","+(g+c.offset);a=""+("M"+a.x+","+(g+c.offset)+"L"+(a.x+a.width)+","+(g+c.offset));return k+a};E.prototype.getColorGradient=function(e){return{axis:e.getBoxFill(),shadow:I({FCcolor:{alpha:"25,0,0",angle:90,color:"000000,FFFFFF,FFFFFF",
ratio:"0,30,40"}})}};E.prototype.draw=function(){var e,b=this.conf,a=b.line,c=(b.bound||{}).style||{},d,f,h=this.compositionsByCategory,g,k,r,m,q,l;2<=arguments.length?(d=arguments[0],q=arguments[1]):1<=arguments.length&&(q=arguments[0]);e=q.parentLayer;g=q.colorRange;k=g.getCumulativeValueRatio();l=q.componentPool;r=l.getKeys();this.getLogicalSpace(d,q);m=this._lSpace;d=l.getComponent(this._id,r.KEY_GROUP);e=d("legend-axis",e);d=l.getComponent(this._id,r.KEY_RECT,!0);this.bound=d(e).attr(m.bound).css(c);
c=this.getDrawableAxisArea(m.node.logicArea);g=this.getColorGradient(g);b.style.fill=g.axis;b.shadow.style.fill=g.shadow;this.node=d(e).attr(c).css(b.style);this.shadow=d(e).attr(c).css(b.shadow.style);b=this.getScaleMarkerPathStr(c,k);d=l.getComponent(this._id,r.KEY_PATH);d("M0,0",e).attr({path:b}).css(a.style);for(f in h)switch(a=h[f],f){case "RANGE":r=this.preDrawingRangeParam(c),q[r.prop]=r[r.prop],q.key=r.prop,q.rCalcBase=r.calculationBase,q.parentLayer=e,a.draw(r.rangeStart,r.rangeEnd,q)}};
z.prototype=Object.create(E.prototype);z.prototype.constructor=z;z.prototype.getLogicalSpace=function(e,b,a){b=this._lSpace;var c=this.conf,d=c.padding,f,h;h=c.legendAxisHeight;var g=this.compositionsByCategory,k;k=0;if(b&&!a)return b.isImpure=!0,b;b=this._lSpace={bound:{height:0,width:0},node:{logicArea:void 0}};a=p(e,{});a.height-=2*d.v;a.width-=2*d.h;a.x+=d.h;a.y+=d.v;c=h/2+c.line.offset;f=h/2;if(g=g.RANGE)k=g.sliders[!1],k=k.conf.outerCircle.rFactor*h,f+=k=Math.max(k/2-h/2,0);a.x+=k;a.width=h=
f+c+k;e.width=h+2*d.v;b.node.logicArea=a;return b.bound=e};z.prototype.getDrawableAxisArea=function(e){var b=this.conf;return{x:e.x,y:e.y,width:b.legendAxisHeight,height:e.height,r:b.legendAxisHeight/2}};z.prototype.getScaleMarkerPathStr=function(e,b){var a=p(e,{}),c=this.conf.line,d,f,h,g,k="";a.y+=a.r;a.height-=2*a.r;g=a.x+a.width;d=0;for(h=b.length;d<h;d++)f=b[d],f=a.y+f*a.height/100,k+="M"+(g-c.grooveLength)+","+f+"L"+(g+c.offset)+","+f;a=""+("M"+(g+c.offset)+","+a.y+"L"+(g+c.offset)+","+(a.y+
a.height));return k+a};z.prototype.getColorGradient=function(e){return{axis:e.getBoxFill(!0),shadow:I({FCcolor:{alpha:"25,0,0",angle:360,color:"000000,FFFFFF,FFFFFF",ratio:"0,30,40"}})}};z.prototype.preDrawingRangeParam=function(e){return{x:e.x+e.width/2,calculationBase:e.width,rangeStart:e.y,rangeEnd:e.y+e.height,prop:"x"}};x.prototype.constructor=x;x.prototype.initRange=function(e,b){this.extremes[+e.sliderIndex]=b};x.prototype.updateRange=function(e,b){var a=e.sliderIndex;this.sliders[!a].updateSwingRange(a,
b)};x.prototype.reset=function(){var e={};e.conf=this.conf;e.sliderGroup=this;this.sliders[!1]=new Z(!1,e,this._id+"_0");this.sliders[!0]=new Z(!0,e,this._id+"_1");this.draw.apply(this,this._drawParams)};x.prototype.clearListeners=function(){this.callbacks.length=0};x.prototype.draw=function(e,b,a){var c=this.sliders,d=c[!1],c=c[!0],f=a.colorRange,h=f.colorRange,g=this._fcChart=a.componentPool.getChart();this.getValueFormPixel=function(a,b,c,d){var f=(b-a)/(d-c);this.getValueFormPixel=function(b){return a+
f*b}};this.updateWhenInMove=function(a,b){this.updateWhenInMove=function(c,d){var f=this.extremes,f=this.getValueFormPixel(c.sliderIndex?f[1]-f[0]+d:d);return f=b?parseFloat(f).toFixed(2)+"%":a.legendValue(f)}};this._drawParams=[e,b,a];this.updateWhenInMove(g.components.numberFormatter,f.mapByPercent);e=d.draw(e,h[0].displayValue,a[a.key],a);e=c.draw(b,h[h.length-1].displayValue,a[a.key],a);d.swing=this.extremes.slice(0);c.swing=this.extremes.slice(0);this.getValueFormPixel(h[0].value,h[h.length-
1].value,this.extremes[0],this.extremes[1]);return e};x.prototype.registerListener=function(e,b,a){this.callbacks.push({fn:e,context:b,params:a||[]})};x.prototype.updateWhenInRest=function(e,b){var a=this.sliders,c=this.extremes,d=e.sliderIndex,f,h=this.callbacks,g,k;d?(f=a[!d].currPos,a=c[1]-c[0]+b):(f=b,a=c[1]-c[0]+a[!d].currPos);c=0;for(d=h.length;c<d;c++)g=h[c],k=g.params.slice(0),k.unshift(this.getValueFormPixel(a)),k.unshift(this.getValueFormPixel(f)),g.fn.apply(g.context,k)};x.prototype.dragStarted=
function(e){var b=this.sliders,a=this.extremes,c=e.conf,d=this._fcChart;A.raiseEvent("legendpointerdragstart",{pointerIndex:+e.sliderIndex,pointers:[{value:this.getValueFormPixel(b[!1].currPos)},{value:this.getValueFormPixel(a[1]-a[0]+b[!0].currPos)}],legendPointerHeight:c.outerRadius,legendPointerWidth:c.innerRadius,outerRadius:c.outerRadius,innerRadius:c.innerRadius},d.chartInstance,[d.id])};x.prototype.dragCompleted=function(e,b,a){var c=this.sliders,d=this.extremes,f=e.conf,h=this.getValueFormPixel(c[!1].currPos),
c=this.getValueFormPixel(d[1]-d[0]+c[!0].currPos),g=this._fcChart,k;e.sliderIndex?(k=h,a=this.getValueFormPixel(d[1]-d[0]+a)):(k=this.getValueFormPixel(a),a=c);b&&A.raiseEvent("legendrangeupdated",{previousMinValue:h,previousMaxValue:c,minValue:k,maxValue:a},g.chartInstance,[g.id]);A.raiseEvent("legendpointerdragstop",{pointerIndex:+e.sliderIndex,pointers:[{value:h},{value:c}],legendPointerHeight:f.outerRadius,legendPointerWidth:f.innerRadius,outerRadius:f.outerRadius,innerRadius:f.innerRadius},g.chartInstance,
[g.id])};Z.prototype.constructor=Z;Z.prototype.updateSwingRange=function(e,b){this.swing[+e]=b};Z.prototype.draw=function(e,b,a,c){var d=c.parentLayer,f=this.conf,h=f.outerCircle,g=f.innerCircle,k=Math.ceil(h.rFactor*c.rCalcBase/2),r=Math.ceil(g.rFactor*c.rCalcBase/2),m=k-r,q=this.rangeGroup,l=this.sliderIndex,n,t,v=c.componentPool,p=v.getKeys();f.outerRadius=k;f.innerRadius=r;this._scaleVal=b;g.style["stroke-width"]=m;m=Math.ceil(h.style["stroke-width"]/2);r+=m;t=v.getComponent(this._id,p.KEY_GROUP);
d=this.node=t("fc-gl-slider",d).attr({cursor:"pointer",transform:"t0,0"});"x"===c.key?e=n=e+(l?-r:+r):(n=a,e=a=e+(l?-r:+r));q.initRange(this,e);t=v.getComponent(this._id,p.KEY_CIRCLE,!0);t(d).attr({cx:a,cy:n,r:k}).css(h.style);t(d).attr({cx:a,cy:n,r:r}).css(g.style);b=this.tracker=t(d).attr({cx:a,cy:n,r:k+5,ishot:!0,fill:V,stroke:0,cursor:"pointer"}).trackTooltip(f.showTooltip?!0:!1).tooltip(b,null,null,!0);this._dragAPI=c=this.getDragAPI("x"===c.key);b.undrag();b.drag(c.dragging,c.dragStart,c.dragEnd);
return{translateAscending:k+m}};Z.prototype.getDragAPI=function(e){var b=this,a=b.node,c=b.sliderIndex,d=b.rangeGroup,f,h,g,k=b.conf.innerRadius,r;return{dragging:function(m,q,l,n,t){var v;t.stopPropagation();t.preventDefault();v=e?q:m;c?(m=f[0]-f[1]+k,q=0):(m=0,q=f[1]-f[0]-k);if(!(b.currPos+v<m||b.currPos+v>q))return a.attr({transform:e?"t0,"+(b.currPos+v):"t"+(b.currPos+v)+",0"}),h=v,g&&clearTimeout(g),g=setTimeout(function(){d.updateWhenInRest(b,b.currPos+v)},100),b.tracker.tooltip(d.updateWhenInMove(b,
b.currPos+v),null,null,!0),r=!0},dragStart:function(c,g,h){h.stopPropagation();h.preventDefault();a.attr({transform:e?"t0,"+b.currPos:"t"+b.currPos+",0"});f=f||b.swing;r=!1;d.dragStarted(b)},dragEnd:function(){var a;d.dragCompleted(b,r,b.currPos+h);r&&(g&&clearTimeout(g),g=setTimeout(function(){d.updateWhenInRest(b,b.currPos)},100),b.currPos+=h,a=f[+c]+b.currPos,d.updateRange(b,a))}}};ca.prototype.constructor=ca;ca.prototype.getValueRatio=function(){var e=this.colorRange,b,a,c=e.length,d=this.valueRatio,
f=e[0].value,h=e[c-1].value-f,g=0;if(d)return d;d=this.valueRatio=[];for(a=0;a<c;a++)b=e[a],b=(b.value-f)/h,d.push(100*(b-g)),g=b;return d};ca.prototype.getCumulativeValueRatio=function(){var e=this.colorRange,b,a,c=e.length,d=e[0].value,f=e[c-1].value,h=[];for(a=0;a<c;a++)b=e[a],h.push((b.value-d)/(f-d)*100);return h};ca.prototype.getBoxFill=function(e){var b=this.colorRange,a,c=b.length,d=[],f;f=e?90:0;for(a=0;a<c;a++)e=b[a],d.push(e.code);b={FCcolor:{alpha:"100,100,100",angle:f,color:d.join(","),
ratio:this.getValueRatio().join(",")}};return I(b)};ca.prototype.getColorByValue=function(e){var b=this.values,a=this.colorRange,c,d,f,h;if(void 0!==e&&null!==e){d=0;for(c=b.length;d<c;d++)if(e===b[d]){h=a[d].code;break}else if(!d&&e<b[d]){f=!0;break}else if(d===c-1&&e>b[d]){f=!0;break}else if(e>b[d]&&e<b[d+1]){b=a[d];c=a[d+1];a=b.value;d=aa(b.code);b=c.value;c=aa(c.code);h=h=void 0;h=b-a;h=[Math.round(d[0]+(c[0]-d[0])/h*(e-a)),Math.round(d[1]+(c[1]-d[1])/h*(e-a)),Math.round(d[2]+(c[2]-d[2])/h*(e-
a))];h=ha(h);break}if(!f)return h}};D.prototype=Object.create(X.prototype);D.prototype.constructor=D;FusionCharts.register("component",["gradientLegend","gradientLegend",{pIndex:1,enabled:!1,init:function(e){function b(b){a.data=e.chart.jsonData.colorrange;(h=a.nData=B.legacyDataParser(a.data,b))?(a.drawOptions={smartLabel:c.linkedItems.smartLabel,colorRange:a.colorRange=f=new ca(h,b,g),maxOtherSide:b.maxOtherSide},a._dontPlot=!1,f&&f._preparationGoneWrong&&(a._dontPlot=!0),a._recalculateLogicalSpace=
!0,a._configure()):a._dontPlot=!0}var a=this,c=e.chart,d,f,h,g;B.init(e);g=a._chart=e.chart;a._cpool=ga(g);if(!(d=e.dataExtremes))return b;b(d)},_configure:function(){var e=this._chart,b=e.jsonData.chart,a=this.conf={},c=b.outcnvbasefont,d=b.outcnvbasefontsize,f=b.outcnvbasefontcolor,e=e.config.dataLabelStyle,h,g,k,r,m,q,l;a.caption=H(b.legendcaption);a.legendPosition=H(b.legendposition,"bottom").toLowerCase();a.showLegend=C(b.showlegend,1);a.interactiveLegend=C(b.interactivelegend,1);a.showLegendLabels=
C(b.showlegendlabels,1);h=b.legenditemfontcolor||f;g=b.legenditemfont||c;k=b.legenditemfontsize||d;r=C(b.legenditemfontbold,0);f=b.legendcaptionfontcolor||f;c=b.legendcaptionfont||c;d=b.legendcaptionfontsize||d;m=C(b.legendcaptionfontbold,1);l=(q=b.legendaxisbordercolor?ia(Y(b.legendaxisbordercolor)):void 0)?C(b.legendaxisborderalpha,100)/100:void 0;a.axisTextItemConf={style:{fill:h?R(H(h)):e.color,fontFamily:g?H(g):e.fontFamily,fontSize:k?C(k):e.fontSize.match(/\d+/)[0],fontWeight:r?"bold":e.fontWeight}};
a.legendCaptionConf={style:{fill:f?R(H(f)):e.color,fontFamily:c?H(c):e.fontFamily,fontSize:d?C(d):e.fontSize.match(/\d+/)[0],fontWeight:m?"bold":e.fontWeight,fontStyle:"normal"}};a.legendAxisConf={legendAxisHeight:11,style:{stroke:q,"stroke-opacity":l},line:{style:{stroke:R(H(b.legendscalelinecolor,"FFF8E9"),C(b.legendscalelinealpha,100)),"stroke-width":C(b.legendscalelinethickness)}}};a.sliderGroupConf={showTooltip:C(b.showtooltip,1),outerCircle:{rFactor:C(b.sliderdiameterfactor),style:{stroke:R(H(b.legendpointerbordercolor,
"757575"),C(b.legendpointerborderalpha,100))}},innerCircle:{rFactor:C(b.sliderholediameterfactor),style:{stroke:R(H(b.legendpointercolor,"FFFFFF"),C(b.legendpointeralpha,100))}}};a.legendCarpetConf={spreadFactor:C(b.legendspreadfactor),allowDrag:!!C(b.legendallowdrag,0),captionAlignment:H(b.legendcaptionalignment,"center"),style:{fill:R(H(b.legendbgcolor,"e4d9c1"),C(b.legendbgalpha,100)),stroke:R(H(b.legendbordercolor,"c4b89d"),C(b.legendborderalpha,100)),"stroke-width":C(b.legendborderthickness,
1)}}},postConfigureInit:function(){var e=this.conf,b,a,c,d,f,h,g;this.elem={};e.caption&&(a=p(B.getDefaultConf("legendCaptionConf"),e.legendCaptionConf),b=new U(e.caption,a));e.interactiveLegend&&(a=p(B.getDefaultConf("sliderGroupConf"),e.sliderGroupConf),this.elem.sGroup=d=new x(a),this.listeners&&0<this.listeners.length&&d.registerListener.apply(d,this.listeners));a=p(B.getDefaultConf("legendCarpetConf"),e.legendCarpetConf);"bottom"===e.legendPosition?(this.drawOptions.refSideKey="canvasWidth",
this.drawOptions.refOffsetKey="canvasLeft",a=new O(a),f=p(B.getDefaultConf("axisTextItemConf"),e.axisTextItemConf),h=new u(this.drawOptions.colorRange,B.getDefaultConf("legendBodyConf"),f),c=new E(p(B.getDefaultConf("legendAxisConf"),e.legendAxisConf)),e.showLegendLabels&&(g=new n(f)),e=new Q(f)):(this.drawOptions.refSideKey="canvasHeight",this.drawOptions.refOffsetKey="canvasTop",f=p(B.getDefaultConf("axisTextItemConf"),e.axisTextItemConf),a=new l(a),h=new J(this.drawOptions.colorRange,B.getDefaultConf("legendBodyConf"),
f),c=new z(p(B.getDefaultConf("legendAxisConf"),e.legendAxisConf)),e.showLegendLabels&&(g=new T(f)),e=new N(f));d&&c.addCompositions(d,"RANGE");g&&h.addCompositions(g,"LEGEND_LABEL");h.addCompositions(c,"LEGEND_AXIS");h.addCompositions(e,"AXIS_VALUE");b&&a.addCompositions(b,"CAPTION");a.addCompositions(h,"LEGEND_BODY");this.elem.gl=new D(a,this._cpool)},notifyWhenUpdate:function(e,b,a){var c;(c=this.elem&&this.elem.sGroup)?c.registerListener(e,b,a):this.listeners=[e,b,a]},dispose:function(){this.elem&&
this.elem.gl&&this.elem.gl.dispose();this.elem={}},getLogicalSpace:function(e){var b=this.conf,a={height:0,width:0},c=this.drawOptions,d=this._chart;if(!this._recalculateLogicalSpace)return b=c.refSideKey,c=c.refOffsetKey,this.drawOptions.refSide=d.config[b],this.drawOptions.refOffset=d.config[c],(this._logicalArea=this.elem.gl.getLogicalSpace(this.drawOptions,!0))||a;if(this._dontPlot)return a;this._recalculateLogicalSpace=!1;this.postConfigureInit();if(!b.showLegend)return a;b=c.refSideKey;c=c.refOffsetKey;
this.drawOptions.refSide=d.config[b];this.drawOptions.refOffset=d.config[c];this.drawOptions.maxOtherSide=e||this.drawOptions.maxOtherSide;return this.elem.gl&&(this._logicalArea=this.elem.gl.getLogicalSpace(this.drawOptions,!0))},resetLegend:function(){var e;(e=this.elem&&this.elem.sGroup)&&e.reset()},clearListeners:function(){var e;(e=this.elem&&this.elem.sGroup)&&e.clearListeners()},draw:function(e,b,a){var c=this.conf;this._dontPlot||(this._cpool.init(a.paper),c.showLegend?(this.drawOptions.paper=
a.paper,this.drawOptions.parentGroup=a.parentGroup,this.drawOptions.x=e,this.drawOptions.y=b,this.drawOptions.maxOtherSide=this.drawOptions.maxOtherSide||a.maxOtherSide,e=this.elem.gl.draw(this.drawOptions),e=e.getBBox(),c.xPos=e.x,c.yPos=e.y,c.height=e.height,c.width=e.width,this.enabled=!0):this.enabled=!1)}}])}]);FusionCharts.register("module",["private","modules.renderer.js-maps",function(){var p=this,P=p.window,w=p.hcLib,F=w.chartAPI,N=w.addEvent,O=w.removeEvent,l=w.pluck,U=w.imprint,u=w.extend2,
J=w.parseTooltext,n=w.pluckNumber,T=w.graphics.getLightColor,Q=w.dropHash,Y=w.HASHSTRING,E=w.parseUnsafeString,z=w.getDashStyle,x=w.schedular,Z=u(w.defaultPaletteOptions,{foregroundcolor:"333333",foregroundalpha:"100",foregrounddarkcolor:"111111",foregrounddarkalpha:"100",foregroundlightcolor:"666666",foregroundlightalpha:"100",backgroundlightcolor:"FFFFFF",backgroundlightalpha:"100",backgroundlightangle:90,backgroundlightratio:"",backgroundcolor:"FFFFCC",backgroundalpha:"100",backgrounddarkcolor:"ffcc66",
backgrounddarkalpha:"100",backgrounddarkangle:270,backgrounddarkratio:"",shadow:1}),ca=w.setLineHeight,D=w.graphics.convertColor,A=P.navigator.userAgent,G=/msie/i.test(A)&&!P.opera,C=w.hasSVG,H=P.Math,I=H.min,K=H.max,la=/stroke/ig,ia=/AppleWebKit/.test(A),R=H.ceil,ha=Math.PI/180,aa=w.hasTouch,P=!/fusioncharts\.com$/i.test(P.location.hostname),M=w.toRaphaelColor,ba="rgba(192,192,192,"+(G?.002:1E-6)+")",V=function(b,a){var c;b||(b={});for(c in a)b[c]=a[c];return b},B=function(b,a){var c=a?V(b.FCcolor,
a):{FCcolor:b};c.toString=M;return c},fa=function(b,a){var c,d;this.index=a;for(d in b)c=Z[b[d]],this[d]=c instanceof Array?c[a]:c},ja={right:function(b,a){return a},left:function(b,a){return b-a},center:function(b,a){return 2*I(a,b-a)}},ga={top:function(b,a){return a},middle:function(b,a){return 2*I(a,b-a)},bottom:function(b,a){return b-a}},da=function(b,a){var c=b&&b.length||!1,d=a||"id",f={},h;if(!b)return b;for(;c--;)h=b[c],void 0!==h[d]&&(f[h[d].toLowerCase()]=h);return f},e=w.KdTree;V(w.eventList,
{entityrollover:"FC_Event",entityrollout:"FC_Event"});F("geo",{name:"geo",friendlyName:"Map",revision:1,creditLabel:P,hasCanvas:!0,standaloneInit:!1,defaultDatasetType:"maps",baseWidth:400,baseHeight:300,baseScaleFactor:1,defaultSeriesType:"geo",fireGroupEvent:!0,legendposition:"right",hasGradientLegend:!0,isMap:!0,entities:{},init:function(b,a,c,d){var f,h;h=a.chart=a.chart||a.graph||a.map||{};this.jsonData=a;f=this.components=this.components||(this.components={});f.mapAnnotations=f.mapAnnotations||
(f.mapAnnotations=new w.Annotations);this.components.colorPalette=new fa(this.colorPaletteMap,(0<h.palette&&6>h.palette?h.palette:n(this.paletteIndex,1))-1);h=FusionCharts.register("component",["caption","MapCaption"]);f.caption||(f.caption=new h);F.mscartesian.init.call(this,b,a,c,d)},configure:function(){var b;b=this.jsonData;var a=b.chart||b.map,c=b.markers,d=new fa(this.colorPaletteMap,(0<a.palette&&6>a.palette?a.palette:n(this.paletteIndex,1))-1),f,h,g,k,e=l(a.entitybordercolor,a.bordercolor,
d.plotbordercolor),m=l(a.entityfillcolor,a.fillcolor,d.plotfillcolor),q=l(a.entityfillalpha,a.fillalpha,d.plotfillalpha),S=l(a.entityfillratio,a.fillratio,d.plotfillratio),ka=l(a.entityfillangle,a.fillangle,d.plotfillangle),t=l(a.nullentityfillcolor,a.nullentitycolor,m),v=n(a.usevaluesformarkers,b.markers&&b.markers.items&&b.markers.items.length,!(b.markers&&b.markers.application&&b.markers.application.length&&b.markers.definition&&b.markers.definition.length));this.base.base.configure.call(this);
b=this.config;b.origMarginTop=n(a.charttopmargin,a.maptopmargin,11);b.origMarginLeft=n(a.chartleftmargin,a.mapleftmargin,11);b.origMarginBottom=n(a.chartbottommargin,a.mapbottommargin,11);b.origMarginRight=n(a.chartrightmargin,a.maprightmargin,11);k=b.style;f=k.inCancolor;h=k.inCanfontFamily;g=k.inCanfontSize;b.entityOpts={baseScaleFactor:this.baseScaleFactor,dataLabels:{style:{fontFamily:h,fontSize:g,lineHeight:k.inCanLineHeight,color:k.inCancolor}},fillColor:m,fillAlpha:q,fillRatio:S,fillAngle:ka,
borderColor:e,borderAlpha:l(a.entityborderalpha,a.borderalpha,this.borderAlpha,"100"),borderThickness:n(a.showentityborder,a.showborder,1)?n(a.entityborderthickness,a.borderthickness,1):0,scaleBorder:n(a.scaleentityborder,a.scaleborder,0),hoverFillColor:l(a.entityfillhovercolor,a.hoverfillcolor,a.hovercolor,d.plothoverfillcolor),hoverFillAlpha:l(a.entityfillhoveralpha,a.hoverfillalpha,a.hoveralpha,d.plothoverfillalpha),hoverFillRatio:l(a.entityfillhoverratio,a.hoverfillratio,a.hoverratio,d.plothoverfillratio),
hoverFillAngle:l(a.entityfillhoverangle,a.hoverfillangle,a.hoverangle,d.plothoverfillangle),hoverBorderThickness:l(a.entityborderhoverthickness,a.hoverborderthickness),hoverBorderColor:l(a.entityborderhovercolor,d.plotbordercolor),hoverBorderAlpha:l(a.entityborderhoveralpha,d.plotborderalpha),nullEntityColor:t,nullEntityAlpha:l(a.nullentityfillalpha,a.nullentityalpha,q),nullEntityRatio:l(a.nullentityfillratio,a.nullentityratio,S),nullEntityAngle:l(a.nullentityfillangle,a.nullentityangle,ka),connectorColor:l(a.labelconnectorcolor,
a.connectorcolor,f),connectorAlpha:l(a.labelconnectoralpha,a.connectoralpha,"100"),connectorThickness:n(a.labelconnectorthickness,a.borderthickness,1),showHoverEffect:n(a.showentityhovereffect,a.usehovercolor,a.showhovereffect,1),hoverOnNull:n(a.hoveronnull,a.entityhoveronnull,1),labelPadding:n(a.labelpadding,5),showLabels:n(a.showlabels,1),labelsOnTop:n(a.entitylabelsontop,1),includeNameInLabels:n(a.includenameinlabels,1),includeValueInLabels:n(a.includevalueinlabels,0),useSNameInTooltip:n(a.usesnameintooltip,
0),useShortName:n(a.usesnameinlabels,1),labelSepChar:l(a.labelsepchar,", "),showTooltip:n(a.showentitytooltip,a.showtooltip,1),tooltipSepChar:l(a.tooltipsepchar,", "),tooltext:a.entitytooltext,hideNullEntities:n(a.hidenullentities,0),showHiddenEntityBorder:n(a.showhiddenentityborder,1),showNullEntityBorder:n(a.shownullentityborder,1),hiddenEntityColor:l(a.hiddenentitycolor,a.hiddenentityfillcolor,a.hiddenentityalpha||a.hiddenentityfillalpha?t:"ffffff"),hiddenEntityAlpha:l(a.hiddenentityalpha,a.hiddenentityfillalpha,
.001),shadow:n(a.showshadow,this.defaultPlotShadow,d.shadow)};b.markerOpts={dataLabels:{style:{fontFamily:l(a.markerfont,h),fontSize:n(a.markerfontsize,parseInt(g,10)),fontColor:l(a.markerfontcolor,f)}},showTooltip:n(a.showmarkertooltip,a.showtooltip,1),showLabels:n(a.showmarkerlabels,a.showlabels,1),showHoverEffect:n(a.showmarkerhovereffect,1),labelPadding:l(a.markerlabelpadding,"5"),labelWrapWidth:n(a.markerlabelwrapwidth,0),labelWrapHeight:n(a.markerlabelwrapheight,0),fillColor:l(a.markerfillcolor,
a.markerbgcolor,d.markerfillcolor),fillAlpha:l(a.markerfillalpha,d.markerfillalpha),fillAngle:l(a.markerfillangle,d.markerfillangle),fillRatio:l(a.markerfillratio,d.markerfillratio),fillPattern:l(a.markerfillpattern,d.markerbgpattern),hoverFillColor:a.markerfillhovercolor,hoverFillAlpha:a.markerfillhoveralpha,hoverFillRatio:a.markerfillhoverratio,hoverFillAngle:a.markerfillhoverangle,borderThickness:l(a.markerborderthickness,1),borderColor:l(a.markerbordercolor,d.markerbordercolor),borderAlpha:n(a.markerborderalpha,
d.markerborderalpha),hoverBorderThickness:a.markerborderhoverthickness,hoverBorderColor:a.markerborderhovercolor,hoverBorderAlpha:a.markerborderhoveralpha,radius:n(a.markerradius&&w.trimString(a.markerradius),7),shapeId:l(a.defaultmarkershape,"circle"),labelSepChar:l(a.labelsepchar,", "),tooltipSepChar:l(a.tooltipsepchar,", "),autoScale:n(a.autoscalemarkers,0),tooltext:l(c&&c.tooltext,a.markertooltext),dataEnabled:v,valueToRadius:n(a.markerradiusfromvalue,1),valueMarkerAlpha:l(a.valuemarkeralpha,
"75"),hideNull:n(a.hidenullmarkers,0),nullRadius:n(a.nullmarkerradius,a.markerradius,7),adjustViewPort:n(a.adjustviewportformarkers,0),startAngle:n(a.markerstartangle,90),maxRadius:n(a.maxmarkerradius,0),minRadius:n(a.minmarkerradius,0),applyAll:n(a.applyallmarkers,0),shadow:n(a.showmarkershadow,a.showshadow,0)};b.connectorOpts={showHoverEffect:n(a.showconnectorhovereffect,1),thickness:n(a.connectorthickness,a.markerconnthickness,"2"),color:l(a.connectorcolor,a.markerconncolor,d.markerbordercolor),
alpha:l(a.connectoralpha,a.markerconnalpha,"100"),hoverThickness:n(a.connectorhoverthickness,a.connectorthickness,a.markerconnthickness,"2"),hoverColor:l(a.connectorhovercolor,a.connectorcolor,a.markerconncolor,d.markerbordercolor),hoverAlpha:l(a.connectorhoveralpha,a.connectoralpha,a.markerconnalpha,"100"),dashed:n(a.connectordashed,a.markerconndashed,0),dashLen:n(a.connectordashlen,a.markerconndashlen,3),dashGap:n(a.connectordashgap,a.markerconndashgap,2),font:l(a.connectorfont,a.markerconnfont,
h),fontColor:l(a.connectorfontcolor,a.markerconnfontcolor,f),fontSize:n(a.connectorfontsize,a.markerconnfontsize,parseInt(g,10)),showLabels:n(a.showconnectorlabels,a.showmarkerlabels,a.showlabels,1),labelBgColor:l(a.connectorlabelbgcolor,a.markerconnlabelbgcolor,d.plotfillcolor),labelBorderColor:l(a.connectorlabelbordercolor,a.markerconnlabelbordercolor,d.markerbordercolor),shadow:n(a.showconnectorshadow,a.showmarkershadow,a.showshadow,0),showTooltip:n(a.showconnectortooltip,a.showmarkertooltip,a.showtooltip,
1),tooltext:l(c&&c.connectortooltext,a.connectortooltext),hideOpen:n(a.hideopenconnectors,1)};b.adjustViewPortForMarkers=n(a.adjustviewportformarkers,v)},_createLayers:function(){var b=this.graphics||(this.graphics={}),a=this.components.paper,b=this.graphics;b.backgroundGroup=b.backgroundGroup||a.group("background");b.canvasGroup=b.canvasGroup||a.group("canvas");b.shadowGroup=b.shadowGroup||a.group("shadow");b.datasetGroup=b.datasetGroup||a.group("dataset");b.datalabelsGroup=b.datalabelsGroup||a.group("datalabel");
b.legendGroup=b.legendGroup||a.group("legend");b.captionGroup=b.captionGroup||a.group("caption");b.captionGroup.trackTooltip(!0);b.datasetGroup.trackTooltip(!0);b.buttonGroup=b.buttonGroup||a.group("buttons");this._attachMouseEvents()},_attachMouseEvents:function(){var b=this.linkedItems,b=b.eventListeners||(b.eventListeners=[]),a=this.linkedItems.container;O(a,aa?"touchstart":"mousemove",this.searchMouseMove);b.push(N(a,"touchstart mousemove",this.searchMouseMove,this))},searchMouseMove:function(b){var a=
b.data,c=a.config,d={};if(a.linkedItems.container){var d=w.getMouseCoordinate(a.linkedItems.container,b),f=d.chartX,h=d.chartY,g=a.config,k=g.canvasLeft,e=g.canvasTop,m=g.canvasLeft+g.canvasWidth,g=g.canvasHeight+g.canvasTop;d.insideCanvas=!1;d.originalEvent=b;f>k&&f<m&&h>e&&h<g&&(d.insideCanvas=!0);d&&d.insideCanvas&&(c.lastMouseEvent=b,d={x:d.chartX,y:d.chartY},a._searchNearestNeighbour(d))}},_searchNearestNeighbour:function(b){var a=this.components.dataset[1];a&&a.components.kDTree&&((b=a.getElement(b))?
this.config.lastHoveredPoint!==b&&a.highlightPoint(b):a.highlightPoint(!1))},_createDatasets:function(){var b=this.components,a=this.jsonData,c=this.defaultDatasetType,d=a.data||{},f=a.markers,a=0,h=this.components.dataset,h=b.dataset||(b.dataset=[]);c&&c.toLowerCase();if(c=FusionCharts.get("component",["dataset","Entities"]))h[a]?(h[a].JSONData=d,h[a].configure()):(b=new c,h.push(b),b.chart=this,b.index=void 0,b.init(d)),a++;c=FusionCharts.get("component",["dataset","Markers"]);b=h[a];c&&f?h[a]?
(b.index=void 0,b.init(f),h[a].configure()):(b=new c,h.push(b),b.chart=this,b.index=void 0,b.init(f)):(d=b&&b.type,"markers"===d&&h.splice(a,1))},_parseBackgroundCosmetics:function(){var b=this.components.background.config,a=this.components.colorPalette,c=this.jsonData.chart,d;d=b.showBorder=n(c.showcanvasborder,1);b.borderWidth=d=d?n(c.canvasborderthickness,1):0;b.borderRadius=b.borderRadius=n(c.canvasborderradius,0);b.borderDashStyle=b.borderDashStyle=n(c.borderdashed,0)?z(n(c.borderdashlen,4),
n(c.borderdashgap,2),d):"none";b.borderColor=b.borderColor=D(l(c.canvasbordercolor,a&&a.borderColor));b.borderAlpha=l(c.canvasborderalpha,a.borderAlpha)},_getBackgroundCosmetics:function(){var b=this.jsonData.chart||this.jsonData.map,a=this.components.colorPalette;return{FCcolor:{color:l(b.bgcolor,b.canvasbgcolor,a.bgcolor),alpha:l(b.bgalpha,b.canvasbgalpha,a.bgalpha),angle:l(b.bgangle,b.canvasbgangle,a.bgangle),ratio:l(b.bgratio,b.canvasbgratio,a.bgratio)}}},_parseCanvasCosmetics:function(){var b=
this.config,a=this.jsonData.chart||this.jsonData.map,c=this.components.canvas.config;b.origMarginTop=n(a.maptopmargin,11);b.origMarginLeft=n(a.mapleftmargin,11);b.origMarginBottom=n(a.mapbottommargin,11);b.origMarginRight=n(a.maprightmargin,11);b.origCanvasLeftMargin=n(a.canvasleftmargin,0);b.origCanvasRightMargin=n(a.canvasrightmargin,0);b.origCanvasTopMargin=n(a.canvastopmargin,0);b.origCanvasBottomMargin=n(a.canvasbottommargin,0);c.canvasBorderRadius=n(a.canvasborderradius,0);c.origCanvasTopPad=
n(a.canvastoppadding,0);c.origCanvasBottomPad=n(a.canvasbottompadding,0);c.origCanvasLeftPad=n(a.canvasleftpadding,0);c.origCanvasRightPad=n(a.canvasrightpadding,0)},draw:function(){this.config.entitiesDrawn=!1;this.config.hasChartMessage?(this._hide(),this.drawChartMessage()):(this._show(),this._createToolBox(),this._manageSpace(),this._updateVisuals(),this.inited=!0,this.chartInstance.jsVars.drawCount+=1,this.chartInstance.__state.dataReady=!0,this.chartInstance.jsVars.hasNativeMessage=!1)},_drawDataset:function(){var b=
this.chartInstance,a=this.components.dataset,c=this.graphics,d=a.length,f=this.config.scalingParams;c.datasetGroup.hide();c.shadowGroup.hide();this.config.entitiesReady=!1;b.addEventListener("internal.mapdrawingcomplete",function(){return function(a){a.detachHandler();C&&(c.datasetGroup&&c.datasetGroup.attr({transform:f.transformStr}),c.shadowGroup&&c.shadowGroup.attr({transform:f.transformStr}));c.datasetGroup&&c.datasetGroup.show();c.shadowGroup&&c.shadowGroup.show()}}());for(b=0;b<d;b++)a[b].draw();
this.checkComplete()},preliminaryScaling:function(){for(var b=this.jsonData,a=(b=b.markers&&b.markers.items||[],b.length)||0,c=Infinity,d=Infinity,f=-Infinity,h=-Infinity,g,k;a--;)k=b[a],g=Number(k.x),k=Number(k.y),c=I(c,g),d=I(d,k),f=K(f,g),h=K(h,k);return{x:c,y:d,x1:f,y1:h}},getScalingParameters:function(b,a,c,d){var f=b/a,h=c/(b*this.baseScaleFactor),g=d/(a*this.baseScaleFactor),k=0,e=0;h>g?(h=g,k+=(c-d*f)/2,b=200/(a*h)):(e+=(d-c/f)/2,b=200/(b*h));return{scaleFactor:h,strokeWidth:b,translateX:k,
translateY:e}},calculateMarkerBounds:function(b,a,c){var d=this.config,f=d.markerOpts,h=this.components.dataset,g=this.getDataLimits(),k=g.dataMin,g=g.dataMax,e=f.hideNull,m=f.nullRadius,f=f.valueToRadius,q,l,n,t,v=Infinity,p=Infinity,u=-Infinity,w=-Infinity,ea;n=0;for(t=h.length;n<t;n++)d=h[n],l=d.type,"markers"===l&&(q=d);if(q)for(n in q.calculateMarkerRadiusLimits(),l=q.conf||{},h=l.minRadius,l=l.maxRadius,q=q.components&&q.components.markerObjs||{},q)d=q[n],d=d.config,ea=d.definition||{},null!==
d.cleanValue?(f&&void 0===ea.radius&&(d.radius=h+(l-h)*(d.cleanValue-k)/(g-k)),t=Number(d.radius),d=(Number(ea.x)+a)*b,ea=(Number(ea.y)+c)*b,v=I(v,d-t),p=I(p,ea-t),u=K(u,d+t),w=K(w,ea+t)):e?d.__hideMarker=!0:null===d.radius&&(d.radius=m);return{x:v,y:p,x1:u,y1:w}},_spaceManager:function(){var b=this.config,a=this.components.legend.config.legendPos,c=this.jsonData.chart,d=b.origMarginLeft,f=b.origMarginTop,h=this.baseWidth,g=this.baseHeight,k,e={},m=0,l=0,S,e=b.markerOpts,c=b.borderWidth=b.showBorder?
n(c.borderthickness,1):0;this._allocateSpace({top:c,bottom:c,left:c,right:c});this._allocateSpace(this._manageActionBarSpace&&this._manageActionBarSpace(.225*b.availableHeight)||{});this._manageLegendSpace("right"===a?.3*b.canvasWidth:.3*b.canvasHeight);a=this._manageChartMenuBar("bottom"===a?.225*b.canvasHeight:.225*b.canvasWidth);c=b.canvasWidth;k=b.canvasHeight;e.dataEnabled?(b.adjustViewPortForMarkers?(e=this.preliminaryScaling(),e.x1>h&&(h=e.x1),0>e.x&&(h+=-e.x,m=-e.x),e.y1>g&&(g=e.y1),0>e.y&&
(g+=-e.y,l=-e.y),b=this.getScalingParameters(h,g,c,k),e=this.calculateMarkerBounds(b.scaleFactor*this.baseScaleFactor,m,l),b=k,S=c,0>e.x&&(d+=-e.x,c+=e.x),0>e.y&&(f+=-e.y,k+=e.y),e.x1>S&&(c-=e.x1-S),e.y1>b&&(k-=e.y1-b)):(b=this.getScalingParameters(h,g,c,k),this.calculateMarkerBounds(b.scaleFactor*this.baseScaleFactor,m,l)),b=this.getScalingParameters(h,g,c,k),d+=m*b.scaleFactor*this.baseScaleFactor,f+=l*b.scaleFactor*this.baseScaleFactor):b=this.getScalingParameters(h,g,c,k);this.config.scalingParams=
b;h=b.scaleFactor;b.translateX+=d;b.translateY=b.translateY+f+a.top||0;b.sFactor=h*this.baseScaleFactor*100/100;b.transformStr=["t",b.translateX,",",b.translateY,"s",h,",",h,",0,0"].join("");this.config.annotationConfig={id:"geo",showbelow:0,autoscale:0,grpxshift:b.translateX?b.translateX:0,grpyshift:b.translateY?b.translateY:0,xscale:100*(h?h*this.baseScaleFactor:1),yscale:100*(h?h*this.baseScaleFactor:1),options:{useTracker:!0}};this.components.mapAnnotations.reset(null,this.config.annotationConfig,
this);this.components.mapAnnotations._renderer&&(this.components.mapAnnotations._renderer=null)},getDataLimits:function(){var b=this.components.dataset,a=b.length,c,d=Infinity,f=-Infinity,h;for(h=0;h<a;h++)c=b[h],c=c.getDataLimits(),d=I(d,c.min),f=K(f,c.max);return{dataMin:d,dataMax:f}},getEntityPaths:function(b){var a={},c=this.entities,d;if(b){for(d in c)a[d]=c[d];return a}return c},checkComplete:function(){var b=this,a=b.getJobList(),c=b.components.mapAnnotations,d=b.components.mapLabelAnnotations||
[],f=d.length,h,g,k=b.config.entityOpts.labelsOnTop,e,m,l=function(){b.config.labelDrawCount++;if(b.config.labelDrawCount===f&&k&&(e=c.groups&&c.groups[0]&&c.groups[0].wrapper))for(g=0;g<f;g++)(m=d[g].groups[0]&&d[g].groups[0].wrapper)&&m.insertAfter(e)};b.config.labelDrawCount=0;if(b.config.entityFlag&&b.config.entitiesReady){b.config.entityFlag=!1;for(g=0;g<f;g++)h=d[g],a.labelDrawID.push(x.addJob(h.draw,h,[b,!0],w.priorityList.label,!0,l));c.draw(b);b.config.markersDrawn=!0;p.raiseEvent("internal.mapdrawingcomplete",
{renderer:b},b.chartInstance)}},colorPaletteMap:{basefontcolor:"foregroundcolor",bordercolor:"foregrounddarkcolor",borderalpha:"foregrounddarkalpha",bgcolor:"backgroundlightcolor",bgalpha:"backgroundlightalpha",bgangle:"backgroundlightangle",bgratio:"backgroundlightratio",canvasbordercolor:"foregrounddarkcolor",canvasborderalpha:"foregrounddarkalpha",canvasbgcolor:"backgroundlightcolor",canvasbgalpha:"backgroundlightalpha",canvasbgangle:"backgroundlightangle",canvasbgratio:"backgroundlightratio",
tooltipbordercolor:"foregrounddarkcolor",tooltipborderalpha:"foregrounddarkalpha",tooltipbgcolor:"backgroundlightcolor",tooltipbgalpha:"backgroundlightalpha",tooltipfontcolor:"foregroundcolor",legendbordercolor:"foregrounddarkcolor",legendborderalpha:"foregrounddarkalpha",markerbordercolor:"foregroundlightcolor",markerborderalpha:"foregroundlightalpha",markerfillcolor:"backgrounddarkcolor",markerfillalpha:"backgrounddarkalpha",markerfillangle:"backgrounddarkangle",markerfillratio:"backgrounddarkratio",
plotfillcolor:"backgroundcolor",plotfillalpha:"backgroundalpha",plotfillangle:"backgroundangle",plotfillratio:"backgroundratio",plothoverfillcolor:"backgrounddarkcolor",plothoverfillalpha:"backgrounddarkalpha",plothoverfillangle:"backgrounddarkangle",plothoverfillratio:"backgrounddarkratio",plotbordercolor:"foregroundcolor",plotborderalpha:"foregroundalpha",shadow:"shadow"},eiMethods:{getMapName:function(){var b=this.jsVars.instanceAPI;return"string"===typeof b.name&&b.name.toLowerCase()},getEntityList:function(){var b=
this.jsVars.instanceAPI.components.dataset||[],a,c,d,f=b.length,h=[],g;for(a=0;a<f;a++)if(d=b[a]||[],g=d.type,"entity"===g){c=d;break}b=c.components.data;for(a in b)b.hasOwnProperty(a)&&(c=b[a]||{},c=c.config||{},h.push({id:c.id,originalId:c.originalId||c.id,label:c.label,shortlabel:c.shortLabel,value:c.value,formattedValue:c.formattedValue,toolText:c.toolText}));return h},getMapAttribute:function(){p.raiseWarning(this,"12061210581","run","JavaScriptRenderer~getMapAttribute()",'Use of deprecated "getMapAttribute()". Replace with "getChartAttribute()".');
return this.getChartAttribute.apply(this,arguments)},exportMap:function(){p.raiseWarning(this,"12061210581","run","JavaScriptRenderer~exportMap()",'Use of deprecated "exportMap()". Replace with "exportChart()".');return this.exportChart&&this.exportChart.apply(this,arguments)},addMarker:function(b){var a=this.jsVars.instanceAPI.components.dataset||[],c=a.length,d,f,h,g;for(d=0;d<c;d++)if(f=a[d]||[],g=f.type,"markers"===g){h=f;break}h&&!h.addMarkerItem(b)&&p.raiseWarning(this,"1309264086","run","MapsRenderer~addMarker()",
"Failed to add marker. Check the options and try again.")},updateMarker:function(b,a){var c=this.jsVars.instanceAPI.components.dataset||[],d=c.length,f,h,g,k;for(f=0;f<d;f++)if(h=c[f]||[],k=h.type,"markers"===k){g=h;break}g&&b&&(b=(b+"").toLowerCase(),g.updateMarkerItem(b,a))},removeMarker:function(b){var a=this.jsVars.instanceAPI.components.dataset||[],c=a.length,d,f,h,g;for(d=0;d<c;d++)if(f=a[d]||[],g=f.type,"markers"===g){h=f;break}b&&(b=(b+"").toLowerCase(),h._removeMarkerItem(b))}},_createAxes:function(){}},
F.mscartesian);FusionCharts.register("component",["caption","MapCaption",{configure:function(){var b=this.chart,a=b.jsonData.chart,c=b.components,d=c.caption.config,f=b.config.style,b=f.outCanfontFamily,h=f.outCancolor,f=f.fontSize,g=["top","center"],c=c.subCaption.config;d.style={fontFamily:l(a.captionfont,b),color:D(l(a.captionfontcolor,h).replace(/^#? ([a-f0-9]+)/ig,"#$1")),fontSize:n(a.captionfontsize,f+3)+"px",fontWeight:0===n(a.captionfontbold)?"normal":"bold"};d.align=c.align=l(a.captionposition,
"center");d.align&&(g=d.align.split("-"),g[0]&&(g[0]=g[0].toLowerCase()),g[1]&&(g[1]=g[1].toLowerCase()));d.isOnTop="bottom"===g[0]?c.isOnTop=0:c.isOnTop=1;switch(g[1]){case "right":d.align="end";break;case "left":d.align="start";break;default:d.align="middle"}d.alignWithCanvas=c.alignWithCanvas=n(a.aligncaptionwithcanvas,1);d.horizontalPadding=c.horizontalPadding=n(a.captionhorizontalpadding,d.alignWithCanvas?0:15);d.drawCaption=!0;ca(d.style);c.style={fontFamily:l(a.subcaptionfont,a.captionfont,
b),color:D(l(a.subcaptionfontcolor,a.captionfontcolor,h).replace(/^#? ([a-f0-9]+)/ig,"#$1")),fontSize:n(a.subcaptionfontsize,n(K(n(a.captionfontsize)-3,-1),f)+n(this.subTitleFontSizeExtender,1))+"px",fontWeight:0===n(a.subcaptionfontbold,this.subTitleFontWeight,a.captionfontbold)?"normal":"bold"};ca(c.style)}},"Caption"]);FusionCharts.register("component",["dataset","Entities",{customConfigFn:"_createDatasets",type:"entity",pIndex:2,configure:function(){var b=this.chart,a=b.jsonData,c=this.conf,d=
b.components,f=a.map||a.chart,h,b=w.nonGradientColorRange,g=(a.colorrange||{}).gradient,k=d.postLegendInitFn,e=d.numberFormatter,m,l={},d=a.entitydef||[];h=a.data&&a.data[0]&&a.data[0].data?this.JSONData=a.data[0].data||[]:this.JSONData=a.data||[];c.useSNameAsId=n(f.usesnameasid,0);this._redefineEntities(d);d=this.components.data;c.showTooltip=n(f.showtooltip,1);c.showHoverEffect=n(f.showhovereffect,0);h=(c=h)&&c.length||0;for(f={};h--;)l=c[h],void 0!==l.id&&(f[l.id.toLowerCase()]=l);h=f;this.calculateDataLimits();
l=this.getDataLimits();g?k({min:l.min,max:l.max}):this.components.colorRange=new b({colorRange:a.colorrange,dataMin:l.min,dataMax:l.max,defaultColor:"#00ff00",numberFormatter:e});for(m in d)a=h[m],b=d[m],b.dataset=this,a?this._configureEntity(m,b,U(this._sanitizeEntityOptions(u({},a)),b.config)):this._configureEntity(m,b,b.config);this._addLegend()},init:function(b){this.JSONData={data:b};this.components={};this.conf={};this.graphics={};this.configure()},updateEntityColors:function(b,a){var c=this.components.data,
d=this.chart,f,h,g,k,e={"fill-opacity":0};for(k in c)f=c[k],h=f.config,g=h.cleanValue,h=h.alphaArr||[],h={"fill-opacity":h[0]/100||1},g<b||g>a?(this.setCustomAttrs(f,e,d),f.hidden=!0):(f.hidden=!1,this.setCustomAttrs(f,h,d))},_addLegend:function(){var b=this.chart.components.legend,a=(this.components.colorRange||{}).colorArr||[],c=this.components.entityColorMap=this.components.entityColorMap||(this.components.entityColorMap=[]),d,f,h=a.length,g,k,e;b.emptyItems();f=c.length=0;for(h=a.length;f<h;f++)d=
a[f],k=l(d.code,d.color),g=T(k,60).replace(Q,Y),e=T(k,40),k={FCcolor:{color:k+","+k+","+e+","+k+","+k,ratio:"0,70,30",angle:270,alpha:"100,100,100,100,100"}},g={fillColor:M(k),label:l(d.label,d.displayvalue),strokeColor:M(g),legendItemId:d.legendItemId},(k=c[f])||(k=c[f]={config:{}}),k.config=d,k.visible=!0,k.dataset=this,k.legendItemId=b.addItems(k,this.legendInteractivity,g)},legendInteractivity:function(b,a){var c=this.config,d=b.config,f=b.visible,h=b.dataset,g=h.chart,k=h.components.data,e,m,
l=a.config,n=a.graphics,p,t=h.components.colorRange,v=c.itemHiddenStyle.color,c=c.itemStyle.color,u=l.fillColor;m={};var w,y={},ea={"fill-opacity":0},x=l.strokeColor;b.visible=!f;for(e in k)k.hasOwnProperty(e)&&(m=k[e],l=m.config,p=l.cleanValue,p=t.getColorObj(p),l=l.visibleEntityAttr,y["fill-opacity"]=l["fill-opacity"],l=f?ea:y,d.code===p.code&&(m.hidden=f?!0:!1,h.setCustomAttrs(m,l,g)));m={legendItemSymbol:{fill:f?v:u,stroke:f?v:x},legendItemText:{fill:f?v:c},legendIconLine:{stroke:f?v:u}};for(w in n)(d=
n[w])&&d.attr&&d.attr(m[w])},setCustomAttrs:function(b,a,c){var d=c.get("config","animationObj");c=d.transposeAnimDuration;d=d.animType;b&&(b=b.graphics,b=b.outlines,b.animate(a,c,d))},calculateDataLimits:function(){var b=this.chart,a=this.conf,c=b.jsonData.data||[],b=b.components.numberFormatter,d,f=Infinity,h=-Infinity,g,k;k=0;for(g=c.length;k<g;k++)d=c[k].value,d=b.getCleanValue(d),f=I(f,d),h=K(h,d);a.max=h;a.min=f},_configureEntity:function(b,a,c){var d=this.chart,f=this.conf,h=d.jsonData,g=d.components,
k=g.numberFormatter,e=d.config.entityOpts,m=a.config,d=a.labelConfig,q=c.value,S=h.colorrange&&h.colorrange.gradient,p=(g=g.gradientLegend)&&g.colorRange,t=this.components.colorRange,g=m.cleanValue=k.getCleanValue(q),v=m.formattedValue=g?k.dataLabels(g):void 0,k=n(c.showtooltip,e.showTooltip),h=this._getDefaultTooltip.call(a,c,this),v={formattedValue:v,sName:c.shortLabel,lName:c.label},w=e.dataLabels.style,k=m.toolText=k?E(l(J(l(c.tooltext,e.tooltext,h),[1,2,7,38,39],v,c))):"",h=m.borderColor=l(c.bordercolor,
e.borderColor),v=m.borderAlpha=l(c.borderalpha,e.borderAlpha),u=m.borderThickness=n(c.borderthickness,e.borderThickness),y=m.useHoverColor=n(c.showhovereffect,c.usehovercolor,e.hoverOnNull?e.showHoverEffect:isNaN(q)?0:e.showHoverEffect),q=m.labelAlignment,x;a.hidden=!1;m.showLabel=n(c.showlabel,e.showLabels);m.labelPadding=n(c.labelpadding,e.labelPadding);m.fontFamily=l(c.font,w.fontFamily);m.fontSize=n(parseInt(c.fontsize,10),parseInt(w.fontSize,10));m.fontBold=n(c.fontbold,0);m.fontColor=l(c.fontcolor,
w.color);m.connectorColor=l(c.labelconnectorcolor,e.connectorColor);m.connectorAlpha=l(c.labelconnectoralpha,e.connectorAlpha);m.hoverBorderThickness=n(c.borderhoverthickness,c.hoverborderthickness,e.hoverBorderThickness);m.hoverBorderColor=l(c.borderhovercolor,c.hoverbordercolor,e.hoverBorderColor,m.borderColor);m.hoverBorderAlpha=l(c.borderhoveralpha,c.hoverborderalpha,e.hoverBorderAlpha,m.borderAlpha);m.connectorThickness=n(c.labelconnectorthickness,e.connectorThickness);m.origConnectorThickness=
m.connectorThickness;m.borderThickness=u;m.link=c.link;m.isVisible=!0;m.id=b;m.originalId=c.origId;null!==g&&(p&&S?x=p.getColorByValue(g):t&&(b=t.getColorObj(g),x=l(b.color,b.code)));void 0!==l(c.color,c.alpha,c.angle,c.ratio)?(x=l(c.color,x,e.fillColor),b=l(c.alpha,e.fillAlpha),g=l(c.angle,e.fillAngle),S=l(c.ratio,e.fillRatio),x=B({color:x,alpha:b,angle:g,ratio:S})):(x=B({color:l(x,e.fillColor),alpha:l(e.fillAlpha),angle:l(e.fillAngle),ratio:l(e.fillRatio)}),b=B({color:l(e.nullEntityColor),alpha:l(e.nullEntityAlpha),
angle:l(e.nullEntityAngle),ratio:l(e.nullEntityRatio)}),x=null===g?b:x,b=x.FCcolor.alpha);""===k&&(f.showTooltip=0);m.visibleEntityAttr={stroke:D(h,v),fill:(m.fillColor=x).toString(),"fill-opacity":b/100};f=b.split(",");m.alphaArr=f;y&&(void 0!==l(c.fillhovercolor,c.fillhoveralpha,c.fillhoverangle,c.fillhoverratio,c.hoverfillcolor,c.hoverfillalpha,c.hoverfillratio,c.hoverfillangle)?(x=l(c.fillhovercolor,c.hoverfillcolor,e.hoverFillColor),b=l(c.fillhoveralpha,c.hoverfillalpha,e.hoverFillAlpha),g=l(c.fillhoverangle,
c.hoverfillangle,e.hoverFillAngle),S=l(c.fillhoverratio,c.hoverfillratio,e.hoverFillRatio),f=B({color:x,alpha:b,angle:g,ratio:S})):(e.hoverColorObject||(e.hoverColorObject=B({color:e.hoverFillColor,alpha:e.hoverFillAlpha,angle:e.hoverFillAngle,ratio:e.hoverFillRatio})),f=e.hoverColorObject),m.hoverColor=f);!d&&(d=a.labelConfig={});e=m.fontColor;b=m.fontFamily;x=m.fontBold;k=m.toolText;g=m.link;q?(f=q[0],q=q[1]):(f="center",q="middle");d.align=f;d.vAlign=q;d.bgColor="";d.borderColor="";d.fontColor=
e;d.fontFamily=b;d.fontBold=x;d.toolText=k;d.link=g;if("object"===typeof m.options)for(g=m.entityLabels=m.entityLabels||[],h=m.labels||[],v=h.length;v--;)g[v]||(g[v]={config:{}}),d=g[v].config,(q=h[v].labelAlignment)?(f=q[0],q=q[1]):(f="center",q="middle"),d.align=f,d.vAlign=q,d.displayValue=this.getDisplayValue.call(a,h[v],m.options.isDataEnabled,!v,c),d.bgColor="",d.borderColor="",d.toolText=k,d.align=f,d.vAlign=q,d.bgColor="",d.borderColor="",d.fontColor=e,d.fontFamily=b,d.fontBold=x,d.toolText=
k;else m={shortText:m.shortLabel,text:m.label},d.displayValue=this.getDisplayValue.call(a,m,!0,!0,c)},getDisplayValue:function(b,a,c,d){var f=this.dataset.chart.config.entityOpts,h=this.config,g=h.cleanValue,e=h.formattedValue,r=f.labelSepChar;a?c&&"undefined"!==typeof d.displayvalue?b=d.displayvalue:(b=l(f.includeNameInLabels?f.useShortName?b.shortText:b.text:""),f.includeValueInLabels&&null!==g&&(b=void 0===b?e:b+r+e)):b=h.label;return b},_sanitizeEntityOptions:function(b){delete b.outlines;delete b.label;
delete b.shortlabel;delete b.labelposition;delete b.labelalignment;delete b.labelconnectors;return b},_redefineEntities:function(b){var a=this.conf,c={},d={},f=this.chart.entities,h=a.useSNameAsId,g,e,l,m,n,S,p,t=0,v,u;for(g=b.length;g--;)if(e=b[g],l=e.internalid,m=e.newid?e.newid:l,n=e.sname,S=e.lname,v=f[l],l=w.trimString(l),m=(m=w.trimString(m))&&m.toLowerCase(),v){c[m]=m={origId:l};d[l]=!0;for(u in v)m[u]=v[u];m.shortLabel=n?n:v.shortLabel;m.label=S?S:v.label;m.showhovereffect=e.showhovereffect;
m.fillhovercolor=e.fillhovercolor;m.fillhoveralpha=e.fillhoveralpha;m.fillhoverangle=e.fillhoverangle;m.fillhoverratio=e.fillhoverratio;m.borderhoverthickness=e.borderhoverthickness}v=this.components.data;v||(v=this.components.data={});for(p in c)p=p.toLowerCase(),v[p]||(v[p]={config:{}}),v[p].config=c[p],t+=1;c=v;for(p in f)if(m=f[p],p=w.trimString(p),!d[p]){h?((v=c[m.shortLabel.toLowerCase()])||(v=c[m.shortLabel.toLowerCase()]={}),v.config={},v.origId=m.shortLabel):((v=c[p.toLowerCase()])||(v=c[p.toLowerCase()]=
{}),v.config={},v.config.origId=p);for(u in m)v.config[u]=m[u];t+=1}a.entityCount=t},draw:function(){var b=this.conf,a=this.chart,c=C?200:10;this.conf.ready=!1;b.BATCH_SIZE=c;b.labelBatchSize=C?200:20;this._batchRender()(0);a.config.entityFlag=!0},_batchRender:function(){var b=this,a=b.conf,c=b.chart,d=c.getJobList(),c=c.entities.firstEntity,f=b.components.data,h=a.BATCH_SIZE,g=a.entityKeys=c?b._getKeys(c,f):Object.keys(f),e=a.entityLength=g.length,l,m,n,p,u,t=function(a){l=a;for(n=0;void 0!==g[l];){m=
f[g[l]];u=b.drawEntity(m,h);n+=u;if(m.config.drawn){if(p=l===e-1?m:f[g[l-1]])p.config.drawn=!1,p.config.outlineStartIndex=void 0;l++}if(n>=h){d.entityDrawID.push(x.addJob(t,b,[l],w.priorityList.entitydraw,!0));break}}l===e&&(b._addEventListenersToEntities(0),b.initComplete())};return t},_addEventListenersToEntities:function(b){for(var a=this.components.data,c=this.chart.getJobList(),d=this.conf,f=d.BATCH_SIZE,h=d.entityKeys,d=d.entityLength,g,e=0,l;b<d;b++)if(g=a[h[b]],l=g.config,(l=l.options)&&!1===
l.isDataEnabled||this.addMouseGestures.call(g),e++,e===f){c.entityDrawID.push(x.addJob(this._addEventListenersToEntities,this,[b],w.priorityList.entitydraw,!0));break}},_getKeys:function(b,a){for(var c=[b],d=b;a[d];)d=a[d].nextId,c.push(d);return c},_getDefaultTooltip:function(b){var a=this.config.cleanValue,c=this.config.formattedValue,d=this.dataset.chart.config.entityOpts;if("object"===typeof this.config.options){b=b.labels&&b.labels[0];if(!b)return;a=(d.useSNameInTooltip?b.shortText:b.text)+(null===
a?"":d.tooltipSepChar+c)}else a=(d.useSNameInTooltip?b.shortLabel:b.label)+(null===a?"":d.tooltipSepChar+c);return a},drawEntity:function(b,a){var c=this.chart,d=c.components.paper,f=b.config,h=C||!G?"litepath":"path",g=f.outlines,e=c.graphics.datasetGroup,l=c.graphics.shadowGroup,m=f.toolText,c=c.config.entityOpts.shadow,n,p=[],w,t,v,x,z,y,E,D;this._configureEntityDrawingParams(b);f=b.config;t=f.visibleEntityAttr;D=f.shadowOptions;w=f.fillOpacity;n=void 0===f.outlineStartIndex?g.length:f.outlineStartIndex;
b.graphics||(b.graphics={});y=0;p=f.outlinePath||(f.outlinePath=[]);E=f.customStrokeWidthModifier;if("object"===typeof f.options){for(;n--;){p=g[n].outline;if(!0===f.options.isDataEnabled)v=t;else{v=u({},t);x=g[n].style;z=E;var A=void 0,L={};z=z||1;if(x&&"object"===typeof x)for(A in x)la.test(A)||("stroke-width"===A?(L[A]=Number(x[A])/z,ia&&(L[A]=L[A]&&R(L[A])||0)):L[A]=x[A]);x=L;v=u(v,x)}x=b.graphics.outlines;x||(x=b.graphics.outlines=[]);!x[n]&&(x[n]={});(z=x[n].outline)?z.attr({"fill-opacity":w}):
z=x[n].outline=d[h](p,e);z.attr(v).tooltip(m).shadow(c?D:!1,l);y++;f.outlineStartIndex=n;if(y===a)return y}f.drawn=!0}else{if(b.graphics.outlines)b.graphics.outlines.attr(t).attr({"fill-opacity":w});else{for(;n--;)if(w=g[n],p=w.concat(p),y++,f.outlineStartIndex=n,y===a)return f.outlinePath=p,y;b.graphics.outlines=d[h](p,e).attr(t)}f.drawn=!0;f.outlineStartIndex=0;f.outlinePath=[];b.graphics.outlines.tooltip(m).shadow(c?D:!1,l)}return y},_configureEntityDrawingParams:function(b){var a=this.chart,c=
a.config,d=a.components.gradientLegend,f=b.config,h=a.config.scalingParams,g=!G||C,e=h.scaleFactor,l=h.strokeWidth,m=(g?a.baseScaleFactor:1)*l,n=1===a.config.entityOpts.scaleBorder,p=f.borderThickness,u=f.origConnectorThickness,t=f.hoverBorderThickness,v=f.visibleEntityAttr,w=v["fill-opacity"];f.shadowOptions={scalefactor:[e,e*a.baseScaleFactor],opacity:K.apply(H,f.alphaArr)/100};d&&!0===c.gLegendEnabled&&(b.hidden=!1);f.fillOpacity=b.hidden?0:w;d&&d.enabled&&(d.resetLegend(),d.clearListeners());
d&&d.notifyWhenUpdate(this.updateEntityColors,this);g?(p=f.entityBorderThickness=n?p*m:p/e,u/=e,b=n?e:h.sFactor,t&&(f.hoverBorderThickness=n?t*m:t/e)):(p=n?p*l:p,b=n?h.scaleFactor:a.baseScaleFactor);f.entityBorderThickness=p;f.connectorThickness=u;f.customStrokeWidthModifier=b;v["stroke-width"]=p;v.transform=C||!G?"":h.transformStr},drawLabels:function(b){var a=b.chart,c=b.conf,d=c.labelBatchSize,f=a.components,c=c.entityLength,h=[],g,e=0,l=0,m=0,n=a.config.annotationConfig,p=f.mapLabelAnnotations=
f.mapLabelAnnotations||(f.mapLabelAnnotations=[]);(f=p[e])||(f=p[e]=new w.Annotations);f.reset(null,n,a);f._renderer&&(f._renderer=null);for(g in this)b.drawLabel.call(this[g],h),e++,e===d?(f.addGroup({id:"entityLabels",items:h}),l++,(f=p[l])||(f=p[l]=new w.Annotations),f.reset(null,n,a),f._renderer&&(f._renderer=null),e=0,h=[]):m===c-1&&f.addGroup({id:"entityLabels",items:h}),m++;b.drawLabelConnFn(0)},drawLabelConnFn:function(b){for(var a=this.conf,c=this.chart.getJobList(),d=this.components.data,
f=a.BATCH_SIZE,a=a.entityKeys,h,g=a.length,e,l,m=0;b<g;b++){l=d[a[b]];h=l.config;if("object"===typeof h.options)for(h=(e=h.labels)&&e.length||0;h--;)e[h].labelConnectors&&(this.drawLabelConnectors.call(l,e[h].labelConnectors),m++);else h.labelConnectors&&(this.drawLabelConnectors.call(l,h.labelConnectors),m++);if(m===f){c.entityDrawID.push(x.addJob(this.drawLabelConnFn,this,[b],w.priorityList.entitydraw,!0));break}}},_getLabelObject:function(b,a){var c=this,d=c.dataset,f=d.chart,e=c.config,g,k=f.config.scalingParams,
l,m,n=c.graphics&&c.graphics.outlines,u,w=e.fontSize,t=e.labelPadding;m=e.labels||[];g=e.entityLabels||[];var v;void 0!==b?(m=m[b],u=g[b],g=u.config,u=g.style=m.style,l=m.labelPosition,m=m.labelAlignment):(g=c.labelConfig,l=e.labelPosition,m=e.labelAlignment);l?(n=l[0],l=l[1]):(l=n.getBBox(),n=l.x+l.width/2,l=l.y+l.height/2);m?(v=m[0],m=m[1],"right"===v?n-=t:"left"===v&&(n+=t),"top"===m?l-=t:"bottom"===m&&(l+=t)):(v="center",m="middle");w=parseFloat(w)/k.sFactor;!a&&u&&(u.color&&(g.fontColor=u.color),
u["font-size"]&&(w=parseFloat(u["font-size"])/k.sFactor),u["font-family"]&&(g.fontFamily=u["font-family"]),void 0!==u["font-weight"]&&(g.fontBold="bold"===u["font-weight"]));g.x=n.toString();g.y=l.toString();g.wrap=1;g.type="text";g.fontSize=w;return{x:n.toString(),y:l.toString(),wrapwidth:ja[v](void 0,n+void 0)-t,wrapheight:ga[m](void 0,l+void 0)-t,wrap:1,type:"text",align:g.align,valign:g.vAlign,text:g.displayValue,tooltext:g.toolText,link:g.link,bgcolor:g.bgColor,bordercolor:g.borderColor,fillcolor:g.fontColor,
fontsize:g.fontSize,font:g.fontFamily,bold:g.fontBold,onclick:function(a){p.raiseEvent("entityclick",e.eventArgs,f.chartInstance,a)},onmouseover:function(a){var b=c.graphics.outlines,f,g;if(b instanceof Array)for(f=0,g=b.length;f<g;f++)d.entityRollOver.call(b[f].outline,a);else d.entityRollOver.call(b,a)},onmouseout:function(a){var b=c.graphics.outlines,f,g;if(b instanceof Array)for(f=0,g=b.length;f<g;f++)d.entityRollOut.call(b[f].outline,a);else d.entityRollOut.call(b,a)},ontouchstart:function(a){var b=
c.graphics.outlines,f,g;if(b instanceof Array)for(f=0,g=b.length;f<g;f++)d.entityRollOver.call(b[f].outline,a);else d.entityRollOver.call(b,a);d.entityRollOver.call(b,a)}}},drawLabel:function(b){var a=this.dataset,c=this.config,d;if(c.showLabel)if("object"===typeof c.options)for(d=(d=c.labels)&&d.length||0,c=c.options.isDataEnabled;d--;)b.push(a._getLabelObject.call(this,d,c,!d));else b.push(a._getLabelObject.call(this,void 0,!0,!0))},drawLabelConnectors:function(b){for(var a=this.config,c=this.dataset.chart,
d=c.components.paper,f=c.config.scalingParams,c=c.graphics.datasetGroup,e=b&&b.length||0,g,k,l=a.showLabel;e--;)k=b[e],g=this.graphics.connectorElem,l?(g||(this.graphics.connectorElem=g=d.path(k,c)),g.show().attr({transform:C||!G?"":f.transformStr,stroke:D(a.connectorColor,a.connectorAlpha),"shape-rendering":"crisp","stroke-width":a.connectorThickness})):g&&g.hide()},entityClick:function(b){var a=this.node.__entity,c=a.dataset.chart,d=c.linkedItems.linkClickFN,a=a.config,f=a.link;p.raiseEvent("entityclick",
a.eventArgs,c.chartInstance,b);void 0!==f&&d.call({link:f},c)},entityRollOver:function(b){var a=this.node.__entity,c=a.config,d=a.dataset.chart,f=c.hoverAttr;w.plotEventHandler.call(this,d,b,"entityRollOver");this.data("hovered")?clearTimeout(a.config.timer):c.useHoverColor&&c.isVisible&&!a.hidden&&(d.config.hoverEntity=this,this.attr(f),this.data("hovered",!0))},entityRollOut:function(b){var a=this,c=this.node.__entity,d,f=c.config.revertAttr;w.plotEventHandler.call(a,c.dataset.chart,b,"entityRollOut");
c.config.timer=setTimeout(function(){d=c.hidden;!0!==d&&(a.attr(f),a.data("hovered",!1))},100)},addMouseGestures:function(){var b=this,a=b.config,c=b.dataset,d=b.graphics,f=a.hoverBorderThickness,e=a.hoverBorderColor,g=a.hoverBorderAlpha,k=a.entityBorderThickness,l=a.borderColor,m=a.borderAlpha,q=a.link,p=a.visibleEntityAttr,u="groupId"+a.originalId,t,v=function(d){void 0!==q&&d.css({cursor:"pointer",_cursor:"hand"});d.data("eventArgs",a.eventArgs);d.data("groupId",u);d.node.__entity=b;b._listenersBinded||
d.click(c.entityClick).hover(c.entityRollOver,c.entityRollOut)};a.eventArgs={value:a.cleanValue,label:a.label,shortLabel:a.shortLabel,originalId:a.origId,id:a.id||a.origId};a.legacyEventArgs={value:a.value,lName:a.label,sName:a.shortLabel,id:a.originalId||a.id};a.hoverAttr={fill:M(a.hoverColor)};a.revertAttr={fill:M(a.fillColor),stroke:M(a.borderColor,a.borderAlpha)};a.revertAttr["fill-opacity"]=p["fill-opacity"];f!==k&&(a.hoverAttr["stroke-width"]=n(f,k),a.revertAttr["stroke-width"]=k);if(e!==l||
g!==m)a.hoverAttr.stoke=D(e,g),a.revertAttr.stroke=D(l,m);for(t in d)if(d.hasOwnProperty(t)){if(d[t]instanceof Array)for(k=d[t],f=0,g=k.length;f<g;f++)e=k[f].outline,v(e);else e=d[t],v(e);b._listenersBinded=!0}},getDataLimits:function(){var b=this.conf;return{max:b.max,min:b.min}},initComplete:function(){var b=this.chart;this.drawLabels.call(this.components.data,this);b.config.entitiesReady=!0;b.checkComplete()}}]);FusionCharts.register("component",["dataset","Markers",{type:"markers",configure:function(){var b=
this.chart.config.markerOpts;this.calculateDataLimits();b.dataEnabled?this._parseMarkers():this.defineMarkersNShapes();this.configureConnectors()},init:function(b){this.JSONData=b;this.components={};this.conf={};this.graphics={};this.configure()},calculateMarkerRadiusLimits:function(){var b=this.JSONData,a=this.conf,c=this.chart,b=this.getMarkerRadiusLimits(c.config.width,c.config.height,b.markermaxradius,b.markerminradius);a.minRadius=b.min;a.maxRadius=b.max},calculateDataLimits:function(){var b=
this.chart,a=this.conf,c=(b.jsonData.markers||{}).items||[],b=b.components.numberFormatter,d=Infinity,f=-Infinity,e,g,k;k=0;for(g=c.length;k<g;k++)e=c[k],e=e.value,e=b.getCleanValue(e),null!==e&&(d=I(e,d),f=K(e,f));a.min=d;a.max=f},_parseMarkers:function(){var b=this.chart,a=b.jsonData.markers,c=a.items,d=a.shapes,a=b.config.markerOpts,f=b.components.numberFormatter,e=this.components.shapeObjs=this.components.shapeObjs||(this.components.shapeObjs={}),g=this.components.markerObjs=this.components.markerObjs||
(this.components.markerObjs={}),k,r,m,q,p,u,t;if(c&&c.length){if(d&&d.length)for(k=d.length;k;--k)if(m=d[k-1],t=m.id.toLowerCase())e[t]=m;for(k=c.length;k--;)if(m=c[k],t=m.id&&m.id.toLowerCase())d=m.value,void 0!==d&&""!==d&&(d=parseFloat(d)),r=this._initializeMarkerItem(t,m,null,b),(q=r.config.options.shapeid)&&"string"===typeof q&&(q=q.toLowerCase()),p=r.config,u=p.options,p.cleanValue=f.getCleanValue(d),p.formattedValue=null!==p.cleanValue?f.dataLabels(d):void 0,p.fillColor=l(u.fillcolor,u.color,
a.fillColor),p.fillAlpha=l(u.fillalpha,u.alpha,a.fillAlpha),p.fillRatio=l(u.fillratio,a.fillRatio),p.fillAngle=l(u.fillangle,a.fillAngle),p.borderThickness=n(u.borderthickness,a.borderThickness),p.borderColor=l(u.bordercolor,a.borderColor),p.borderAlpha=l(u.borderalpha,a.borderAlpha),p.labelPadding=u.labelpadding||a.labelPadding,r.dataset=this,m.__hideMarker&&(r._isHidden=!0),q&&(r.shapeObj=e[q]),g[t]=r}},defineMarkersNShapes:function(){var b=this.chart,a=b.jsonData.markers,c=a.definition,d=b.components.numberFormatter,
f=b.config.markerOpts,e=da(c)||{},g=da(a.application)||{},k=a.shapes,a=this.components.shapeObjs=this.components.shapeObjs||(this.components.shapeObjs={}),r=this.components.markerObjs=this.components.markerObjs||(this.components.markerObjs={}),m,q,p,u;if(c&&c.length){if(k&&k.length)for(c=k.length;c;--c)if(m=k[c-1],u=m.id.toLowerCase())a[u]=m;for(u in e)m=e[u],c=r[u]=this._initializeMarkerItem(u,m,g[u],b),c.dataset=this,p=c.config.options.shapeid,k=c.config,q=m.value,k.cleanValue=d.getCleanValue(q),
m=k.options,k.formattedValue=null!==k.cleanValue?d.dataLabels(q):void 0,k.fillColor=l(m.fillcolor,m.color,f.fillColor),k.fillAlpha=l(m.fillalpha,m.alpha,f.fillAlpha),k.fillRatio=l(m.fillratio,f.fillRatio),k.fillAngle=l(m.fillangle,f.fillAngle),k.borderThickness=n(m.borderthickness,f.borderThickness),k.borderColor=l(m.bordercolor,f.borderColor),k.borderAlpha=l(m.borderalpha,f.borderAlpha),k.labelPadding=m.labelpadding||f.labelPadding,k.options.tooltext=l(m.tooltext,f.tooltext),k.link=m.link,p&&(c.shapeObj=
a[p.toLowerCase()])}},getMarkerRadiusLimits:function(b,a,c,d){a=I(b,a);b=.02*a;a*=.07;d=parseFloat(d);c=parseFloat(c);return isNaN(d)||isNaN(c)?isNaN(d)?isNaN(c)?{min:b,max:a}:{min:parseInt(c/10,10),max:c}:{min:d,max:10*d}:d<c?{min:d,max:c}:{min:c,max:d}},getDataLimits:function(){var b=this.conf;return{min:b.min,max:b.max}},_initializeMarkerItem:function(b,a,c){var d={},f=d.config;f||(f=d.config={});f.id=b;f.definition=a;f.application=c;f.hasValue=null;f.value=null;f.options=null;f.label=null;f.markerShape=
null;f.markerLabel=null;f.drawOptions={shape:null,label:null};f.drawComplete=!1;b=d.config.options=u({},f.definition);f.dataEnabled?isNaN(b.value)||""===b.value||(d.value=parseFloat(b.value),d.hasValue=!0):f.applyAll?f.options=u(b,f.application):c&&(f.options=u(b,f.application));return d},configureConnectors:function(){var b=this.chart,a=b.jsonData.markers||{},a=a.connector||a.connectors||[],c=this.components.markerObjs,d=a.length,f=this.components.connectors,e=function(a){return function(c){var d=
c.data,f=d.wrapper;f&&d.options.hoverEffect&&f.attr(d.options._hoverAttrs);p.raiseEvent("connectorrollover",a,b.chartInstance,c)}},g=function(a){return function(c){var d=c.data,f=d.wrapper;f&&d.options.hoverEffect&&f.attr(d.options._defaultAttrs);p.raiseEvent("connectorrollout",a,b.chartInstance,c)}},k=function(a){return function(c){p.raiseEvent("connectorClick",a,b.chartInstance,c)}},r=b.config.connectorOpts,m={},q,w,x,t,v,z,A,y,C,D,G,L,F;f||(f=this.components.connectors=[]);for(F=0;F<d;F++)if(L=
a[F],L.from||L.to)w=c[L.from.toLowerCase()],x=c[L.to.toLowerCase()],w&&x&&(t=a[F].label,m=f[F],!m&&(m=f[F]={}),!m.config&&(q=m.config={}),!m.graphics&&(m.graphics={}),q=m.config=u({},L),q.fromMarker=w,q.toMarker=x,q.link=L.link,q.showTooltip=n(L.showtooltip,r.showTooltip),v=q.tooltext=q.showTooltip?l(L.tooltext,r.tooltext):"",z=q.thickness=l(L.thickness,r.thickness),A=q.color=l(L.color,r.color),y=q.alpha=l(L.alpha,r.alpha),q.hoverEffect=n(L.showhovereffect,r.showHoverEffect),C=l(L.hovercolor,r.hoverColor,
A),D=l(L.hoveralpha,r.hoverAlpha,y),G=l(L.hoverthickness,r.hoverThickness,z),q.dashed=l(L.dashed,r.dashed),q.dashLen=n(L.dashlen,r.dashlen),q.dashGap=n(L.dashgap,r.dashgap),v&&(q.tooltext=v=E(J(v,[3,40,41,42,43],{label:t,fromId:w.config.definition.id,toId:x.config.definition.id,fromLabel:w.config.definition.label,toLabel:x.config.definition.label},void 0))),q.eventArgs={fromMarkerId:w.config.id,toMarkerId:x.config.id,label:t},q._hoverAttrs={stroke:B({color:C,alpha:D}).toString(),"stroke-width":G},
q._defaultAttrs={stroke:B({color:A,alpha:y}).toString(),"stroke-width":z},q.type="line",q.onclick=k(q.eventArgs),q.onmouseover=e(q.eventArgs),q.onmouseout=g(q.eventArgs),t&&(q=m.labelConfig,!q&&(q=m.labelConfig={}),q.type="text",q.text=t,q.align="center",q.valign="middle",q.font=r.font,q.fillcolor=r.fontColor,q.bgcolor=r.labelBgColor,q.bordercolor=r.labelBorderColor,q.tooltext=r.tooltext))},draw:function(){var b=this.chart,a=this.conf,c=b.components.mapAnnotations,d=this.components.markerObjs,f=b.config,
e=f.markerOpts,g=f.scalingParams,f=[],k=[],l,m,n=b.getJobList();this.imageCount=this.imageLoadCount=0;m=c.addGroup({items:k});c=c.addGroup({fillalpha:"100",items:f});this.components.markerGroup=c;this.components.markerLabelGroup=m;a.autoScale=e.autoScale?g.sFactor:1;for(l in d)a=null,e=d[l],g=e.config,g.conIsHidden||(a=this._drawMarkerItem.call(e)),a&&(g._annotationIndex=f.length,e.markerShape=a.markerShape&&c.addItem(a.markerShape,!1,b),f.push(e.markerShape),e.markerLabel=a.markerLabel&&m.addItem(a.markerLabel,
!1,b),k.push(e.markerLabel));this._drawConnectors();n.kdTreeID.push(x.addJob(this._buildKdTree,this,[],w.priorityList.kdTree,!0))},_buildKdTree:function(){var b=this.components.kdArrayMap,a=this.components.markerGroup,c=[],d,f=a&&a.items,h=f&&f.length||0;for(d=0;d<h;d++)a=f[d]._id,c.push(b[a]);this.components.kDTree||(this.components.kDTree=new e(!0));this.components.kDTree._setSearchLimit(Infinity,Infinity);this.components.kDTree.buildKdTree(c)},_drawMarkerItem:function(){var b=this,a=b.dataset,
c=a.chart,d=c.config,f=a.conf,e=d.scalingParams,g=b.config,k=g.options,r=g.definition,m=d.markerOpts,d=m.dataLabels.style,q=k.shapeid,p=k.scale||1,w=k.label||"",t=c.config.scalingParams.scaleFactor*c.baseScaleFactor,c=(k.labelpos||"top").toLowerCase(),v=void 0===g.formattedValue?void 0:g.formattedValue,x=k.tooltext,f=n(r.radius,g.radius,m.radius)*p*f.autoScale||1E-4,r=g.fillColor,z=g.fillAlpha,y=g.fillRatio,A=g.fillAngle,C=g.borderThickness,F=g.borderColor,G=g.borderAlpha,B,H,I=a.components.kdArrayMap||
(a.components.kdArrayMap={}),K=b.config.id;g.autoScale=m.autoScale?t:1;if(q){x=x?E(J(x,[1,2,3],{formattedValue:v,label:w},k)):v?w+m.tooltipSepChar+v:w;void 0!==v&&null!==v?w=w+m.labelSepChar+v:isNaN(p)?p=1:0>p?p=0:5<p&&(p=5);u(k,{x:k.x.toString(),y:k.y.toString(),fillcolor:r,fillalpha:z,fillratio:y,fillangle:A,borderthickness:C,bordercolor:F,borderalpha:G,hovereffect:l(m.showHoverEffect),radius:f.toString(),link:k.link,showshadow:n(k.showshadow,g.shadow),_markerLabel:w,_markerId:k.id,id:(k.id+"").toLowerCase()});
delete k.tooltext;g.tooltext=m.showTooltip?x:!1;t=Number(k.x)*e.sFactor+e.translateX;v=Number(k.y)*e.sFactor+e.translateY;f=k.radius;"triangle"===q?(u(k,{type:"polygon",sides:3,startangle:m.startAngle}),p="polygon",B=3):"diamond"===q?(u(k,{type:"polygon",sides:4,startangle:m.startAngle}),p="polygon",B=4):"arc"===q?(H=.6*f,u(k,{type:"arc",startangle:0,endangle:360,innerradius:H}),p="arc"):"circle"===q?p=k.type="circle":(B=a.getShapeArgs.call(b),m.dataEnabled&&m.valueToRadius&&void 0!==k.radius?delete B.radius:
(!B.radius&&(B.radius=m.radius),B.radius=B.radius*p*g.autoScale),u(k,B),k.id=k._markerId&&k._markerId.toLowerCase(),H=B.innerradius,f=B.radius,p=B.type,B=B.sides);u(k,{hoverfillcolor:l(k.fillhovercolor,m.hoverFillColor,k.fillcolor),hoverfillalpha:l(k.fillhoveralpha,m.hoverFillAlpha,k.fillalpha),hoverfillratio:l(k.fillhoverratio,m.hoverFillRatio,k.fillratio),hoverfillangle:l(k.fillhoverangle,m.hoverFillAngle,k.fillangle),hoverborderthickness:n(k.borderhoverthickness,m.hoverBorderThickness,k.borderthickness),
hoverbordercolor:l(k.borderhovercolor,m.hoverBorderColor,k.bordercolor),hoverborderalpha:l(k.borderhoveralpha,m.hoverBorderAlpha,k.borderalpha)});q={alpha:k.fillalpha,color:k.fillcolor,angle:360-k.fillangle,ratio:k.fillratio};x={alpha:k.hoverfillalpha,color:k.hoverfillcolor,angle:360-k.hoverfillangle,ratio:k.hoverfillratio};k._defaultattrs={fill:M(q),"stroke-width":"0"!==k.showborder?k.borderthickness:0,stroke:D(k.bordercolor,k.borderalpha)};k._hoverattrs={fill:M(x),"stroke-width":"0"!==k.showborder?
k.hoverborderthickness:0,stroke:D(k.hoverbordercolor,k.hoverborderalpha)};"image"===k.type?(k.borderthickness=k.borderthickness||0,k.onload=function(c){var d=this.options,f=c.width;c=c.height;var g={},k=(Number(d.x)-f/(2*e.sFactor))*e.sFactor,d=(Number(d.y)-c/(2*e.sFactor))*e.sFactor,l,g=I[K]||(I[K]={});g.x=k+e.translateX;g.y=d+e.translateY;g.element=b;g.shapeInfo={type:"rect",width:f,height:c};if(f&&c)for(l in{wrapper:1,tracker:1})this[l]&&this[l].attr({x:k,y:d,width:f,height:c});a.imageLoadCount++;
a.imageLoadCount===a.imageCount&&a._buildKdTree()},k.onerror=function(){a.imageLoadCount++;a.imageLoadCount===a.imageCount&&a._buildKdTree()},a.imageCount++):(q=I[K]||(I[K]={}),q.x=t,q.y=v,q.element=b,q.shapeInfo={type:p,sides:B,radius:Number(f)+k.borderthickness/2,innerradius:H});g.drawOptions.shape=k;if(!m.showLabels)return{markerShape:k};H=k.labelpadding||m.labelPadding;c=a._getLabelOptions(c,H,k);B=c.align;f=c.valign;t=g._labelBaseWidth;p=g._labelBaseHeight;v=g._labelXOffset;q=g._labelYOffset;
t=m.labelWrapWidth?m.labelWrapWidth:a.getWrapWidth[B](t,Number(c.x)+v);m=m.labelWrapHeight?m.labelWrapHeight:a.getWrapHeight[f](p,Number(c.y)+q);t>H&&(t-=H);m>H&&(m-=H);g.drawOptions.label=u({type:"text"},{text:w,tooltext:k.tooltext,x:c.x,y:c.y,align:B,valign:c.valign,wrap:1,wrapwidth:t,wrapheight:m,fontsize:d.fontSize/e.sFactor,font:d.fontFamily,fillcolor:d.fontColor});return{markerShape:k,markerLabel:g.drawOptions.label}}},getHoverFn:function(){var b=this.chart;return function(){var a=this.data("marker"),
c=a.markerShape,d=c.options,f=c.bounds,e=d._markerEventArgs,g=c.wrapper,k=c.fillOptions,l=b.config.scalingParams,m=l.translateX,l=l.translateY,a=a.config;g&&d.hovereffect&&("circle"===c.type&&(c={color:d.hoverfillcolor,alpha:d.hoverfillalpha,angle:360-d.hoverfillangle,ratio:d.hoverfillratio,gradientUnits:"objectBoundingBox",radialGradient:k.radialGradient,cx:k.cx,cy:k.cy},d._hoverattrs.fill=M(c)),c=u({},d._hoverattrs),"image"===g.type&&(delete c.fill,delete c.stroke,delete c["stroke-width"]),g.attr(c));
e||(e=d._markerEventArgs={x:f.x1/f.xs,y:f.y1/f.ys,scaledX:f.x1,scaledY:f.y1,chartX:m+f.x1,chartY:l+f.y1,id:d._markerId,label:d._markerLabel});p.raiseEventGroup(a.id,"markerRollOver",e,b.chartInstance,a,void 0,void 0,void 0)}},getHoverOutFn:function(){var b=this.chart;return function(){var a=this.data("marker"),c=a.markerShape,d=c.wrapper,e=c.fillOptions,a=a.config,h=c.options;d&&c.options.hovereffect&&("circle"===c.type&&(h._defaultattrs.fill=M(e)),e=u({},c.options._defaultattrs),"image"===d.type&&
(delete e.fill,delete e.stroke,delete e["stroke-width"]),d.attr(e));p.raiseEventGroup(a.id,"markerRollOut",c.options._markerEventArgs,b.chartInstance,void 0,void 0,void 0)}},getClickFn:function(){var b=this;return function(a){var c=this.data("marker"),d=b.chart,e=d.config.scalingParams,h=e.translateX,e=e.translateY,g=c.markerShape,c=g.options,g=g.bounds,k=c._markerEventArgs;k||(k=c._markerEventArgs={x:g.x1/g.xs,y:g.y1/g.ys,scaledX:g.x1,scaledY:g.y1,chartX:h+g.x1,chartY:e+g.y1,id:c._markerId,label:c._markerLabel});
p.raiseEvent("markerClick",k,d.chartInstance,a)}},highlightPoint:function(b){var a=b.element,c=this.chart,d=c.graphics,e=c.components.paper,h=d.trackerElems||(d.trackerElems={}),g=b.shapeInfo,k,l=b.x,m=b.y,n,p,u;k=c.config.lastHoveredPoint;var t=!1;!1===b?(k=k&&k.shapeInfo.type,(h=h[k])&&h.hide(),c.config.lastHoveredPoint=null):(k=g.type,"circle"===k&&(k="polygon"),h=h[k],"polygon"===k?(n=g.sides||1,p=g.startAngle,g=g.radius,h?h.attr({polypath:[n,l,m,g,p]}):(h=d.trackerElems[k]=e.polypath(n,l,m,g,
p),t=!0)):"rect"===k?(p=g.width,g=g.height,h?h.attr({x:l,y:m,width:p,height:g}):(h=d.trackerElems[k]=e.rect(l,m,p,g),t=!0)):"arc"===k&&(n=a.markerShape.bounds.innerR,u=a.markerShape.bounds.angles,p=u.start*ha,u=u.end*ha,g=g.radius,h?h.attr({ringpath:[l,m,g,n,p,u]}):(h=d.trackerElems[k]=e.ringpath(l,m,g,n,p,u),t=!0)),c.config.lastHoveredPoint=b,t&&(h.attr({fill:ba,stroke:ba}).click(this.getClickFn()).hover(this.getHoverFn(),this.getHoverOutFn()),h.trackTooltip(!0)),h.show().tooltip(a.config.tooltext).data("marker",
a))},_drawConnectors:function(){var b=this.chart,a=this.components.connectors,c=a.length,d=b.config.scalingParams,e=b.config.connectorOpts,h=e.showLabels,g=b.components.mapAnnotations,k,l=[],m=[],n,p,u,t,v=[];v.push({id:"connectorLabels",fillalpha:"100",items:m});v.push({id:"connectors",fillalpha:"100",items:l});for(k=0;k<c;k++)a[k]&&(p=a[k].config.fromMarker.config,t=a[k].config.toMarker.config,n=p.options.x,p=p.options.y,u=t.options.x,t=t.options.y,a[k].config.x=n,a[k].config.y=p,a[k].config.tox=
u,a[k].config.toy=t,l.push(a[k].config),a[k].labelConfig&&h&&(a[k].labelConfig.x=((Number(n)+Number(u))/2).toString(),a[k].labelConfig.y=((Number(p)+Number(t))/2).toString(),a[k].labelConfig.fontsize=e.fontSize/(d.scaleFactor*b.baseScaleFactor),m.push(a[k].labelConfig)));g.addGroup(v[0]);g.addGroup(v[1])},getShapeArgs:function(){var b=this.config,a=u({},this.shapeObj),c;b.autoScale=1;return a?("polygon"===a.type?3>a.sides?a.type="circle":a.startangle=b.startAngle:"arc"===a.type&&(c=(a.radius||b.markerRadius)*
b.autoScale,a.radius=c,a.innerradius=a.innerradius&&a.innerradius*b.autoScale||.6*c),a):null},_getLabelOptions:function(b,a,c,d,e){var h,g=b&&b.toLowerCase();this.getLabelAlignment[g]||(g="center");b=Number(c.x);h=Number(c.y);c=void 0===d||void 0===e?c.radius||0:/^(top|bottom)$/ig.test(g)&&.5*e||/^(left|right)$/ig.test(g)&&.5*d||0;c=Number(c)+Number(a);return this.getLabelAlignment[g](b,h,c)},getLabelAlignment:{top:function(b,a,c){return{x:b.toString(),y:(a-c).toString(),align:"center",valign:"top"}},
left:function(b,a,c){return{x:(b-c).toString(),y:a.toString(),align:"right",valign:"middle"}},right:function(b,a,c){return{x:(b+c).toString(),y:a.toString(),align:"left",valign:"middle"}},bottom:function(b,a,c){return{x:b.toString(),y:(a+c).toString(),align:"center",valign:"bottom"}},center:function(b,a){return{x:b.toString(),y:a.toString(),align:"center",valign:"middle"}}},getWrapWidth:{right:function(b,a){return a},left:function(b,a){return b-a},center:function(b,a){return 2*I(a,b-a)}},getWrapHeight:{top:function(b,
a){return a},middle:function(b,a){return 2*I(a,b-a)},bottom:function(b,a){return b-a}},addMarkerItem:function(b){var a=this.components.markerObjs,c=this.components.shapeObjs,d=this.components.markerGroup,e=this.components.markerLabelGroup,h,g;if((g=b.id.toLowerCase())&&!a[g]){delete b.value;this.imageLoadCount=0;b=this._initializeMarkerItem(g,b,null);b.dataset=this;if(h=b.config.options.shapeid)b.shapeObj=c[h&&h.toLowerCase()];a[g]=b;a=this._drawMarkerItem.call(b);d&&e&&(b.markerShape=a.markerShape&&
d.addItem(a.markerShape,!0),b.markerLabel=a.markerLabel&&e.addItem(a.markerLabel,!0));this._buildKdTree()}},updateMarkerItem:function(b,a){var c=this.chart.components.mapAnnotations,d,e=this.components.markerObjs[b];e&&(d=e.config.options,u(d,a),this.imageLoadCount=0,d=this._drawMarkerItem.call(e).markerShape,this._buildKdTree(),c.update(b,d))},_removeMarkerItem:function(b){var a=this.components,c=a.markerObjs,d=c[b],a=a.kdArrayMap,e;d&&(e=d.markerShape,d=d.markerLabel,e&&e.destroy(),d&&d.destroy(),
delete a[b],this._buildKdTree());delete c[b]},getElement:function(b){if(this.components.kDTree)return this.components.kDTree.getNeighbour(b)}},"Entities"])},[3,2,0,"release"]]);Y&&(N.FusionCharts=FusionCharts);return FusionCharts});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment