UNPKG

7.49 kBJavaScriptView Raw
1/*
2 Highcharts JS v5.0.2 (2016-10-26)
3 Gantt series
4
5 (c) 2016 Lars A. V. Cabrera
6
7 --- WORK IN PROGRESS ---
8
9 License: www.highcharts.com/license
10*/
11(function(m){"object"===typeof module&&module.exports?module.exports=m:m(Highcharts)})(function(m){(function(a){var m=a.dateFormat,u=a.each,v=a.isObject,n=a.pick,k=a.wrap,p=a.Axis,w=a.Chart,t=a.Tick;p.prototype.isOuterAxis=function(){var b=this,g=-1,c=!0;u(this.chart.axes,function(e,h){e.side===b.side&&(e===b?g=h:0<=g&&h>g&&(c=!1))});return c};t.prototype.getLabelWidth=function(){return this.label.getBBox().width};p.prototype.getMaxLabelLength=function(b){var g=this.tickPositions,c=this.ticks,e=0;
12if(!this.maxLabelLength||b)u(g,function(b){(b=c[b])&&b.labelLength>e&&(e=b.labelLength)}),this.maxLabelLength=e;return this.maxLabelLength};p.prototype.addTitle=function(){var b=this.chart.renderer,g=this.axisParent,c=this.horiz,e=this.opposite,h=this.options,d=h.title,a;this.showAxis=a=this.hasData()||n(h.showEmpty,!0);h.title="";this.axisTitle||((h=d.textAlign)||(h=(c?{low:"left",middle:"center",high:"right"}:{low:e?"right":"left",middle:"center",high:e?"left":"right"})[d.align]),this.axisTitle=
13b.text(d.text,0,0,d.useHTML).attr({zIndex:7,rotation:d.rotation||0,align:h}).addClass("highcharts-axis-title").css(d.style).add(g),this.axisTitle.isNew=!0);this.axisTitle[a?"show":"hide"](!0)};a.dateFormats={W:function(b){b=new Date(b);var g=0===b.getUTCDay()?7:b.getUTCDay(),c=b.getTime(),e=new Date(b.getUTCFullYear(),0,1,-6);b.setDate(b.getUTCDate()+4-g);return 1+Math.floor(Math.floor((c-e)/864E5)/7)},E:function(b){return m("%a",b,!0).charAt(0)}};k(t.prototype,"addLabel",function(b){var g=this.axis,
14c=void 0!==g.options.categories,e=g.tickPositions,e=this.pos!==e[e.length-1];(!g.options.grid||c||e)&&b.apply(this)});k(t.prototype,"getLabelPosition",function(b,g,c,e){var h=b.apply(this,Array.prototype.slice.call(arguments,1)),d=this.axis,a=d.options,f=a.tickInterval||1,q,r;a.grid&&(q=a.labels.style.fontSize,r=d.chart.renderer.fontMetrics(q,e),q=r.b,r=r.h,d.horiz&&void 0===a.categories?(a=d.axisGroup.getBBox().height,f=this.pos+f/2,h.x=d.translate(f)+d.left,f=a/2+r/2-Math.abs(r-q),h.y=0===d.side?
15c-f:c+f):(void 0===a.categories&&(f=this.pos+f/2,h.y=d.translate(f)+d.top+q/2),f=this.getLabelWidth()/2-d.maxLabelLength/2,h.x=3===d.side?h.x+f:h.x-f));return h});k(p.prototype,"tickSize",function(b){var g=b.apply(this,Array.prototype.slice.call(arguments,1)),c;this.options.grid&&!this.horiz&&(c=2*Math.abs(this.defaultLeftAxisOptions.labels.x),this.maxLabelLength||(this.maxLabelLength=this.getMaxLabelLength()),c=this.maxLabelLength+c,g[0]=c);return g});k(p.prototype,"getOffset",function(b){var g=
16this.chart.axisOffset,c=this.side,a,h,d=this.options,k=d.title,f=k&&k.text&&!1!==k.enabled;this.options.grid&&v(this.options.title)?(h=this.tickSize("tick")[0],g[c]&&h&&(a=g[c]+h),f&&this.addTitle(),b.apply(this,Array.prototype.slice.call(arguments,1)),g[c]=n(a,g[c]),d.title=k):b.apply(this,Array.prototype.slice.call(arguments,1))});k(p.prototype,"renderUnsquish",function(b){this.options.grid&&(this.labelRotation=0,this.options.labels.rotation=0);b.apply(this)});k(p.prototype,"setOptions",function(b,
17a){a.grid&&this.horiz&&(a.startOnTick=!0,a.minPadding=0,a.endOnTick=!0);b.apply(this,Array.prototype.slice.call(arguments,1))});k(p.prototype,"render",function(b){var a=this.options,c,e,h,d,k,f,q=this.chart.renderer;if(a.grid){if(c=2*Math.abs(this.defaultLeftAxisOptions.labels.x),c=this.maxLabelLength+c,e=a.lineWidth,this.rightWall&&this.rightWall.destroy(),b.apply(this),b=this.axisGroup.getBBox(),this.horiz&&(this.rightWall=q.path(["M",b.x+this.width+1,b.y,"L",b.x+this.width+1,b.y+b.height]).attr({stroke:a.tickColor||
18"#ccd6eb","stroke-width":a.tickWidth||1,zIndex:7,class:"grid-wall"}).add(this.axisGroup)),this.isOuterAxis()&&this.axisLine&&(this.horiz&&(c=b.height-1),e)){b=this.getLinePath(e);k=b.indexOf("M")+1;f=b.indexOf("L")+1;h=b.indexOf("M")+2;d=b.indexOf("L")+2;if(0===this.side||3===this.side)c=-c;this.horiz?(b[h]+=c,b[d]+=c):(b[k]+=c,b[f]+=c);this.axisLineExtra?this.axisLineExtra.animate({d:b}):this.axisLineExtra=q.path(b).attr({stroke:a.lineColor,"stroke-width":e,zIndex:7}).add(this.axisGroup);this.axisLine[this.showAxis?
19"show":"hide"](!0)}}else b.apply(this)});k(w.prototype,"render",function(b){var a=25/11,c,e;u(this.axes,function(b){var d=b.options;d.grid&&(e=d.labels.style.fontSize,c=b.chart.renderer.fontMetrics(e),"datetime"===d.type&&(d.units=[["millisecond",[1]],["second",[1]],["minute",[1]],["hour",[1]],["day",[1]],["week",[1]],["month",[1]],["year",null]]),b.horiz?d.tickLength=d.cellHeight||c.h*a:(d.tickWidth=1,d.lineWidth||(d.lineWidth=1)))});b.apply(this)})})(m);(function(a){var m=a.getOptions().plotOptions,
20u=a.Color,v=a.seriesTypes.column,n=a.each,k=a.extendClass,p=a.isNumber,w=a.isObject,t=a.merge,b=a.pick,g=a.seriesTypes,c=a.stop,e=a.wrap,h=a.Axis,d=a.Point,x=a.Series;m.xrange=t(m.column,{tooltip:{pointFormat:'\x3cspan style\x3d"color:{point.color}"\x3e\u25cf\x3c/span\x3e {series.name}: \x3cb\x3e{point.yCategory}\x3c/b\x3e\x3cbr/\x3e'}});g.xrange=k(v,{pointClass:k(d,{getLabelConfig:function(){var b=d.prototype.getLabelConfig.call(this);b.x2=this.x2;b.yCategory=this.yCategory=this.series.yAxis.categories&&
21this.series.yAxis.categories[this.y];return b}}),type:"xrange",forceDL:!0,parallelArrays:["x","x2","y"],requireSorting:!1,animate:g.line.prototype.animate,getColumnMetrics:function(){function b(){n(c.series,function(b){var a=b.xAxis;b.xAxis=b.yAxis;b.yAxis=a})}var a,c=this.chart;b();this.yAxis.closestPointRange=1;a=v.prototype.getColumnMetrics.call(this);b();return a},cropData:function(b,a,c,d){a=x.prototype.cropData.call(this,this.x2Data,a,c,d);a.xData=b.slice(a.start,a.end);return a},translate:function(){v.prototype.translate.apply(this,
22arguments);var a=this.xAxis,c=this.columnMetrics,d=this.options.minPointLength||0;n(this.points,function(e){var f=e.plotX,l=b(e.x2,e.x+(e.len||0)),l=a.toPixels(l,!0),h=l-f,g;d&&(g=d-h,0>g&&(g=0),f-=g/2,l+=g/2);f=Math.max(f,-10);l=Math.min(Math.max(l,-10),a.len+10);e.shapeArgs={x:f,y:e.plotY+c.offset,width:l-f,height:c.width};e.tooltipPos[0]+=h/2;e.tooltipPos[1]-=c.width/2;if(l=e.partialFill)w(l)&&(l=l.amount),p(l)||(l=0),f=e.shapeArgs,e.partShapeArgs={x:f.x,y:f.y+1,width:f.width*l,height:f.height-
232}})},drawPoints:function(){var b=this,a=this.chart,d=b.options,e=a.renderer,g=a.pointCount<(d.animationLimit||250)?"animate":"attr";n(b.points,function(a){var f=a.graphic,h=a.shapeType,k=a.shapeArgs,l=a.partShapeArgs,r=b.options,m=a.partialFill,q=a.selected&&"select",n=d.stacking&&!d.borderRadius;if(p(a.plotY)&&null!==a.y){if(f){if(c(f),a.graphicOriginal[g](t(k)),l)a.graphicOverlay[g](t(l))}else a.graphic=f=e.g("point").attr({"class":a.getClassName()}).add(a.group||b.group),a.graphicOriginal=e[h](k).addClass("highcharts-partfill-original").add(f),
24l&&(a.graphicOverlay=e[h](l).addClass("highcharts-partfill-overlay").add(f));a.graphicOriginal.attr(b.pointAttribs(a,q)).shadow(d.shadow,null,n);l&&(w(m)||(m={}),w(r.partialFill)&&(m=t(m,r.partialFill)),f=m.fill||u(b.color).brighten(-.3).get("rgb"),a.graphicOverlay.attr(b.pointAttribs(a,q)).attr("fill",f).attr("stroke-width",0).shadow(d.shadow,null,n))}else f&&(a.graphic=f.destroy())})}});e(h.prototype,"getSeriesExtremes",function(a){var d=this.series,c,e;a.call(this);this.isXAxis&&"xrange"===d.type&&
25(c=b(this.dataMax,Number.MIN_VALUE),n(this.series,function(a){n(a.x2Data||[],function(a){a>c&&(c=a,e=!0)})}),e&&(this.dataMax=c))})})(m)});