treegrid.js
19.9 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
/*
Highcharts JS v6.2.0 (2018-10-17)
Tree Grid
(c) 2016 Jon Arild Nygard
--- WORK IN PROGRESS ---
License: www.highcharts.com/license
*/
(function(C){"object"===typeof module&&module.exports?module.exports=C:"function"===typeof define&&define.amd?define(function(){return C}):C(Highcharts)})(function(C){(function(a){var x=function(d){return Array.prototype.slice.call(d,1)},y=a.dateFormat,m=a.defined,t=a.each,n=a.isArray,u=a.isNumber,q=function(d){return a.isObject(d,!0)},B=a.merge,r=a.pick,g=a.wrap,e=a.Axis,h=a.Tick,p={top:0,right:1,bottom:2,left:3,0:"top",1:"right",2:"bottom",3:"left"};e.prototype.isNavigatorAxis=function(){return/highcharts-navigator-[xy]axis/.test(this.options.className)};
e.prototype.isOuterAxis=function(){var d=this,c=-1,b=!0;t(d.chart.axes,function(k,f){k.side!==d.side||k.isNavigatorAxis()||(k===d?c=f:0<=c&&f>c&&(b=!1))});return b};e.prototype.getMaxLabelDimensions=function(d,c){var b={width:0,height:0};t(c,function(c){c=d[c];var f;q(c)&&(f=q(c.label)?c.label:{},c=f.getBBox?f.getBBox().height:0,f=u(f.textPxLength)?f.textPxLength:0,b.height=Math.max(c,b.height),b.width=Math.max(f,b.width))});return b};a.dateFormats={W:function(d){d=new Date(d);var c;d.setHours(0,
0,0,0);d.setDate(d.getDate()-(d.getDay()||7));c=new Date(d.getFullYear(),0,1);return Math.ceil(((d-c)/864E5+1)/7)},E:function(d){return y("%a",d,!0).charAt(0)}};g(e.prototype,"autoLabelAlign",function(d){return this.chart.isStock?"left":d.apply(this,x(arguments))});g(h.prototype,"getLabelPosition",function(d,c,b,a,f,E,h,e){var l=this.axis,k=l.reversed,w=l.chart,g=l.options,z=g&&q(g.grid)?g.grid:{},g=E.align,r=p[l.side],m=l.tickPositions,F=this.pos-h,D=u(m[e+1])?m[e+1]-h:l.max+h,v=l.tickSize("tick",
!0),m=n(v)?v[0]:0,v=v&&v[1]/2,A;!0===z.enabled?("top"===r?(z=l.top+l.offset,A=z-m):"bottom"===r?(A=w.chartHeight-l.bottom+l.offset,z=A+m):(z=l.top+l.len-l.translate(k?D:F),A=l.top+l.len-l.translate(k?F:D)),"right"===r?(r=w.chartWidth-l.right+l.offset,k=r+m):"left"===r?(k=l.left+l.offset,r=k-m):(r=Math.round(l.left+l.translate(k?D:F))-v,k=Math.round(l.left+l.translate(k?F:D))-v),this.slotWidth=k-r,k={x:"left"===g?r:"right"===g?k:r+(k-r)/2,y:A+(z-A)/2},w=w.renderer.fontMetrics(E.style.fontSize,a.element),
g=a.getBBox().height,E.useHTML?k.y+=w.b+-(g/2):(g=Math.round(g/w.h),k.y+=(w.b-(w.h-w.f))/2+-((g-1)*w.h/2)),k.x+=l.horiz&&E.x||0):k=d.apply(this,x(arguments));return k});g(e.prototype,"tickSize",function(d){var c=this.maxLabelDimensions,b=this.options,k=b&&q(b.grid)?b.grid:{},b=d.apply(this,x(arguments));!0===k.enabled&&(k=2*Math.abs(this.defaultLeftAxisOptions.labels.x),c=k+(this.horiz?c.height:c.width),n(b)?b[0]=c:b=[c]);return b});g(e.prototype,"getTitlePosition",function(d){var c=this.options;
if(!0===(c&&q(c.grid)?c.grid:{}).enabled){var b=this.axisTitle,k=b&&b.getBBox().width,f=this.horiz,a=this.left,h=this.top,g=this.width,l=this.height,e=c.title,c=this.opposite,G=this.offset,m=this.tickSize()||[0],t=e.x||0,n=e.y||0,u=r(e.margin,f?5:10),b=this.chart.renderer.fontMetrics(e.style&&e.style.fontSize,b).f,m=(f?h+l:a)+m[0]/2*(c?-1:1)*(f?1:-1)+(this.side===p.bottom?b:0);return{x:f?a-k/2-u+t:m+(c?g:0)+G+t,y:f?m-(c?l:0)+(c?b:-b)/2+G+n:h-u+n}}return d.apply(this,x(arguments))});g(e.prototype,
"unsquish",function(d){var c=this.options;return!0===(c&&q(c.grid)?c.grid:{}).enabled&&this.categories?this.tickInterval:d.apply(this,x(arguments))});a.addEvent(e,"afterSetOptions",function(d){var c=this.options;d=d.userOptions;var b,k=c&&q(c.grid)?c.grid:{};!0===k.enabled&&(b=B(!0,{className:"highcharts-grid-axis "+(d.className||""),dateTimeLabelFormats:{hour:{list:["%H:%M","%H"]},day:{list:["%A, %e. %B","%a, %e. %b","%E"]},week:{list:["Week %W","W%W"]},month:{list:["%B","%b","%o"]}},grid:{borderWidth:1},
labels:{padding:2,style:{fontSize:"13px"}},title:{text:null,reserveSpace:!1,rotation:0},units:[["millisecond",[1,10,100]],["second",[1,10]],["minute",[1,5,15]],["hour",[1,6]],["day",[1]],["week",[1]],["month",[1]],["year",null]]},d),"xAxis"===this.coll&&(m(d.linkedTo)&&!m(d.tickPixelInterval)&&(b.tickPixelInterval=350),m(d.tickPixelInterval)||!m(d.linkedTo)||m(d.tickPositioner)||m(d.tickInterval)||(b.tickPositioner=function(c,d){var f=this.linkedParent&&this.linkedParent.tickPositions&&this.linkedParent.tickPositions.info;
if(f){var k,l,h,e,g=b.units;for(e=0;e<g.length;e++)if(g[e][0]===f.unitName){k=e;break}if(g[k][1])return g[k+1]&&(h=g[k+1][0],l=(g[k+1][1]||[1])[0]),f=a.timeUnits[h],this.tickInterval=f*l,this.getTimeTicks({unitRange:f,count:l,unitName:h},c,d,this.options.startOfWeek)}})),B(!0,this.options,b),this.horiz&&(c.minPadding=r(d.minPadding,0),c.maxPadding=r(d.maxPadding,0)),u(c.grid.borderWidth)&&(c.tickWidth=c.lineWidth=k.borderWidth))});g(e.prototype,"setAxisTranslation",function(d){var c=this.options,
b=c&&q(c.grid)?c.grid:{},k=this.tickPositions&&this.tickPositions.info,f=this.userOptions.labels||{};this.horiz&&(!0===b.enabled&&t(this.series,function(b){b.options.pointRange=0}),k&&(!1===c.dateTimeLabelFormats[k.unitName].range||1<k.count)&&!m(f.align)&&(c.labels.align="left",m(f.x)||(c.labels.x=3)));d.apply(this,x(arguments))});g(e.prototype,"trimTicks",function(d){var c=this.options,b=c&&q(c.grid)?c.grid:{},k=this.categories,f=this.tickPositions,a=f[0],h=f[f.length-1],e=this.linkedParent&&this.linkedParent.min||
this.min,l=this.linkedParent&&this.linkedParent.max||this.max,g=this.tickInterval,p=a>e,r=h<l,a=a<e&&a+g>e,h=h>l&&h-g<l;!0!==b.enabled||k||!this.horiz&&!this.isLinked||(!p&&!a||c.startOnTick||(f[0]=e),!r&&!h||c.endOnTick||(f[f.length-1]=l));d.apply(this,x(arguments))});g(e.prototype,"render",function(d){var c=this.options,b=c&&q(c.grid)?c.grid:{},k,f,a,h=this.chart.renderer,e=this.horiz;if(!0===b.enabled){if(b=2*Math.abs(this.defaultLeftAxisOptions.labels.x),this.maxLabelDimensions=this.getMaxLabelDimensions(this.ticks,
this.tickPositions),b=this.maxLabelDimensions.width+b,c=c.lineWidth,this.rightWall&&this.rightWall.destroy(),d.apply(this),d=this.axisGroup.getBBox(),this.isOuterAxis()&&this.axisLine&&(e&&(b=d.height-1),c)){d=this.getLinePath(c);f=d.indexOf("M")+1;a=d.indexOf("L")+1;c=d.indexOf("M")+2;k=d.indexOf("L")+2;if(this.side===p.top||this.side===p.left)b=-b;e?(d[c]+=b,d[k]+=b):(d[f]+=b,d[a]+=b);this.axisLineExtra?this.axisLineExtra.animate({d:d}):this.axisLineExtra=h.path(d).attr({zIndex:7}).addClass("highcharts-axis-line").add(this.axisGroup);
this.axisLine[this.showAxis?"show":"hide"](!0)}}else d.apply(this)});g(e.prototype,"init",function(d,c,b){function k(b){var c=b.options,d=25/11,h=b.chart.renderer.fontMetrics(c.labels.style.fontSize);c.labels||(c.labels={});c.labels.align=r(c.labels.align,"center");b.categories||(c.showLastLabel=!1);b.horiz&&(c.tickLength=f.cellHeight||h.h*d);b.labelRotation=0;c.labels.rotation=0}var f=b&&q(b.grid)?b.grid:{},h,p,z;if(f.enabled)if(m(f.borderColor)&&(b.tickColor=b.lineColor=f.borderColor),n(f.columns))for(p=
0,z=f.columns.length;z--;)h=B(b,f.columns[z],{type:"category"}),delete h.grid.columns,h=new e(c,h),h.isColumn=!0,h.columnIndex=p,g(h,"labelFormatter",function(b){var c=this.axis,d=c.tickPositions,f=this.value,h=f===d[0],d=f===d[d.length-1],k=a.find(c.series[0].options.data,function(b){return b[c.isXAxis?"x":"y"]===f});this.isFirst=h;this.isLast=d;this.point=k;return b.call(this)}),p++;else d.apply(this,x(arguments)),k(this);else d.apply(this,x(arguments))})})(C);var J=function(a){var x=a.each,y=a.extend,
m=a.isNumber,t=a.keys,n=a.map,u=a.pick,q=a.reduce,B=function(g,e){var h=q(g,function(h,d){var c=u(d.parent,"");void 0===h[c]&&(h[c]=[]);h[c].push(d);return h},{});g=t(h);x(g,function(g,d){var c=h[g];""!==g&&-1===a.inArray(g,e)&&(x(c,function(b){d[""].push(b)}),delete d[g])});return h},r=function(a,e,h,p,d,c){var b=0,k=0,f=c&&c.after,g=c&&c.before;e={data:p,depth:h-1,id:a,level:h,parent:e};var w,z;"function"===typeof g&&g(e,c);g=n(d[a]||[],function(f){var g=r(f.id,a,h+1,f,d,c),e=f.start;f=!0===f.milestone?
e:f.end;w=!m(w)||e<w?e:w;z=!m(z)||f>z?f:z;b=b+1+g.descendants;k=Math.max(g.height+1,k);return g});p&&(p.start=u(p.start,w),p.end=u(p.end,z));y(e,{children:g,descendants:b,height:k});"function"===typeof f&&f(e,c);return e};return{getListOfParents:B,getNode:r,getTree:function(a,e){var h=n(a,function(h){return h.id});a=B(a,h);return r("",null,1,null,a,e)}}}(C),M=function(a){var x=a.each,y=a.extend,m=a.isArray,t=a.isObject,n=a.isNumber,u=a.merge,q=a.pick,B=a.reduce;return{getColor:function(a,g){var e=
g.mapOptionsToLevel,h=g.parentColorIndex,p=g.series,d=g.colors,c=p.points,b,k;a&&(c=c[a.i],e=e[a.level]||{},(a=c&&e.colorByPoint)&&(b=c.index%(d?d.length:p.chart.options.chart.colorCount)),k=q(c&&c.options.colorIndex,e&&e.colorIndex,b,h,g.colorIndex));return{color:void 0,colorIndex:k}},getLevelOptions:function(a){var g=null,e,h,p,d;if(t(a))for(g={},p=n(a.from)?a.from:1,d=a.levels,h={},e=t(a.defaults)?a.defaults:{},m(d)&&(h=B(d,function(c,b){var d,a;t(b)&&n(b.level)&&(a=u({},b),d="boolean"===typeof a.levelIsConstant?
a.levelIsConstant:e.levelIsConstant,delete a.levelIsConstant,delete a.level,b=b.level+(d?0:p-1),t(c[b])?y(c[b],a):c[b]=a);return c},{})),d=n(a.to)?a.to:1,a=0;a<=d;a++)g[a]=u({},e,t(h[a])?h[a]:{});return g},setTreeValues:function g(a,h){var e=h.before,d=h.idRoot,c=h.mapIdToNode[d],b=h.points[a.i],k=b&&b.options||{},f=0,E=[];y(a,{levelDynamic:a.level-(("boolean"===typeof h.levelIsConstant?h.levelIsConstant:1)?0:c.level),name:q(b&&b.name,""),visible:d===a.id||("boolean"===typeof h.visible?h.visible:
!1)});"function"===typeof e&&(a=e(a,h));x(a.children,function(b,c){var d=y({},h);y(d,{index:c,siblings:a.children.length,visible:a.visible});b=g(b,d);E.push(b);b.visible&&(f+=b.val)});a.visible=0<f||a.visible;e=q(k.value,f);y(a,{children:E,childrenTotal:f,isLeaf:a.visible&&!f,val:e});return a},updateRootId:function(a){var e;t(a)&&(e=t(a.options)?a.options:{},e=q(a.rootNode,e.rootId,""),t(a.userOptions)&&(a.userOptions.rootId=e),a.rootNode=e);return e}}}(C);(function(a){function x(){return Array.prototype.slice.call(arguments,
1)}function y(a){a.apply(this);this.drawBreaks(this.xAxis,["x"]);this.drawBreaks(this.yAxis,t(this.pointArrayMap,["y"]))}var m=a.addEvent,t=a.pick,n=a.wrap,u=a.each,q=a.extend,B=a.isArray,r=a.fireEvent,g=a.Axis,e=a.Series;q(g.prototype,{isInBreak:function(a,e){var d=a.repeat||Infinity,c=a.from,b=a.to-a.from;e=e>=c?(e-c)%d:d-(c-e)%d;return a.inclusive?e<=b:e<b&&0!==e},isInAnyBreak:function(a,e){var d=this.options.breaks,c=d&&d.length,b,h,f;if(c){for(;c--;)this.isInBreak(d[c],a)&&(b=!0,h||(h=t(d[c].showPoints,
this.isXAxis?!1:!0)));f=b&&e?b&&!h:b}return f}});m(g,"afterInit",function(){"function"===typeof this.setBreaks&&this.setBreaks(this.options.breaks,!1)});m(g,"afterSetTickPositions",function(){if(this.isBroken){var a=this.tickPositions,e=this.tickPositions.info,d=[],c;for(c=0;c<a.length;c++)this.isInAnyBreak(a[c])||d.push(a[c]);this.tickPositions=d;this.tickPositions.info=e}});m(g,"afterSetOptions",function(){this.isBroken&&(this.options.ordinal=!1)});g.prototype.setBreaks=function(a,e){function d(a){var c=
a,d,f;for(f=0;f<b.breakArray.length;f++)if(d=b.breakArray[f],d.to<=a)c-=d.len;else if(d.from>=a)break;else if(b.isInBreak(d,a)){c-=a-d.from;break}return c}function c(a){var c,d;for(d=0;d<b.breakArray.length&&!(c=b.breakArray[d],c.from>=a);d++)c.to<a?a+=c.len:b.isInBreak(c,a)&&(a+=c.len);return a}var b=this,h=B(a)&&!!a.length;b.isDirty=b.isBroken!==h;b.isBroken=h;b.options.breaks=b.userOptions.breaks=a;b.forceRedraw=!0;h||b.val2lin!==d||(delete b.val2lin,delete b.lin2val);h&&(b.userOptions.ordinal=
!1,b.val2lin=d,b.lin2val=c,b.setExtremes=function(a,b,c,d,h){if(this.isBroken){for(;this.isInAnyBreak(a);)a-=this.closestPointRange;for(;this.isInAnyBreak(b);)b-=this.closestPointRange}g.prototype.setExtremes.call(this,a,b,c,d,h)},b.setAxisTranslation=function(a){g.prototype.setAxisTranslation.call(this,a);this.unitLength=null;if(this.isBroken){a=b.options.breaks;var c=[],d=[],h=0,e,f,k=b.userMin||b.min,p=b.userMax||b.max,m=t(b.pointRangePadding,0),n,q;u(a,function(a){f=a.repeat||Infinity;b.isInBreak(a,
k)&&(k+=a.to%f-k%f);b.isInBreak(a,p)&&(p-=p%f-a.from%f)});u(a,function(a){n=a.from;for(f=a.repeat||Infinity;n-f>k;)n-=f;for(;n<k;)n+=f;for(q=n;q<p;q+=f)c.push({value:q,move:"in"}),c.push({value:q+(a.to-a.from),move:"out",size:a.breakSize})});c.sort(function(a,c){return a.value===c.value?("in"===a.move?0:1)-("in"===c.move?0:1):a.value-c.value});e=0;n=k;u(c,function(a){e+="in"===a.move?1:-1;1===e&&"in"===a.move&&(n=a.value);0===e&&(d.push({from:n,to:a.value,len:a.value-n-(a.size||0)}),h+=a.value-n-
(a.size||0))});b.breakArray=d;b.unitLength=p-k-h+m;r(b,"afterBreaks");b.staticScale?b.transA=b.staticScale:b.unitLength&&(b.transA*=(p-b.min+m)/b.unitLength);m&&(b.minPixelPadding=b.transA*b.minPointOffset);b.min=k;b.max=p}});t(e,!0)&&this.chart.redraw()};n(e.prototype,"generatePoints",function(a){a.apply(this,x(arguments));var h=this.xAxis,d=this.yAxis,c=this.points,b,e=c.length,f=this.options.connectNulls,g;if(h&&d&&(h.options.breaks||d.options.breaks))for(;e--;)b=c[e],g=null===b.y&&!1===f,g||!h.isInAnyBreak(b.x,
!0)&&!d.isInAnyBreak(b.y,!0)||(c.splice(e,1),this.data[e]&&this.data[e].destroyElements())});a.Series.prototype.drawBreaks=function(a,e){var d=this,c=d.points,b,h,f,g;a&&u(e,function(e){b=a.breakArray||[];h=a.isXAxis?a.min:t(d.options.threshold,a.min);u(c,function(c){g=t(c["stack"+e.toUpperCase()],c[e]);u(b,function(b){f=!1;if(h<b.from&&g>b.to||h>b.from&&g<b.from)f="pointBreak";else if(h<b.from&&g>b.from&&g<b.to||h>b.from&&g>b.to&&g<b.from)f="pointInBreak";f&&r(a,f,{point:c,brk:b})})})})};a.Series.prototype.gappedPath=
function(){var e=this.currentDataGrouping,g=e&&e.totalRange,e=this.options.gapSize,d=this.points.slice(),c=d.length-1,b=this.yAxis;if(e&&0<c)for("value"!==this.options.gapUnit&&(e*=this.closestPointRange),g&&g>e&&(e=g);c--;)d[c+1].x-d[c].x>e&&(g=(d[c].x+d[c+1].x)/2,d.splice(c+1,0,{isNull:!0,x:g}),this.options.stacking&&(g=b.stacks[this.stackKey][g]=new a.StackItem(b,b.options.stackLabels,!1,g,this.stack),g.total=0));return this.getGraphPath(d)};n(a.seriesTypes.column.prototype,"drawPoints",y);n(a.Series.prototype,
"drawPoints",y)})(C);(function(a,x,y){var m=function(a){return Array.prototype.slice.call(a,1)},t=a.defined,n=a.each,u=a.extend,q=a.find,B=a.fireEvent,r=y.getLevelOptions,g=a.map,e=a.merge,h=a.inArray,p=a.isNumber,d=function(b){return a.isObject(b,!0)},c=a.isString,b=a.keys,k=a.pick,f=a.reduce,C=a.wrap;y=a.Axis;var w=a.Tick,z=function(a,b){var c=!1;n(a,function(a,d,e){c||(c=b(a,d,e))});return c},l=function(a,b){var c,d;for(c in b)b.hasOwnProperty(c)&&(d=b[c],C(a,c,d))},H=function(a,b){var c=a.collapseStart;
a=a.collapseEnd;a>=b&&(c-=.5);return{from:c,to:a,showPoints:!1}},G=function(a){return f(b(a.mapOfPosToGridNode),function(c,b){b=+b;a.min<=b&&a.max>=b&&!a.isInAnyBreak(b)&&c.push(b);return c},[])},K=function(a,b){var c=a.options.breaks||[],d=H(b,a.max);return z(c,function(a){return a.from===d.from&&a.to===d.to})},I=function(a,b){var c=a.options.breaks||[];a=H(b,a.max);c.push(a);return c},L=function(a,b){var c=a.options.breaks||[],d=H(b,a.max);return f(c,function(a,b){b.to===d.to&&b.from===d.from||
a.push(b);return a},[])},J=function(b,c){var d=b.labelIcon,e=!d,f=c.renderer,g=c.xy,h=c.options,k=h.width,v=h.height,l=g.x-k/2-h.padding,g=g.y-v/2,m=c.collapsed?90:180,D=c.show&&a.isNumber(g);e&&(b.labelIcon=d=f.path(f.symbols[h.type](h.x,h.y,k,v)).addClass("highcharts-label-icon").add(c.group));D||d.attr({y:-9999});d[e?"attr":"animate"]({translateX:l,translateY:g,rotation:m})},F=function(a,b,e){var g=[],f=[],h={},k={},v=-1,l="boolean"===typeof b?b:!1;a=x.getTree(a,{after:function(a){a=k[a.pos];var b=
0,c=0;n(a.children,function(a){c+=a.descendants+1;b=Math.max(a.height+1,b)});a.descendants=c;a.height=b;a.collapsed&&f.push(a)},before:function(a){var b=d(a.data)?a.data:{},e=c(b.name)?b.name:"",f=h[a.parent],f=d(f)?k[f.pos]:null,m=function(a){return a.name===e},A;l&&d(f)&&(A=q(f.children,m))?(m=A.pos,A.nodes.push(a)):m=v++;k[m]||(k[m]=A={depth:f?f.depth+1:0,name:e,nodes:[a],children:[],pos:m},-1!==m&&g.push(e),d(f)&&f.children.push(A));c(a.id)&&(h[a.id]=a);!0===b.collapsed&&(A.collapsed=!0);a.pos=
m}});k=function(a,b){var c=function(a,e,f){var g=e+(-1===e?0:b-1),h=(g-e)/2,k=e+h;n(a.nodes,function(a){var b=a.data;d(b)&&(b.y=e+b.seriesIndex,delete b.seriesIndex);a.pos=k});f[k]=a;a.pos=k;a.tickmarkOffset=h+.5;a.collapseStart=g+.5;n(a.children,function(a){c(a,g+1,f);g=a.collapseEnd-.5});a.collapseEnd=g+.5;return f};return c(a["-1"],-1,{})}(k,e);return{categories:g,mapOfIdToNode:h,mapOfPosToGridNode:k,collapsedNodes:f,tree:a}};l(y.prototype,{init:function(b,c,d){var f=this,h,k="treegrid"===d.type;
k&&(d=e({grid:{enabled:!0},labels:{align:"left",levels:[{level:void 0},{level:1,style:{fontWeight:"bold"}}],symbol:{type:"triangle",x:-5,y:-5,height:10,width:10,padding:5}},uniqueNames:!1},d,{reversed:!0,grid:{columns:void 0}}));b.apply(f,[c,d]);k&&(a.addEvent(f.chart,"beforeRender",function(){var b=f.options&&f.options.labels;f.updateYNames();n(f.series,function(a){a.yData=g(a.options.data,function(a){return a.y})});f.mapOptionsToLevel=r({defaults:b,from:1,levels:b.levels,to:f.tree.height});h=a.addEvent(f,
"foundExtremes",function(){n(f.collapsedNodes,function(a){a=I(f,a);f.setBreaks(a,!1)});h()})}),f.hasNames=!0,f.options.showLastLabel=!0)},getMaxLabelDimensions:function(a){var b=this.options,c=b&&b.labels,b=c&&p(c.indentation)?b.labels.indentation:0,c=a.apply(this,m(arguments)),d;"treegrid"===this.options.type&&(d=this.mapOfPosToGridNode[-1].height,c.width+=b*(d-1));return c},generateTick:function(a,b){var c=d(this.mapOptionsToLevel)?this.mapOptionsToLevel:{},e=this.ticks,f=e[b],g,h;"treegrid"===
this.options.type?(h=this.mapOfPosToGridNode[b],(c=c[h.depth])&&(g={labels:c}),f?(f.parameters.category=h.name,f.options=g,f.addLabel()):e[b]=new w(this,b,null,void 0,{category:h.name,tickmarkOffset:h.tickmarkOffset,options:g})):a.apply(this,m(arguments))},setTickInterval:function(a){var b=this.options;"treegrid"===b.type?(this.min=k(this.userMin,b.min,this.dataMin),this.max=k(this.userMax,b.max,this.dataMax),B(this,"foundExtremes"),this.setAxisTranslation(!0),this.tickmarkOffset=.5,this.tickInterval=
1,this.tickPositions=G(this)):a.apply(this,m(arguments))}});l(w.prototype,{getLabelPosition:function(a,b,c,f,e,h,g,m,l){var v=k(this.options&&this.options.labels,h);h=this.pos;var n=this.axis,A="treegrid"===n.options.type;a=a.apply(this,[b,c,f,e,v,g,m,l]);A&&(b=v&&d(v.symbol)?v.symbol:{},v=v&&p(v.indentation)?v.indentation:0,h=(h=(n=n.mapOfPosToGridNode)&&n[h])&&h.depth||1,a.x+=b.width+2*b.padding+(h-1)*v);return a},renderLabel:function(b){var c=this,f=c.pos,e=c.axis,g=c.label,l=e.mapOfPosToGridNode,
p=e.options,q=k(c.options&&c.options.labels,p&&p.labels),r=q&&d(q.symbol)?q.symbol:{},u=(l=l&&l[f])&&l.depth,p="treegrid"===p.type,D=!(!g||!g.element),f=-1<h(f,e.tickPositions);p&&l&&D&&g.addClass("highcharts-treegrid-node-level-"+u);b.apply(c,m(arguments));p&&l&&D&&0<l.descendants&&(e=K(e,l),J(c,{collapsed:e,group:g.parentGroup,options:r,renderer:g.renderer,show:f,xy:g.xy}),r="highcharts-treegrid-node-"+(e?"expanded":"collapsed"),g.addClass("highcharts-treegrid-node-"+(e?"collapsed":"expanded")).removeClass(r),
n([g,c.labelIcon],function(b){b.attachedTreeGridEvents||(a.addEvent(b.element,"mouseover",function(){g.addClass("highcharts-treegrid-node-active")}),a.addEvent(b.element,"mouseout",function(){var a=g;t(q.style);a.removeClass("highcharts-treegrid-node-active")}),a.addEvent(b.element,"click",function(){c.toggleCollapse()}),b.attachedTreeGridEvents=!0)}))}});u(w.prototype,{collapse:function(a){var b=this.axis,c=I(b,b.mapOfPosToGridNode[this.pos]);b.setBreaks(c,k(a,!0))},expand:function(a){var b=this.axis,
c=L(b,b.mapOfPosToGridNode[this.pos]);b.setBreaks(c,k(a,!0))},toggleCollapse:function(a){var b=this.axis,c;c=b.mapOfPosToGridNode[this.pos];c=K(b,c)?L(b,c):I(b,c);b.setBreaks(c,k(a,!0))}});y.prototype.updateYNames=function(){var a=this.options,b=a.uniqueNames,c=!this.isXAxis,e=this.series,g=0;"treegrid"===a.type&&c&&(a=f(e,function(a,c){c.visible&&(n(c.options.data,function(b){d(b)&&(b.seriesIndex=g,a.push(b))}),!0===b&&g++);return a},[]),a=F(a,b,!0===b?g:1),this.categories=a.categories,this.mapOfPosToGridNode=
a.mapOfPosToGridNode,this.collapsedNodes=a.collapsedNodes,this.hasNames=!0,this.tree=a.tree)};y.prototype.utils={getNode:x.getNode}})(C,J,M)});
//# sourceMappingURL=treegrid.js.map