28 lines
9.1 KiB
JavaScript
28 lines
9.1 KiB
JavaScript
/*
|
|
Highcharts Gantt JS v8.1.0 (2020-05-05)
|
|
|
|
GridAxis
|
|
|
|
(c) 2016-2019 Lars A. V. Cabrera
|
|
|
|
License: www.highcharts.com/license
|
|
*/
|
|
(function(d){"object"===typeof module&&module.exports?(d["default"]=d,module.exports=d):"function"===typeof define&&define.amd?define("highcharts/modules/grid-axis",["highcharts"],function(n){d(n);d.Highcharts=n;return d}):d("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(d){function n(d,r,n,f){d.hasOwnProperty(r)||(d[r]=f.apply(null,n))}d=d?d._modules:{};n(d,"parts-gantt/GridAxis.js",[d["parts/Axis.js"],d["parts/Globals.js"],d["parts/Tick.js"],d["parts/Utilities.js"]],function(d,n,
|
|
A,f){var h=f.addEvent,p=f.defined,r=f.erase,B=f.find,C=f.isArray,t=f.isNumber,x=f.merge,y=f.pick,D=f.timeUnits,z=f.wrap,E=n.dateFormat,F=n.Chart,G=function(b){var a=b.options;a.labels||(a.labels={});a.labels.align=y(a.labels.align,"center");b.categories||(a.showLastLabel=!1);b.labelRotation=0;a.labels.rotation=0};"";d.prototype.getMaxLabelDimensions=function(b,a){var c={width:0,height:0};a.forEach(function(a){a=b[a];if(f.isObject(a,!0)){var e=f.isObject(a.label,!0)?a.label:{};a=e.getBBox?e.getBBox().height:
|
|
0;e.textStr&&!t(e.textPxLength)&&(e.textPxLength=e.getBBox().width);e=t(e.textPxLength)?Math.round(e.textPxLength):0;c.height=Math.max(a,c.height);c.width=Math.max(e,c.width)}});return c};n.dateFormats.W=function(b){b=new this.Date(b);var a=(this.get("Day",b)+6)%7,c=new this.Date(b.valueOf());this.set("Date",c,this.get("Date",b)-a+3);a=new this.Date(this.get("FullYear",c),0,1);4!==this.get("Day",a)&&(this.set("Month",b,0),this.set("Date",b,1+(11-this.get("Day",a))%7));return(1+Math.floor((c.valueOf()-
|
|
a.valueOf())/6048E5)).toString()};n.dateFormats.E=function(b){return E("%a",b,!0).charAt(0)};h(F,"afterSetChartSize",function(){this.axes.forEach(function(b){(b.grid&&b.grid.columns||[]).forEach(function(a){a.setAxisSize();a.setAxisTranslation()})})});h(A,"afterGetLabelPosition",function(b){var a=this.label,c=this.axis,m=c.reversed,e=c.chart,l=c.options.grid||{},g=c.options.labels,u=g.align,k=w.Side[c.side],d=b.tickmarkOffset,v=c.tickPositions,q=this.pos-d;v=t(v[b.index+1])?v[b.index+1]-d:c.max+d;
|
|
var f=c.tickSize("tick");d=f?f[0]:0;f=f?f[1]/2:0;if(!0===l.enabled){if("top"===k){l=c.top+c.offset;var h=l-d}else"bottom"===k?(h=e.chartHeight-c.bottom+c.offset,l=h+d):(l=c.top+c.len-c.translate(m?v:q),h=c.top+c.len-c.translate(m?q:v));"right"===k?(k=e.chartWidth-c.right+c.offset,m=k+d):"left"===k?(m=c.left+c.offset,k=m-d):(k=Math.round(c.left+c.translate(m?v:q))-f,m=Math.round(c.left+c.translate(m?q:v))-f);this.slotWidth=m-k;b.pos.x="left"===u?k:"right"===u?m:k+(m-k)/2;b.pos.y=h+(l-h)/2;e=e.renderer.fontMetrics(g.style.fontSize,
|
|
a.element);a=a.getBBox().height;g.useHTML?b.pos.y+=e.b+-(a/2):(a=Math.round(a/e.h),b.pos.y+=(e.b-(e.h-e.f))/2+-((a-1)*e.h/2));b.pos.x+=c.horiz&&g.x||0}});var H=function(){function b(a){this.axis=a}b.prototype.isOuterAxis=function(){var a=this.axis,c=a.grid.columnIndex,b=a.linkedParent&&a.linkedParent.grid.columns||a.grid.columns,e=c?a.linkedParent:a,d=-1,g=0;a.chart[a.coll].forEach(function(c,b){c.side!==a.side||c.options.isInternal||(g=b,c===e&&(d=b))});return g===d&&(t(c)?b.length===c:!0)};return b}(),
|
|
w=function(){function b(){}b.compose=function(a){d.keepProps.push("grid");z(a.prototype,"unsquish",b.wrapUnsquish);h(a,"init",b.onInit);h(a,"afterGetOffset",b.onAfterGetOffset);h(a,"afterGetTitlePosition",b.onAfterGetTitlePosition);h(a,"afterInit",b.onAfterInit);h(a,"afterRender",b.onAfterRender);h(a,"afterSetAxisTranslation",b.onAfterSetAxisTranslation);h(a,"afterSetOptions",b.onAfterSetOptions);h(a,"afterSetOptions",b.onAfterSetOptions2);h(a,"afterSetScale",b.onAfterSetScale);h(a,"afterTickSize",
|
|
b.onAfterTickSize);h(a,"trimTicks",b.onTrimTicks);h(a,"destroy",b.onDestroy)};b.onAfterGetOffset=function(){var a=this.grid;(a&&a.columns||[]).forEach(function(a){a.getOffset()})};b.onAfterGetTitlePosition=function(a){if(!0===(this.options.grid||{}).enabled){var c=this.axisTitle,d=this.height,e=this.horiz,l=this.left,g=this.offset,u=this.opposite,k=this.options.title,f=void 0===k?{}:k;k=this.top;var h=this.width,q=this.tickSize(),n=c&&c.getBBox().width,p=f.x||0,r=f.y||0,t=y(f.margin,e?5:10);c=this.chart.renderer.fontMetrics(f.style&&
|
|
f.style.fontSize,c).f;q=(e?k+d:l)+(e?1:-1)*(u?-1:1)*(q?q[0]/2:0)+(this.side===b.Side.bottom?c:0);a.titlePosition.x=e?l-n/2-t+p:q+(u?h:0)+g+p;a.titlePosition.y=e?q-(u?d:0)+(u?c:-c)/2+g+r:k-t+r}};b.onAfterInit=function(){var a=this.chart,c=this.options.grid;c=void 0===c?{}:c;var b=this.userOptions;c.enabled&&(G(this),z(this,"labelFormatter",function(a){var c=this.axis,b=this.value,e=c.tickPositions,d=(c.isLinked?c.linkedParent:c).series[0],m=b===e[0];e=b===e[e.length-1];d=d&&B(d.options.data,function(a){return a[c.isXAxis?
|
|
"x":"y"]===b});this.isFirst=m;this.isLast=e;this.point=d;return a.call(this)}));if(c.columns)for(var e=this.grid.columns=[],l=this.grid.columnIndex=0;++l<c.columns.length;){var g=x(b,c.columns[c.columns.length-l-1],{linkedTo:0,type:"category"});delete g.grid.columns;g=new d(this.chart,g);g.grid.isColumn=!0;g.grid.columnIndex=l;r(a.axes,g);r(a[this.coll],g);e.push(g)}};b.onAfterRender=function(){var a=this.grid,c=this.options,d=this.chart.renderer;if(!0===(c.grid||{}).enabled){this.maxLabelDimensions=
|
|
this.getMaxLabelDimensions(this.ticks,this.tickPositions);this.rightWall&&this.rightWall.destroy();if(this.grid&&this.grid.isOuterAxis()&&this.axisLine){var e=c.lineWidth;if(e){var l=this.getLinePath(e),g=l[0],f=l[1],k=((this.tickSize("tick")||[1])[0]-1)*(this.side===b.Side.top||this.side===b.Side.left?-1:1);"M"===g[0]&&"L"===f[0]&&(this.horiz?(g[2]+=k,f[2]+=k):(g[1]+=k,f[1]+=k));this.grid.axisLineExtra?this.grid.axisLineExtra.animate({d:l}):(this.grid.axisLineExtra=d.path(l).attr({zIndex:7}).addClass("highcharts-axis-line").add(this.axisGroup),
|
|
d.styledMode||this.grid.axisLineExtra.attr({stroke:c.lineColor,"stroke-width":e}));this.axisLine[this.showAxis?"show":"hide"](!0)}}(a&&a.columns||[]).forEach(function(a){a.render()})}};b.onAfterSetAxisTranslation=function(){var a=this.tickPositions&&this.tickPositions.info,c=this.options,b=c.grid||{},e=this.userOptions.labels||{};this.horiz&&(!0===b.enabled&&this.series.forEach(function(a){a.options.pointRange=0}),a&&c.dateTimeLabelFormats&&c.labels&&!p(e.align)&&(!1===c.dateTimeLabelFormats[a.unitName].range||
|
|
1<a.count)&&(c.labels.align="left",p(e.x)||(c.labels.x=3)))};b.onAfterSetOptions=function(a){var c=this.options;a=a.userOptions;var b=c&&f.isObject(c.grid,!0)?c.grid:{};if(!0===b.enabled){var e=x(!0,{className:"highcharts-grid-axis "+(a.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"}},margin:0,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]]},a);"xAxis"===this.coll&&(p(a.linkedTo)&&!p(a.tickPixelInterval)&&(e.tickPixelInterval=350),p(a.tickPixelInterval)||!p(a.linkedTo)||p(a.tickPositioner)||p(a.tickInterval)||(e.tickPositioner=function(a,c){var b=this.linkedParent&&this.linkedParent.tickPositions&&this.linkedParent.tickPositions.info;if(b){var d,f=e.units;for(d=0;d<f.length;d++)if(f[d][0]===
|
|
b.unitName){var g=d;break}if(f[g+1]){var m=f[g+1][0];var l=(f[g+1][1]||[1])[0]}else"year"===b.unitName&&(m="year",l=10*b.count);b=D[m];this.tickInterval=b*l;return this.getTimeTicks({unitRange:b,count:l,unitName:m},a,c,this.options.startOfWeek)}}));x(!0,this.options,e);this.horiz&&(c.minPadding=y(a.minPadding,0),c.maxPadding=y(a.maxPadding,0));t(c.grid.borderWidth)&&(c.tickWidth=c.lineWidth=b.borderWidth)}};b.onAfterSetOptions2=function(a){a=(a=a.userOptions)&&a.grid||{};var c=a.columns;a.enabled&&
|
|
c&&x(!0,this.options,c[c.length-1])};b.onAfterSetScale=function(){(this.grid.columns||[]).forEach(function(a){a.setScale()})};b.onAfterTickSize=function(a){var c=d.defaultLeftAxisOptions,b=this.horiz,e=this.maxLabelDimensions,f=this.options.grid;f=void 0===f?{}:f;f.enabled&&e&&(c=2*Math.abs(c.labels.x),b=b?f.cellHeight||c+e.height:c+e.width,C(a.tickSize)?a.tickSize[0]=b:a.tickSize=[b,0])};b.onDestroy=function(a){var c=this.grid;(c.columns||[]).forEach(function(c){c.destroy(a.keepEvents)});c.columns=
|
|
void 0};b.onInit=function(a){a=a.userOptions||{};var c=a.grid||{};c.enabled&&p(c.borderColor)&&(a.tickColor=a.lineColor=c.borderColor);this.grid||(this.grid=new H(this))};b.onTrimTicks=function(){var a=this.options,c=this.categories,b=this.tickPositions,e=b[0],d=b[b.length-1],f=this.linkedParent&&this.linkedParent.min||this.min,h=this.linkedParent&&this.linkedParent.max||this.max,k=this.tickInterval;!0!==(a.grid||{}).enabled||c||!this.horiz&&!this.isLinked||(e<f&&e+k>f&&!a.startOnTick&&(b[0]=f),d>
|
|
h&&d-k<h&&!a.endOnTick&&(b[b.length-1]=h))};b.wrapUnsquish=function(a){var b=this.options.grid;return!0===(void 0===b?{}:b).enabled&&this.categories?this.tickInterval:a.apply(this,Array.prototype.slice.call(arguments,1))};return b}();(function(b){b=b.Side||(b.Side={});b[b.top=0]="top";b[b.right=1]="right";b[b.bottom=2]="bottom";b[b.left=3]="left"})(w||(w={}));w.compose(d);return w});n(d,"masters/modules/grid-axis.src.js",[],function(){})});
|
|
//# sourceMappingURL=grid-axis.js.map
|