-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfusioncharts.treemap.js
More file actions
54 lines (53 loc) · 23.3 KB
/
fusioncharts.treemap.js
File metadata and controls
54 lines (53 loc) · 23.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
FusionCharts JavaScript Library - Tree Map Chart
Copyright FusionCharts Technologies LLP
License Information at <http://www.fusioncharts.com/license>
@version 3.10.1
*/
FusionCharts.register("module",["private","modules.renderer.js-treemap",function(){function H(a){return a?a.replace(/^#*/,"#"):"#E5E5E5"}function n(a,h,b){this.label=a;this.value=parseFloat(h,10);this.colorValue=parseFloat(b,10);this.prev=this.next=void 0;this.meta={}}function F(){this._b=[];this._css=void 0;this.rangeOurEffectApplyFn=function(){};this.statePointerLow={value:void 0,index:void 0};this.statePointerHigh={value:void 0,index:void 0}}var y=this.hcLib,M=y.extend2,O=y.chartAPI,T=y.Raphael,
P=y.chartAPI,I=y.graphics,L=I.convertColor,Q=I.getLightColor,z=this.raiseEvent,U=y.colorRange,K,C,v=y.pluckNumber,w=y.pluck,I=!/fusioncharts\.com$/i.test(this.window.location.hostname);T.addSymbol({backIcon:function(a,h,b){--b;var c=h+b,f=c-b/2,g=a+b,d=f-b;return["M",a,h-b,"L",a-b,h,a,c,a,f,g,f,g,d,g-b,d,"Z"]},homeIcon:function(a,h,b){--b;var c=2*b,f=a-b,g=f+c/6,d=h+b,e=g+c/4,E=d-b/2,m=e+c/6,G=E+b/2,k=m+c/4,t=G-b;return["M",a,h-b,"L",f,h,g,h,g,d,e,d,e,E,m,E,m,G,k,G,k,t,k+c/6,t,"Z"]}});Array.prototype.indexOf||
(Array.prototype.indexOf=function(a,h){var b;if(null==this)throw new TypeError('"this" is null or not defined');var c=Object(this),f=c.length>>>0;if(0===f)return-1;b=+h||0;Infinity===Math.abs(b)&&(b=0);if(b>=f)return-1;for(b=Math.max(0<=b?b:f-Math.abs(b),0);b<f;){if(b in c&&c[b]===a)return b;b++}return-1});"function"!=typeof Object.create&&(Object.create=function(){function a(){}var h=Object.prototype.hasOwnProperty;return function(b){var c,f,g;if("object"!=typeof b)throw TypeError("Object prototype may only be an Object or null");
a.prototype=b;c=new a;a.prototype=null;if(1<arguments.length)for(g in f=Object(arguments[1]),f)h.call(f,g)&&(c[g]=f[g]);return c}}());Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!==typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var h=Array.prototype.slice.call(arguments,1),b=this,c=function(){},f=function(){return b.apply(this instanceof c?this:a,h.concat(Array.prototype.slice.call(arguments)))};this.prototype&&
(c.prototype=this.prototype);f.prototype=new c;return f});n.prototype.constructor=n;n.prototype.addChild=function(a){a instanceof n&&(this.next=this.next||[],[].push.call(this.next,a),a.setParent(this));return this.next};n.prototype.getChildren=function(){return this.next};n.prototype.setParent=function(a){a instanceof n&&(this.prev=a);return this};n.prototype.getSiblingCount=function(){var a;if(this instanceof n&&(a=this.getParent()))return a.getChildren().length};n.prototype.getParent=function(){return this.prev};
n.prototype.getLabel=function(){return this.label};n.prototype.getValue=function(){return this.value};n.prototype.getColorValue=function(){return this.colorValue};n.prototype.getSibling=function(a){a=a.toLowerCase();var h=this.getParent(),b=this.getLabel(),c,f;if(h)for(h=h.getChildren(),c=0;c<h.length;c++)if(f=h[c],f=f.getLabel(),f===b)switch(a){case "left":return h[c-1];case "right":return h[c+1]}};n.prototype.setMeta=function(a,h){this.meta[a]=h};n.prototype.getMeta=function(a){return a?this.meta[a]:
this.meta};F.prototype.constructor=F;F.prototype.setRangeOutEffect=function(a,h){this._css=a;this.rangeOurEffectApplyFn=h};F.prototype.addInBucket=function(a){var h=this._b,b=a.getColorValue(),c=0,f=h.length-1;if(b){a:{for(var g,d;c<=f;)if(g=(c+f)/2|0,d=h[g],d=d.getColorValue(),d<b)c=g+1;else if(d>b)f=g-1;else{b=g;break a}b=~f}h.splice(Math.abs(b),0,a)}};F.prototype.moveLowerShadePointer=function(a){var h=this._b,b,c,f,g=this.statePointerLow;b=g.index;c=g.value;var d=!1;b=void 0!==b?b:0;c=void 0!==
c?c:Number.NEGATIVE_INFINITY;if(a!==c){if(c<=a){for(;;){f=(c=h[b++])?c.getColorValue():0;if(a<f||!c)break;d=!0;c.rangeOutEffect=this._css;this.rangeOurEffectApplyFn.call(c,this._css)}b=d?b-2:b-1}else{for(;;){f=(c=h[b--])?c.getColorValue():0;if(a>=f||!c)break;c.cssConf=c.cssConf||{};d=!0;delete c.rangeOutEffect;c.cssConf.opacity=1;this.rangeOurEffectApplyFn.call(c,c.cssConf)}b=d?b+2:b+1}g.index=b;g.value=a}};F.prototype.moveHigherShadePointer=function(a){var h=this._b,b=h.length,c,f,g=this.statePointerHigh;
f=g.index;c=g.value;var d=!1,b=void 0!==f?f:b-1;c=void 0!==c?c:Number.POSITIVE_INFINITY;if(a!==c){if(c>a){for(;;){f=(c=h[b--])?c.getColorValue():0;if(a>=f||!c)break;d=!0;c.rangeOutEffect=this._css;this.rangeOurEffectApplyFn.call(c,this._css)}b=d?b+2:b+1}else{for(;;){f=(c=h[b++])?c.getColorValue():0;if(a<f||!c)break;c.cssConf=c.cssConf||{};d=!0;delete c.rangeOutEffect;c.cssConf.opacity=1;this.rangeOurEffectApplyFn.call(c,c.cssConf)}b=d?b-2:b-1}g.index=b;g.value=a}};O("treemap",{friendlyName:"Tree Map Chart",
rendererId:"treemap",standaloneInit:!0,defaultSeriesType:"treemap",creditLabel:I,series:function(a,h){var b=a&&a.data||[],c=h.chart,f={data:b},g={},d=this.dataObj.chart,e=this.hcJSON.chart;b&&b.length&&(h.series.push(f),c.metaTreeInf=g,this.hcJSON.legend.enabled=!1,b=this.dataObj.chart.algorithm||"squarified",e.algorithm=b.toLowerCase(),e.horizontalPadding=v(d.horizontalpadding,5),e.horizontalPadding=0>e.horizontalPadding?0:e.horizontalPadding,e.verticalPadding=v(d.verticalpadding,5),e.verticalPadding=
0>e.verticalPadding?0:e.verticalPadding,e.showParent=v(d.showparent,1),e.showChildLabels=v(d.showchildlabels,0),e.highlightParentsOnHover=v(d.highlightparentsonhover,0),e.defaultParentBGColor=w(d.defaultparentbgcolor,void 0),e.baseFontSize=v(d.basefontsize,10),e.baseFontSize=1>e.baseFontSize?1:e.baseFontSize,e.labelFontSize=v(d.labelfontsize,void 0),e.labelFontSize=1>e.labelFontSize?1:e.labelFontSize,e.baseFont=w(d.basefont,"Verdana, Sans"),e.labelFont=w(d.labelfont,void 0),e.baseFontColor=w(d.basefontcolor,
"#000000").replace(/^#?([a-f0-9]+)/ig,"#$1"),e.labelFontColor=w(d.labelfontcolor,void 0),e.labelFontColor&&(e.labelFontColor=e.labelFontColor.replace(/^#?([a-f0-9]+)/ig,"#$1")),e.labelFontBold=v(d.labelfontbold,0),e.labelFontItalic=v(d.labelfontitalic,0),e.plotBorderThickness=v(d.plotborderthickness,1),e.plotBorderThickness=0>e.plotBorderThickness?0:5<e.plotBorderThickness?5:e.plotBorderThickness,e.plotBorderColor=w(d.plotbordercolor,"#000000").replace(/^#?([a-f0-9]+)/ig,"#$1"),e.tooltipSeparationCharacter=
w(d.tooltipsepchar,","),e.plotToolText=w(d.plottooltext,""),e.parentLabelLineHeight=v(d.parentlabellineheight,12),e.parentLabelLineHeight=0>e.parentLabelLineHeight?0:e.parentLabelLineHeight,e.labelGlow=v(d.labelglow,1),e.labelGlowIntensity=v(d.labelglowintensity,100)/100,e.labelGlowIntensity=0>e.labelGlowIntensity?0:1<e.labelGlowIntensity?1:e.labelGlowIntensity,e.labelGlowColor=w(d.labelglowcolor,"#ffffff").replace(/^#?([a-f0-9]+)/ig,"#$1"),e.labelGlowRadius=v(d.labelglowradius,2),e.labelGlowRadius=
0>e.labelGlowRadius?0:10<e.labelGlowRadius?10:e.labelGlowRadius,b=v(d.showlegend,1),e.btnResetChartTooltext=w(d.btnresetcharttooltext,"Back to Top"),e.btnBackChartTooltext=w(d.btnbackcharttooltext,"Back to Parent"),e.rangeOutBgColor=w(d.rangeoutbgcolor,"#808080").replace(/^#?([a-f0-9]+)/ig,"#$1"),e.rangeOutBgAlpha=v(d.rangeoutbgalpha,100),e.rangeOutBgAlpha=1>e.rangeOutBgAlpha||100<e.rangeOutBgAlpha?100:e.rangeOutBgAlpha,d=a.colorrange||{},e=v(d.mapbycategory,0),h.colorRange=new U({colorRange:d,mapByCategory:e,
numberFormatter:this.numberFormatter}),h.colorRange.rangeOutsideColor=d.rangeoutsidecolor,h.legend.type="gradient",h.legend.enabled=!!b)},placeLegendBlockRight:function(){return"gradient"===arguments[0].legend.type?y.placeGLegendBlockRight?y.placeGLegendBlockRight.apply(this,arguments):0:y.placeLegendBlockRight.apply(this,arguments)},placeLegendBlockBottom:function(){return"gradient"===arguments[0].legend.type?y.placeGLegendBlockBottom?y.placeGLegendBlockBottom.apply(this,arguments):0:y.placeLegendBlockBottom.apply(this,
arguments)}},O.singleseries);C=function(){function a(b,c){this.node=b;this.bucket=c?new F:void 0}var h;a.prototype.get=function(){var b=this.order,c=this.bucket;return function g(d){var e,a,m;m=["label","value","data","svalue"];var G;if(d)for(G in e=new n(d.label,d.value,d.svalue),a=d.data||[],0===a.length&&c&&c.addInBucket(e),d)-1===m.indexOf(G)&&e.setMeta(G,d[G]);b&&(a=b(a));for(d=0;d<a.length;d++)m=a[d],m=g(m),e.addChild(m);return e}(this.node)};a.prototype.getBucket=function(){return this.bucket};
h=function(){function b(){this.con={}}var c={},a;b.prototype.constructor=b;b.prototype.get=function(b){return this.con[b]};b.prototype.set=function(b,c){this.con[b]=c};return{getInstance:function(g){var d;return(d=c[g])?a=d:a=c[g]=new b}}}();return{AbstractTreeMaker:a,iterator:function(b){function c(b){this.iterAPI=b}var a;c.prototype.constructor=c;c.prototype.initWith=function(b){return this.iterAPI(b)};a=(new c(function(b){var c=b,a=[],f=!1;a.push(c);return{next:function(){var b,c,d;if(!f)return c=
a.shift(),(d=(b=c.getChildren())&&b.length||0)&&[].unshift.apply(a,b),0===a.length&&(f=!0),c},reset:function(){f=!1;c=b;a.length=0;a.push(c)}}})).initWith(b);b=(new c(function(b){var c=b,a=[],f=[],m=!1;a.push(c);f.push(c);return{next:function(){var b,c,f;if(!m)return c=a.shift(),(f=(b=c.getChildren())&&b.length||0)&&[].push.apply(a,b),0===a.length&&(m=!0),c},nextBatch:function(){var b,c;if(!m)return b=f.shift(),(c=(b=b.getChildren())&&b.length||0)&&[].push.apply(f,b),0===a.length&&(m=!0),b},reset:function(){m=
!1;c=b;a.length=0;a.push(c)}}})).initWith(b);return{df:a,bf:b}},initConfigurationForlabel:function(b,c,a){var g=b.x,d=b.y,e=c/2,h=a.showParent?0:1,m=a.showChildLabels;return function(b,k){var t=!1,l={x:void 0,y:void 0,width:void 0,height:void 0},D={},A=0,B={},r={},q,p;p=b.meta;if(b)return b.next||(t=!0),D.label=b.getLabel(),l.width=k.width-2*g,l.x=k.x+k.width/2,B=k.height-2*d,!t&&B<c&&(l.height=-1),t?(l.height=m?l.height?l.height:k.height-2*d:-1,l.y=k.y+k.height/2):h?(l.y=-1,c=d=0,q="hidden"):(l.height=
l.height?l.height:c,l.y=k.y+d+e),A+=2*d,A+=c,D.rectShiftY=A,D.textRect=l,a.labelGlow?(r["stroke-width"]=a.labelGlowRadius,r.opacity=a.labelGlowIntensity,r.stroke=a.labelGlowColor,r.visibility="hidden"===q?"hidden":"visible"):r.visibility="hidden",B={fontSize:a.labelFontSize||a.baseFontSize,fontFamily:a.labelFont||a.baseFont,fill:p&&p.fontcolor&&H(p.fontcolor)||a.labelFontColor||a.baseFontColor,fontWeight:a.labelFontBold&&"bold",fontStyle:a.labelFontItalic&&"italic",visibility:q},{conf:D,attr:B,highlight:r}}},
context:h,mapColorManager:function(b,c){var a=b.defaultParentBGColor,a=H(a);return function(g){var d={},e=g.meta,e=e.fillcolor?H(e.fillcolor):void 0,h;g.next?d.fill=e||a:(h=(h=g.getParent().cssConf)&&h.fill,g=b.isLegendEnabled?c.getColorObj(g.getColorValue()).code&&"#"+c.getColorObj(g.getColorValue()).code||H(c.rangeOutsideColor):h,d.fill=e||g);d.stroke=b.plotBorderColor;d.strokeWidth=b.plotBorderThickness;return d}},abstractEventRegisterer:function(b){var a=b[1],f=a.logic,g=a.logic.chartInstance,
d=f.hcJSON.legend,e=f.hcJSON.chart,h=b[0].drawTree,m=b[3].removeLayers;a.backToParent=function(d){var k=this,f=k&&k.getParent();d?z("beforedrillup",{node:k,withoutHead:!e.showParent},g,void 0,function(){f&&(m(),h.apply(f,b));z("drillup",{node:k,sender:a.fusionCharts,withoutHead:!e.showParent,drillUp:a.backToParent,drillUpToTop:a.resetTree},g);k=k&&k.getParent()},function(){z("drillupcancelled",{node:k,withoutHead:!e.showParent},g)}):(f&&(m(),h.apply(f,b)),k=k&&k.getParent())};a.resetTree=function(d){for(var f=
this,t=f&&f.getParent(),l;t;)l=t,t=t.getParent();d?z("beforedrillup",{node:f,withoutHead:!e.showParent},g,void 0,function(){l&&(m(),h.apply(l,b),z("drillup",{node:f,sender:a.fusionCharts,withoutHead:!e.showParent,drillUp:a.backToParent,drillUpToTop:a.resetTree},g))},function(){z("drillupcancelled",{node:f,withoutHead:!e.showParent},g)}):l&&(m(),h.apply(l,b))};return function(f,k){var t=f.virginNode,l,D,A;if(D=t.getParent()){if(t===k)A=D,l="drillup";else{if(t.next)A=t;else if(A=D,k===A){l=void 0;return}l=
"drilldown"}d.enabled&&y.rendererRoot.resetLegendSlider();l&&z("before"+l,{node:A,withoutHead:!e.showParent},g,void 0,function(){m();h.apply(A,b);z(l,{node:A,sender:a.fusionCharts,withoutHead:!e.showParent,drillUp:a.backToParent,drillUpToTop:a.resetTree},g)},function(){z(l+"cancelled",{node:A,withoutHead:!e.showParent},g)});a.backToParent=a.backToParent.bind(A);a.resetTree=a.resetTree.bind(A)}}}}}();K=function(){function a(){c.apply(this,arguments)}function h(){var a=b[f],c;c=Array.prototype.slice.call(arguments,
0);c.unshift(a);a.drawTree.apply(d,c)}var b,c=C.AbstractTreeMaker,f,g,d,e;b={sliceanddice:{areaBaseCalculator:function(b,a){return function(c,e,d){var f,h,g={},B,r,q,p=f=0;if(c){d&&(f=d.textMargin||f);p=f;d=c.getParent();f=c.getSibling("left");if(d){h=d.getValue();q=d.rect;B=q.height-2*a-p;r=q.width-2*b;g.effectiveRect={height:B,width:r,x:q.x+b,y:q.y+a+p};g.effectiveArea=B*r;g.ratio=c.getValue()/h;if(f)return e.call(c,g,f,d);g.lastIsParent=!0;return e.call(c,g,d)}return null}}},applyShadeFiltering:function(b,
a){var c=this;c.setRangeOutEffect(b,a);return function(b){c.moveLowerShadePointer(b.start);c.moveHigherShadePointer(b.end)}},drawTree:function(b,a,c,d){var e=arguments,f=a.logic,g=d.drawRect,h=d.drawText,B=d.drawHot,r=c.horizontalPadding,q=c.verticalPadding,p=a.smartLabel,v=C.iterator,R=v(this).df,u,n=b.areaBaseCalculator(r,q),x=a.logic.hcJSON.chart,J=x.highlightParentsOnHover,w,z,S=C.context,N=C.mapColorManager(x,f.hcJSON.colorRange),V=C.abstractEventRegisterer(e),f=f.chartInstance.jsVars._reflowData;
w=C.initConfigurationForlabel({x:5,y:5},x.parentLabelLineHeight,x);for(e=u=R.next();e.getParent();)e=e.getParent();e!=u?(a.resetButton.show(),a.backButton.show()):(a.resetButton.hide(),a.backButton.hide());p.setStyle({fontSize:(x.labelFontSize||x.baseFontSize)+"px",fontFamily:x.labelFont||x.baseFont,lineHeight:1.2*(x.labelFontSize||x.baseFontSize)+"px"});f.tree=u;a.backToParent=a.backToParent.bind(u);a.resetTree=a.resetTree.bind(u);(function W(a,b){var c,d,e,f,m;d={};var k,l={},t={};e={};var G="";
a&&(c=a.rect={},e=a.textRect={},c.width=b.width,c.height=b.height,c.x=b.x,c.y=b.y,e=N(a),k=g(c,e),a.cssConf=e,f=w(a,c),m=f.conf,d.textMargin=m.rectShiftY,e=m.textRect,m=p.getSmartText(m.label,e.width,e.height).text,h(m,e,f.attr,f.highlight),a.plotItem=k,l.virginNode=a,l.plotItem=k,a.getColorValue()&&(G=x.tooltipSeparationCharacter+a.getColorValue()),l.toolText=y.parseTooltext(x.plotToolText,[2,3,119],{label:a.getLabel()},{value:a.getValue(),svalue:a.getColorValue()})||a.getLabel()+x.tooltipSeparationCharacter+
a.getValue()+G,l.rect=c,t.hover=[function(){var a,b,c;c=S.getInstance("hover");b=this.virginNode;a=J&&!b.next?(a=b.getParent())?a:b:this.virginNode;c.set("element",a);c=L(Q(a.cssConf.fill,80),60);a.plotItem.tracker.attr({fill:c})}.bind(l),function(){var a,b;a=S.getInstance("hover").get("element");b=L(a.cssConf.fill||"#fff",0);a.plotItem.tracker.attr({fill:b})}.bind(l)],t.tooltip=[l.toolText],t.click=[function(){V(this,u)}.bind(l)],B(l,t),c=R.next(),d=n(c,function(a,b){var c=a.effectiveArea*a.ratio,
e=a.effectiveRect,d=b.rect,f,m,g;a.lastIsParent?(m=e.x,g=e.y,f=e.height,e=e.width,z=this.isDirectionVertical=!0):(f=e.height+e.y-(d.height+d.y),e=e.width+e.x-(d.width+d.x),z=this.isDirectionVertical=!b.isDirectionVertical);z?(e=c/f,m=void 0!==m?m:d.x,g=void 0!==g?g:d.y+d.height):(f=c/e,m=void 0!==m?m:d.x+d.width,g=void 0!==g?g:d.y);return{height:f,width:e,x:m,y:g}},d),W(c,d))})(u,c)}},squarified:{orderNodes:function(){return this.sort(function(a,b){return parseFloat(a.value,10)<parseFloat(b.value,
10)?1:-1})},areaBaseCalculator:function(a,b){return function(c,e,d){var f={},g,h=g=0,B,r;if(c&&0!==c.length)return d&&(g=d.textMargin||g),h=g,B=c[0],(c=B.getParent())?(r=c.rect,d=r.height-2*b-h,g=r.width-2*a,f.effectiveRect={height:d,width:g,x:r.x+a,y:r.y+b+h},f.effectiveArea=d*g,e.call(B,f,c)):null}},layoutManager:function(){function a(b,c){this.totalValue=c;this._rHeight=b.height;this._rWidth=b.width;this._rx=b.x;this._ry=b.y;this._rTotalArea=b.height*b.width;this.nodes=[];this._prevAR=void 0;this._rHeight<
this._rWidth&&(this._hSegmented=!0)}a.prototype.constructor=a;a.prototype.addNode=function(a){var b=this._rTotalArea,c,e,d,f,g,h,r,q=this._hSegmented,p=this._rx,E=this._ry,v,u,n,x,y=0;this.nodes.push(a);d=0;for(e=this.nodes.length;d<e;d++)y+=parseFloat(this.nodes[d].getValue(),10);c=y/this.totalValue*b;q?(b=this._rHeight,e=c/b,v=p+e,u=E,n=this._rHeight,x=this._rWidth-e):(e=this._rWidth,b=c/e,v=p,u=E+b,n=this._rHeight-b,x=this._rWidth);d=0;for(f=this.nodes.length;d<f;d++)a=this.nodes[d],g=a.getValue(),
h=g/y*c,a.hRect=a.rect||{},a._hRect=a._rect||{},g=a.rect={},q?(g.width=r=e,g.height=r=h/r,g.x=p,g.y=E,E+=r):(g.height=r=b,g.width=r=h/r,g.x=p,g.y=E,p+=r),h=Math.max(g.height,g.width),g=Math.min(g.height,g.width),a.aspectRatio=h/g;if(1<this.nodes.length){if(this.prevAR<a.aspectRatio){this.nodes.pop().rect={};d=0;for(e=this.nodes.length;d<e;d++)this.nodes[d].rect=1===e&&this.nodes[d].firstPassed?this.nodes[d]._hRect:this.nodes[d].hRect,q=this.nodes[d]._rect={},p=this.nodes[d].rect,q.width=p.width,q.height=
p.height,q.x=p.x,q.y=p.y;return!1}}else a&&(q=a._rect={},p=a.rect,q.width=p.width,q.height=p.height,q.x=p.x,q.y=p.y,a.firstPassed=!0);this.prevAR=a.aspectRatio;this.height=b;this.width=e;this.getNextLogicalDivision=function(){return{height:n,width:x,x:v,y:u}};return a};return{RowLayout:a}}(),applyShadeFiltering:function(a,b){var c=this;c.setRangeOutEffect(a,b);return function(a){c.moveLowerShadePointer(a.start);c.moveHigherShadePointer(a.end)}},drawTree:function(a,b,c,d){var e=arguments,f=b.logic,
g=a.areaBaseCalculator(c.horizontalPadding,c.verticalPadding),h=a.layoutManager.RowLayout,v=b.smartLabel,r=d.drawRect,q=d.drawText,p=d.drawHot,n=C.iterator,n=n(this).bf,w,u=b.logic.hcJSON.chart,z=u.highlightParentsOnHover,x,J=C.context,F=C.mapColorManager(u,f.hcJSON.colorRange),K=C.abstractEventRegisterer(e),e=f.chartInstance.jsVars._reflowData;x=C.initConfigurationForlabel({x:5,y:5},u.parentLabelLineHeight,u);for(f=w=n.next();f.getParent();)f=f.getParent();f!=w?(b.resetButton.show(),b.backButton.show()):
(b.resetButton.hide(),b.backButton.hide());v.setStyle({fontSize:(u.labelFontSize||u.baseFontSize)+"px",fontFamily:u.labelFont||u.baseFont,lineHeight:1.2*(u.labelFontSize||u.baseFontSize)+"px"});e.tree=w;b.backToParent=b.backToParent.bind(w);b.resetTree=b.resetTree.bind(w);(function N(a,b){var c,d,e,f,m=0,k,l,n;k={};var E;l={};var t={};d={};var G="";if(a&&(c=a.rect={},d=a.textRect={},c.width=b.width,c.height=b.height,c.x=b.x,c.y=b.y,d=F(a),f=r(c,d),a.cssConf=d,E=x(a,c),n=E.conf,k.textMargin=n.rectShiftY,
d=n.textRect,n=v.getSmartText(n.label,d.width,d.height).text,q(n,d,E.attr,E.highlight),a.plotItem=f,l.virginNode=a,l.plotItem=f,a.getColorValue()&&(G=u.tooltipSeparationCharacter+a.getColorValue()),l.toolText=y.parseTooltext(u.plotToolText,[2,3,119],{label:a.getLabel()},{value:a.getValue(),svalue:a.getColorValue()})||a.getLabel()+u.tooltipSeparationCharacter+a.getValue()+G,l.rect=c,t.hover=[function(){var a,b,c;c=J.getInstance("hover");b=this.virginNode;a=z&&!b.next?(a=b.getParent())?a:b:this.virginNode;
c.set("element",a);c=L(Q(a.cssConf.fill,80),60);a.plotItem.tracker.attr({fill:c})}.bind(l),function(){var a,b;a=J.getInstance("hover").get("element");b=L(a.cssConf.fill||"#fff",0);a.plotItem.tracker.attr({fill:b})}.bind(l)],t.tooltip=[l.toolText],t.click=[function(){K(this,w)}.bind(l)],p(l,t),e=a.getChildren()))for(k=g(e,function(a,b){var c,d,f=0,g,k,l=[];c=new h({width:a.effectiveRect.width,height:a.effectiveRect.height,x:a.effectiveRect.x,y:a.effectiveRect.y},b.getValue());for(d=e.length;f++!==
d;)g=e[f-1],k=c.addNode(g),!1===k?(c=c.getNextLogicalDivision(),c=new h(c,b.getValue()-m),f--):(m+=parseFloat(g.getValue(),10),l.push(g));return l},k),c=0,f=k.length;c<f;c++)l=k[c],N(l,l.rect)})(w,c)}}};a.prototype=Object.create(c.prototype);a.prototype.constructor=c;a.prototype.order=function(a){var c=b[f],d=c.orderNodes;return d?d.apply(a,[c]):a};return{init:function(a,b){f=a;e=b},plotOnCanvas:function(b,c){g=new a(b,e);d=g.get();return h},applyShadeFiltering:function(a,c){var d,e;e=b[f].applyShadeFiltering.call(g.getBucket(),
a,c);return function(a){d=Array.prototype.slice.call(arguments,0);d.unshift(a);e.apply(g.getBucket(),d)}},setTreeBase:function(a){return a&&(d=a)}}}();P("renderer.treemap",{drawPlotTreemap:function(){var a=this,h=a.paper,b=a.layers,c=a.definition.data,f=a.logic,g=f.hcJSON.chart,d=f.hcJSON.legend,e=a.toolbar,n=g.animation,m=n&&n.duration||void 0,n=g.algorithm,w=f.hcJSON.legend.enabled,k,f=a.options.chart.metaTreeInf,t=b.tracker,l=b.dataset=b.dataset||h.group("dataset"),D=b.datalabels=b.datalabels||
h.group("datalabels").insertAfter(l),A=b.lineHot=b.lineHot||h.group("line-hot",t),B=b.labelHighlight=b.labelHighlight||h.group("labelhighlight",D),r=b.floatLabel=b.floatLabel||h.group("labelfloat",D).insertAfter(B),q,p=[],z=[],C=[],u=[],b={},F,x,J,D=a.fusionCharts.jsVars._reflowData,H,I;g.isLegendEnabled=w;t={hcJSON:{chart:{chartResized:!0,rawAnimationDuration:1E3*v(a.definition.chart.animationduration/2,.5)}}};f.effectiveWidth=a.canvasRight-a.canvasLeft;f.effectiveHeight=a.canvasBottom-a.canvasTop;
f.startX=a.canvasLeft;f.startY=a.canvasTop;F=f.effectiveWidth/2;x=f.effectiveHeight/2;a.resetButton=e.add("homeIcon",function(){d.enabled&&y.rendererRoot.resetLegendSlider();a.resetTree&&a.resetTree(!0)},{tooltip:g.btnResetChartTooltext}).hide();k=a.resetButton.attr("fill");k[2]="rgba(255,255,255,0)";a.resetButton.attr("fill",[k[0],k[1],k[2],k[3]]);k=a.resetButton.attr("stroke");k[1]="rgba(136,136,136)";a.resetButton.attr("stroke",[k[0],k[1]]);a.backButton=e.add("backIcon",function(){d.enabled&&y.rendererRoot.resetLegendSlider();
a.backToParent&&a.backToParent(!0)},{tooltip:g.btnBackChartTooltext}).hide();k=a.backButton.attr("fill");k[2]="rgba(255,255,255,0)";a.backButton.attr("fill",[k[0],k[1],k[2],k[3]]);k=a.backButton.attr("stroke");k[1]="rgba(136,136,136)";a.backButton.attr("stroke",[k[0],k[1]]);b.drawRect=function(a,b){var c,d,e={},f={};for(c in a)d=a[c],0>d&&(a[c]=0,f.visibility="hidden");m||H&&(m=g.rawAnimationDuration)?(M(e,a),e.x=F,e.y=x,e.height=0,e.width=0,q=h.rect(e,l).css(b),q.animate(a,m,"normal")):q=h.rect(a,
l).css(b);q.css(f);p.push(q);return q};b.drawText=function(a,b,c,d){var e={},f=h.text(r),k=h.text(B);M(e,c);delete e.fill;e["stroke-linejoin"]="round";m||H&&(m=g.rawAnimationDuration)?(f.attr({text:a,x:F,y:x,fill:"#000000"}).css(c),f.animate({text:a,x:b.x,y:b.y},m,"normal"),k.attr({text:a,x:F,y:x,stroke:"#ffffff"}).css(e).css(d),k.animate({x:b.x,y:b.y},m,"normal")):(f.attr({text:a,x:b.x,y:b.y,fill:"#000000"}).css(c),k.attr({text:a,x:b.x,y:b.y,stroke:"#ffffff"}).css(e).css(d));z.push(f);C.push(k);
return f};b.drawHot=function(a,b){var c;c=a.plotItem;var d=a.rect,e,f,g;for(f in d)g=d[f],0>g&&(d[f]=0);c=c.tracker=h.rect(A).attr(d).attr({cursor:"pointer",fill:"rgba(255, 255, 255, 0)",stroke:"none"});for(e in b)d=b[e],c[e].apply(c,d);u.push(c);return c};b.removeLayers=function(){var a,b,c,d,e,f;b=Math.max(p.length,z.length,C.length,u.length);for(a=0;a<b;a++)c=p[a],d=z[a],f=u[a],e=C[a],c&&c.remove(),d&&d.remove(),f&&f.remove(),e&&e.remove();p.length=0;z.length=0;u.length=0};(e=D.tree)?(c=D.drawTreeFn,
I=!0):(D.algorithmAPI=K.init(n,w),D.drawTreeFn=c=K.plotOnCanvas(c[0]),I=!1);K.setTreeBase(e);d.enabled&&(J=K.applyShadeFiltering({fill:g.rangeOutBgColor,opacity:.01*g.rangeOutBgAlpha},function(a){this.plotItem&&this.plotItem.attr(a)}),a.setScaleRange=function(a,b){var c={start:a,end:b};I&&J({start:Number.NEGATIVE_INFINITY,end:Number.POSITIVE_INFINITY});J(c)});c.apply(void 0,[a,{width:f.effectiveWidth,height:f.effectiveHeight,x:f.startX,y:f.startY,horizontalPadding:g.horizontalPadding,verticalPadding:g.verticalPadding},
b]);g.chartResized&&(H=!0);M(a.logic.chartInstance.jsVars._reflowData,t,!0)}},P["renderer.root"])}]);