highcharts-release
Advanced tools
Comparing version 4.2.7 to 5.0.0
{ | ||
"name": "highcharts", | ||
"version": "v4.2.7", | ||
"main": [ | ||
"highcharts.js", | ||
"highcharts-more.js", | ||
"modules/exporting.js" | ||
] | ||
"version": "v5.0.0", | ||
"main": "highcharts.js" | ||
} |
/* | ||
Highcharts JS v4.2.7 (2016-09-21) | ||
Highcharts JS v5.0.0 (2016-09-29) | ||
@@ -8,43 +8,43 @@ 3D features for Highcharts JS | ||
*/ | ||
(function(d){typeof module==="object"&&module.exports?module.exports=d:d(Highcharts)})(function(d){function C(c){return c!==void 0&&c!==null}function H(c){var b=0,a,f;for(a=0;a<c.length;a++)f=(a+1)%c.length,b+=c[a].x*c[f].y-c[f].x*c[a].y;return b/2}function D(c){var b=0,a;for(a=0;a<c.length;a++)b+=c[a].z;return c.length?b/c.length:0}function u(c,b,a,f,e,g,d,j){var k=[];g>e&&g-e>n/2+1.0E-4?(k=k.concat(u(c,b,a,f,e,e+n/2,d,j)),k=k.concat(u(c,b,a,f,e+n/2,g,d,j))):g<e&&e-g>n/2+1.0E-4?(k=k.concat(u(c,b, | ||
a,f,e,e-n/2,d,j)),k=k.concat(u(c,b,a,f,e-n/2,g,d,j))):(k=g-e,k=["C",c+a*l(e)-a*E*k*q(e)+d,b+f*q(e)+f*E*k*l(e)+j,c+a*l(g)+a*E*k*q(g)+d,b+f*q(g)-f*E*k*l(g)+j,c+a*l(g)+d,b+f*q(g)+j]);return k}function L(c,b){var a=c.plotLeft,f=c.plotWidth+a,e=c.plotTop,g=c.plotHeight+e,d=a+c.plotWidth/2,j=e+c.plotHeight/2,k=Number.MAX_VALUE,h=-Number.MAX_VALUE,m=Number.MAX_VALUE,s=-Number.MAX_VALUE,l,p=1;l=[{x:a,y:e,z:0},{x:a,y:e,z:b}];t([0,1],function(a){l.push({x:f,y:l[a].y,z:l[a].z})});t([0,1,2,3],function(a){l.push({x:l[a].x, | ||
y:g,z:l[a].z})});l=r(l,c,!1);t(l,function(a){k=Math.min(k,a.x);h=Math.max(h,a.x);m=Math.min(m,a.y);s=Math.max(s,a.y)});a>k&&(p=Math.min(p,1-Math.abs((a+d)/(k+d))%1));f<h&&(p=Math.min(p,(f-d)/(h-d)));e>m&&(p=m<0?Math.min(p,(e+j)/(-m+e+j)):Math.min(p,1-(e+j)/(m+j)%1));g<s&&(p=Math.min(p,Math.abs((g-j)/(s-j))));return p}function I(c){if(this.chart.is3d()){var b=this.chart.options.plotOptions.column.grouping;if(b!==void 0&&!b&&this.group.zIndex!==void 0&&!this.zIndexSet)this.group.attr({zIndex:this.group.zIndex* | ||
10}),this.zIndexSet=!0;var a=this.options,f=this.options.states;this.borderWidth=a.borderWidth=C(a.edgeWidth)?a.edgeWidth:1;d.each(this.data,function(b){if(b.y!==null)b=b.pointAttr,this.borderColor=d.pick(a.edgeColor,b[""].fill),b[""].stroke=this.borderColor,b.hover.stroke=d.pick(f.hover.edgeColor,this.borderColor),b.select.stroke=d.pick(f.select.edgeColor,this.borderColor)})}c.apply(this,[].slice.call(arguments,1))}var M=d.animObject,t=d.each,N=d.extend,O=d.inArray,F=d.merge,A=d.pick,J=d.wrap,n= | ||
Math.PI,B=n/180,q=Math.sin,l=Math.cos,K=Math.round,r=d.perspective=function(c,b,a){var f=b.options.chart.options3d,e=a?b.inverted:!1,g=b.plotWidth/2,i=b.plotHeight/2,j=f.depth/2,k=A(f.depth,1)*A(f.viewDistance,0),h=b.scale3d||1,m=B*f.beta*(e?-1:1),f=B*f.alpha*(e?-1:1),s=l(f),n=l(-m),p=q(f),o=q(-m);a||(g+=b.plotLeft,i+=b.plotTop);return d.map(c,function(a){var b;b=-p*o*((e?a.y:a.x)-g)+s*((e?a.x:a.y)-i)-n*p*((a.z||0)-j);var c=s*o*((e?a.y:a.x)-g)+p*((e?a.x:a.y)-i)+s*n*((a.z||0)-j),f=k>0&&k<Number.POSITIVE_INFINITY? | ||
k/(c+j+k):1;a=(n*((e?a.y:a.x)-g)-o*((a.z||0)-j))*f;b*=f;a=a*h+g;b=b*h+i;return{x:e?b:a,y:e?a:b,z:c*h+j}})},E=4*(Math.sqrt(2)-1)/3/(n/2);d.SVGRenderer.prototype.toLinePath=function(c,b){var a=[];d.each(c,function(b){a.push("L",b.x,b.y)});c.length&&(a[0]="M",b&&a.push("Z"));return a};d.SVGRenderer.prototype.cuboid=function(c){var b=this.g(),c=this.cuboidPath(c);b.front=this.path(c[0]).attr({zIndex:c[3],"stroke-linejoin":"round"}).add(b);b.top=this.path(c[1]).attr({zIndex:c[4],"stroke-linejoin":"round"}).add(b); | ||
b.side=this.path(c[2]).attr({zIndex:c[5],"stroke-linejoin":"round"}).add(b);b.fillSetter=function(a){var b=d.Color(a).brighten(0.1).get(),c=d.Color(a).brighten(-0.1).get();this.front.attr({fill:a});this.top.attr({fill:b});this.side.attr({fill:c});this.color=a;return this};b.opacitySetter=function(a){this.front.attr({opacity:a});this.top.attr({opacity:a});this.side.attr({opacity:a});return this};b.attr=function(a){if(a.shapeArgs||C(a.x))a=this.renderer.cuboidPath(a.shapeArgs||a),this.front.attr({d:a[0], | ||
zIndex:a[3]}),this.top.attr({d:a[1],zIndex:a[4]}),this.side.attr({d:a[2],zIndex:a[5]});else return d.SVGElement.prototype.attr.call(this,a);return this};b.animate=function(a,b,c){C(a.x)&&C(a.y)?(a=this.renderer.cuboidPath(a),this.front.attr({zIndex:a[3]}).animate({d:a[0]},b,c),this.top.attr({zIndex:a[4]}).animate({d:a[1]},b,c),this.side.attr({zIndex:a[5]}).animate({d:a[2]},b,c),this.attr({zIndex:-a[6]})):a.opacity?(this.front.animate(a,b,c),this.top.animate(a,b,c),this.side.animate(a,b,c)):d.SVGElement.prototype.animate.call(this, | ||
a,b,c);return this};b.destroy=function(){this.front.destroy();this.top.destroy();this.side.destroy();return null};b.attr({zIndex:-c[6]});return b};d.SVGRenderer.prototype.cuboidPath=function(c){function b(a){return h[a]}var a=c.x,f=c.y,e=c.z,g=c.height,i=c.width,j=c.depth,k=d.map,h=[{x:a,y:f,z:e},{x:a+i,y:f,z:e},{x:a+i,y:f+g,z:e},{x:a,y:f+g,z:e},{x:a,y:f+g,z:e+j},{x:a+i,y:f+g,z:e+j},{x:a+i,y:f,z:e+j},{x:a,y:f,z:e+j}],h=r(h,d.charts[this.chartIndex],c.insidePlotArea),e=function(a,c){var f=[],a=k(a, | ||
b),c=k(c,b);H(a)<0?f=a:H(c)<0&&(f=c);return f},c=e([3,2,1,0],[7,6,5,4]),a=[4,5,2,3],f=e([1,6,7,0],a),e=e([1,2,5,6],[0,7,4,3]);return[this.toLinePath(c,!0),this.toLinePath(f,!0),this.toLinePath(e,!0),D(c),D(f),D(e),D(k(a,b))*9E9]};d.SVGRenderer.prototype.arc3d=function(c){function b(a){var b=!1,c={},f;for(f in a)O(f,e)!==-1&&(c[f]=a[f],delete a[f],b=!0);return b?c:!1}var a=this.g(),f=a.renderer,e="x,y,r,innerR,start,end".split(","),c=F(c);c.alpha*=B;c.beta*=B;a.top=f.path();a.side1=f.path();a.side2= | ||
f.path();a.inn=f.path();a.out=f.path();a.onAdd=function(){var b=a.parentGroup;a.top.add(a);a.out.add(b);a.inn.add(b);a.side1.add(b);a.side2.add(b)};a.setPaths=function(b){var c=a.renderer.arc3dPath(b),f=c.zTop*100;a.attribs=b;a.top.attr({d:c.top,zIndex:c.zTop});a.inn.attr({d:c.inn,zIndex:c.zInn});a.out.attr({d:c.out,zIndex:c.zOut});a.side1.attr({d:c.side1,zIndex:c.zSide1});a.side2.attr({d:c.side2,zIndex:c.zSide2});a.zIndex=f;a.attr({zIndex:f});b.center&&(a.top.setRadialReference(b.center),delete b.center)}; | ||
a.setPaths(c);a.fillSetter=function(a){var b=d.Color(a).brighten(-0.1).get();this.fill=a;this.side1.attr({fill:b});this.side2.attr({fill:b});this.inn.attr({fill:b});this.out.attr({fill:b});this.top.attr({fill:a});return this};t(["opacity","translateX","translateY","visibility"],function(b){a[b+"Setter"]=function(b,c){a[c]=b;t(["out","inn","side1","side2","top"],function(f){a[f].attr(c,b)})}});J(a,"attr",function(c,f,e){var d;if(typeof f==="object"&&(d=b(f)))N(a.attribs,d),a.setPaths(a.attribs);return c.call(this, | ||
f,e)});J(a,"animate",function(a,c,f,e){var d=this.attribs,m,l;delete c.center;delete c.z;delete c.depth;delete c.alpha;delete c.beta;l=M(A(f,this.renderer.globalAnimation));if(l.duration){c=F(c);if(f=b(c))m=f,l.step=function(a,b){function c(a){return d[a]+(A(m[a],d[a])-d[a])*b.pos}b.elem.setPaths(F(d,{x:c("x"),y:c("y"),r:c("r"),innerR:c("innerR"),start:c("start"),end:c("end")}))};f=l}return a.call(this,c,f,e)});a.destroy=function(){this.top.destroy();this.out.destroy();this.inn.destroy();this.side1.destroy(); | ||
this.side2.destroy();d.SVGElement.prototype.destroy.call(this)};a.hide=function(){this.top.hide();this.out.hide();this.inn.hide();this.side1.hide();this.side2.hide()};a.show=function(){this.top.show();this.out.show();this.inn.show();this.side1.show();this.side2.show()};return a};d.SVGRenderer.prototype.arc3dPath=function(c){function b(a){a%=2*n;a>n&&(a=2*n-a);return a}var a=c.x,f=c.y,e=c.start,d=c.end-1.0E-5,i=c.r,j=c.innerR,k=c.depth,h=c.alpha,m=c.beta,s=l(e),t=q(e),c=l(d),p=q(d),o=i*l(m);i*=l(h); | ||
var x=j*l(m),y=j*l(h),j=k*q(m),v=k*q(h),k=["M",a+o*s,f+i*t],k=k.concat(u(a,f,o,i,e,d,0,0)),k=k.concat(["L",a+x*c,f+y*p]),k=k.concat(u(a,f,x,y,d,e,0,0)),k=k.concat(["Z"]),r=m>0?n/2:0,m=h>0?0:n/2,r=e>-r?e:d>-r?-r:e,w=d<n-m?d:e<n-m?n-m:d,z=2*n-m,h=["M",a+o*l(r),f+i*q(r)],h=h.concat(u(a,f,o,i,r,w,0,0));d>z&&e<z?(h=h.concat(["L",a+o*l(w)+j,f+i*q(w)+v]),h=h.concat(u(a,f,o,i,w,z,j,v)),h=h.concat(["L",a+o*l(z),f+i*q(z)]),h=h.concat(u(a,f,o,i,z,d,0,0)),h=h.concat(["L",a+o*l(d)+j,f+i*q(d)+v]),h=h.concat(u(a, | ||
f,o,i,d,z,j,v)),h=h.concat(["L",a+o*l(z),f+i*q(z)]),h=h.concat(u(a,f,o,i,z,w,0,0))):d>n-m&&e<n-m&&(h=h.concat(["L",a+o*l(w)+j,f+i*q(w)+v]),h=h.concat(u(a,f,o,i,w,d,j,v)),h=h.concat(["L",a+o*l(d),f+i*q(d)]),h=h.concat(u(a,f,o,i,d,w,0,0)));h=h.concat(["L",a+o*l(w)+j,f+i*q(w)+v]);h=h.concat(u(a,f,o,i,w,r,j,v));h=h.concat(["Z"]);m=["M",a+x*s,f+y*t];m=m.concat(u(a,f,x,y,e,d,0,0));m=m.concat(["L",a+x*l(d)+j,f+y*q(d)+v]);m=m.concat(u(a,f,x,y,d,e,j,v));m=m.concat(["Z"]);s=["M",a+o*s,f+i*t,"L",a+o*s+j,f+i* | ||
t+v,"L",a+x*s+j,f+y*t+v,"L",a+x*s,f+y*t,"Z"];a=["M",a+o*c,f+i*p,"L",a+o*c+j,f+i*p+v,"L",a+x*c+j,f+y*p+v,"L",a+x*c,f+y*p,"Z"];p=Math.atan2(v,-j);f=Math.abs(d+p);c=Math.abs(e+p);e=Math.abs((e+d)/2+p);f=b(f);c=b(c);e=b(e);e*=1E5;d=c*1E5;f*=1E5;return{top:k,zTop:n*1E5+1,out:h,zOut:Math.max(e,d,f),inn:m,zInn:Math.max(e,d,f),side1:s,zSide1:f*0.99,side2:a,zSide2:d*0.99}};d.Chart.prototype.is3d=function(){return this.options.chart.options3d&&this.options.chart.options3d.enabled};d.wrap(d.Chart.prototype, | ||
"isInsidePlot",function(c){return this.is3d()||c.apply(this,[].slice.call(arguments,1))});d.getOptions().chart.options3d={enabled:!1,alpha:0,beta:0,depth:100,fitToPlot:!0,viewDistance:25,frame:{bottom:{size:1,color:"rgba(255,255,255,0)"},side:{size:1,color:"rgba(255,255,255,0)"},back:{size:1,color:"rgba(255,255,255,0)"}}};d.wrap(d.Chart.prototype,"init",function(c){var b=[].slice.call(arguments,1),a;if(b[0].chart&&b[0].chart.options3d&&b[0].chart.options3d.enabled)b[0].chart.options3d.alpha=(b[0].chart.options3d.alpha|| | ||
0)%360,b[0].chart.options3d.beta=(b[0].chart.options3d.beta||0)%360,a=b[0].plotOptions||{},a=a.pie||{},a.borderColor=d.pick(a.borderColor,void 0);c.apply(this,b)});d.wrap(d.Chart.prototype,"setChartSize",function(c){var b=this.options.chart.options3d;c.apply(this,[].slice.call(arguments,1));if(this.is3d()){var a=this.inverted,f=this.clipBox,d=this.margin;f[a?"y":"x"]=-(d[3]||0);f[a?"x":"y"]=-(d[0]||0);f[a?"height":"width"]=this.chartWidth+(d[3]||0)+(d[1]||0);f[a?"width":"height"]=this.chartHeight+ | ||
(d[0]||0)+(d[2]||0);this.scale3d=1;if(b.fitToPlot===!0)this.scale3d=L(this,b.depth)}});d.wrap(d.Chart.prototype,"redraw",function(c){if(this.is3d())this.isDirtyBox=!0;c.apply(this,[].slice.call(arguments,1))});d.wrap(d.Chart.prototype,"renderSeries",function(c){var b=this.series.length;if(this.is3d())for(;b--;)c=this.series[b],c.translate(),c.render();else c.call(this)});d.Chart.prototype.retrieveStacks=function(c){var b=this.series,a={},f,e=1;d.each(this.series,function(d){f=A(d.options.stack,c? | ||
0:b.length-1-d.index);a[f]?a[f].series.push(d):(a[f]={series:[d],position:e},e++)});a.totalStacks=e+1;return a};d.wrap(d.Axis.prototype,"setOptions",function(c,b){var a;c.call(this,b);if(this.chart.is3d())a=this.options,a.tickWidth=d.pick(a.tickWidth,0),a.gridLineWidth=d.pick(a.gridLineWidth,1)});d.wrap(d.Axis.prototype,"render",function(c){c.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var b=this.chart,a=b.renderer,d=b.options.chart.options3d,e=d.frame,g=e.bottom,i=e.back,e=e.side, | ||
j=d.depth,k=this.height,h=this.width,l=this.left,n=this.top;if(!this.isZAxis)this.horiz?(i={x:l,y:n+(b.xAxis[0].opposite?-g.size:k),z:0,width:h,height:g.size,depth:j,insidePlotArea:!1},this.bottomFrame?this.bottomFrame.animate(i):this.bottomFrame=a.cuboid(i).attr({fill:g.color,zIndex:b.yAxis[0].reversed&&d.alpha>0?4:-1}).css({stroke:g.color}).add()):(d={x:l+(b.yAxis[0].opposite?0:-e.size),y:n+(b.xAxis[0].opposite?-g.size:0),z:j,width:h+e.size,height:k+g.size,depth:i.size,insidePlotArea:!1},this.backFrame? | ||
this.backFrame.animate(d):this.backFrame=a.cuboid(d).attr({fill:i.color,zIndex:-3}).css({stroke:i.color}).add(),b={x:l+(b.yAxis[0].opposite?h:-e.size),y:n+(b.xAxis[0].opposite?-g.size:0),z:0,width:e.size,height:k+g.size,depth:j,insidePlotArea:!1},this.sideFrame?this.sideFrame.animate(b):this.sideFrame=a.cuboid(b).attr({fill:e.color,zIndex:-2}).css({stroke:e.color}).add())}});d.wrap(d.Axis.prototype,"getPlotLinePath",function(c){var b=c.apply(this,[].slice.call(arguments,1));if(!this.chart.is3d())return b; | ||
if(b===null)return b;var a=this.chart,d=a.options.chart.options3d,a=this.isZAxis?a.plotWidth:d.depth,d=this.opposite;this.horiz&&(d=!d);b=[this.swapZ({x:b[1],y:b[2],z:d?a:0}),this.swapZ({x:b[1],y:b[2],z:a}),this.swapZ({x:b[4],y:b[5],z:a}),this.swapZ({x:b[4],y:b[5],z:d?0:a})];b=r(b,this.chart,!1);return b=this.chart.renderer.toLinePath(b,!1)});d.wrap(d.Axis.prototype,"getLinePath",function(c){return this.chart.is3d()?[]:c.apply(this,[].slice.call(arguments,1))});d.wrap(d.Axis.prototype,"getPlotBandPath", | ||
function(c){if(!this.chart.is3d())return c.apply(this,[].slice.call(arguments,1));var b=arguments,a=b[1],b=this.getPlotLinePath(b[2]);(a=this.getPlotLinePath(a))&&b?a.push("L",b[10],b[11],"L",b[7],b[8],"L",b[4],b[5],"L",b[1],b[2]):a=null;return a});d.wrap(d.Tick.prototype,"getMarkPath",function(c){var b=c.apply(this,[].slice.call(arguments,1));if(!this.axis.chart.is3d())return b;b=[this.axis.swapZ({x:b[1],y:b[2],z:0}),this.axis.swapZ({x:b[4],y:b[5],z:0})];b=r(b,this.axis.chart,!1);return b=["M",b[0].x, | ||
b[0].y,"L",b[1].x,b[1].y]});d.wrap(d.Tick.prototype,"getLabelPosition",function(c){var b=c.apply(this,[].slice.call(arguments,1));this.axis.chart.is3d()&&(b=r([this.axis.swapZ({x:b.x,y:b.y,z:0})],this.axis.chart,!1)[0]);return b});d.wrap(d.Axis.prototype,"getTitlePosition",function(c){var b=this.chart.is3d(),a,d;if(b)d=this.axisTitleMargin,this.axisTitleMargin=0;a=c.apply(this,[].slice.call(arguments,1));if(b)a=r([this.swapZ({x:a.x,y:a.y,z:0})],this.chart,!1)[0],a[this.horiz?"y":"x"]+=(this.horiz? | ||
1:-1)*(this.opposite?-1:1)*d,this.axisTitleMargin=d;return a});d.wrap(d.Axis.prototype,"drawCrosshair",function(c){var b=arguments;this.chart.is3d()&&b[2]&&(b[2]={plotX:b[2].plotXold||b[2].plotX,plotY:b[2].plotYold||b[2].plotY});c.apply(this,[].slice.call(b,1))});d.Axis.prototype.swapZ=function(c,b){if(this.isZAxis){var a=b?0:this.chart.plotLeft,d=this.chart;return{x:a+(d.yAxis[0].opposite?c.z:d.xAxis[0].width-c.z),y:c.y,z:c.x-a}}return c};var G=d.ZAxis=function(){this.isZAxis=!0;this.init.apply(this, | ||
arguments)};d.extend(G.prototype,d.Axis.prototype);d.extend(G.prototype,{setOptions:function(c){c=d.merge({offset:0,lineWidth:0},c);d.Axis.prototype.setOptions.call(this,c);this.coll="zAxis"},setAxisSize:function(){d.Axis.prototype.setAxisSize.call(this);this.width=this.len=this.chart.options.chart.options3d.depth;this.right=this.chart.chartWidth-this.width-this.left},getSeriesExtremes:function(){var c=this,b=c.chart;c.hasVisibleSeries=!1;c.dataMin=c.dataMax=c.ignoreMinPadding=c.ignoreMaxPadding= | ||
null;c.buildStacks&&c.buildStacks();d.each(c.series,function(a){if(a.visible||!b.options.chart.ignoreHiddenSeries)if(c.hasVisibleSeries=!0,a=a.zData,a.length)c.dataMin=Math.min(A(c.dataMin,a[0]),Math.min.apply(null,a)),c.dataMax=Math.max(A(c.dataMax,a[0]),Math.max.apply(null,a))})}});d.wrap(d.Chart.prototype,"getAxes",function(c){var b=this,a=this.options,a=a.zAxis=d.splat(a.zAxis||{});c.call(this);if(b.is3d())this.zAxis=[],d.each(a,function(a,c){a.index=c;a.isX=!0;(new G(b,a)).setScale()})});d.wrap(d.seriesTypes.column.prototype, | ||
"translate",function(c){c.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var b=this.chart,a=this.options,f=a.depth||25,e=(a.stacking?a.stack||0:this._i)*(f+(a.groupZPadding||1));a.grouping!==!1&&(e=0);e+=a.groupZPadding||1;d.each(this.data,function(a){if(a.y!==null){var c=a.shapeArgs,d=a.tooltipPos;a.shapeType="cuboid";c.z=e;c.depth=f;c.insidePlotArea=!0;d=r([{x:d[0],y:d[1],z:e}],b,!0)[0];a.tooltipPos=[d.x,d.y]}});this.z=e}});d.wrap(d.seriesTypes.column.prototype,"animate",function(c){if(this.chart.is3d()){var b= | ||
arguments[1],a=this.yAxis,f=this,e=this.yAxis.reversed;if(d.svg)b?d.each(f.data,function(b){if(b.y!==null&&(b.height=b.shapeArgs.height,b.shapey=b.shapeArgs.y,b.shapeArgs.height=1,!e))b.shapeArgs.y=b.stackY?b.plotY+a.translate(b.stackY):b.plotY+(b.negative?-b.height:b.height)}):(d.each(f.data,function(a){if(a.y!==null)a.shapeArgs.height=a.height,a.shapeArgs.y=a.shapey,a.graphic&&a.graphic.animate(a.shapeArgs,f.options.animation)}),this.drawDataLabels(),f.animate=null)}else c.apply(this,[].slice.call(arguments, | ||
1))});d.wrap(d.seriesTypes.column.prototype,"init",function(c){c.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var b=this.options,a=b.grouping,d=b.stacking,e=A(this.yAxis.options.reversedStacks,!0),g=0;if(a===void 0||a){a=this.chart.retrieveStacks(d);g=b.stack||0;for(d=0;d<a[g].series.length;d++)if(a[g].series[d]===this)break;g=10*(a.totalStacks-a[g].position)+(e?d:-d);this.xAxis.reversed||(g=a.totalStacks*10-g)}b.zIndex=g}});d.wrap(d.Series.prototype,"alignDataLabel",function(c){if(this.chart.is3d()&& | ||
(this.type==="column"||this.type==="columnrange")){var b=arguments[4],a={x:b.x,y:b.y,z:this.z},a=r([a],this.chart,!0)[0];b.x=a.x;b.y=a.y}c.apply(this,[].slice.call(arguments,1))});d.seriesTypes.columnrange&&d.wrap(d.seriesTypes.columnrange.prototype,"drawPoints",I);d.wrap(d.seriesTypes.column.prototype,"drawPoints",I);d.wrap(d.seriesTypes.pie.prototype,"translate",function(c){c.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var b=this,a=b.options,d=a.depth||0,e=b.chart.options.chart.options3d, | ||
g=e.alpha,i=e.beta,j=a.stacking?(a.stack||0)*d:b._i*d;j+=d/2;a.grouping!==!1&&(j=0);t(b.data,function(c){var e=c.shapeArgs;c.shapeType="arc3d";e.z=j;e.depth=d*0.75;e.alpha=g;e.beta=i;e.center=b.center;e=(e.end+e.start)/2;c.slicedTranslation={translateX:K(l(e)*a.slicedOffset*l(g*B)),translateY:K(q(e)*a.slicedOffset*l(g*B))}})}});d.wrap(d.seriesTypes.pie.prototype.pointClass.prototype,"haloPath",function(c){var b=arguments;return this.series.chart.is3d()?[]:c.call(this,b[1])});d.wrap(d.seriesTypes.pie.prototype, | ||
"drawPoints",function(c){var b=this.options,a=b.states;if(this.chart.is3d())this.borderWidth=b.borderWidth=b.edgeWidth||1,this.borderColor=b.edgeColor=d.pick(b.edgeColor,b.borderColor,void 0),a.hover.borderColor=d.pick(a.hover.edgeColor,this.borderColor),a.hover.borderWidth=d.pick(a.hover.edgeWidth,this.borderWidth),a.select.borderColor=d.pick(a.select.edgeColor,this.borderColor),a.select.borderWidth=d.pick(a.select.edgeWidth,this.borderWidth),t(this.data,function(b){var c=b.pointAttr;c[""].stroke= | ||
b.series.borderColor||b.color;c[""]["stroke-width"]=b.series.borderWidth;c.hover.stroke=a.hover.borderColor;c.hover["stroke-width"]=a.hover.borderWidth;c.select.stroke=a.select.borderColor;c.select["stroke-width"]=a.select.borderWidth});c.apply(this,[].slice.call(arguments,1));this.chart.is3d()&&t(this.points,function(a){var b=a.graphic;if(b)b[a.y&&a.visible?"show":"hide"]()})});d.wrap(d.seriesTypes.pie.prototype,"drawDataLabels",function(c){if(this.chart.is3d()){var b=this.chart.options.chart.options3d; | ||
t(this.data,function(a){var c=a.shapeArgs,d=c.r,g=(c.beta||b.beta)*B,i=(c.start+c.end)/2,j=a.labelPos,k=-d*(1-l((c.alpha||b.alpha)*B))*q(i),h=d*(l(g)-1)*l(i);t([0,2,4],function(a){j[a]+=h;j[a+1]+=k})})}c.apply(this,[].slice.call(arguments,1))});d.wrap(d.seriesTypes.pie.prototype,"addPoint",function(c){c.apply(this,[].slice.call(arguments,1));this.chart.is3d()&&this.update(this.userOptions,!0)});d.wrap(d.seriesTypes.pie.prototype,"animate",function(c){if(this.chart.is3d()){var b=arguments[1],a=this.options.animation, | ||
f=this.center,e=this.group,g=this.markerGroup;if(d.svg)if(a===!0&&(a={}),b){if(e.oldtranslateX=e.translateX,e.oldtranslateY=e.translateY,b={translateX:f[0],translateY:f[1],scaleX:0.001,scaleY:0.001},e.attr(b),g)g.attrSetters=e.attrSetters,g.attr(b)}else b={translateX:e.oldtranslateX,translateY:e.oldtranslateY,scaleX:1,scaleY:1},e.animate(b,a),g&&g.animate(b,a),this.animate=null}else c.apply(this,[].slice.call(arguments,1))});d.wrap(d.seriesTypes.scatter.prototype,"translate",function(c){c.apply(this, | ||
[].slice.call(arguments,1));if(this.chart.is3d()){var b=this.chart,a=d.pick(this.zAxis,b.options.zAxis[0]),f=[],e,g,i;for(i=0;i<this.data.length;i++)e=this.data[i],g=a.isLog&&a.val2lin?a.val2lin(e.z):e.z,e.plotZ=a.translate(g),e.isInside=e.isInside?g>=a.min&&g<=a.max:!1,f.push({x:e.plotX,y:e.plotY,z:e.plotZ});b=r(f,b,!0);for(i=0;i<this.data.length;i++)e=this.data[i],a=b[i],e.plotXold=e.plotX,e.plotYold=e.plotY,e.plotZold=e.plotZ,e.plotX=a.x,e.plotY=a.y,e.plotZ=a.z}});d.wrap(d.seriesTypes.scatter.prototype, | ||
"init",function(c,b,a){if(b.is3d())this.axisTypes=["xAxis","yAxis","zAxis"],this.pointArrayMap=["x","y","z"],this.parallelArrays=["x","y","z"],this.directTouch=!0;c=c.apply(this,[b,a]);if(this.chart.is3d())this.tooltipOptions.pointFormat=this.userOptions.tooltip?this.userOptions.tooltip.pointFormat||"x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>z: <b>{point.z}</b><br/>":"x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>z: <b>{point.z}</b><br/>";return c});if(d.VMLRenderer)d.setOptions({animate:!1}), | ||
d.VMLRenderer.prototype.cuboid=d.SVGRenderer.prototype.cuboid,d.VMLRenderer.prototype.cuboidPath=d.SVGRenderer.prototype.cuboidPath,d.VMLRenderer.prototype.toLinePath=d.SVGRenderer.prototype.toLinePath,d.VMLRenderer.prototype.createElement3D=d.SVGRenderer.prototype.createElement3D,d.VMLRenderer.prototype.arc3d=function(c){c=d.SVGRenderer.prototype.arc3d.call(this,c);c.css({zIndex:c.zIndex});return c},d.VMLRenderer.prototype.arc3dPath=d.SVGRenderer.prototype.arc3dPath,d.wrap(d.Axis.prototype,"render", | ||
function(c){c.apply(this,[].slice.call(arguments,1));this.sideFrame&&(this.sideFrame.css({zIndex:0}),this.sideFrame.front.attr({fill:this.sideFrame.color}));this.bottomFrame&&(this.bottomFrame.css({zIndex:1}),this.bottomFrame.front.attr({fill:this.bottomFrame.color}));this.backFrame&&(this.backFrame.css({zIndex:0}),this.backFrame.front.attr({fill:this.backFrame.color}))})}); | ||
(function(E){"object"===typeof module&&module.exports?module.exports=E:E(Highcharts)})(function(E){(function(a){var r=a.deg2rad,k=a.pick;a.perspective=function(p,q,w){var n=q.options.chart.options3d,g=w?q.inverted:!1,h=q.plotWidth/2,l=q.plotHeight/2,e=n.depth/2,d=k(n.depth,1)*k(n.viewDistance,0),f=q.scale3d||1,b=r*n.beta*(g?-1:1),n=r*n.alpha*(g?-1:1),c=Math.cos(n),x=Math.cos(-b),y=Math.sin(n),z=Math.sin(-b);w||(h+=q.plotLeft,l+=q.plotTop);return a.map(p,function(b){var a,n;n=(g?b.y:b.x)-h;var k=(g? | ||
b.x:b.y)-l,q=(b.z||0)-e;a=x*n-z*q;b=-y*z*n+c*k-x*y*q;n=c*z*n+y*k+c*x*q;k=0<d&&d<Number.POSITIVE_INFINITY?d/(n+e+d):1;a=a*k*f+h;b=b*k*f+l;return{x:g?b:a,y:g?a:b,z:n*f+e}})}})(E);(function(a){function r(b){var c=0,m,a;for(m=0;m<b.length;m++)a=(m+1)%b.length,c+=b[m].x*b[a].y-b[a].x*b[m].y;return c/2}function k(b){var c=0,m;for(m=0;m<b.length;m++)c+=b[m].z;return b.length?c/b.length:0}function p(b,c,m,a,f,d,D,e){var l=[],n=d-f;return d>f&&d-f>Math.PI/2+1E-4?(l=l.concat(p(b,c,m,a,f,f+Math.PI/2,D,e)),l= | ||
l.concat(p(b,c,m,a,f+Math.PI/2,d,D,e))):d<f&&f-d>Math.PI/2+1E-4?(l=l.concat(p(b,c,m,a,f,f-Math.PI/2,D,e)),l=l.concat(p(b,c,m,a,f-Math.PI/2,d,D,e))):["C",b+m*Math.cos(f)-m*t*n*Math.sin(f)+D,c+a*Math.sin(f)+a*t*n*Math.cos(f)+e,b+m*Math.cos(d)+m*t*n*Math.sin(d)+D,c+a*Math.sin(d)-a*t*n*Math.cos(d)+e,b+m*Math.cos(d)+D,c+a*Math.sin(d)+e]}var q=Math.cos,w=Math.PI,n=Math.sin,g=a.animObject,h=a.charts,l=a.color,e=a.defined,d=a.deg2rad,f=a.each,b=a.extend,c=a.inArray,x=a.map,y=a.merge,z=a.perspective,F=a.pick, | ||
A=a.SVGElement,B=a.SVGRenderer,u=a.wrap,t=4*(Math.sqrt(2)-1)/3/(w/2);B.prototype.toLinePath=function(b,c){var m=[];f(b,function(b){m.push("L",b.x,b.y)});b.length&&(m[0]="M",c&&m.push("Z"));return m};B.prototype.cuboid=function(b){var c=this.g();b=this.cuboidPath(b);c.attr({"stroke-linejoin":"round"});c.front=this.path(b[0]).attr({"class":"highcharts-3d-front",zIndex:b[3]}).add(c);c.top=this.path(b[1]).attr({"class":"highcharts-3d-top",zIndex:b[4]}).add(c);c.side=this.path(b[2]).attr({"class":"highcharts-3d-side", | ||
zIndex:b[5]}).add(c);c.fillSetter=function(b){this.front.attr({fill:b});this.top.attr({fill:l(b).brighten(.1).get()});this.side.attr({fill:l(b).brighten(-.1).get()});this.color=b;return this};c.opacitySetter=function(b){this.front.attr({opacity:b});this.top.attr({opacity:b});this.side.attr({opacity:b});return this};c.attr=function(b){if(b.shapeArgs||e(b.x))b=this.renderer.cuboidPath(b.shapeArgs||b),this.front.attr({d:b[0],zIndex:b[3]}),this.top.attr({d:b[1],zIndex:b[4]}),this.side.attr({d:b[2],zIndex:b[5]}); | ||
else return a.SVGElement.prototype.attr.call(this,b);return this};c.animate=function(b,c,a){e(b.x)&&e(b.y)?(b=this.renderer.cuboidPath(b),this.front.attr({zIndex:b[3]}).animate({d:b[0]},c,a),this.top.attr({zIndex:b[4]}).animate({d:b[1]},c,a),this.side.attr({zIndex:b[5]}).animate({d:b[2]},c,a),this.attr({zIndex:-b[6]})):b.opacity?(this.front.animate(b,c,a),this.top.animate(b,c,a),this.side.animate(b,c,a)):A.prototype.animate.call(this,b,c,a);return this};c.destroy=function(){this.front.destroy();this.top.destroy(); | ||
this.side.destroy();return null};c.attr({zIndex:-b[6]});return c};B.prototype.cuboidPath=function(b){function c(b){return n[b]}var a=b.x,f=b.y,d=b.z,e=b.height,D=b.width,l=b.depth,n=[{x:a,y:f,z:d},{x:a+D,y:f,z:d},{x:a+D,y:f+e,z:d},{x:a,y:f+e,z:d},{x:a,y:f+e,z:d+l},{x:a+D,y:f+e,z:d+l},{x:a+D,y:f,z:d+l},{x:a,y:f,z:d+l}],n=z(n,h[this.chartIndex],b.insidePlotArea),d=function(b,a){var f=[];b=x(b,c);a=x(a,c);0>r(b)?f=b:0>r(a)&&(f=a);return f};b=d([3,2,1,0],[7,6,5,4]);a=[4,5,2,3];f=d([1,6,7,0],a);d=d([1, | ||
2,5,6],[0,7,4,3]);return[this.toLinePath(b,!0),this.toLinePath(f,!0),this.toLinePath(d,!0),k(b),k(f),k(d),9E9*k(x(a,c))]};a.SVGRenderer.prototype.arc3d=function(a){function e(b){var a=!1,f={},d;for(d in b)-1!==c(d,h)&&(f[d]=b[d],delete b[d],a=!0);return a?f:!1}var m=this.g(),n=m.renderer,h="x y r innerR start end".split(" ");a=y(a);a.alpha*=d;a.beta*=d;m.top=n.path();m.side1=n.path();m.side2=n.path();m.inn=n.path();m.out=n.path();m.onAdd=function(){var b=m.parentGroup,a=m.attr("class");m.top.add(m); | ||
f(["out","inn","side1","side2"],function(c){m[c].addClass(a+" highcharts-3d-side").add(b)})};m.setPaths=function(b){var a=m.renderer.arc3dPath(b),c=100*a.zTop;m.attribs=b;m.top.attr({d:a.top,zIndex:a.zTop});m.inn.attr({d:a.inn,zIndex:a.zInn});m.out.attr({d:a.out,zIndex:a.zOut});m.side1.attr({d:a.side1,zIndex:a.zSide1});m.side2.attr({d:a.side2,zIndex:a.zSide2});m.zIndex=c;m.attr({zIndex:c});b.center&&(m.top.setRadialReference(b.center),delete b.center)};m.setPaths(a);m.fillSetter=function(b){var a= | ||
l(b).brighten(-.1).get();this.fill=b;this.side1.attr({fill:a});this.side2.attr({fill:a});this.inn.attr({fill:a});this.out.attr({fill:a});this.top.attr({fill:b});return this};f(["opacity","translateX","translateY","visibility"],function(b){m[b+"Setter"]=function(b,a){m[a]=b;f(["out","inn","side1","side2","top"],function(c){m[c].attr(a,b)})}});u(m,"attr",function(a,c,f){var d;"object"===typeof c&&(d=e(c))&&(b(m.attribs,d),m.setPaths(m.attribs));return a.call(this,c,f)});u(m,"animate",function(b,a,c, | ||
f){var d,m=this.attribs,l;delete a.center;delete a.z;delete a.depth;delete a.alpha;delete a.beta;l=g(F(c,this.renderer.globalAnimation));if(l.duration){a=y(a);if(d=e(a))l.step=function(b,a){function c(b){return m[b]+(F(d[b],m[b])-m[b])*a.pos}a.elem.setPaths(y(m,{x:c("x"),y:c("y"),r:c("r"),innerR:c("innerR"),start:c("start"),end:c("end")}))};c=l}return b.call(this,a,c,f)});m.destroy=function(){this.top.destroy();this.out.destroy();this.inn.destroy();this.side1.destroy();this.side2.destroy();A.prototype.destroy.call(this)}; | ||
m.hide=function(){this.top.hide();this.out.hide();this.inn.hide();this.side1.hide();this.side2.hide()};m.show=function(){this.top.show();this.out.show();this.inn.show();this.side1.show();this.side2.show()};return m};B.prototype.arc3dPath=function(b){function a(b){b%=2*Math.PI;b>Math.PI&&(b=2*Math.PI-b);return b}var c=b.x,f=b.y,d=b.start,e=b.end-1E-5,l=b.r,h=b.innerR,x=b.depth,g=b.alpha,k=b.beta,y=Math.cos(d),r=Math.sin(d);b=Math.cos(e);var z=Math.sin(e),v=l*Math.cos(k),l=l*Math.cos(g),t=h*Math.cos(k), | ||
u=h*Math.cos(g),h=x*Math.sin(k),C=x*Math.sin(g),x=["M",c+v*y,f+l*r],x=x.concat(p(c,f,v,l,d,e,0,0)),x=x.concat(["L",c+t*b,f+u*z]),x=x.concat(p(c,f,t,u,e,d,0,0)),x=x.concat(["Z"]),F=0<k?Math.PI/2:0,k=0<g?0:Math.PI/2,F=d>-F?d:e>-F?-F:d,A=e<w-k?e:d<w-k?w-k:e,B=2*w-k,g=["M",c+v*q(F),f+l*n(F)],g=g.concat(p(c,f,v,l,F,A,0,0));e>B&&d<B?(g=g.concat(["L",c+v*q(A)+h,f+l*n(A)+C]),g=g.concat(p(c,f,v,l,A,B,h,C)),g=g.concat(["L",c+v*q(B),f+l*n(B)]),g=g.concat(p(c,f,v,l,B,e,0,0)),g=g.concat(["L",c+v*q(e)+h,f+l*n(e)+ | ||
C]),g=g.concat(p(c,f,v,l,e,B,h,C)),g=g.concat(["L",c+v*q(B),f+l*n(B)]),g=g.concat(p(c,f,v,l,B,A,0,0))):e>w-k&&d<w-k&&(g=g.concat(["L",c+v*Math.cos(A)+h,f+l*Math.sin(A)+C]),g=g.concat(p(c,f,v,l,A,e,h,C)),g=g.concat(["L",c+v*Math.cos(e),f+l*Math.sin(e)]),g=g.concat(p(c,f,v,l,e,A,0,0)));g=g.concat(["L",c+v*Math.cos(A)+h,f+l*Math.sin(A)+C]);g=g.concat(p(c,f,v,l,A,F,h,C));g=g.concat(["Z"]);k=["M",c+t*y,f+u*r];k=k.concat(p(c,f,t,u,d,e,0,0));k=k.concat(["L",c+t*Math.cos(e)+h,f+u*Math.sin(e)+C]);k=k.concat(p(c, | ||
f,t,u,e,d,h,C));k=k.concat(["Z"]);y=["M",c+v*y,f+l*r,"L",c+v*y+h,f+l*r+C,"L",c+t*y+h,f+u*r+C,"L",c+t*y,f+u*r,"Z"];c=["M",c+v*b,f+l*z,"L",c+v*b+h,f+l*z+C,"L",c+t*b+h,f+u*z+C,"L",c+t*b,f+u*z,"Z"];z=Math.atan2(C,-h);f=Math.abs(e+z);b=Math.abs(d+z);d=Math.abs((d+e)/2+z);f=a(f);b=a(b);d=a(d);d*=1E5;e=1E5*b;f*=1E5;return{top:x,zTop:1E5*Math.PI+1,out:g,zOut:Math.max(d,e,f),inn:k,zInn:Math.max(d,e,f),side1:y,zSide1:.99*f,side2:c,zSide2:.99*e}}})(E);(function(a){function r(a,e){var d=a.plotLeft,f=a.plotWidth+ | ||
d,b=a.plotTop,c=a.plotHeight+b,g=d+a.plotWidth/2,h=b+a.plotHeight/2,n=Number.MAX_VALUE,k=-Number.MAX_VALUE,q=Number.MAX_VALUE,r=-Number.MAX_VALUE,u,t=1;u=[{x:d,y:b,z:0},{x:d,y:b,z:e}];p([0,1],function(b){u.push({x:f,y:u[b].y,z:u[b].z})});p([0,1,2,3],function(b){u.push({x:u[b].x,y:c,z:u[b].z})});u=w(u,a,!1);p(u,function(b){n=Math.min(n,b.x);k=Math.max(k,b.x);q=Math.min(q,b.y);r=Math.max(r,b.y)});d>n&&(t=Math.min(t,1-Math.abs((d+g)/(n+g))%1));f<k&&(t=Math.min(t,(f-g)/(k-g)));b>q&&(t=0>q?Math.min(t, | ||
(b+h)/(-q+b+h)):Math.min(t,1-(b+h)/(q+h)%1));c<r&&(t=Math.min(t,Math.abs((c-h)/(r-h))));return t}var k=a.Chart,p=a.each,q=a.merge,w=a.perspective,n=a.pick,g=a.wrap;k.prototype.is3d=function(){return this.options.chart.options3d&&this.options.chart.options3d.enabled};k.prototype.propsRequireDirtyBox.push("chart.options3d");k.prototype.propsRequireUpdateSeries.push("chart.options3d");a.wrap(a.Chart.prototype,"isInsidePlot",function(a){return this.is3d()||a.apply(this,[].slice.call(arguments,1))});var h= | ||
a.getOptions();q(!0,h,{chart:{options3d:{enabled:!1,alpha:0,beta:0,depth:100,fitToPlot:!0,viewDistance:25,frame:{bottom:{size:1},side:{size:1},back:{size:1}}}}});g(k.prototype,"setClassName",function(a){a.apply(this,[].slice.call(arguments,1));this.is3d()&&(this.container.className+=" highcharts-3d-chart")});a.wrap(a.Chart.prototype,"setChartSize",function(a){var e=this.options.chart.options3d;a.apply(this,[].slice.call(arguments,1));if(this.is3d()){var d=this.inverted,f=this.clipBox,b=this.margin; | ||
f[d?"y":"x"]=-(b[3]||0);f[d?"x":"y"]=-(b[0]||0);f[d?"height":"width"]=this.chartWidth+(b[3]||0)+(b[1]||0);f[d?"width":"height"]=this.chartHeight+(b[0]||0)+(b[2]||0);this.scale3d=1;!0===e.fitToPlot&&(this.scale3d=r(this,e.depth))}});g(k.prototype,"redraw",function(a){this.is3d()&&(this.isDirtyBox=!0);a.apply(this,[].slice.call(arguments,1))});g(k.prototype,"renderSeries",function(a){var e=this.series.length;if(this.is3d())for(;e--;)a=this.series[e],a.translate(),a.render();else a.call(this)});k.prototype.retrieveStacks= | ||
function(a){var e=this.series,d={},f,b=1;p(this.series,function(c){f=n(c.options.stack,a?0:e.length-1-c.index);d[f]?d[f].series.push(c):(d[f]={series:[c],position:b},b++)});d.totalStacks=b+1;return d}})(E);(function(a){var r,k=a.Axis,p=a.Chart,q=a.each,w=a.extend,n=a.merge,g=a.perspective,h=a.pick,l=a.splat,e=a.Tick,d=a.wrap;d(k.prototype,"setOptions",function(a,b){var c;a.call(this,b);this.chart.is3d()&&(c=this.options,c.tickWidth=h(c.tickWidth,0),c.gridLineWidth=h(c.gridLineWidth,1))});d(k.prototype, | ||
"render",function(a){a.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var b=this.chart,c=b.renderer,d=b.options.chart.options3d,e=d.frame,g=e.bottom,h=e.back,e=e.side,l=d.depth,n=this.height,k=this.width,q=this.left,p=this.top;this.isZAxis||(this.horiz?(h={x:q,y:p+(b.xAxis[0].opposite?-g.size:n),z:0,width:k,height:g.size,depth:l,insidePlotArea:!1},this.bottomFrame?this.bottomFrame.animate(h):(this.bottomFrame=c.cuboid(h).attr({"class":"highcharts-3d-frame highcharts-3d-frame-bottom", | ||
zIndex:b.yAxis[0].reversed&&0<d.alpha?4:-1}).add(),this.bottomFrame.attr({fill:g.color||"none",stroke:g.color||"none"}))):(d={x:q+(b.yAxis[0].opposite?0:-e.size),y:p+(b.xAxis[0].opposite?-g.size:0),z:l,width:k+e.size,height:n+g.size,depth:h.size,insidePlotArea:!1},this.backFrame?this.backFrame.animate(d):(this.backFrame=c.cuboid(d).attr({"class":"highcharts-3d-frame highcharts-3d-frame-back",zIndex:-3}).add(),this.backFrame.attr({fill:h.color||"none",stroke:h.color||"none"})),b={x:q+(b.yAxis[0].opposite? | ||
k:-e.size),y:p+(b.xAxis[0].opposite?-g.size:0),z:0,width:e.size,height:n+g.size,depth:l,insidePlotArea:!1},this.sideFrame?this.sideFrame.animate(b):(this.sideFrame=c.cuboid(b).attr({"class":"highcharts-3d-frame highcharts-3d-frame-side",zIndex:-2}).add(),this.sideFrame.attr({fill:e.color||"none",stroke:e.color||"none"}))))}});d(k.prototype,"getPlotLinePath",function(a){var b=a.apply(this,[].slice.call(arguments,1));if(!this.chart.is3d()||null===b)return b;var c=this.chart,d=c.options.chart.options3d, | ||
c=this.isZAxis?c.plotWidth:d.depth,d=this.opposite;this.horiz&&(d=!d);b=[this.swapZ({x:b[1],y:b[2],z:d?c:0}),this.swapZ({x:b[1],y:b[2],z:c}),this.swapZ({x:b[4],y:b[5],z:c}),this.swapZ({x:b[4],y:b[5],z:d?0:c})];b=g(b,this.chart,!1);return b=this.chart.renderer.toLinePath(b,!1)});d(k.prototype,"getLinePath",function(a){return this.chart.is3d()?[]:a.apply(this,[].slice.call(arguments,1))});d(k.prototype,"getPlotBandPath",function(a){if(!this.chart.is3d())return a.apply(this,[].slice.call(arguments,1)); | ||
var b=arguments,c=b[1],b=this.getPlotLinePath(b[2]);(c=this.getPlotLinePath(c))&&b?c.push("L",b[10],b[11],"L",b[7],b[8],"L",b[4],b[5],"L",b[1],b[2]):c=null;return c});d(e.prototype,"getMarkPath",function(a){var b=a.apply(this,[].slice.call(arguments,1));if(!this.axis.chart.is3d())return b;b=[this.axis.swapZ({x:b[1],y:b[2],z:0}),this.axis.swapZ({x:b[4],y:b[5],z:0})];b=g(b,this.axis.chart,!1);return b=["M",b[0].x,b[0].y,"L",b[1].x,b[1].y]});d(e.prototype,"getLabelPosition",function(a){var b=a.apply(this, | ||
[].slice.call(arguments,1));this.axis.chart.is3d()&&(b=g([this.axis.swapZ({x:b.x,y:b.y,z:0})],this.axis.chart,!1)[0]);return b});a.wrap(k.prototype,"getTitlePosition",function(a){var b=this.chart.is3d(),c,d;b&&(d=this.axisTitleMargin,this.axisTitleMargin=0);c=a.apply(this,[].slice.call(arguments,1));b&&(c=g([this.swapZ({x:c.x,y:c.y,z:0})],this.chart,!1)[0],c[this.horiz?"y":"x"]+=(this.horiz?1:-1)*(this.opposite?-1:1)*d,this.axisTitleMargin=d);return c});d(k.prototype,"drawCrosshair",function(a){var b= | ||
arguments;this.chart.is3d()&&b[2]&&(b[2]={plotX:b[2].plotXold||b[2].plotX,plotY:b[2].plotYold||b[2].plotY});a.apply(this,[].slice.call(b,1))});k.prototype.swapZ=function(a,b){if(this.isZAxis){var c=b?0:this.chart.plotLeft,d=this.chart;return{x:c+(d.yAxis[0].opposite?a.z:d.xAxis[0].width-a.z),y:a.y,z:a.x-c}}return a};r=a.ZAxis=function(){this.isZAxis=!0;this.init.apply(this,arguments)};w(r.prototype,k.prototype);w(r.prototype,{setOptions:function(a){a=n({offset:0,lineWidth:0},a);k.prototype.setOptions.call(this, | ||
a);this.coll="zAxis"},setAxisSize:function(){k.prototype.setAxisSize.call(this);this.width=this.len=this.chart.options.chart.options3d.depth;this.right=this.chart.chartWidth-this.width-this.left},getSeriesExtremes:function(){var a=this,b=a.chart;a.hasVisibleSeries=!1;a.dataMin=a.dataMax=a.ignoreMinPadding=a.ignoreMaxPadding=null;a.buildStacks&&a.buildStacks();q(a.series,function(c){if(c.visible||!b.options.chart.ignoreHiddenSeries)a.hasVisibleSeries=!0,c=c.zData,c.length&&(a.dataMin=Math.min(h(a.dataMin, | ||
c[0]),Math.min.apply(null,c)),a.dataMax=Math.max(h(a.dataMax,c[0]),Math.max.apply(null,c)))})}});d(p.prototype,"getAxes",function(a){var b=this,c=this.options,c=c.zAxis=l(c.zAxis||{});a.call(this);b.is3d()&&(this.zAxis=[],q(c,function(a,c){a.index=c;a.isX=!0;(new r(b,a)).setScale()}))})})(E);(function(a){function r(a){var e=a.apply(this,[].slice.call(arguments,1));this.chart.is3d()&&(e.stroke=this.options.edgeColor||e.fill,e["stroke-width"]=w(this.options.edgeWidth,1));return e}function k(a){if(this.chart.is3d()){var e= | ||
this.chart.options.plotOptions.column.grouping;void 0===e||e||void 0===this.group.zIndex||this.zIndexSet||(this.group.attr({zIndex:10*this.group.zIndex}),this.zIndexSet=!0)}a.apply(this,[].slice.call(arguments,1))}var p=a.each,q=a.perspective,w=a.pick,n=a.Series,g=a.seriesTypes,h=a.svg;a=a.wrap;a(g.column.prototype,"translate",function(a){a.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var e=this.chart,d=this.options,f=d.depth||25,b=(d.stacking?d.stack||0:this._i)*(f+(d.groupZPadding|| | ||
1));!1!==d.grouping&&(b=0);b+=d.groupZPadding||1;p(this.data,function(a){if(null!==a.y){var d=a.shapeArgs,g=a.tooltipPos;a.shapeType="cuboid";d.z=b;d.depth=f;d.insidePlotArea=!0;g=q([{x:g[0],y:g[1],z:b}],e,!0)[0];a.tooltipPos=[g.x,g.y]}});this.z=b}});a(g.column.prototype,"animate",function(a){if(this.chart.is3d()){var e=arguments[1],d=this.yAxis,f=this,b=this.yAxis.reversed;h&&(e?p(f.data,function(a){null!==a.y&&(a.height=a.shapeArgs.height,a.shapey=a.shapeArgs.y,a.shapeArgs.height=1,b||(a.shapeArgs.y= | ||
a.stackY?a.plotY+d.translate(a.stackY):a.plotY+(a.negative?-a.height:a.height)))}):(p(f.data,function(a){null!==a.y&&(a.shapeArgs.height=a.height,a.shapeArgs.y=a.shapey,a.graphic&&a.graphic.animate(a.shapeArgs,f.options.animation))}),this.drawDataLabels(),f.animate=null))}else a.apply(this,[].slice.call(arguments,1))});a(g.column.prototype,"init",function(a){a.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var e=this.options,d=e.grouping,f=e.stacking,b=w(this.yAxis.options.reversedStacks, | ||
!0),c=0;if(void 0===d||d){d=this.chart.retrieveStacks(f);c=e.stack||0;for(f=0;f<d[c].series.length&&d[c].series[f]!==this;f++);c=10*(d.totalStacks-d[c].position)+(b?f:-f);this.xAxis.reversed||(c=10*d.totalStacks-c)}e.zIndex=c}});a(g.column.prototype,"pointAttribs",r);g.columnrange&&a(g.columnrange.prototype,"pointAttribs",r);a(n.prototype,"alignDataLabel",function(a){if(this.chart.is3d()&&("column"===this.type||"columnrange"===this.type)){var e=arguments[4],d={x:e.x,y:e.y,z:this.z},d=q([d],this.chart, | ||
!0)[0];e.x=d.x;e.y=d.y}a.apply(this,[].slice.call(arguments,1))});g.columnrange&&a(g.columnrange.prototype,"drawPoints",k);a(g.column.prototype,"drawPoints",k)})(E);(function(a){var r=a.deg2rad,k=a.each,p=a.pick,q=a.seriesTypes,w=a.svg;a=a.wrap;a(q.pie.prototype,"translate",function(a){a.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var g=this,h=g.options,l=h.depth||0,e=g.chart.options.chart.options3d,d=e.alpha,f=e.beta,b=h.stacking?(h.stack||0)*l:g._i*l,b=b+l/2;!1!==h.grouping&&(b= | ||
0);k(g.data,function(a){var e=a.shapeArgs;a.shapeType="arc3d";e.z=b;e.depth=.75*l;e.alpha=d;e.beta=f;e.center=g.center;e=(e.end+e.start)/2;a.slicedTranslation={translateX:Math.round(Math.cos(e)*h.slicedOffset*Math.cos(d*r)),translateY:Math.round(Math.sin(e)*h.slicedOffset*Math.cos(d*r))}})}});a(q.pie.prototype.pointClass.prototype,"haloPath",function(a){var g=arguments;return this.series.chart.is3d()?[]:a.call(this,g[1])});a(q.pie.prototype,"pointAttribs",function(a,g,h){a=a.call(this,g,h);h=this.options; | ||
this.chart.is3d()&&(a.stroke=h.edgeColor||g.color||this.color,a["stroke-width"]=p(h.edgeWidth,1));return a});a(q.pie.prototype,"drawPoints",function(a){a.apply(this,[].slice.call(arguments,1));this.chart.is3d()&&k(this.points,function(a){var h=a.graphic;if(h)h[a.y&&a.visible?"show":"hide"]()})});a(q.pie.prototype,"drawDataLabels",function(a){if(this.chart.is3d()){var g=this.chart.options.chart.options3d;k(this.data,function(a){var l=a.shapeArgs,e=l.r,d=(l.start+l.end)/2,f=a.labelPos,b=-e*(1-Math.cos((l.alpha|| | ||
g.alpha)*r))*Math.sin(d),c=e*(Math.cos((l.beta||g.beta)*r)-1)*Math.cos(d);k([0,2,4],function(a){f[a]+=c;f[a+1]+=b})})}a.apply(this,[].slice.call(arguments,1))});a(q.pie.prototype,"addPoint",function(a){a.apply(this,[].slice.call(arguments,1));this.chart.is3d()&&this.update(this.userOptions,!0)});a(q.pie.prototype,"animate",function(a){if(this.chart.is3d()){var g=arguments[1],h=this.options.animation,k=this.center,e=this.group,d=this.markerGroup;w&&(!0===h&&(h={}),g?(e.oldtranslateX=e.translateX,e.oldtranslateY= | ||
e.translateY,g={translateX:k[0],translateY:k[1],scaleX:.001,scaleY:.001},e.attr(g),d&&(d.attrSetters=e.attrSetters,d.attr(g))):(g={translateX:e.oldtranslateX,translateY:e.oldtranslateY,scaleX:1,scaleY:1},e.animate(g,h),d&&d.animate(g,h),this.animate=null))}else a.apply(this,[].slice.call(arguments,1))})})(E);(function(a){var r=a.perspective,k=a.pick,p=a.seriesTypes;a=a.wrap;a(p.scatter.prototype,"translate",function(a){a.apply(this,[].slice.call(arguments,1));if(this.chart.is3d()){var p=this.chart, | ||
n=k(this.zAxis,p.options.zAxis[0]),g=[],h,l,e;for(e=0;e<this.data.length;e++)h=this.data[e],l=n.isLog&&n.val2lin?n.val2lin(h.z):h.z,h.plotZ=n.translate(l),h.isInside=h.isInside?l>=n.min&&l<=n.max:!1,g.push({x:h.plotX,y:h.plotY,z:h.plotZ});p=r(g,p,!0);for(e=0;e<this.data.length;e++)h=this.data[e],n=p[e],h.plotXold=h.plotX,h.plotYold=h.plotY,h.plotZold=h.plotZ,h.plotX=n.x,h.plotY=n.y,h.plotZ=n.z}});a(p.scatter.prototype,"init",function(a,k,n){k.is3d()&&(this.axisTypes=["xAxis","yAxis","zAxis"],this.pointArrayMap= | ||
["x","y","z"],this.parallelArrays=["x","y","z"],this.directTouch=!0);a=a.apply(this,[k,n]);this.chart.is3d()&&(this.tooltipOptions.pointFormat=this.userOptions.tooltip?this.userOptions.tooltip.pointFormat||"x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>z: <b>{point.z}</b><br/>":"x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>z: <b>{point.z}</b><br/>");return a})})(E);(function(a){var r=a.Axis,k=a.SVGRenderer,p=a.VMLRenderer;p&&(a.setOptions({animate:!1}),p.prototype.cuboid=k.prototype.cuboid,p.prototype.cuboidPath= | ||
k.prototype.cuboidPath,p.prototype.toLinePath=k.prototype.toLinePath,p.prototype.createElement3D=k.prototype.createElement3D,p.prototype.arc3d=function(a){a=k.prototype.arc3d.call(this,a);a.css({zIndex:a.zIndex});return a},a.VMLRenderer.prototype.arc3dPath=a.SVGRenderer.prototype.arc3dPath,a.wrap(r.prototype,"render",function(a){a.apply(this,[].slice.call(arguments,1));this.sideFrame&&(this.sideFrame.css({zIndex:0}),this.sideFrame.front.attr({fill:this.sideFrame.color}));this.bottomFrame&&(this.bottomFrame.css({zIndex:1}), | ||
this.bottomFrame.front.attr({fill:this.bottomFrame.color}));this.backFrame&&(this.backFrame.css({zIndex:0}),this.backFrame.front.attr({fill:this.backFrame.color}))}))})(E)}); |
/* | ||
Highcharts JS v4.2.7 (2016-09-21) | ||
Highcharts JS v5.0.0 (2016-09-29) | ||
@@ -8,52 +8,54 @@ (c) 2009-2016 Torstein Honsi | ||
*/ | ||
(function(m){typeof module==="object"&&module.exports?module.exports=m:m(Highcharts)})(function(m){function M(a,b,c){this.init(a,b,c)}var R=m.arrayMin,S=m.arrayMax,s=m.each,J=m.extend,G=m.isNumber,v=m.merge,T=m.map,r=m.pick,B=m.pInt,H=m.correctFloat,p=m.getOptions().plotOptions,i=m.seriesTypes,t=m.extendClass,N=m.splat,w=m.wrap,O=m.Axis,z=m.Tick,I=m.Point,U=m.Pointer,V=m.CenteredSeriesMixin,C=m.TrackerMixin,x=m.Series,y=Math,F=y.round,D=y.floor,P=y.max,W=m.Color,n=function(){};J(M.prototype,{init:function(a, | ||
b,c){var d=this,g=d.defaultOptions;d.chart=b;d.options=a=v(g,b.angular?{background:{}}:void 0,a);(a=a.background)&&s([].concat(N(a)).reverse(),function(a){var b=a.backgroundColor,g=c.userOptions,a=v(d.defaultBackgroundOptions,a);if(b)a.backgroundColor=b;a.color=a.backgroundColor;c.options.plotBands.unshift(a);g.plotBands=g.plotBands||[];g.plotBands!==c.options.plotBands&&g.plotBands.unshift(a)})},defaultOptions:{center:["50%","50%"],size:"85%",startAngle:0},defaultBackgroundOptions:{shape:"circle", | ||
borderWidth:1,borderColor:"silver",backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,"#FFF"],[1,"#DDD"]]},from:-Number.MAX_VALUE,innerRadius:0,to:Number.MAX_VALUE,outerRadius:"105%"}});var A=O.prototype,z=z.prototype,X={getOffset:n,redraw:function(){this.isDirty=!1},render:function(){this.isDirty=!1},setScale:n,setCategories:n,setTitle:n},Q={isRadial:!0,defaultRadialGaugeOptions:{labels:{align:"center",x:0,y:null},minorGridLineWidth:0,minorTickInterval:"auto",minorTickLength:10,minorTickPosition:"inside", | ||
minorTickWidth:1,tickLength:10,tickPosition:"inside",tickWidth:2,title:{rotation:0},zIndex:2},defaultRadialXOptions:{gridLineWidth:1,labels:{align:null,distance:15,x:0,y:null},maxPadding:0,minPadding:0,showLastLabel:!1,tickLength:0},defaultRadialYOptions:{gridLineInterpolation:"circle",labels:{align:"right",x:-3,y:-2},showLastLabel:!1,title:{x:4,text:null,rotation:90}},setOptions:function(a){a=this.options=v(this.defaultOptions,this.defaultRadialOptions,a);if(!a.plotBands)a.plotBands=[]},getOffset:function(){A.getOffset.call(this); | ||
this.chart.axisOffset[this.side]=0;this.center=this.pane.center=V.getCenter.call(this.pane)},getLinePath:function(a,b){var c=this.center,d,g=this.chart;d=r(b,c[2]/2-this.offset);this.isCircular||b!==void 0?c=this.chart.renderer.symbols.arc(this.left+c[0],this.top+c[1],d,d,{start:this.startAngleRad,end:this.endAngleRad,open:!0,innerR:0}):(d=this.postTranslate(this.angleRad,d),c=["M",c[0]+g.plotLeft,c[1]+g.plotTop,"L",d.x,d.y]);return c},setAxisTranslation:function(){A.setAxisTranslation.call(this); | ||
if(this.center)this.transA=this.isCircular?(this.endAngleRad-this.startAngleRad)/(this.max-this.min||1):this.center[2]/2/(this.max-this.min||1),this.minPixelPadding=this.isXAxis?this.transA*this.minPointOffset:0},beforeSetTickPositions:function(){(this.autoConnect=this.isCircular&&r(this.userMax,this.options.max)===void 0&&this.endAngleRad-this.startAngleRad===2*Math.PI)&&(this.max+=this.categories&&1||this.pointRange||this.closestPointRange||0)},setAxisSize:function(){A.setAxisSize.call(this);if(this.isRadial){this.center= | ||
this.pane.center=m.CenteredSeriesMixin.getCenter.call(this.pane);if(this.isCircular)this.sector=this.endAngleRad-this.startAngleRad;this.len=this.width=this.height=this.center[2]*r(this.sector,1)/2}},getPosition:function(a,b){return this.postTranslate(this.isCircular?this.translate(a):this.angleRad,r(this.isCircular?b:this.translate(a),this.center[2]/2)-this.offset)},postTranslate:function(a,b){var c=this.chart,d=this.center,a=this.startAngleRad+a;return{x:c.plotLeft+d[0]+Math.cos(a)*b,y:c.plotTop+ | ||
d[1]+Math.sin(a)*b}},getPlotBandPath:function(a,b,c){var d=this.center,g=this.startAngleRad,e=d[2]/2,j=[r(c.outerRadius,"100%"),c.innerRadius,r(c.thickness,10)],l=Math.min(this.offset,0),h=/%$/,f,k=this.isCircular;this.options.gridLineInterpolation==="polygon"?d=this.getPlotLinePath(a).concat(this.getPlotLinePath(b,!0)):(a=Math.max(a,this.min),b=Math.min(b,this.max),k||(j[0]=this.translate(a),j[1]=this.translate(b)),j=T(j,function(a){h.test(a)&&(a=B(a,10)*e/100);return a}),c.shape==="circle"||!k? | ||
(a=-Math.PI/2,b=Math.PI*1.5,f=!0):(a=g+this.translate(a),b=g+this.translate(b)),j[0]-=l,j[2]-=l,d=this.chart.renderer.symbols.arc(this.left+d[0],this.top+d[1],j[0],j[0],{start:Math.min(a,b),end:Math.max(a,b),innerR:r(j[1],j[0]-j[2]),open:f}));return d},getPlotLinePath:function(a,b){var c=this,d=c.center,g=c.chart,e=c.getPosition(a),j,l,h;c.isCircular?h=["M",d[0]+g.plotLeft,d[1]+g.plotTop,"L",e.x,e.y]:c.options.gridLineInterpolation==="circle"?(a=c.translate(a))&&(h=c.getLinePath(0,a)):(s(g.xAxis, | ||
function(a){a.pane===c.pane&&(j=a)}),h=[],a=c.translate(a),d=j.tickPositions,j.autoConnect&&(d=d.concat([d[0]])),b&&(d=[].concat(d).reverse()),s(d,function(e,b){l=j.getPosition(e,a);h.push(b?"L":"M",l.x,l.y)}));return h},getTitlePosition:function(){var a=this.center,b=this.chart,c=this.options.title;return{x:b.plotLeft+a[0]+(c.x||0),y:b.plotTop+a[1]-{high:0.5,middle:0.25,low:0}[c.align]*a[2]+(c.y||0)}}};w(A,"init",function(a,b,c){var k;var d=b.angular,g=b.polar,e=c.isX,j=d&&e,l,h=b.options,f=c.pane|| | ||
0;if(d){if(J(this,j?X:Q),l=!e)this.defaultRadialOptions=this.defaultRadialGaugeOptions}else if(g)J(this,Q),this.defaultRadialOptions=(l=e)?this.defaultRadialXOptions:v(this.defaultYAxisOptions,this.defaultRadialYOptions);if(d||g)b.inverted=!1,h.chart.zoomType=null;a.call(this,b,c);if(!j&&(d||g)){a=this.options;if(!b.panes)b.panes=[];this.pane=(k=b.panes[f]=b.panes[f]||new M(N(h.pane)[f],b,this),b=k);b=b.options;this.angleRad=(a.angle||0)*Math.PI/180;this.startAngleRad=(b.startAngle-90)*Math.PI/180; | ||
this.endAngleRad=(r(b.endAngle,b.startAngle+360)-90)*Math.PI/180;this.offset=a.offset||0;this.isCircular=l}});w(A,"autoLabelAlign",function(a){if(!this.isRadial)return a.apply(this,[].slice.call(arguments,1))});w(z,"getPosition",function(a,b,c,d,g){var e=this.axis;return e.getPosition?e.getPosition(c):a.call(this,b,c,d,g)});w(z,"getLabelPosition",function(a,b,c,d,g,e,j,l,h){var f=this.axis,k=e.y,o=20,u=e.align,i=(f.translate(this.pos)+f.startAngleRad+Math.PI/2)/Math.PI*180%360;f.isRadial?(a=f.getPosition(this.pos, | ||
f.center[2]/2+r(e.distance,-25)),e.rotation==="auto"?d.attr({rotation:i}):k===null&&(k=f.chart.renderer.fontMetrics(d.styles.fontSize).b-d.getBBox().height/2),u===null&&(f.isCircular?(this.label.getBBox().width>f.len*f.tickInterval/(f.max-f.min)&&(o=0),u=i>o&&i<180-o?"left":i>180+o&&i<360-o?"right":"center"):u="center",d.attr({align:u})),a.x+=e.x,a.y+=k):a=a.call(this,b,c,d,g,e,j,l,h);return a});w(z,"getMarkPath",function(a,b,c,d,g,e,j){var l=this.axis;l.isRadial?(a=l.getPosition(this.pos,l.center[2]/ | ||
2+d),b=["M",b,c,"L",a.x,a.y]):b=a.call(this,b,c,d,g,e,j);return b});p.arearange=v(p.area,{lineWidth:1,marker:null,threshold:null,tooltip:{pointFormat:'<span style="color:{series.color}">\u25cf</span> {series.name}: <b>{point.low}</b> - <b>{point.high}</b><br/>'},trackByArea:!0,dataLabels:{align:null,verticalAlign:null,xLow:0,xHigh:0,yLow:0,yHigh:0},states:{hover:{halo:!1}}});i.arearange=t(i.area,{type:"arearange",pointArrayMap:["low","high"],dataLabelCollections:["dataLabel","dataLabelUpper"],toYData:function(a){return[a.low, | ||
a.high]},pointValKey:"low",deferTranslatePolar:!0,highToXY:function(a){var b=this.chart,c=this.xAxis.postTranslate(a.rectPlotX,this.yAxis.len-a.plotHigh);a.plotHighX=c.x-b.plotLeft;a.plotHigh=c.y-b.plotTop},translate:function(){var a=this,b=a.yAxis;i.area.prototype.translate.apply(a);s(a.points,function(a){var d=a.low,g=a.high,e=a.plotY;g===null||d===null?a.isNull=!0:(a.plotLow=e,a.plotHigh=b.translate(g,0,1,0,1))});this.chart.polar&&s(this.points,function(b){a.highToXY(b)})},getGraphPath:function(a){var b= | ||
[],c=[],d,g=i.area.prototype.getGraphPath,e,j,l;l=this.options;var h=l.step,a=a||this.points;for(d=a.length;d--;)e=a[d],!e.isNull&&!l.connectEnds&&(!a[d+1]||a[d+1].isNull)&&c.push({plotX:e.plotX,plotY:e.plotY,doCurve:!1}),j={polarPlotY:e.polarPlotY,rectPlotX:e.rectPlotX,yBottom:e.yBottom,plotX:r(e.plotHighX,e.plotX),plotY:e.plotHigh,isNull:e.isNull},c.push(j),b.push(j),!e.isNull&&!l.connectEnds&&(!a[d-1]||a[d-1].isNull)&&c.push({plotX:e.plotX,plotY:e.plotY,doCurve:!1});a=g.call(this,a);if(h)h===!0&& | ||
(h="left"),l.step={left:"right",center:"center",right:"left"}[h];b=g.call(this,b);c=g.call(this,c);l.step=h;l=[].concat(a,b);!this.chart.polar&&c[0]==="M"&&(c[0]="L");this.graphPath=l;this.areaPath=this.areaPath.concat(a,c);l.isArea=!0;l.xMap=a.xMap;this.areaPath.xMap=a.xMap;return l},drawDataLabels:function(){var a=this.data,b=a.length,c,d=[],g=x.prototype,e=this.options.dataLabels,j=e.align,l=e.verticalAlign,h=e.inside,f,k,o=this.chart.inverted;if(e.enabled||this._hasPointLabels){for(c=b;c--;)if(f= | ||
a[c]){k=h?f.plotHigh<f.plotLow:f.plotHigh>f.plotLow;f.y=f.high;f._plotY=f.plotY;f.plotY=f.plotHigh;d[c]=f.dataLabel;f.dataLabel=f.dataLabelUpper;f.below=k;if(o){if(!j)e.align=k?"right":"left"}else if(!l)e.verticalAlign=k?"top":"bottom";e.x=e.xHigh;e.y=e.yHigh}g.drawDataLabels&&g.drawDataLabels.apply(this,arguments);for(c=b;c--;)if(f=a[c]){k=h?f.plotHigh<f.plotLow:f.plotHigh>f.plotLow;f.dataLabelUpper=f.dataLabel;f.dataLabel=d[c];f.y=f.low;f.plotY=f._plotY;f.below=!k;if(o){if(!j)e.align=k?"left":"right"}else if(!l)e.verticalAlign= | ||
k?"bottom":"top";e.x=e.xLow;e.y=e.yLow}g.drawDataLabels&&g.drawDataLabels.apply(this,arguments)}e.align=j;e.verticalAlign=l},alignDataLabel:function(){i.column.prototype.alignDataLabel.apply(this,arguments)},setStackedPoints:n,getSymbol:n,drawPoints:n});p.areasplinerange=v(p.arearange);i.areasplinerange=t(i.arearange,{type:"areasplinerange",getPointSpline:i.spline.prototype.getPointSpline});(function(){var a=i.column.prototype;p.columnrange=v(p.column,p.arearange,{lineWidth:1,pointRange:null});i.columnrange= | ||
t(i.arearange,{type:"columnrange",translate:function(){var b=this,c=b.yAxis,d=b.xAxis,g=d.startAngleRad,e,j=b.chart,l=b.xAxis.isRadial,h;a.translate.apply(b);s(b.points,function(a){var k=a.shapeArgs,o=b.options.minPointLength,u,i;a.plotHigh=h=c.translate(a.high,0,1,0,1);a.plotLow=a.plotY;i=h;u=r(a.rectPlotY,a.plotY)-h;Math.abs(u)<o?(o-=u,u+=o,i-=o/2):u<0&&(u*=-1,i-=u);l?(e=a.barX+g,a.shapeType="path",a.shapeArgs={d:b.polarArc(i+u,i,e,e+a.pointWidth)}):(k.height=u,k.y=i,a.tooltipPos=j.inverted?[c.len+ | ||
c.pos-j.plotLeft-i-u/2,d.len+d.pos-j.plotTop-k.x-k.width/2,u]:[d.left-j.plotLeft+k.x+k.width/2,c.pos-j.plotTop+i+u/2,u])})},directTouch:!0,trackerGroups:["group","dataLabelsGroup"],drawGraph:n,crispCol:a.crispCol,pointAttrToOptions:a.pointAttrToOptions,drawPoints:a.drawPoints,drawTracker:a.drawTracker,getColumnMetrics:a.getColumnMetrics,animate:function(){return a.animate.apply(this,arguments)},polarArc:function(){return a.polarArc.apply(this,arguments)}})})();p.gauge=v(p.line,{dataLabels:{enabled:!0, | ||
defer:!1,y:15,borderWidth:1,borderColor:"silver",borderRadius:3,crop:!1,verticalAlign:"top",zIndex:2},dial:{},pivot:{},tooltip:{headerFormat:""},showInLegend:!1});C={type:"gauge",pointClass:t(I,{setState:function(a){this.state=a}}),angular:!0,directTouch:!0,drawGraph:n,fixedBox:!0,forceDL:!0,noSharedTooltip:!0,trackerGroups:["group","dataLabelsGroup"],translate:function(){var a=this.yAxis,b=this.options,c=a.center;this.generatePoints();s(this.points,function(d){var g=v(b.dial,d.dial),e=B(r(g.radius, | ||
80))*c[2]/200,j=B(r(g.baseLength,70))*e/100,l=B(r(g.rearLength,10))*e/100,h=g.baseWidth||3,f=g.topWidth||1,k=b.overshoot,o=a.startAngleRad+a.translate(d.y,null,null,null,!0);G(k)?(k=k/180*Math.PI,o=Math.max(a.startAngleRad-k,Math.min(a.endAngleRad+k,o))):b.wrap===!1&&(o=Math.max(a.startAngleRad,Math.min(a.endAngleRad,o)));o=o*180/Math.PI;d.shapeType="path";d.shapeArgs={d:g.path||["M",-l,-h/2,"L",j,-h/2,e,-f/2,e,f/2,j,h/2,-l,h/2,"z"],translateX:c[0],translateY:c[1],rotation:o};d.plotX=c[0];d.plotY= | ||
c[1]})},drawPoints:function(){var a=this,b=a.yAxis.center,c=a.pivot,d=a.options,g=d.pivot,e=a.chart.renderer;s(a.points,function(b){var g=b.graphic,c=b.shapeArgs,f=c.d,k=v(d.dial,b.dial);g?(g.animate(c),c.d=f):b.graphic=e[b.shapeType](c).attr({stroke:k.borderColor||"none","stroke-width":k.borderWidth||0,fill:k.backgroundColor||"black",rotation:c.rotation,zIndex:1}).add(a.group)});c?c.animate({translateX:b[0],translateY:b[1]}):a.pivot=e.circle(0,0,r(g.radius,5)).attr({"stroke-width":g.borderWidth|| | ||
0,stroke:g.borderColor||"silver",fill:g.backgroundColor||"black",zIndex:2}).translate(b[0],b[1]).add(a.group)},animate:function(a){var b=this;if(!a)s(b.points,function(a){var d=a.graphic;d&&(d.attr({rotation:b.yAxis.startAngleRad*180/Math.PI}),d.animate({rotation:a.shapeArgs.rotation},b.options.animation))}),b.animate=null},render:function(){this.group=this.plotGroup("group","series",this.visible?"visible":"hidden",this.options.zIndex,this.chart.seriesGroup);x.prototype.render.call(this);this.group.clip(this.chart.clipRect)}, | ||
setData:function(a,b){x.prototype.setData.call(this,a,!1);this.processData();this.generatePoints();r(b,!0)&&this.chart.redraw()},drawTracker:C&&C.drawTrackerPoint};i.gauge=t(i.line,C);p.boxplot=v(p.column,{fillColor:"#FFFFFF",lineWidth:1,medianWidth:2,states:{hover:{brightness:-0.3}},threshold:null,tooltip:{pointFormat:'<span style="color:{point.color}">\u25cf</span> <b> {series.name}</b><br/>Maximum: {point.high}<br/>Upper quartile: {point.q3}<br/>Median: {point.median}<br/>Lower quartile: {point.q1}<br/>Minimum: {point.low}<br/>'}, | ||
whiskerLength:"50%",whiskerWidth:2});i.boxplot=t(i.column,{type:"boxplot",pointArrayMap:["low","q1","median","q3","high"],toYData:function(a){return[a.low,a.q1,a.median,a.q3,a.high]},pointValKey:"high",pointAttrToOptions:{fill:"fillColor",stroke:"color","stroke-width":"lineWidth"},drawDataLabels:n,translate:function(){var a=this.yAxis,b=this.pointArrayMap;i.column.prototype.translate.apply(this);s(this.points,function(c){s(b,function(b){c[b]!==null&&(c[b+"Plot"]=a.translate(c[b],0,1,0,1))})})},drawPoints:function(){var a= | ||
this,b=a.options,c=a.chart.renderer,d,g,e,j,l,h,f,k,o,i,m,K,L,p,v,n,w,t,x,y,C,B,z=a.doQuartiles!==!1,A,E=a.options.whiskerLength;s(a.points,function(q){o=q.graphic;C=q.shapeArgs;m={};p={};n={};B=q.color||a.color;if(q.plotY!==void 0)if(d=q.pointAttr[q.selected?"selected":""],w=C.width,t=D(C.x),x=t+w,y=F(w/2),g=D(z?q.q1Plot:q.lowPlot),e=D(z?q.q3Plot:q.lowPlot),j=D(q.highPlot),l=D(q.lowPlot),m.stroke=q.stemColor||b.stemColor||B,m["stroke-width"]=r(q.stemWidth,b.stemWidth,b.lineWidth),m.dashstyle=q.stemDashStyle|| | ||
b.stemDashStyle,p.stroke=q.whiskerColor||b.whiskerColor||B,p["stroke-width"]=r(q.whiskerWidth,b.whiskerWidth,b.lineWidth),n.stroke=q.medianColor||b.medianColor||B,n["stroke-width"]=r(q.medianWidth,b.medianWidth,b.lineWidth),f=m["stroke-width"]%2/2,k=t+y+f,i=["M",k,e,"L",k,j,"M",k,g,"L",k,l],z&&(f=d["stroke-width"]%2/2,k=D(k)+f,g=D(g)+f,e=D(e)+f,t+=f,x+=f,K=["M",t,e,"L",t,g,"L",x,g,"L",x,e,"L",t,e,"z"]),E&&(f=p["stroke-width"]%2/2,j+=f,l+=f,A=/%$/.test(E)?y*parseFloat(E)/100:E/2,L=["M",k-A,j,"L",k+ | ||
A,j,"M",k-A,l,"L",k+A,l]),f=n["stroke-width"]%2/2,h=F(q.medianPlot)+f,v=["M",t,h,"L",x,h],o)q.stem.animate({d:i}),E&&q.whiskers.animate({d:L}),z&&q.box.animate({d:K}),q.medianShape.animate({d:v});else{q.graphic=o=c.g().add(a.group);q.stem=c.path(i).attr(m).add(o);if(E)q.whiskers=c.path(L).attr(p).add(o);if(z)q.box=c.path(K).attr(d).add(o);q.medianShape=c.path(v).attr(n).add(o)}})},setStackedPoints:n});p.errorbar=v(p.boxplot,{color:"#000000",grouping:!1,linkedTo:":previous",tooltip:{pointFormat:'<span style="color:{point.color}">\u25cf</span> {series.name}: <b>{point.low}</b> - <b>{point.high}</b><br/>'}, | ||
whiskerWidth:null});i.errorbar=t(i.boxplot,{type:"errorbar",pointArrayMap:["low","high"],toYData:function(a){return[a.low,a.high]},pointValKey:"high",doQuartiles:!1,drawDataLabels:i.arearange?function(){var a=this.pointValKey;i.arearange.prototype.drawDataLabels.call(this);s(this.data,function(b){b.y=b[a]})}:n,getColumnMetrics:function(){return this.linkedParent&&this.linkedParent.columnMetrics||i.column.prototype.getColumnMetrics.call(this)}});p.waterfall=v(p.column,{lineWidth:1,lineColor:"#333", | ||
dashStyle:"dot",borderColor:"#333",dataLabels:{inside:!0},states:{hover:{lineWidthPlus:0}}});i.waterfall=t(i.column,{type:"waterfall",upColorProp:"fill",pointValKey:"y",pointClass:t(I,{isValid:function(){return G(this.y,!0)||this.isSum||this.isIntermediateSum}}),translate:function(){var a=this.options,b=this.yAxis,c,d,g,e,j,l,h,f,k,o=r(a.minPointLength,5),u=a.threshold,m=a.stacking;i.column.prototype.translate.apply(this);this.minPointLengthOffset=0;h=f=u;d=this.points;for(c=0,a=d.length;c<a;c++){g= | ||
d[c];l=this.processedYData[c];e=g.shapeArgs;k=(j=m&&b.stacks[(this.negStacks&&l<u?"-":"")+this.stackKey])?j[g.x].points[this.index+","+c]:[0,l];if(g.isSum)g.y=H(l);else if(g.isIntermediateSum)g.y=H(l-f);j=P(h,h+g.y)+k[0];e.y=b.toPixels(j,!0);g.isSum?(e.y=b.toPixels(k[1],!0),e.height=Math.min(b.toPixels(k[0],!0),b.len)-e.y+this.minPointLengthOffset):g.isIntermediateSum?(e.y=b.toPixels(k[1],!0),e.height=Math.min(b.toPixels(f,!0),b.len)-e.y+this.minPointLengthOffset,f=k[1]):(e.height=l>0?b.toPixels(h, | ||
!0)-e.y:b.toPixels(h,!0)-b.toPixels(h-l,!0),h+=l);e.height<0&&(e.y+=e.height,e.height*=-1);g.plotY=e.y=F(e.y)-this.borderWidth%2/2;e.height=P(F(e.height),0.001);g.yBottom=e.y+e.height;if(e.height<=o)e.height=o,this.minPointLengthOffset+=o;e.y-=this.minPointLengthOffset;e=g.plotY+(g.negative?e.height:0)-this.minPointLengthOffset;this.chart.inverted?g.tooltipPos[0]=b.len-e:g.tooltipPos[1]=e}},processData:function(a){var b=this.yData,c=this.options.data,d,g=b.length,e,j,l,h,f,k;j=e=l=h=this.options.threshold|| | ||
0;for(k=0;k<g;k++)f=b[k],d=c&&c[k]?c[k]:{},f==="sum"||d.isSum?b[k]=H(j):f==="intermediateSum"||d.isIntermediateSum?b[k]=H(e):(j+=f,e+=f),l=Math.min(j,l),h=Math.max(j,h);x.prototype.processData.call(this,a);this.dataMin=l;this.dataMax=h},toYData:function(a){return a.isSum?a.x===0?null:"sum":a.isIntermediateSum?a.x===0?null:"intermediateSum":a.y},getAttribs:function(){i.column.prototype.getAttribs.apply(this,arguments);var a=this,b=a.options,c=b.states,d=b.upColor||a.color,b=m.Color(d).brighten(b.states.hover.brightness).get(), | ||
g=v(a.pointAttr),e=a.upColorProp;g[""][e]=d;g.hover[e]=c.hover.upColor||b;g.select[e]=c.select.upColor||d;s(a.points,function(b){if(!b.options.color)b.y>0?(b.pointAttr=g,b.color=d):b.pointAttr=a.pointAttr})},getGraphPath:function(){var a=this.data,b=a.length,c=F(this.options.lineWidth+this.borderWidth)%2/2,d=[],g,e,j;for(j=1;j<b;j++)e=a[j].shapeArgs,g=a[j-1].shapeArgs,e=["M",g.x+g.width,g.y+c,"L",e.x,g.y+c],a[j-1].y<0&&(e[2]+=g.height,e[5]+=g.height),d=d.concat(e);return d},getExtremes:n,drawGraph:x.prototype.drawGraph}); | ||
p.polygon=v(p.scatter,{marker:{enabled:!1,states:{hover:{enabled:!1}}},stickyTracking:!1,tooltip:{followPointer:!0,pointFormat:""},trackByArea:!0});i.polygon=t(i.scatter,{type:"polygon",getGraphPath:function(){for(var a=x.prototype.getGraphPath.call(this),b=a.length+1;b--;)(b===a.length||a[b]==="M")&&b>0&&a.splice(b,0,"z");return this.areaPath=a},drawGraph:function(){this.options.fillColor=this.color;i.area.prototype.drawGraph.call(this)},drawLegendSymbol:m.LegendSymbolMixin.drawRectangle,drawTracker:x.prototype.drawTracker, | ||
setStackedPoints:n});p.bubble=v(p.scatter,{dataLabels:{formatter:function(){return this.point.z},inside:!0,verticalAlign:"middle"},marker:{lineColor:null,lineWidth:1},minSize:8,maxSize:"20%",softThreshold:!1,states:{hover:{halo:{size:5}}},tooltip:{pointFormat:"({point.x}, {point.y}), Size: {point.z}"},turboThreshold:0,zThreshold:0,zoneAxis:"z"});C=t(I,{haloPath:function(){return I.prototype.haloPath.call(this,this.shapeArgs.r+this.series.options.states.hover.halo.size)},ttBelow:!1});i.bubble=t(i.scatter, | ||
{type:"bubble",pointClass:C,pointArrayMap:["y","z"],parallelArrays:["x","y","z"],trackerGroups:["group","dataLabelsGroup"],bubblePadding:!0,zoneAxis:"z",pointAttrToOptions:{stroke:"lineColor","stroke-width":"lineWidth",fill:"fillColor"},applyOpacity:function(a){var b=this.options.marker,c=r(b.fillOpacity,0.5),a=a||b.fillColor||this.color;c!==1&&(a=W(a).setOpacity(c).get("rgba"));return a},convertAttribs:function(){var a=x.prototype.convertAttribs.apply(this,arguments);a.fill=this.applyOpacity(a.fill); | ||
return a},getRadii:function(a,b,c,d){var g,e,j,l=this.zData,h=[],f=this.options,k=f.sizeBy!=="width",o=f.zThreshold,i=b-a;for(e=0,g=l.length;e<g;e++)j=l[e],f.sizeByAbsoluteValue&&j!==null&&(j=Math.abs(j-o),b=Math.max(b-o,Math.abs(a-o)),a=0),j===null?j=null:j<a?j=c/2-1:(j=i>0?(j-a)/i:0.5,k&&j>=0&&(j=Math.sqrt(j)),j=y.ceil(c+j*(d-c))/2),h.push(j);this.radii=h},animate:function(a){var b=this.options.animation;if(!a)s(this.points,function(a){var d=a.graphic,a=a.shapeArgs;d&&a&&(d.attr("r",1),d.animate({r:a.r}, | ||
b))}),this.animate=null},translate:function(){var a,b=this.data,c,d,g=this.radii;i.scatter.prototype.translate.call(this);for(a=b.length;a--;)c=b[a],d=g?g[a]:0,G(d)&&d>=this.minPxSize/2?(c.shapeType="circle",c.shapeArgs={x:c.plotX,y:c.plotY,r:d},c.dlBox={x:c.plotX-d,y:c.plotY-d,width:2*d,height:2*d}):c.shapeArgs=c.plotY=c.dlBox=void 0},drawLegendSymbol:function(a,b){var c=this.chart.renderer,d=c.fontMetrics(a.itemStyle.fontSize).f/2;b.legendSymbol=c.circle(d,a.baseline-d,d).attr({zIndex:3}).add(b.legendGroup); | ||
b.legendSymbol.isMarker=!0},drawPoints:i.column.prototype.drawPoints,alignDataLabel:i.column.prototype.alignDataLabel,buildKDTree:n,applyZones:n});O.prototype.beforePadding=function(){var a=this,b=this.len,c=this.chart,d=0,g=b,e=this.isXAxis,j=e?"xData":"yData",l=this.min,h={},f=y.min(c.plotWidth,c.plotHeight),k=Number.MAX_VALUE,i=-Number.MAX_VALUE,m=this.max-l,p=b/m,n=[];s(this.series,function(b){var g=b.options;if(b.bubblePadding&&(b.visible||!c.options.chart.ignoreHiddenSeries))if(a.allowZoomOutside= | ||
!0,n.push(b),e)s(["minSize","maxSize"],function(a){var b=g[a],e=/%$/.test(b),b=B(b);h[a]=e?f*b/100:b}),b.minPxSize=h.minSize,b.maxPxSize=h.maxSize,b=b.zData,b.length&&(k=r(g.zMin,y.min(k,y.max(R(b),g.displayNegative===!1?g.zThreshold:-Number.MAX_VALUE))),i=r(g.zMax,y.max(i,S(b))))});s(n,function(b){var c=b[j],f=c.length,h;e&&b.getRadii(k,i,b.minPxSize,b.maxPxSize);if(m>0)for(;f--;)G(c[f])&&a.dataMin<=c[f]&&c[f]<=a.dataMax&&(h=b.radii[f],d=Math.min((c[f]-l)*p-h,d),g=Math.max((c[f]-l)*p+h,g))});n.length&& | ||
m>0&&!this.isLog&&(g-=b,p*=(b+d-g)/b,s([["min","userMin",d],["max","userMax",g]],function(b){r(a.options[b[0]],a[b[1]])===void 0&&(a[b[0]]+=b[2]/p)}))};(function(){function a(a,b){var c=this.chart,d=this.options.animation,h=this.group,f=this.markerGroup,k=this.xAxis.center,i=c.plotLeft,m=c.plotTop;if(c.polar){if(c.renderer.isSVG)d===!0&&(d={}),b?(c={translateX:k[0]+i,translateY:k[1]+m,scaleX:0.001,scaleY:0.001},h.attr(c),f&&f.attr(c)):(c={translateX:i,translateY:m,scaleX:1,scaleY:1},h.animate(c,d), | ||
f&&f.animate(c,d),this.animate=null)}else a.call(this,b)}var b=x.prototype,c=U.prototype,d;b.searchPointByAngle=function(a){var b=this.chart,c=this.xAxis.pane.center;return this.searchKDTree({clientX:180+Math.atan2(a.chartX-c[0]-b.plotLeft,a.chartY-c[1]-b.plotTop)*(-180/Math.PI)})};w(b,"buildKDTree",function(a){if(this.chart.polar)this.kdByAngle?this.searchPoint=this.searchPointByAngle:this.kdDimensions=2;a.apply(this)});b.toXY=function(a){var b,c=this.chart,d=a.plotX;b=a.plotY;a.rectPlotX=d;a.rectPlotY= | ||
b;b=this.xAxis.postTranslate(a.plotX,this.yAxis.len-b);a.plotX=a.polarPlotX=b.x-c.plotLeft;a.plotY=a.polarPlotY=b.y-c.plotTop;this.kdByAngle?(c=(d/Math.PI*180+this.xAxis.pane.options.startAngle)%360,c<0&&(c+=360),a.clientX=c):a.clientX=a.plotX};i.spline&&w(i.spline.prototype,"getPointSpline",function(a,b,c,d){var h,f,k,i,m,p,n;if(this.chart.polar){h=c.plotX;f=c.plotY;a=b[d-1];k=b[d+1];this.connectEnds&&(a||(a=b[b.length-2]),k||(k=b[1]));if(a&&k)i=a.plotX,m=a.plotY,b=k.plotX,p=k.plotY,i=(1.5*h+i)/ | ||
2.5,m=(1.5*f+m)/2.5,k=(1.5*h+b)/2.5,n=(1.5*f+p)/2.5,b=Math.sqrt(Math.pow(i-h,2)+Math.pow(m-f,2)),p=Math.sqrt(Math.pow(k-h,2)+Math.pow(n-f,2)),i=Math.atan2(m-f,i-h),m=Math.atan2(n-f,k-h),n=Math.PI/2+(i+m)/2,Math.abs(i-n)>Math.PI/2&&(n-=Math.PI),i=h+Math.cos(n)*b,m=f+Math.sin(n)*b,k=h+Math.cos(Math.PI+n)*p,n=f+Math.sin(Math.PI+n)*p,c.rightContX=k,c.rightContY=n;d?(c=["C",a.rightContX||a.plotX,a.rightContY||a.plotY,i||h,m||f,h,f],a.rightContX=a.rightContY=null):c=["M",h,f]}else c=a.call(this,b,c,d); | ||
return c});w(b,"translate",function(a){var b=this.chart;a.call(this);if(b.polar&&(this.kdByAngle=b.tooltip&&b.tooltip.shared,!this.preventPostTranslate)){a=this.points;for(b=a.length;b--;)this.toXY(a[b])}});w(b,"getGraphPath",function(a,b){var c=this,d,h;if(this.chart.polar){b=b||this.points;for(d=0;d<b.length;d++)if(!b[d].isNull){h=d;break}if(this.options.connectEnds!==!1&&h!==void 0)this.connectEnds=!0,b.splice(b.length,0,b[h]);s(b,function(a){a.polarPlotY===void 0&&c.toXY(a)})}return a.apply(this, | ||
[].slice.call(arguments,1))});w(b,"animate",a);if(i.column)d=i.column.prototype,d.polarArc=function(a,b,c,d){var h=this.xAxis.center,f=this.yAxis.len;return this.chart.renderer.symbols.arc(h[0],h[1],f-b,null,{start:c,end:d,innerR:f-r(a,f)})},w(d,"animate",a),w(d,"translate",function(a){var b=this.xAxis,c=b.startAngleRad,d,h,f;this.preventPostTranslate=!0;a.call(this);if(b.isRadial){d=this.points;for(f=d.length;f--;)h=d[f],a=h.barX+c,h.shapeType="path",h.shapeArgs={d:this.polarArc(h.yBottom,h.plotY, | ||
a,a+h.pointWidth)},this.toXY(h),h.tooltipPos=[h.plotX,h.plotY],h.ttBelow=h.plotY>b.center[1]}}),w(d,"alignDataLabel",function(a,c,d,i,h,f){if(this.chart.polar){a=c.rectPlotX/Math.PI*180;if(i.align===null)i.align=a>20&&a<160?"left":a>200&&a<340?"right":"center";if(i.verticalAlign===null)i.verticalAlign=a<45||a>315?"bottom":a>135&&a<225?"top":"middle";b.alignDataLabel.call(this,c,d,i,h,f)}else a.call(this,c,d,i,h,f)});w(c,"getCoordinates",function(a,b){var c=this.chart,d={xAxis:[],yAxis:[]};c.polar? | ||
s(c.axes,function(a){var f=a.isXAxis,g=a.center,i=b.chartX-g[0]-c.plotLeft,g=b.chartY-g[1]-c.plotTop;d[f?"xAxis":"yAxis"].push({axis:a,value:a.translate(f?Math.PI-Math.atan2(i,g):Math.sqrt(Math.pow(i,2)+Math.pow(g,2)),!0)})}):d=a.call(this,b);return d})})()}); | ||
(function(x){"object"===typeof module&&module.exports?module.exports=x:x(Highcharts)})(function(x){(function(a){function f(a,b,g){this.init(a,b,g)}var r=a.each,u=a.extend,l=a.merge,p=a.splat;u(f.prototype,{init:function(a,b,g){var d=this,n=d.defaultOptions;d.chart=b;d.options=a=l(n,b.angular?{background:{}}:void 0,a);(a=a.background)&&r([].concat(p(a)).reverse(),function(b){var c,a=g.userOptions;c=l(d.defaultBackgroundOptions,b);b.backgroundColor&&(c.backgroundColor=b.backgroundColor);c.color=c.backgroundColor; | ||
g.options.plotBands.unshift(c);a.plotBands=a.plotBands||[];a.plotBands!==g.options.plotBands&&a.plotBands.unshift(c)})},defaultOptions:{center:["50%","50%"],size:"85%",startAngle:0},defaultBackgroundOptions:{className:"highcharts-pane",shape:"circle",borderWidth:1,borderColor:"#cccccc",backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,"#ffffff"],[1,"#e6e6e6"]]},from:-Number.MAX_VALUE,innerRadius:0,to:Number.MAX_VALUE,outerRadius:"105%"}});a.Pane=f})(x);(function(a){var f=a.CenteredSeriesMixin, | ||
r=a.each,u=a.extend,l=a.map,p=a.merge,q=a.noop,b=a.Pane,g=a.pick,d=a.pInt,n=a.splat,h=a.wrap,c,e,k=a.Axis.prototype;a=a.Tick.prototype;c={getOffset:q,redraw:function(){this.isDirty=!1},render:function(){this.isDirty=!1},setScale:q,setCategories:q,setTitle:q};e={defaultRadialGaugeOptions:{labels:{align:"center",x:0,y:null},minorGridLineWidth:0,minorTickInterval:"auto",minorTickLength:10,minorTickPosition:"inside",minorTickWidth:1,tickLength:10,tickPosition:"inside",tickWidth:2,title:{rotation:0},zIndex:2}, | ||
defaultRadialXOptions:{gridLineWidth:1,labels:{align:null,distance:15,x:0,y:null},maxPadding:0,minPadding:0,showLastLabel:!1,tickLength:0},defaultRadialYOptions:{gridLineInterpolation:"circle",labels:{align:"right",x:-3,y:-2},showLastLabel:!1,title:{x:4,text:null,rotation:90}},setOptions:function(d){d=this.options=p(this.defaultOptions,this.defaultRadialOptions,d);d.plotBands||(d.plotBands=[])},getOffset:function(){k.getOffset.call(this);this.chart.axisOffset[this.side]=0;this.center=this.pane.center= | ||
f.getCenter.call(this.pane)},getLinePath:function(d,m){var b=this.center,c,a=this.chart;c=g(m,b[2]/2-this.offset);this.isCircular||void 0!==m?b=this.chart.renderer.symbols.arc(this.left+b[0],this.top+b[1],c,c,{start:this.startAngleRad,end:this.endAngleRad,open:!0,innerR:0}):(c=this.postTranslate(this.angleRad,c),b=["M",b[0]+a.plotLeft,b[1]+a.plotTop,"L",c.x,c.y]);return b},setAxisTranslation:function(){k.setAxisTranslation.call(this);this.center&&(this.transA=this.isCircular?(this.endAngleRad-this.startAngleRad)/ | ||
(this.max-this.min||1):this.center[2]/2/(this.max-this.min||1),this.minPixelPadding=this.isXAxis?this.transA*this.minPointOffset:0)},beforeSetTickPositions:function(){if(this.autoConnect=this.isCircular&&void 0===g(this.userMax,this.options.max)&&this.endAngleRad-this.startAngleRad===2*Math.PI)this.max+=this.categories&&1||this.pointRange||this.closestPointRange||0},setAxisSize:function(){k.setAxisSize.call(this);this.isRadial&&(this.center=this.pane.center=f.getCenter.call(this.pane),this.isCircular&& | ||
(this.sector=this.endAngleRad-this.startAngleRad),this.len=this.width=this.height=this.center[2]*g(this.sector,1)/2)},getPosition:function(d,m){return this.postTranslate(this.isCircular?this.translate(d):this.angleRad,g(this.isCircular?m:this.translate(d),this.center[2]/2)-this.offset)},postTranslate:function(d,m){var b=this.chart,c=this.center;d=this.startAngleRad+d;return{x:b.plotLeft+c[0]+Math.cos(d)*m,y:b.plotTop+c[1]+Math.sin(d)*m}},getPlotBandPath:function(b,m,c){var a=this.center,n=this.startAngleRad, | ||
k=a[2]/2,e=[g(c.outerRadius,"100%"),c.innerRadius,g(c.thickness,10)],h=Math.min(this.offset,0),C=/%$/,q,p=this.isCircular;"polygon"===this.options.gridLineInterpolation?a=this.getPlotLinePath(b).concat(this.getPlotLinePath(m,!0)):(b=Math.max(b,this.min),m=Math.min(m,this.max),p||(e[0]=this.translate(b),e[1]=this.translate(m)),e=l(e,function(b){C.test(b)&&(b=d(b,10)*k/100);return b}),"circle"!==c.shape&&p?(b=n+this.translate(b),m=n+this.translate(m)):(b=-Math.PI/2,m=1.5*Math.PI,q=!0),e[0]-=h,e[2]-= | ||
h,a=this.chart.renderer.symbols.arc(this.left+a[0],this.top+a[1],e[0],e[0],{start:Math.min(b,m),end:Math.max(b,m),innerR:g(e[1],e[0]-e[2]),open:q}));return a},getPlotLinePath:function(b,d){var c=this,g=c.center,a=c.chart,e=c.getPosition(b),n,k,h;c.isCircular?h=["M",g[0]+a.plotLeft,g[1]+a.plotTop,"L",e.x,e.y]:"circle"===c.options.gridLineInterpolation?(b=c.translate(b))&&(h=c.getLinePath(0,b)):(r(a.xAxis,function(b){b.pane===c.pane&&(n=b)}),h=[],b=c.translate(b),g=n.tickPositions,n.autoConnect&&(g= | ||
g.concat([g[0]])),d&&(g=[].concat(g).reverse()),r(g,function(d,c){k=n.getPosition(d,b);h.push(c?"L":"M",k.x,k.y)}));return h},getTitlePosition:function(){var b=this.center,d=this.chart,c=this.options.title;return{x:d.plotLeft+b[0]+(c.x||0),y:d.plotTop+b[1]-{high:.5,middle:.25,low:0}[c.align]*b[2]+(c.y||0)}}};h(k,"init",function(d,m,a){var k=m.angular,h=m.polar,w=a.isX,q=k&&w,l,C=m.options,f=a.pane||0;if(k){if(u(this,q?c:e),l=!w)this.defaultRadialOptions=this.defaultRadialGaugeOptions}else h&&(u(this, | ||
e),this.defaultRadialOptions=(l=w)?this.defaultRadialXOptions:p(this.defaultYAxisOptions,this.defaultRadialYOptions));k||h?(this.isRadial=!0,m.inverted=!1,C.chart.zoomType=null):this.isRadial=!1;d.call(this,m,a);q||!k&&!h||(d=this.options,m.panes||(m.panes=[]),this.pane=m=m.panes[f]=m.panes[f]||new b(n(C.pane)[f],m,this),m=m.options,this.angleRad=(d.angle||0)*Math.PI/180,this.startAngleRad=(m.startAngle-90)*Math.PI/180,this.endAngleRad=(g(m.endAngle,m.startAngle+360)-90)*Math.PI/180,this.offset=d.offset|| | ||
0,this.isCircular=l)});h(k,"autoLabelAlign",function(b){if(!this.isRadial)return b.apply(this,[].slice.call(arguments,1))});h(a,"getPosition",function(b,d,c,g,a){var e=this.axis;return e.getPosition?e.getPosition(c):b.call(this,d,c,g,a)});h(a,"getLabelPosition",function(b,d,c,a,e,k,n,h,q){var p=this.axis,l=k.y,f=20,r=k.align,u=(p.translate(this.pos)+p.startAngleRad+Math.PI/2)/Math.PI*180%360;p.isRadial?(b=p.getPosition(this.pos,p.center[2]/2+g(k.distance,-25)),"auto"===k.rotation?a.attr({rotation:u}): | ||
null===l&&(l=p.chart.renderer.fontMetrics(a.styles.fontSize).b-a.getBBox().height/2),null===r&&(p.isCircular?(this.label.getBBox().width>p.len*p.tickInterval/(p.max-p.min)&&(f=0),r=u>f&&u<180-f?"left":u>180+f&&u<360-f?"right":"center"):r="center",a.attr({align:r})),b.x+=k.x,b.y+=l):b=b.call(this,d,c,a,e,k,n,h,q);return b});h(a,"getMarkPath",function(b,d,c,g,a,e,k){var n=this.axis;n.isRadial?(b=n.getPosition(this.pos,n.center[2]/2+g),d=["M",d,c,"L",b.x,b.y]):d=b.call(this,d,c,g,a,e,k);return d})})(x); | ||
(function(a){var f=a.each,r=a.noop,u=a.pick,l=a.Series,p=a.seriesType,q=a.seriesTypes;p("arearange","area",{lineWidth:1,marker:null,threshold:null,tooltip:{pointFormat:'<span style="color:{series.color}">\u25cf</span> {series.name}: <b>{point.low}</b> - <b>{point.high}</b><br/>'},trackByArea:!0,dataLabels:{align:null,verticalAlign:null,xLow:0,xHigh:0,yLow:0,yHigh:0},states:{hover:{halo:!1}}},{pointArrayMap:["low","high"],dataLabelCollections:["dataLabel","dataLabelUpper"],toYData:function(b){return[b.low, | ||
b.high]},pointValKey:"low",deferTranslatePolar:!0,highToXY:function(b){var g=this.chart,d=this.xAxis.postTranslate(b.rectPlotX,this.yAxis.len-b.plotHigh);b.plotHighX=d.x-g.plotLeft;b.plotHigh=d.y-g.plotTop},translate:function(){var b=this,g=b.yAxis;q.area.prototype.translate.apply(b);f(b.points,function(b){var a=b.low,h=b.high,c=b.plotY;null===h||null===a?b.isNull=!0:(b.plotLow=c,b.plotHigh=g.translate(h,0,1,0,1))});this.chart.polar&&f(this.points,function(d){b.highToXY(d)})},getGraphPath:function(b){var g= | ||
[],d=[],a,h=q.area.prototype.getGraphPath,c,e,k;k=this.options;var v=k.step;b=b||this.points;for(a=b.length;a--;)c=b[a],c.isNull||k.connectEnds||b[a+1]&&!b[a+1].isNull||d.push({plotX:c.plotX,plotY:c.plotY,doCurve:!1}),e={polarPlotY:c.polarPlotY,rectPlotX:c.rectPlotX,yBottom:c.yBottom,plotX:u(c.plotHighX,c.plotX),plotY:c.plotHigh,isNull:c.isNull},d.push(e),g.push(e),c.isNull||k.connectEnds||b[a-1]&&!b[a-1].isNull||d.push({plotX:c.plotX,plotY:c.plotY,doCurve:!1});b=h.call(this,b);v&&(!0===v&&(v="left"), | ||
k.step={left:"right",center:"center",right:"left"}[v]);g=h.call(this,g);d=h.call(this,d);k.step=v;k=[].concat(b,g);this.chart.polar||"M"!==d[0]||(d[0]="L");this.graphPath=k;this.areaPath=this.areaPath.concat(b,d);k.isArea=!0;k.xMap=b.xMap;this.areaPath.xMap=b.xMap;return k},drawDataLabels:function(){var b=this.data,g=b.length,d,a=[],h=l.prototype,c=this.options.dataLabels,e=c.align,k=c.verticalAlign,v=c.inside,m,t,q=this.chart.inverted;if(c.enabled||this._hasPointLabels){for(d=g;d--;)if(m=b[d])t= | ||
v?m.plotHigh<m.plotLow:m.plotHigh>m.plotLow,m.y=m.high,m._plotY=m.plotY,m.plotY=m.plotHigh,a[d]=m.dataLabel,m.dataLabel=m.dataLabelUpper,m.below=t,q?e||(c.align=t?"right":"left"):k||(c.verticalAlign=t?"top":"bottom"),c.x=c.xHigh,c.y=c.yHigh;h.drawDataLabels&&h.drawDataLabels.apply(this,arguments);for(d=g;d--;)if(m=b[d])t=v?m.plotHigh<m.plotLow:m.plotHigh>m.plotLow,m.dataLabelUpper=m.dataLabel,m.dataLabel=a[d],m.y=m.low,m.plotY=m._plotY,m.below=!t,q?e||(c.align=t?"left":"right"):k||(c.verticalAlign= | ||
t?"bottom":"top"),c.x=c.xLow,c.y=c.yLow;h.drawDataLabels&&h.drawDataLabels.apply(this,arguments)}c.align=e;c.verticalAlign=k},alignDataLabel:function(){q.column.prototype.alignDataLabel.apply(this,arguments)},setStackedPoints:r,getSymbol:r,drawPoints:r})})(x);(function(a){var f=a.seriesType;f("areasplinerange","arearange",null,{getPointSpline:a.seriesTypes.spline.prototype.getPointSpline})})(x);(function(a){var f=a.defaultPlotOptions,r=a.each,u=a.merge,l=a.noop,p=a.pick,q=a.seriesType,b=a.seriesTypes.column.prototype; | ||
q("columnrange","arearange",u(f.column,f.arearange,{lineWidth:1,pointRange:null}),{translate:function(){var a=this,d=a.yAxis,n=a.xAxis,h=n.startAngleRad,c,e=a.chart,k=a.xAxis.isRadial,v;b.translate.apply(a);r(a.points,function(b){var t=b.shapeArgs,q=a.options.minPointLength,l,w;b.plotHigh=v=d.translate(b.high,0,1,0,1);b.plotLow=b.plotY;w=v;l=p(b.rectPlotY,b.plotY)-v;Math.abs(l)<q?(q-=l,l+=q,w-=q/2):0>l&&(l*=-1,w-=l);k?(c=b.barX+h,b.shapeType="path",b.shapeArgs={d:a.polarArc(w+l,w,c,c+b.pointWidth)}): | ||
(t.height=l,t.y=w,b.tooltipPos=e.inverted?[d.len+d.pos-e.plotLeft-w-l/2,n.len+n.pos-e.plotTop-t.x-t.width/2,l]:[n.left-e.plotLeft+t.x+t.width/2,d.pos-e.plotTop+w+l/2,l])})},directTouch:!0,trackerGroups:["group","dataLabelsGroup"],drawGraph:l,crispCol:b.crispCol,drawPoints:b.drawPoints,drawTracker:b.drawTracker,getColumnMetrics:b.getColumnMetrics,animate:function(){return b.animate.apply(this,arguments)},polarArc:function(){return b.polarArc.apply(this,arguments)},pointAttribs:b.pointAttribs})})(x); | ||
(function(a){var f=a.each,r=a.isNumber,u=a.merge,l=a.pick,p=a.pInt,q=a.Series,b=a.seriesType,g=a.TrackerMixin;b("gauge","line",{dataLabels:{enabled:!0,defer:!1,y:15,borderRadius:3,crop:!1,verticalAlign:"top",zIndex:2,borderWidth:1,borderColor:"#cccccc"},dial:{},pivot:{},tooltip:{headerFormat:""},showInLegend:!1},{angular:!0,directTouch:!0,drawGraph:a.noop,fixedBox:!0,forceDL:!0,noSharedTooltip:!0,trackerGroups:["group","dataLabelsGroup"],translate:function(){var b=this.yAxis,a=this.options,g=b.center; | ||
this.generatePoints();f(this.points,function(c){var e=u(a.dial,c.dial),k=p(l(e.radius,80))*g[2]/200,v=p(l(e.baseLength,70))*k/100,m=p(l(e.rearLength,10))*k/100,t=e.baseWidth||3,q=e.topWidth||1,f=a.overshoot,w=b.startAngleRad+b.translate(c.y,null,null,null,!0);r(f)?(f=f/180*Math.PI,w=Math.max(b.startAngleRad-f,Math.min(b.endAngleRad+f,w))):!1===a.wrap&&(w=Math.max(b.startAngleRad,Math.min(b.endAngleRad,w)));w=180*w/Math.PI;c.shapeType="path";c.shapeArgs={d:e.path||["M",-m,-t/2,"L",v,-t/2,k,-q/2,k, | ||
q/2,v,t/2,-m,t/2,"z"],translateX:g[0],translateY:g[1],rotation:w};c.plotX=g[0];c.plotY=g[1]})},drawPoints:function(){var b=this,a=b.yAxis.center,g=b.pivot,c=b.options,e=c.pivot,k=b.chart.renderer;f(b.points,function(a){var g=a.graphic,e=a.shapeArgs,h=e.d,n=u(c.dial,a.dial);g?(g.animate(e),e.d=h):(a.graphic=k[a.shapeType](e).attr({rotation:e.rotation,zIndex:1}).addClass("highcharts-dial").add(b.group),a.graphic.attr({stroke:n.borderColor||"none","stroke-width":n.borderWidth||0,fill:n.backgroundColor|| | ||
"#000000"}))});g?g.animate({translateX:a[0],translateY:a[1]}):(b.pivot=k.circle(0,0,l(e.radius,5)).attr({zIndex:2}).addClass("highcharts-pivot").translate(a[0],a[1]).add(b.group),b.pivot.attr({"stroke-width":e.borderWidth||0,stroke:e.borderColor||"#cccccc",fill:e.backgroundColor||"#000000"}))},animate:function(b){var a=this;b||(f(a.points,function(b){var c=b.graphic;c&&(c.attr({rotation:180*a.yAxis.startAngleRad/Math.PI}),c.animate({rotation:b.shapeArgs.rotation},a.options.animation))}),a.animate= | ||
null)},render:function(){this.group=this.plotGroup("group","series",this.visible?"visible":"hidden",this.options.zIndex,this.chart.seriesGroup);q.prototype.render.call(this);this.group.clip(this.chart.clipRect)},setData:function(b,a){q.prototype.setData.call(this,b,!1);this.processData();this.generatePoints();l(a,!0)&&this.chart.redraw()},drawTracker:g&&g.drawTrackerPoint},{setState:function(b){this.state=b}})})(x);(function(a){var f=a.each,r=a.noop,u=a.pick,l=a.seriesType,p=a.seriesTypes;l("boxplot", | ||
"column",{threshold:null,tooltip:{pointFormat:'<span style="color:{point.color}">\u25cf</span> <b> {series.name}</b><br/>Maximum: {point.high}<br/>Upper quartile: {point.q3}<br/>Median: {point.median}<br/>Lower quartile: {point.q1}<br/>Minimum: {point.low}<br/>'},whiskerLength:"50%",fillColor:"#ffffff",lineWidth:1,medianWidth:2,states:{hover:{brightness:-.3}},whiskerWidth:2},{pointArrayMap:["low","q1","median","q3","high"],toYData:function(a){return[a.low,a.q1,a.median,a.q3,a.high]},pointValKey:"high", | ||
pointAttribs:function(a){var b=this.options;a=a&&a.color||this.color;return{fill:b.fillColor||a,stroke:b.lineColor||a,"stroke-width":b.lineWidth||0}},drawDataLabels:r,translate:function(){var a=this.yAxis,b=this.pointArrayMap;p.column.prototype.translate.apply(this);f(this.points,function(g){f(b,function(b){null!==g[b]&&(g[b+"Plot"]=a.translate(g[b],0,1,0,1))})})},drawPoints:function(){var a=this,b=a.options,g=a.chart.renderer,d,n,h,c,e,k,v=0,m,t,l,p,w=!1!==a.doQuartiles,r,x=a.options.whiskerLength; | ||
f(a.points,function(f){var y=f.graphic,A=y?"animate":"attr",D=f.shapeArgs,z={},B={},E={},F=f.color||a.color;void 0!==f.plotY&&(m=D.width,t=Math.floor(D.x),l=t+m,p=Math.round(m/2),d=Math.floor(w?f.q1Plot:f.lowPlot),n=Math.floor(w?f.q3Plot:f.lowPlot),h=Math.floor(f.highPlot),c=Math.floor(f.lowPlot),y||(f.graphic=y=g.g("point").add(a.group),f.stem=g.path().addClass("highcharts-boxplot-stem").add(y),x&&(f.whiskers=g.path().addClass("highcharts-boxplot-whisker").add(y)),w&&(f.box=g.path(void 0).addClass("highcharts-boxplot-box").add(y)), | ||
f.medianShape=g.path(void 0).addClass("highcharts-boxplot-median").add(y),z.stroke=f.stemColor||b.stemColor||F,z["stroke-width"]=u(f.stemWidth,b.stemWidth,b.lineWidth),z.dashstyle=f.stemDashStyle||b.stemDashStyle,f.stem.attr(z),x&&(B.stroke=f.whiskerColor||b.whiskerColor||F,B["stroke-width"]=u(f.whiskerWidth,b.whiskerWidth,b.lineWidth),f.whiskers.attr(B)),w&&(y=a.pointAttribs(f),f.box.attr(y)),E.stroke=f.medianColor||b.medianColor||F,E["stroke-width"]=u(f.medianWidth,b.medianWidth,b.lineWidth),f.medianShape.attr(E)), | ||
k=f.stem.strokeWidth()%2/2,v=t+p+k,f.stem[A]({d:["M",v,n,"L",v,h,"M",v,d,"L",v,c]}),w&&(k=f.box.strokeWidth()%2/2,d=Math.floor(d)+k,n=Math.floor(n)+k,t+=k,l+=k,f.box[A]({d:["M",t,n,"L",t,d,"L",l,d,"L",l,n,"L",t,n,"z"]})),x&&(k=f.whiskers.strokeWidth()%2/2,h+=k,c+=k,r=/%$/.test(x)?p*parseFloat(x)/100:x/2,f.whiskers[A]({d:["M",v-r,h,"L",v+r,h,"M",v-r,c,"L",v+r,c]})),e=Math.round(f.medianPlot),k=f.medianShape.strokeWidth()%2/2,e+=k,f.medianShape[A]({d:["M",t,e,"L",l,e]}))})},setStackedPoints:r})})(x); | ||
(function(a){var f=a.each,r=a.noop,u=a.seriesType,l=a.seriesTypes;u("errorbar","boxplot",{color:"#000000",grouping:!1,linkedTo:":previous",tooltip:{pointFormat:'<span style="color:{point.color}">\u25cf</span> {series.name}: <b>{point.low}</b> - <b>{point.high}</b><br/>'},whiskerWidth:null},{type:"errorbar",pointArrayMap:["low","high"],toYData:function(a){return[a.low,a.high]},pointValKey:"high",doQuartiles:!1,drawDataLabels:l.arearange?function(){var a=this.pointValKey;l.arearange.prototype.drawDataLabels.call(this); | ||
f(this.data,function(f){f.y=f[a]})}:r,getColumnMetrics:function(){return this.linkedParent&&this.linkedParent.columnMetrics||l.column.prototype.getColumnMetrics.call(this)}})})(x);(function(a){var f=a.correctFloat,r=a.isNumber,u=a.pick,l=a.Point,p=a.Series,q=a.seriesType,b=a.seriesTypes;q("waterfall","column",{dataLabels:{inside:!0},lineWidth:1,lineColor:"#333333",dashStyle:"dot",borderColor:"#333333",states:{hover:{lineWidthPlus:0}}},{pointValKey:"y",translate:function(){var a=this.options,d=this.yAxis, | ||
n,h,c,e,k,v,m,t,l,p=u(a.minPointLength,5),w=a.threshold,q=a.stacking;b.column.prototype.translate.apply(this);this.minPointLengthOffset=0;m=t=w;h=this.points;n=0;for(a=h.length;n<a;n++)c=h[n],v=this.processedYData[n],e=c.shapeArgs,l=(k=q&&d.stacks[(this.negStacks&&v<w?"-":"")+this.stackKey])?k[c.x].points[this.index+","+n]:[0,v],c.isSum?c.y=f(v):c.isIntermediateSum&&(c.y=f(v-t)),k=Math.max(m,m+c.y)+l[0],e.y=d.toPixels(k,!0),c.isSum?(e.y=d.toPixels(l[1],!0),e.height=Math.min(d.toPixels(l[0],!0),d.len)- | ||
e.y+this.minPointLengthOffset):c.isIntermediateSum?(e.y=d.toPixels(l[1],!0),e.height=Math.min(d.toPixels(t,!0),d.len)-e.y+this.minPointLengthOffset,t=l[1]):(e.height=0<v?d.toPixels(m,!0)-e.y:d.toPixels(m,!0)-d.toPixels(m-v,!0),m+=v),0>e.height&&(e.y+=e.height,e.height*=-1),c.plotY=e.y=Math.round(e.y)-this.borderWidth%2/2,e.height=Math.max(Math.round(e.height),.001),c.yBottom=e.y+e.height,e.height<=p&&(e.height=p,this.minPointLengthOffset+=p),e.y-=this.minPointLengthOffset,e=c.plotY+(c.negative?e.height: | ||
0)-this.minPointLengthOffset,this.chart.inverted?c.tooltipPos[0]=d.len-e:c.tooltipPos[1]=e},processData:function(b){var a=this.yData,n=this.options.data,h,c=a.length,e,k,l,m,t,q;k=e=l=m=this.options.threshold||0;for(q=0;q<c;q++)t=a[q],h=n&&n[q]?n[q]:{},"sum"===t||h.isSum?a[q]=f(k):"intermediateSum"===t||h.isIntermediateSum?a[q]=f(e):(k+=t,e+=t),l=Math.min(k,l),m=Math.max(k,m);p.prototype.processData.call(this,b);this.dataMin=l;this.dataMax=m},toYData:function(b){return b.isSum?0===b.x?null:"sum": | ||
b.isIntermediateSum?0===b.x?null:"intermediateSum":b.y},pointAttribs:function(a,d){var n=this.options.upColor;n&&!a.options.color&&(a.color=0<a.y?n:null);n=b.column.prototype.pointAttribs.call(this,a,d);delete n.dashstyle;return n},getGraphPath:function(){return["M",0,0]},getCrispPath:function(){var b=this.data,a=b.length,n=this.graph.strokeWidth()+this.borderWidth,n=Math.round(n)%2/2,h=[],c,e,k;for(k=1;k<a;k++)e=b[k].shapeArgs,c=b[k-1].shapeArgs,e=["M",c.x+c.width,c.y+n,"L",e.x,c.y+n],0>b[k-1].y&& | ||
(e[2]+=c.height,e[5]+=c.height),h=h.concat(e);return h},drawGraph:function(){p.prototype.drawGraph.call(this);this.graph.attr({d:this.getCrispPath()})},getExtremes:a.noop},{getClassName:function(){var b=l.prototype.getClassName.call(this);this.isSum?b+=" highcharts-sum":this.isIntermediateSum&&(b+=" highcharts-intermediate-sum");return b},isValid:function(){return r(this.y,!0)||this.isSum||this.isIntermediateSum}})})(x);(function(a){var f=a.Series,r=a.seriesType,u=a.seriesTypes;r("polygon","scatter", | ||
{marker:{enabled:!1,states:{hover:{enabled:!1}}},stickyTracking:!1,tooltip:{followPointer:!0,pointFormat:""},trackByArea:!0},{type:"polygon",getGraphPath:function(){for(var a=f.prototype.getGraphPath.call(this),p=a.length+1;p--;)(p===a.length||"M"===a[p])&&0<p&&a.splice(p,0,"z");return this.areaPath=a},drawGraph:function(){this.options.fillColor=this.color;u.area.prototype.drawGraph.call(this)},drawLegendSymbol:a.LegendSymbolMixin.drawRectangle,drawTracker:f.prototype.drawTracker,setStackedPoints:a.noop})})(x); | ||
(function(a){var f=a.arrayMax,r=a.arrayMin,u=a.Axis,l=a.color,p=a.each,q=a.isNumber,b=a.noop,g=a.pick,d=a.pInt,n=a.Point,h=a.Series,c=a.seriesType,e=a.seriesTypes;c("bubble","scatter",{dataLabels:{formatter:function(){return this.point.z},inside:!0,verticalAlign:"middle"},marker:{lineColor:null,lineWidth:1,radius:null,states:{hover:{radiusPlus:0}}},minSize:8,maxSize:"20%",softThreshold:!1,states:{hover:{halo:{size:5}}},tooltip:{pointFormat:"({point.x}, {point.y}), Size: {point.z}"},turboThreshold:0, | ||
zThreshold:0,zoneAxis:"z"},{pointArrayMap:["y","z"],parallelArrays:["x","y","z"],trackerGroups:["group","dataLabelsGroup"],bubblePadding:!0,zoneAxis:"z",pointAttribs:function(b,a){var c=g(this.options.marker.fillOpacity,.5),d=h.prototype.pointAttribs.call(this,b,a);1!==c&&(d.fill=l(d.fill).setOpacity(c).get("rgba"));return d},getRadii:function(b,a,c,d){var e,g,h,n=this.zData,f=[],l=this.options,p="width"!==l.sizeBy,q=l.zThreshold,r=a-b;g=0;for(e=n.length;g<e;g++)h=n[g],l.sizeByAbsoluteValue&&null!== | ||
h&&(h=Math.abs(h-q),a=Math.max(a-q,Math.abs(b-q)),b=0),null===h?h=null:h<b?h=c/2-1:(h=0<r?(h-b)/r:.5,p&&0<=h&&(h=Math.sqrt(h)),h=Math.ceil(c+h*(d-c))/2),f.push(h);this.radii=f},animate:function(b){var a=this.options.animation;b||(p(this.points,function(b){var c=b.graphic;b=b.shapeArgs;c&&b&&(c.attr("r",1),c.animate({r:b.r},a))}),this.animate=null)},translate:function(){var b,a=this.data,c,d,g=this.radii;e.scatter.prototype.translate.call(this);for(b=a.length;b--;)c=a[b],d=g?g[b]:0,q(d)&&d>=this.minPxSize/ | ||
2?(c.shapeType="circle",c.shapeArgs={x:c.plotX,y:c.plotY,r:d},c.dlBox={x:c.plotX-d,y:c.plotY-d,width:2*d,height:2*d}):c.shapeArgs=c.plotY=c.dlBox=void 0},drawLegendSymbol:function(b,a){var c=this.chart.renderer,d=c.fontMetrics(b.itemStyle.fontSize).f/2;a.legendSymbol=c.circle(d,b.baseline-d,d).attr({zIndex:3}).add(a.legendGroup);a.legendSymbol.isMarker=!0},drawPoints:e.column.prototype.drawPoints,alignDataLabel:e.column.prototype.alignDataLabel,buildKDTree:b,applyZones:b},{haloPath:function(){return n.prototype.haloPath.call(this, | ||
this.shapeArgs.r+this.series.options.states.hover.halo.size)},ttBelow:!1});u.prototype.beforePadding=function(){var b=this,a=this.len,c=this.chart,e=0,h=a,n=this.isXAxis,l=n?"xData":"yData",u=this.min,x={},C=Math.min(c.plotWidth,c.plotHeight),y=Number.MAX_VALUE,A=-Number.MAX_VALUE,D=this.max-u,z=a/D,B=[];p(this.series,function(a){var e=a.options;!a.bubblePadding||!a.visible&&c.options.chart.ignoreHiddenSeries||(b.allowZoomOutside=!0,B.push(a),n&&(p(["minSize","maxSize"],function(b){var a=e[b],c=/%$/.test(a), | ||
a=d(a);x[b]=c?C*a/100:a}),a.minPxSize=x.minSize,a.maxPxSize=x.maxSize,a=a.zData,a.length&&(y=g(e.zMin,Math.min(y,Math.max(r(a),!1===e.displayNegative?e.zThreshold:-Number.MAX_VALUE))),A=g(e.zMax,Math.max(A,f(a))))))});p(B,function(a){var c=a[l],d=c.length,g;n&&a.getRadii(y,A,a.minPxSize,a.maxPxSize);if(0<D)for(;d--;)q(c[d])&&b.dataMin<=c[d]&&c[d]<=b.dataMax&&(g=a.radii[d],e=Math.min((c[d]-u)*z-g,e),h=Math.max((c[d]-u)*z+g,h))});B.length&&0<D&&!this.isLog&&(h-=a,z*=(a+e-h)/a,p([["min","userMin",e], | ||
["max","userMax",h]],function(a){void 0===g(b.options[a[0]],b[a[1]])&&(b[a[0]]+=a[2]/z)}))}})(x);(function(a){function f(b,a){var d=this.chart,n=this.options.animation,h=this.group,c=this.markerGroup,e=this.xAxis.center,k=d.plotLeft,f=d.plotTop;d.polar?d.renderer.isSVG&&(!0===n&&(n={}),a?(d={translateX:e[0]+k,translateY:e[1]+f,scaleX:.001,scaleY:.001},h.attr(d),c&&c.attr(d)):(d={translateX:k,translateY:f,scaleX:1,scaleY:1},h.animate(d,n),c&&c.animate(d,n),this.animate=null)):b.call(this,a)}var r= | ||
a.each,u=a.pick,l=a.seriesTypes,p=a.wrap,q=a.Series.prototype;a=a.Pointer.prototype;q.searchPointByAngle=function(b){var a=this.chart,d=this.xAxis.pane.center;return this.searchKDTree({clientX:180+-180/Math.PI*Math.atan2(b.chartX-d[0]-a.plotLeft,b.chartY-d[1]-a.plotTop)})};p(q,"buildKDTree",function(b){this.chart.polar&&(this.kdByAngle?this.searchPoint=this.searchPointByAngle:this.kdDimensions=2);b.apply(this)});q.toXY=function(b){var a,d=this.chart,n=b.plotX;a=b.plotY;b.rectPlotX=n;b.rectPlotY=a; | ||
a=this.xAxis.postTranslate(b.plotX,this.yAxis.len-a);b.plotX=b.polarPlotX=a.x-d.plotLeft;b.plotY=b.polarPlotY=a.y-d.plotTop;this.kdByAngle?(d=(n/Math.PI*180+this.xAxis.pane.options.startAngle)%360,0>d&&(d+=360),b.clientX=d):b.clientX=b.plotX};l.spline&&p(l.spline.prototype,"getPointSpline",function(a,g,d,n){var h,c,e,k,f,m,l;this.chart.polar?(h=d.plotX,c=d.plotY,a=g[n-1],e=g[n+1],this.connectEnds&&(a||(a=g[g.length-2]),e||(e=g[1])),a&&e&&(k=a.plotX,f=a.plotY,g=e.plotX,m=e.plotY,k=(1.5*h+k)/2.5,f= | ||
(1.5*c+f)/2.5,e=(1.5*h+g)/2.5,l=(1.5*c+m)/2.5,g=Math.sqrt(Math.pow(k-h,2)+Math.pow(f-c,2)),m=Math.sqrt(Math.pow(e-h,2)+Math.pow(l-c,2)),k=Math.atan2(f-c,k-h),f=Math.atan2(l-c,e-h),l=Math.PI/2+(k+f)/2,Math.abs(k-l)>Math.PI/2&&(l-=Math.PI),k=h+Math.cos(l)*g,f=c+Math.sin(l)*g,e=h+Math.cos(Math.PI+l)*m,l=c+Math.sin(Math.PI+l)*m,d.rightContX=e,d.rightContY=l),n?(d=["C",a.rightContX||a.plotX,a.rightContY||a.plotY,k||h,f||c,h,c],a.rightContX=a.rightContY=null):d=["M",h,c]):d=a.call(this,g,d,n);return d}); | ||
p(q,"translate",function(a){var g=this.chart;a.call(this);if(g.polar&&(this.kdByAngle=g.tooltip&&g.tooltip.shared,!this.preventPostTranslate))for(a=this.points,g=a.length;g--;)this.toXY(a[g])});p(q,"getGraphPath",function(a,g){var d=this,f,h;if(this.chart.polar){g=g||this.points;for(f=0;f<g.length;f++)if(!g[f].isNull){h=f;break}!1!==this.options.connectEnds&&void 0!==h&&(this.connectEnds=!0,g.splice(g.length,0,g[h]));r(g,function(a){void 0===a.polarPlotY&&d.toXY(a)})}return a.apply(this,[].slice.call(arguments, | ||
1))});p(q,"animate",f);l.column&&(l=l.column.prototype,l.polarArc=function(a,g,d,f){var h=this.xAxis.center,c=this.yAxis.len;return this.chart.renderer.symbols.arc(h[0],h[1],c-g,null,{start:d,end:f,innerR:c-u(a,c)})},p(l,"animate",f),p(l,"translate",function(a){var g=this.xAxis,d=g.startAngleRad,f,h,c;this.preventPostTranslate=!0;a.call(this);if(g.isRadial)for(f=this.points,c=f.length;c--;)h=f[c],a=h.barX+d,h.shapeType="path",h.shapeArgs={d:this.polarArc(h.yBottom,h.plotY,a,a+h.pointWidth)},this.toXY(h), | ||
h.tooltipPos=[h.plotX,h.plotY],h.ttBelow=h.plotY>g.center[1]}),p(l,"alignDataLabel",function(a,g,d,f,h,c){this.chart.polar?(a=g.rectPlotX/Math.PI*180,null===f.align&&(f.align=20<a&&160>a?"left":200<a&&340>a?"right":"center"),null===f.verticalAlign&&(f.verticalAlign=45>a||315<a?"bottom":135<a&&225>a?"top":"middle"),q.alignDataLabel.call(this,g,d,f,h,c)):a.call(this,g,d,f,h,c)}));p(a,"getCoordinates",function(a,f){var d=this.chart,l={xAxis:[],yAxis:[]};d.polar?r(d.axes,function(a){var b=a.isXAxis,e= | ||
a.center,k=f.chartX-e[0]-d.plotLeft,e=f.chartY-e[1]-d.plotTop;l[b?"xAxis":"yAxis"].push({axis:a,value:a.translate(b?Math.PI-Math.atan2(k,e):Math.sqrt(Math.pow(k,2)+Math.pow(e,2)),!0)})}):l=a.call(this,f);return l})})(x)}); |
@@ -1,13 +0,22 @@ | ||
(function(c){typeof module==="object"&&module.exports?module.exports=c:c(Highcharts)})(function(c){function A(a,b,d,f,h){for(var h=h||0,f=f||B,c=h+f,r=!0;r&&h<c&&h<a.length;)r=b(a[h],h),h+=1;r&&(h<a.length?setTimeout(function(){A(a,b,d,f,h)}):d&&d())}var s=c.win.document,R=function(){},S=c.Color,k=c.Series,e=c.seriesTypes,l=c.each,t=c.extend,T=c.addEvent,U=c.fireEvent,u=c.grep,m=c.isNumber,V=c.merge,W=c.pick,j=c.wrap,p=c.getOptions().plotOptions,B=5E4,C;l(["area","arearange","column","line","scatter"], | ||
function(a){if(p[a])p[a].boostThreshold=5E3});l(["translate","generatePoints","drawTracker","drawPoints","render"],function(a){function b(b){var f=this.options.stacking&&(a==="translate"||a==="generatePoints");if((this.processedXData||this.options.data).length<(this.options.boostThreshold||Number.MAX_VALUE)||f){if(a==="render"&&this.image)this.image.attr({href:""}),this.animate=null;b.call(this)}else if(this[a+"Canvas"])this[a+"Canvas"]()}j(k.prototype,a,b);a==="translate"&&(e.column&&j(e.column.prototype, | ||
a,b),e.arearange&&j(e.arearange.prototype,a,b))});j(k.prototype,"getExtremes",function(a){this.hasExtremes()||a.apply(this,Array.prototype.slice.call(arguments,1))});j(k.prototype,"setData",function(a){this.hasExtremes(!0)||a.apply(this,Array.prototype.slice.call(arguments,1))});j(k.prototype,"processData",function(a){this.hasExtremes(!0)||a.apply(this,Array.prototype.slice.call(arguments,1))});c.extend(k.prototype,{pointRange:0,allowDG:!1,hasExtremes:function(a){var b=this.options,d=this.xAxis&& | ||
this.xAxis.options,f=this.yAxis&&this.yAxis.options;return b.data.length>(b.boostThreshold||Number.MAX_VALUE)&&m(f.min)&&m(f.max)&&(!a||m(d.min)&&m(d.max))},destroyGraphics:function(){var a=this,b=this.points,d,f;if(b)for(f=0;f<b.length;f+=1)if((d=b[f])&&d.graphic)d.graphic=d.graphic.destroy();l(["graph","area","tracker"],function(b){a[b]&&(a[b]=a[b].destroy())})},getContext:function(){var a=this.chart,b=a.plotWidth,d=a.plotHeight,f=this.ctx,h=function(a,b,d,f,h,c,e){a.call(this,d,b,f,h,c,e)};this.canvas? | ||
f.clearRect(0,0,b,d):(this.canvas=s.createElement("canvas"),this.image=a.renderer.image("",0,0,b,d).add(this.group),this.ctx=f=this.canvas.getContext("2d"),a.inverted&&l(["moveTo","lineTo","rect","arc"],function(a){j(f,a,h)}));this.canvas.width=b;this.canvas.height=d;this.image.attr({width:b,height:d});return f},canvasToSVG:function(){this.image.attr({href:this.canvas.toDataURL("image/png")})},cvsLineTo:function(a,b,d){a.lineTo(b,d)},renderCanvas:function(){var a=this,b=a.options,d=a.chart,f=this.xAxis, | ||
h=this.yAxis,c,e=0,j=a.processedXData,k=a.processedYData,l=b.data,i=f.getExtremes(),p=i.min,s=i.max,i=h.getExtremes(),u=i.min,X=i.max,D={},v,Y=!!a.sampling,E,F=b.marker&&b.marker.radius,G=this.cvsDrawPoint,w=b.lineWidth?this.cvsLineTo:!1,H=F<=1?this.cvsMarkerSquare:this.cvsMarkerCircle,Z=b.enableMouseTracking!==!1,I,i=b.threshold,n=h.getThreshold(i),J=m(i),K=n,$=this.fill,L=a.pointArrayMap&&a.pointArrayMap.join(",")==="low,high",M=!!b.stacking,aa=a.cropStart||0,i=d.options.loading,ba=a.requireSorting, | ||
N,ca=b.connectNulls,O=!j,x,y,o,q,da=a.fillOpacity?(new S(a.color)).setOpacity(W(b.fillOpacity,0.75)).get():a.color,P=function(){$?(c.fillStyle=da,c.fill()):(c.strokeStyle=a.color,c.lineWidth=b.lineWidth,c.stroke())},Q=function(a,b,d){if(e===0&&(c.beginPath(),w))c.lineJoin="round";N?c.moveTo(a,b):G?G(c,a,b,d,I):w?w(c,a,b):H&&H(c,a,b,F);e+=1;e===1E3&&(P(),e=0);I={clientX:a,plotY:b,yBottom:d}},z=function(a,b,c){Z&&!D[a+","+b]&&(D[a+","+b]=!0,d.inverted&&(a=f.len-a,b=h.len-b),E.push({clientX:a,plotX:a, | ||
plotY:b,i:aa+c}))};(this.points||this.graph)&&this.destroyGraphics();a.plotGroup("group","series",a.visible?"visible":"hidden",b.zIndex,d.seriesGroup);a.getAttribs();a.markerGroup=a.group;T(a,"destroy",function(){a.markerGroup=null});E=this.points=[];c=this.getContext();a.buildKDTree=R;if(l.length>99999)d.options.loading=V(i,{labelStyle:{backgroundColor:"rgba(255,255,255,0.75)",padding:"1em",borderRadius:"0.5em"},style:{backgroundColor:"none",opacity:1}}),clearTimeout(C),d.showLoading("Drawing..."), | ||
d.options.loading=i;A(M?a.data:j||l,function(b,c){var e,g,j,i,l=typeof d.index==="undefined",m=!0;if(!l){O?(e=b[0],g=b[1]):(e=b,g=k[c]);if(L)O&&(g=b.slice(1,3)),i=g[0],g=g[1];else if(M)e=b.x,g=b.stackY,i=g-b.y;j=g===null;ba||(m=g>=u&&g<=X);if(!j&&e>=p&&e<=s&&m)if(e=Math.round(f.toPixels(e,!0)),Y){if(o===void 0||e===v){L||(i=g);if(q===void 0||g>y)y=g,q=c;if(o===void 0||i<x)x=i,o=c}e!==v&&(o!==void 0&&(g=h.toPixels(y,!0),n=h.toPixels(x,!0),Q(e,J?Math.min(g,K):g,J?Math.max(n,K):n),z(e,g,q),n!==g&&z(e, | ||
n,o)),o=q=void 0,v=e)}else g=Math.round(h.toPixels(g,!0)),Q(e,g,n),z(e,g,c);N=j&&!ca;c%B===0&&a.canvasToSVG()}return!l},function(){var b=d.loadingDiv,c=d.loadingShown;P();a.canvasToSVG();U(a,"renderedCanvas");if(c)t(b.style,{transition:"opacity 250ms",opacity:0}),d.loadingShown=!1,C=setTimeout(function(){b.parentNode&&b.parentNode.removeChild(b);d.loadingDiv=d.loadingSpan=null},250);a.directTouch=!1;a.options.stickyTracking=!0;delete a.buildKDTree;a.buildKDTree()},d.renderer.forExport?Number.MAX_VALUE: | ||
void 0)}});e.scatter.prototype.cvsMarkerCircle=function(a,b,d,c){a.moveTo(b,d);a.arc(b,d,c,0,2*Math.PI,!1)};e.scatter.prototype.cvsMarkerSquare=function(a,b,d,c){a.rect(b-c,d-c,c*2,c*2)};e.scatter.prototype.fill=!0;t(e.area.prototype,{cvsDrawPoint:function(a,b,d,c,e){e&&b!==e.clientX&&(a.moveTo(e.clientX,e.yBottom),a.lineTo(e.clientX,e.plotY),a.lineTo(b,d),a.lineTo(b,c))},fill:!0,fillOpacity:!0,sampling:!0});t(e.column.prototype,{cvsDrawPoint:function(a,b,c,e){a.rect(b-1,c,1,e-c)},fill:!0,sampling:!0}); | ||
k.prototype.getPoint=function(a){var b=a;if(a&&!(a instanceof this.pointClass))b=(new this.pointClass).init(this,this.options.data[a.i]),b.category=b.x,b.dist=a.dist,b.distX=a.distX,b.plotX=a.plotX,b.plotY=a.plotY;return b};j(k.prototype,"destroy",function(a){var b=this,c=b.chart;if(c.hoverPoints)c.hoverPoints=u(c.hoverPoints,function(a){return a.series===b});if(c.hoverPoint&&c.hoverPoint.series===b)c.hoverPoint=null;a.call(this)});j(k.prototype,"searchPoint",function(a){return this.getPoint(a.apply(this, | ||
[].slice.call(arguments,1)))})}); | ||
/* | ||
Highcharts JS v5.0.0 (2016-09-29) | ||
Boost module | ||
(c) 2010-2016 Highsoft AS | ||
Author: Torstein Honsi | ||
License: www.highcharts.com/license | ||
*/ | ||
(function(n){"object"===typeof module&&module.exports?module.exports=n:n(Highcharts)})(function(n){(function(f){function n(a,b,c,e,h){h=h||0;e=e||5E4;for(var k=h+e,f=!0;f&&h<k&&h<a.length;)f=b(a[h],h),h+=1;f&&(h<a.length?setTimeout(function(){n(a,b,c,e,h)}):c&&c())}var x=f.win.document,U=function(){},V=f.Color,p=f.Series,d=f.seriesTypes,q=f.each,y=f.extend,W=f.addEvent,X=f.fireEvent,z=f.grep,u=f.isNumber,Y=f.merge,Z=f.pick,l=f.wrap,v=f.getOptions().plotOptions,F;q(["area","arearange","column","line", | ||
"scatter"],function(a){v[a]&&(v[a].boostThreshold=5E3)});q(["translate","generatePoints","drawTracker","drawPoints","render"],function(a){function b(b){var e=this.options.stacking&&("translate"===a||"generatePoints"===a);if((this.processedXData||this.options.data).length<(this.options.boostThreshold||Number.MAX_VALUE)||e)"render"===a&&this.image&&(this.image.attr({href:""}),this.animate=null),b.call(this);else if(this[a+"Canvas"])this[a+"Canvas"]()}l(p.prototype,a,b);"translate"===a&&(d.column&&l(d.column.prototype, | ||
a,b),d.arearange&&l(d.arearange.prototype,a,b))});l(p.prototype,"getExtremes",function(a){this.hasExtremes()||a.apply(this,Array.prototype.slice.call(arguments,1))});l(p.prototype,"setData",function(a){this.hasExtremes(!0)||a.apply(this,Array.prototype.slice.call(arguments,1))});l(p.prototype,"processData",function(a){this.hasExtremes(!0)||a.apply(this,Array.prototype.slice.call(arguments,1))});f.extend(p.prototype,{pointRange:0,allowDG:!1,hasExtremes:function(a){var b=this.options,c=this.xAxis&& | ||
this.xAxis.options,e=this.yAxis&&this.yAxis.options;return b.data.length>(b.boostThreshold||Number.MAX_VALUE)&&u(e.min)&&u(e.max)&&(!a||u(c.min)&&u(c.max))},destroyGraphics:function(){var a=this,b=this.points,c,e;if(b)for(e=0;e<b.length;e+=1)(c=b[e])&&c.graphic&&(c.graphic=c.graphic.destroy());q(["graph","area","tracker"],function(b){a[b]&&(a[b]=a[b].destroy())})},getContext:function(){var a=this.chart,b=a.plotWidth,c=a.plotHeight,e=this.ctx,h=function(a,b,c,e,h,f,d){a.call(this,c,b,e,h,f,d)};this.canvas? | ||
e.clearRect(0,0,b,c):(this.canvas=x.createElement("canvas"),this.image=a.renderer.image("",0,0,b,c).add(this.group),this.ctx=e=this.canvas.getContext("2d"),a.inverted&&q(["moveTo","lineTo","rect","arc"],function(a){l(e,a,h)}));this.canvas.width=b;this.canvas.height=c;this.image.attr({width:b,height:c});return e},canvasToSVG:function(){this.image.attr({href:this.canvas.toDataURL("image/png")})},cvsLineTo:function(a,b,c){a.lineTo(b,c)},renderCanvas:function(){var a=this,b=a.options,c=a.chart,e=this.xAxis, | ||
h=this.yAxis,k,d=0,l=a.processedXData,p=a.processedYData,q=b.data,m=e.getExtremes(),v=m.min,x=m.max,m=h.getExtremes(),z=m.min,aa=m.max,G={},A,ba=!!a.sampling,H,I=b.marker&&b.marker.radius,J=this.cvsDrawPoint,B=b.lineWidth?this.cvsLineTo:!1,K=1>=I?this.cvsMarkerSquare:this.cvsMarkerCircle,ca=!1!==b.enableMouseTracking,L,m=b.threshold,r=h.getThreshold(m),M=u(m),N=r,da=this.fill,O=a.pointArrayMap&&"low,high"===a.pointArrayMap.join(","),P=!!b.stacking,ea=a.cropStart||0,m=c.options.loading,fa=a.requireSorting, | ||
Q,ga=b.connectNulls,R=!l,C,D,t,w,ha=a.fillOpacity?(new V(a.color)).setOpacity(Z(b.fillOpacity,.75)).get():a.color,S=function(){da?(k.fillStyle=ha,k.fill()):(k.strokeStyle=a.color,k.lineWidth=b.lineWidth,k.stroke())},T=function(a,b,c){0===d&&(k.beginPath(),B&&(k.lineJoin="round"));Q?k.moveTo(a,b):J?J(k,a,b,c,L):B?B(k,a,b):K&&K(k,a,b,I);d+=1;1E3===d&&(S(),d=0);L={clientX:a,plotY:b,yBottom:c}},E=function(a,b,f){ca&&!G[a+","+b]&&(G[a+","+b]=!0,c.inverted&&(a=e.len-a,b=h.len-b),H.push({clientX:a,plotX:a, | ||
plotY:b,i:ea+f}))};(this.points||this.graph)&&this.destroyGraphics();a.plotGroup("group","series",a.visible?"visible":"hidden",b.zIndex,c.seriesGroup);a.markerGroup=a.group;W(a,"destroy",function(){a.markerGroup=null});H=this.points=[];k=this.getContext();a.buildKDTree=U;99999<q.length&&(c.options.loading=Y(m,{labelStyle:{backgroundColor:f.color("#ffffff").setOpacity(.75).get(),padding:"1em",borderRadius:"0.5em"},style:{backgroundColor:"none",opacity:1}}),clearTimeout(F),c.showLoading("Drawing..."), | ||
c.options.loading=m);n(P?a.data:l||q,function(b,f){var d,g,k,l,m="undefined"===typeof c.index,n=!0;if(!m){R?(d=b[0],g=b[1]):(d=b,g=p[f]);O?(R&&(g=b.slice(1,3)),l=g[0],g=g[1]):P&&(d=b.x,g=b.stackY,l=g-b.y);k=null===g;fa||(n=g>=z&&g<=aa);if(!k&&d>=v&&d<=x&&n)if(d=Math.round(e.toPixels(d,!0)),ba){if(void 0===t||d===A){O||(l=g);if(void 0===w||g>D)D=g,w=f;if(void 0===t||l<C)C=l,t=f}d!==A&&(void 0!==t&&(g=h.toPixels(D,!0),r=h.toPixels(C,!0),T(d,M?Math.min(g,N):g,M?Math.max(r,N):r),E(d,g,w),r!==g&&E(d,r, | ||
t)),t=w=void 0,A=d)}else g=Math.round(h.toPixels(g,!0)),T(d,g,r),E(d,g,f);Q=k&&!ga;0===f%5E4&&a.canvasToSVG()}return!m},function(){var b=c.loadingDiv,e=c.loadingShown;S();a.canvasToSVG();X(a,"renderedCanvas");e&&(y(b.style,{transition:"opacity 250ms",opacity:0}),c.loadingShown=!1,F=setTimeout(function(){b.parentNode&&b.parentNode.removeChild(b);c.loadingDiv=c.loadingSpan=null},250));a.directTouch=!1;a.options.stickyTracking=!0;delete a.buildKDTree;a.buildKDTree()},c.renderer.forExport?Number.MAX_VALUE: | ||
void 0)}});d.scatter.prototype.cvsMarkerCircle=function(a,b,c,e){a.moveTo(b,c);a.arc(b,c,e,0,2*Math.PI,!1)};d.scatter.prototype.cvsMarkerSquare=function(a,b,c,e){a.rect(b-e,c-e,2*e,2*e)};d.scatter.prototype.fill=!0;y(d.area.prototype,{cvsDrawPoint:function(a,b,c,e,d){d&&b!==d.clientX&&(a.moveTo(d.clientX,d.yBottom),a.lineTo(d.clientX,d.plotY),a.lineTo(b,c),a.lineTo(b,e))},fill:!0,fillOpacity:!0,sampling:!0});y(d.column.prototype,{cvsDrawPoint:function(a,b,c,e){a.rect(b-1,c,1,e-c)},fill:!0,sampling:!0}); | ||
p.prototype.getPoint=function(a){var b=a;!a||a instanceof this.pointClass||(b=(new this.pointClass).init(this,this.options.data[a.i]),b.category=b.x,b.dist=a.dist,b.distX=a.distX,b.plotX=a.plotX,b.plotY=a.plotY);return b};l(p.prototype,"destroy",function(a){var b=this,c=b.chart;c.hoverPoints&&(c.hoverPoints=z(c.hoverPoints,function(a){return a.series===b}));c.hoverPoint&&c.hoverPoint.series===b&&(c.hoverPoint=null);a.call(this)});l(p.prototype,"searchPoint",function(a){return this.getPoint(a.apply(this, | ||
[].slice.call(arguments,1)))})})(n)}); |
/** | ||
* This is an experimental Highcharts module that draws long data series on a canvas | ||
* in order to increase performance of the initial load time and tooltip responsiveness. | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* Boost module | ||
* | ||
* Compatible with HTML5 canvas compatible browsers (not IE < 9). | ||
* | ||
* (c) 2010-2016 Highsoft AS | ||
* Author: Torstein Honsi | ||
* | ||
* | ||
* Development plan | ||
* - Column range. | ||
* - Heatmap. | ||
* - Treemap. | ||
* - Check how it works with Highstock and data grouping. Currently it only works when navigator.adaptToUpdatedData | ||
* is false. It is also recommended to set scrollbar.liveRedraw to false. | ||
* - Check inverted charts. | ||
* - Check reversed axes. | ||
* - Chart callback should be async after last series is drawn. (But not necessarily, we don't do | ||
that with initial series animation). | ||
* - Cache full-size image so we don't have to redraw on hide/show and zoom up. But k-d-tree still | ||
* needs to be built. | ||
* - Test IE9 and IE10. | ||
* - Stacking is not perhaps not correct since it doesn't use the translation given in | ||
* the translate method. If this gets to complicated, a possible way out would be to | ||
* have a simplified renderCanvas method that simply draws the areaPath on a canvas. | ||
* | ||
* If this module is taken in as part of the core | ||
* - All the loading logic should be merged with core. Update styles in the core. | ||
* - Most of the method wraps should probably be added directly in parent methods. | ||
* | ||
* Notes for boost mode | ||
* - Area lines are not drawn | ||
* - Point markers are not drawn on line-type series | ||
* - Lines are not drawn on scatter charts | ||
* - Zones and negativeColor don't work | ||
* - Columns are always one pixel wide. Don't set the threshold too low. | ||
* | ||
* Optimizing tips for users | ||
* - For scatter plots, use a marker.radius of 1 or less. It results in a rectangle being drawn, which is | ||
* considerably faster than a circle. | ||
* - Set extremes (min, max) explicitly on the axes in order for Highcharts to avoid computing extremes. | ||
* - Set enableMouseTracking to false on the series to improve total rendering time. | ||
* - The default threshold is set based on one series. If you have multiple, dense series, the combined | ||
* number of points drawn gets higher, and you may want to set the threshold lower in order to | ||
* use optimizations. | ||
* License: www.highcharts.com/license | ||
*/ | ||
/* eslint indent: [2, 4] */ | ||
(function (factory) { | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
@@ -55,568 +16,622 @@ module.exports = factory; | ||
} | ||
}(function (H) { | ||
}(function(Highcharts) { | ||
(function(H) { | ||
/** | ||
* License: www.highcharts.com/license | ||
* Author: Torstein Honsi | ||
* | ||
* This is an experimental Highcharts module that draws long data series on a canvas | ||
* in order to increase performance of the initial load time and tooltip responsiveness. | ||
* | ||
* Compatible with HTML5 canvas compatible browsers (not IE < 9). | ||
* | ||
* | ||
* | ||
* Development plan | ||
* - Column range. | ||
* - Heatmap. | ||
* - Treemap. | ||
* - Check how it works with Highstock and data grouping. Currently it only works when navigator.adaptToUpdatedData | ||
* is false. It is also recommended to set scrollbar.liveRedraw to false. | ||
* - Check inverted charts. | ||
* - Check reversed axes. | ||
* - Chart callback should be async after last series is drawn. (But not necessarily, we don't do | ||
that with initial series animation). | ||
* - Cache full-size image so we don't have to redraw on hide/show and zoom up. But k-d-tree still | ||
* needs to be built. | ||
* - Test IE9 and IE10. | ||
* - Stacking is not perhaps not correct since it doesn't use the translation given in | ||
* the translate method. If this gets to complicated, a possible way out would be to | ||
* have a simplified renderCanvas method that simply draws the areaPath on a canvas. | ||
* | ||
* If this module is taken in as part of the core | ||
* - All the loading logic should be merged with core. Update styles in the core. | ||
* - Most of the method wraps should probably be added directly in parent methods. | ||
* | ||
* Notes for boost mode | ||
* - Area lines are not drawn | ||
* - Point markers are not drawn on line-type series | ||
* - Lines are not drawn on scatter charts | ||
* - Zones and negativeColor don't work | ||
* - Columns are always one pixel wide. Don't set the threshold too low. | ||
* | ||
* Optimizing tips for users | ||
* - For scatter plots, use a marker.radius of 1 or less. It results in a rectangle being drawn, which is | ||
* considerably faster than a circle. | ||
* - Set extremes (min, max) explicitly on the axes in order for Highcharts to avoid computing extremes. | ||
* - Set enableMouseTracking to false on the series to improve total rendering time. | ||
* - The default threshold is set based on one series. If you have multiple, dense series, the combined | ||
* number of points drawn gets higher, and you may want to set the threshold lower in order to | ||
* use optimizations. | ||
*/ | ||
'use strict'; | ||
'use strict'; | ||
var win = H.win, | ||
doc = win.document, | ||
noop = function () {}, | ||
Color = H.Color, | ||
Series = H.Series, | ||
seriesTypes = H.seriesTypes, | ||
each = H.each, | ||
extend = H.extend, | ||
addEvent = H.addEvent, | ||
fireEvent = H.fireEvent, | ||
grep = H.grep, | ||
isNumber = H.isNumber, | ||
merge = H.merge, | ||
pick = H.pick, | ||
wrap = H.wrap, | ||
plotOptions = H.getOptions().plotOptions, | ||
CHUNK_SIZE = 50000, | ||
destroyLoadingDiv; | ||
var win = H.win, | ||
doc = win.document, | ||
noop = function() {}, | ||
Color = H.Color, | ||
Series = H.Series, | ||
seriesTypes = H.seriesTypes, | ||
each = H.each, | ||
extend = H.extend, | ||
addEvent = H.addEvent, | ||
fireEvent = H.fireEvent, | ||
grep = H.grep, | ||
isNumber = H.isNumber, | ||
merge = H.merge, | ||
pick = H.pick, | ||
wrap = H.wrap, | ||
plotOptions = H.getOptions().plotOptions, | ||
CHUNK_SIZE = 50000, | ||
destroyLoadingDiv; | ||
function eachAsync(arr, fn, finalFunc, chunkSize, i) { | ||
i = i || 0; | ||
chunkSize = chunkSize || CHUNK_SIZE; | ||
var threshold = i + chunkSize, | ||
proceed = true; | ||
function eachAsync(arr, fn, finalFunc, chunkSize, i) { | ||
i = i || 0; | ||
chunkSize = chunkSize || CHUNK_SIZE; | ||
while (proceed && i < threshold && i < arr.length) { | ||
proceed = fn(arr[i], i); | ||
i = i + 1; | ||
} | ||
if (proceed) { | ||
if (i < arr.length) { | ||
setTimeout(function () { | ||
eachAsync(arr, fn, finalFunc, chunkSize, i); | ||
}); | ||
} else if (finalFunc) { | ||
finalFunc(); | ||
var threshold = i + chunkSize, | ||
proceed = true; | ||
while (proceed && i < threshold && i < arr.length) { | ||
proceed = fn(arr[i], i); | ||
i = i + 1; | ||
} | ||
} | ||
} | ||
// Set default options | ||
each(['area', 'arearange', 'column', 'line', 'scatter'], function (type) { | ||
if (plotOptions[type]) { | ||
plotOptions[type].boostThreshold = 5000; | ||
} | ||
}); | ||
/** | ||
* Override a bunch of methods the same way. If the number of points is below the threshold, | ||
* run the original method. If not, check for a canvas version or do nothing. | ||
*/ | ||
each(['translate', 'generatePoints', 'drawTracker', 'drawPoints', 'render'], function (method) { | ||
function branch(proceed) { | ||
var letItPass = this.options.stacking && (method === 'translate' || method === 'generatePoints'); | ||
if ((this.processedXData || this.options.data).length < (this.options.boostThreshold || Number.MAX_VALUE) || | ||
letItPass) { | ||
// Clear image | ||
if (method === 'render' && this.image) { | ||
this.image.attr({ href: '' }); | ||
this.animate = null; // We're zooming in, don't run animation | ||
if (proceed) { | ||
if (i < arr.length) { | ||
setTimeout(function() { | ||
eachAsync(arr, fn, finalFunc, chunkSize, i); | ||
}); | ||
} else if (finalFunc) { | ||
finalFunc(); | ||
} | ||
proceed.call(this); | ||
// If a canvas version of the method exists, like renderCanvas(), run | ||
} else if (this[method + 'Canvas']) { | ||
this[method + 'Canvas'](); | ||
} | ||
} | ||
wrap(Series.prototype, method, branch); | ||
// A special case for some types - its translate method is already wrapped | ||
if (method === 'translate') { | ||
if (seriesTypes.column) { | ||
wrap(seriesTypes.column.prototype, method, branch); | ||
// Set default options | ||
each(['area', 'arearange', 'column', 'line', 'scatter'], function(type) { | ||
if (plotOptions[type]) { | ||
plotOptions[type].boostThreshold = 5000; | ||
} | ||
if (seriesTypes.arearange) { | ||
wrap(seriesTypes.arearange.prototype, method, branch); | ||
} | ||
} | ||
}); | ||
}); | ||
/** | ||
* Do not compute extremes when min and max are set. | ||
* If we use this in the core, we can add the hook to hasExtremes to the methods directly. | ||
*/ | ||
wrap(Series.prototype, 'getExtremes', function (proceed) { | ||
if (!this.hasExtremes()) { | ||
proceed.apply(this, Array.prototype.slice.call(arguments, 1)); | ||
} | ||
}); | ||
wrap(Series.prototype, 'setData', function (proceed) { | ||
if (!this.hasExtremes(true)) { | ||
proceed.apply(this, Array.prototype.slice.call(arguments, 1)); | ||
} | ||
}); | ||
wrap(Series.prototype, 'processData', function (proceed) { | ||
if (!this.hasExtremes(true)) { | ||
proceed.apply(this, Array.prototype.slice.call(arguments, 1)); | ||
} | ||
}); | ||
/** | ||
* Override a bunch of methods the same way. If the number of points is below the threshold, | ||
* run the original method. If not, check for a canvas version or do nothing. | ||
*/ | ||
each(['translate', 'generatePoints', 'drawTracker', 'drawPoints', 'render'], function(method) { | ||
function branch(proceed) { | ||
var letItPass = this.options.stacking && (method === 'translate' || method === 'generatePoints'); | ||
if ((this.processedXData || this.options.data).length < (this.options.boostThreshold || Number.MAX_VALUE) || | ||
letItPass) { | ||
// Clear image | ||
if (method === 'render' && this.image) { | ||
this.image.attr({ | ||
href: '' | ||
}); | ||
this.animate = null; // We're zooming in, don't run animation | ||
} | ||
H.extend(Series.prototype, { | ||
pointRange: 0, | ||
allowDG: false, // No data grouping, let boost handle large data | ||
hasExtremes: function (checkX) { | ||
var options = this.options, | ||
data = options.data, | ||
xAxis = this.xAxis && this.xAxis.options, | ||
yAxis = this.yAxis && this.yAxis.options; | ||
return data.length > (options.boostThreshold || Number.MAX_VALUE) && isNumber(yAxis.min) && isNumber(yAxis.max) && | ||
(!checkX || (isNumber(xAxis.min) && isNumber(xAxis.max))); | ||
}, | ||
proceed.call(this); | ||
/** | ||
* If implemented in the core, parts of this can probably be shared with other similar | ||
* methods in Highcharts. | ||
*/ | ||
destroyGraphics: function () { | ||
var series = this, | ||
points = this.points, | ||
point, | ||
i; | ||
// If a canvas version of the method exists, like renderCanvas(), run | ||
} else if (this[method + 'Canvas']) { | ||
if (points) { | ||
for (i = 0; i < points.length; i = i + 1) { | ||
point = points[i]; | ||
if (point && point.graphic) { | ||
point.graphic = point.graphic.destroy(); | ||
} | ||
this[method + 'Canvas'](); | ||
} | ||
} | ||
wrap(Series.prototype, method, branch); | ||
each(['graph', 'area', 'tracker'], function (prop) { | ||
if (series[prop]) { | ||
series[prop] = series[prop].destroy(); | ||
// A special case for some types - its translate method is already wrapped | ||
if (method === 'translate') { | ||
if (seriesTypes.column) { | ||
wrap(seriesTypes.column.prototype, method, branch); | ||
} | ||
}); | ||
}, | ||
if (seriesTypes.arearange) { | ||
wrap(seriesTypes.arearange.prototype, method, branch); | ||
} | ||
} | ||
}); | ||
/** | ||
* Create a hidden canvas to draw the graph on. The contents is later copied over | ||
* to an SVG image element. | ||
* Do not compute extremes when min and max are set. | ||
* If we use this in the core, we can add the hook to hasExtremes to the methods directly. | ||
*/ | ||
getContext: function () { | ||
var chart = this.chart, | ||
width = chart.plotWidth, | ||
height = chart.plotHeight, | ||
ctx = this.ctx, | ||
swapXY = function (proceed, x, y, a, b, c, d) { | ||
proceed.call(this, y, x, a, b, c, d); | ||
}; | ||
if (!this.canvas) { | ||
this.canvas = doc.createElement('canvas'); | ||
this.image = chart.renderer.image('', 0, 0, width, height).add(this.group); | ||
this.ctx = ctx = this.canvas.getContext('2d'); | ||
if (chart.inverted) { | ||
each(['moveTo', 'lineTo', 'rect', 'arc'], function (fn) { | ||
wrap(ctx, fn, swapXY); | ||
}); | ||
} | ||
} else { | ||
ctx.clearRect(0, 0, width, height); | ||
wrap(Series.prototype, 'getExtremes', function(proceed) { | ||
if (!this.hasExtremes()) { | ||
proceed.apply(this, Array.prototype.slice.call(arguments, 1)); | ||
} | ||
}); | ||
wrap(Series.prototype, 'setData', function(proceed) { | ||
if (!this.hasExtremes(true)) { | ||
proceed.apply(this, Array.prototype.slice.call(arguments, 1)); | ||
} | ||
}); | ||
wrap(Series.prototype, 'processData', function(proceed) { | ||
if (!this.hasExtremes(true)) { | ||
proceed.apply(this, Array.prototype.slice.call(arguments, 1)); | ||
} | ||
}); | ||
this.canvas.width = width; | ||
this.canvas.height = height; | ||
this.image.attr({ | ||
width: width, | ||
height: height | ||
}); | ||
return ctx; | ||
}, | ||
H.extend(Series.prototype, { | ||
pointRange: 0, | ||
allowDG: false, // No data grouping, let boost handle large data | ||
hasExtremes: function(checkX) { | ||
var options = this.options, | ||
data = options.data, | ||
xAxis = this.xAxis && this.xAxis.options, | ||
yAxis = this.yAxis && this.yAxis.options; | ||
return data.length > (options.boostThreshold || Number.MAX_VALUE) && isNumber(yAxis.min) && isNumber(yAxis.max) && | ||
(!checkX || (isNumber(xAxis.min) && isNumber(xAxis.max))); | ||
}, | ||
/** | ||
* Draw the canvas image inside an SVG image | ||
*/ | ||
canvasToSVG: function () { | ||
this.image.attr({ href: this.canvas.toDataURL('image/png') }); | ||
}, | ||
/** | ||
* If implemented in the core, parts of this can probably be shared with other similar | ||
* methods in Highcharts. | ||
*/ | ||
destroyGraphics: function() { | ||
var series = this, | ||
points = this.points, | ||
point, | ||
i; | ||
cvsLineTo: function (ctx, clientX, plotY) { | ||
ctx.lineTo(clientX, plotY); | ||
}, | ||
renderCanvas: function () { | ||
var series = this, | ||
options = series.options, | ||
chart = series.chart, | ||
xAxis = this.xAxis, | ||
yAxis = this.yAxis, | ||
ctx, | ||
c = 0, | ||
xData = series.processedXData, | ||
yData = series.processedYData, | ||
rawData = options.data, | ||
xExtremes = xAxis.getExtremes(), | ||
xMin = xExtremes.min, | ||
xMax = xExtremes.max, | ||
yExtremes = yAxis.getExtremes(), | ||
yMin = yExtremes.min, | ||
yMax = yExtremes.max, | ||
pointTaken = {}, | ||
lastClientX, | ||
sampling = !!series.sampling, | ||
points, | ||
r = options.marker && options.marker.radius, | ||
cvsDrawPoint = this.cvsDrawPoint, | ||
cvsLineTo = options.lineWidth ? this.cvsLineTo : false, | ||
cvsMarker = r <= 1 ? this.cvsMarkerSquare : this.cvsMarkerCircle, | ||
enableMouseTracking = options.enableMouseTracking !== false, | ||
lastPoint, | ||
threshold = options.threshold, | ||
yBottom = yAxis.getThreshold(threshold), | ||
hasThreshold = isNumber(threshold), | ||
translatedThreshold = yBottom, | ||
doFill = this.fill, | ||
isRange = series.pointArrayMap && series.pointArrayMap.join(',') === 'low,high', | ||
isStacked = !!options.stacking, | ||
cropStart = series.cropStart || 0, | ||
loadingOptions = chart.options.loading, | ||
requireSorting = series.requireSorting, | ||
wasNull, | ||
connectNulls = options.connectNulls, | ||
useRaw = !xData, | ||
minVal, | ||
maxVal, | ||
minI, | ||
maxI, | ||
fillColor = series.fillOpacity ? | ||
new Color(series.color).setOpacity(pick(options.fillOpacity, 0.75)).get() : | ||
series.color, | ||
stroke = function () { | ||
if (doFill) { | ||
ctx.fillStyle = fillColor; | ||
ctx.fill(); | ||
} else { | ||
ctx.strokeStyle = series.color; | ||
ctx.lineWidth = options.lineWidth; | ||
ctx.stroke(); | ||
} | ||
}, | ||
drawPoint = function (clientX, plotY, yBottom) { | ||
if (c === 0) { | ||
ctx.beginPath(); | ||
if (cvsLineTo) { | ||
ctx.lineJoin = 'round'; | ||
if (points) { | ||
for (i = 0; i < points.length; i = i + 1) { | ||
point = points[i]; | ||
if (point && point.graphic) { | ||
point.graphic = point.graphic.destroy(); | ||
} | ||
} | ||
} | ||
if (wasNull) { | ||
ctx.moveTo(clientX, plotY); | ||
} else { | ||
if (cvsDrawPoint) { | ||
cvsDrawPoint(ctx, clientX, plotY, yBottom, lastPoint); | ||
} else if (cvsLineTo) { | ||
cvsLineTo(ctx, clientX, plotY); | ||
} else if (cvsMarker) { | ||
cvsMarker(ctx, clientX, plotY, r); | ||
} | ||
each(['graph', 'area', 'tracker'], function(prop) { | ||
if (series[prop]) { | ||
series[prop] = series[prop].destroy(); | ||
} | ||
}); | ||
}, | ||
// We need to stroke the line for every 1000 pixels. It will crash the browser | ||
// memory use if we stroke too infrequently. | ||
c = c + 1; | ||
if (c === 1000) { | ||
stroke(); | ||
c = 0; | ||
/** | ||
* Create a hidden canvas to draw the graph on. The contents is later copied over | ||
* to an SVG image element. | ||
*/ | ||
getContext: function() { | ||
var chart = this.chart, | ||
width = chart.plotWidth, | ||
height = chart.plotHeight, | ||
ctx = this.ctx, | ||
swapXY = function(proceed, x, y, a, b, c, d) { | ||
proceed.call(this, y, x, a, b, c, d); | ||
}; | ||
if (!this.canvas) { | ||
this.canvas = doc.createElement('canvas'); | ||
this.image = chart.renderer.image('', 0, 0, width, height).add(this.group); | ||
this.ctx = ctx = this.canvas.getContext('2d'); | ||
if (chart.inverted) { | ||
each(['moveTo', 'lineTo', 'rect', 'arc'], function(fn) { | ||
wrap(ctx, fn, swapXY); | ||
}); | ||
} | ||
} else { | ||
ctx.clearRect(0, 0, width, height); | ||
} | ||
// Area charts need to keep track of the last point | ||
lastPoint = { | ||
clientX: clientX, | ||
plotY: plotY, | ||
yBottom: yBottom | ||
}; | ||
}, | ||
this.canvas.width = width; | ||
this.canvas.height = height; | ||
this.image.attr({ | ||
width: width, | ||
height: height | ||
}); | ||
addKDPoint = function (clientX, plotY, i) { | ||
return ctx; | ||
}, | ||
// The k-d tree requires series points. Reduce the amount of points, since the time to build the | ||
// tree increases exponentially. | ||
if (enableMouseTracking && !pointTaken[clientX + ',' + plotY]) { | ||
pointTaken[clientX + ',' + plotY] = true; | ||
/** | ||
* Draw the canvas image inside an SVG image | ||
*/ | ||
canvasToSVG: function() { | ||
this.image.attr({ | ||
href: this.canvas.toDataURL('image/png') | ||
}); | ||
}, | ||
if (chart.inverted) { | ||
clientX = xAxis.len - clientX; | ||
plotY = yAxis.len - plotY; | ||
cvsLineTo: function(ctx, clientX, plotY) { | ||
ctx.lineTo(clientX, plotY); | ||
}, | ||
renderCanvas: function() { | ||
var series = this, | ||
options = series.options, | ||
chart = series.chart, | ||
xAxis = this.xAxis, | ||
yAxis = this.yAxis, | ||
ctx, | ||
c = 0, | ||
xData = series.processedXData, | ||
yData = series.processedYData, | ||
rawData = options.data, | ||
xExtremes = xAxis.getExtremes(), | ||
xMin = xExtremes.min, | ||
xMax = xExtremes.max, | ||
yExtremes = yAxis.getExtremes(), | ||
yMin = yExtremes.min, | ||
yMax = yExtremes.max, | ||
pointTaken = {}, | ||
lastClientX, | ||
sampling = !!series.sampling, | ||
points, | ||
r = options.marker && options.marker.radius, | ||
cvsDrawPoint = this.cvsDrawPoint, | ||
cvsLineTo = options.lineWidth ? this.cvsLineTo : false, | ||
cvsMarker = r <= 1 ? this.cvsMarkerSquare : this.cvsMarkerCircle, | ||
enableMouseTracking = options.enableMouseTracking !== false, | ||
lastPoint, | ||
threshold = options.threshold, | ||
yBottom = yAxis.getThreshold(threshold), | ||
hasThreshold = isNumber(threshold), | ||
translatedThreshold = yBottom, | ||
doFill = this.fill, | ||
isRange = series.pointArrayMap && series.pointArrayMap.join(',') === 'low,high', | ||
isStacked = !!options.stacking, | ||
cropStart = series.cropStart || 0, | ||
loadingOptions = chart.options.loading, | ||
requireSorting = series.requireSorting, | ||
wasNull, | ||
connectNulls = options.connectNulls, | ||
useRaw = !xData, | ||
minVal, | ||
maxVal, | ||
minI, | ||
maxI, | ||
fillColor = series.fillOpacity ? | ||
new Color(series.color).setOpacity(pick(options.fillOpacity, 0.75)).get() : | ||
series.color, | ||
stroke = function() { | ||
if (doFill) { | ||
ctx.fillStyle = fillColor; | ||
ctx.fill(); | ||
} else { | ||
ctx.strokeStyle = series.color; | ||
ctx.lineWidth = options.lineWidth; | ||
ctx.stroke(); | ||
} | ||
}, | ||
drawPoint = function(clientX, plotY, yBottom) { | ||
if (c === 0) { | ||
ctx.beginPath(); | ||
points.push({ | ||
if (cvsLineTo) { | ||
ctx.lineJoin = 'round'; | ||
} | ||
} | ||
if (wasNull) { | ||
ctx.moveTo(clientX, plotY); | ||
} else { | ||
if (cvsDrawPoint) { | ||
cvsDrawPoint(ctx, clientX, plotY, yBottom, lastPoint); | ||
} else if (cvsLineTo) { | ||
cvsLineTo(ctx, clientX, plotY); | ||
} else if (cvsMarker) { | ||
cvsMarker(ctx, clientX, plotY, r); | ||
} | ||
} | ||
// We need to stroke the line for every 1000 pixels. It will crash the browser | ||
// memory use if we stroke too infrequently. | ||
c = c + 1; | ||
if (c === 1000) { | ||
stroke(); | ||
c = 0; | ||
} | ||
// Area charts need to keep track of the last point | ||
lastPoint = { | ||
clientX: clientX, | ||
plotX: clientX, | ||
plotY: plotY, | ||
i: cropStart + i | ||
}); | ||
} | ||
}; | ||
yBottom: yBottom | ||
}; | ||
}, | ||
// If we are zooming out from SVG mode, destroy the graphics | ||
if (this.points || this.graph) { | ||
this.destroyGraphics(); | ||
} | ||
addKDPoint = function(clientX, plotY, i) { | ||
// The group | ||
series.plotGroup( | ||
'group', | ||
'series', | ||
series.visible ? 'visible' : 'hidden', | ||
options.zIndex, | ||
chart.seriesGroup | ||
); | ||
// The k-d tree requires series points. Reduce the amount of points, since the time to build the | ||
// tree increases exponentially. | ||
if (enableMouseTracking && !pointTaken[clientX + ',' + plotY]) { | ||
pointTaken[clientX + ',' + plotY] = true; | ||
series.getAttribs(); | ||
series.markerGroup = series.group; | ||
addEvent(series, 'destroy', function () { | ||
series.markerGroup = null; | ||
}); | ||
if (chart.inverted) { | ||
clientX = xAxis.len - clientX; | ||
plotY = yAxis.len - plotY; | ||
} | ||
points = this.points = []; | ||
ctx = this.getContext(); | ||
series.buildKDTree = noop; // Do not start building while drawing | ||
points.push({ | ||
clientX: clientX, | ||
plotX: clientX, | ||
plotY: plotY, | ||
i: cropStart + i | ||
}); | ||
} | ||
}; | ||
// Display a loading indicator | ||
if (rawData.length > 99999) { | ||
chart.options.loading = merge(loadingOptions, { | ||
labelStyle: { | ||
backgroundColor: 'rgba(255,255,255,0.75)', | ||
padding: '1em', | ||
borderRadius: '0.5em' | ||
}, | ||
style: { | ||
backgroundColor: 'none', | ||
opacity: 1 | ||
} | ||
// If we are zooming out from SVG mode, destroy the graphics | ||
if (this.points || this.graph) { | ||
this.destroyGraphics(); | ||
} | ||
// The group | ||
series.plotGroup( | ||
'group', | ||
'series', | ||
series.visible ? 'visible' : 'hidden', | ||
options.zIndex, | ||
chart.seriesGroup | ||
); | ||
series.markerGroup = series.group; | ||
addEvent(series, 'destroy', function() { | ||
series.markerGroup = null; | ||
}); | ||
clearTimeout(destroyLoadingDiv); | ||
chart.showLoading('Drawing...'); | ||
chart.options.loading = loadingOptions; // reset | ||
} | ||
// Loop over the points | ||
eachAsync(isStacked ? series.data : (xData || rawData), function (d, i) { | ||
var x, | ||
y, | ||
clientX, | ||
plotY, | ||
isNull, | ||
low, | ||
chartDestroyed = typeof chart.index === 'undefined', | ||
isYInside = true; | ||
points = this.points = []; | ||
ctx = this.getContext(); | ||
series.buildKDTree = noop; // Do not start building while drawing | ||
if (!chartDestroyed) { | ||
if (useRaw) { | ||
x = d[0]; | ||
y = d[1]; | ||
} else { | ||
x = d; | ||
y = yData[i]; | ||
} | ||
// Display a loading indicator | ||
if (rawData.length > 99999) { | ||
chart.options.loading = merge(loadingOptions, { | ||
labelStyle: { | ||
backgroundColor: H.color('#ffffff').setOpacity(0.75).get(), | ||
padding: '1em', | ||
borderRadius: '0.5em' | ||
}, | ||
style: { | ||
backgroundColor: 'none', | ||
opacity: 1 | ||
} | ||
}); | ||
clearTimeout(destroyLoadingDiv); | ||
chart.showLoading('Drawing...'); | ||
chart.options.loading = loadingOptions; // reset | ||
} | ||
// Resolve low and high for range series | ||
if (isRange) { | ||
// Loop over the points | ||
eachAsync(isStacked ? series.data : (xData || rawData), function(d, i) { | ||
var x, | ||
y, | ||
clientX, | ||
plotY, | ||
isNull, | ||
low, | ||
chartDestroyed = typeof chart.index === 'undefined', | ||
isYInside = true; | ||
if (!chartDestroyed) { | ||
if (useRaw) { | ||
y = d.slice(1, 3); | ||
x = d[0]; | ||
y = d[1]; | ||
} else { | ||
x = d; | ||
y = yData[i]; | ||
} | ||
low = y[0]; | ||
y = y[1]; | ||
} else if (isStacked) { | ||
x = d.x; | ||
y = d.stackY; | ||
low = y - d.y; | ||
} | ||
isNull = y === null; | ||
// Resolve low and high for range series | ||
if (isRange) { | ||
if (useRaw) { | ||
y = d.slice(1, 3); | ||
} | ||
low = y[0]; | ||
y = y[1]; | ||
} else if (isStacked) { | ||
x = d.x; | ||
y = d.stackY; | ||
low = y - d.y; | ||
} | ||
// Optimize for scatter zooming | ||
if (!requireSorting) { | ||
isYInside = y >= yMin && y <= yMax; | ||
} | ||
isNull = y === null; | ||
if (!isNull && x >= xMin && x <= xMax && isYInside) { | ||
// Optimize for scatter zooming | ||
if (!requireSorting) { | ||
isYInside = y >= yMin && y <= yMax; | ||
} | ||
clientX = Math.round(xAxis.toPixels(x, true)); | ||
if (!isNull && x >= xMin && x <= xMax && isYInside) { | ||
if (sampling) { | ||
if (minI === undefined || clientX === lastClientX) { | ||
if (!isRange) { | ||
low = y; | ||
} | ||
if (maxI === undefined || y > maxVal) { | ||
maxVal = y; | ||
maxI = i; | ||
} | ||
if (minI === undefined || low < minVal) { | ||
minVal = low; | ||
minI = i; | ||
} | ||
clientX = Math.round(xAxis.toPixels(x, true)); | ||
} | ||
if (clientX !== lastClientX) { // Add points and reset | ||
if (minI !== undefined) { // then maxI is also a number | ||
plotY = yAxis.toPixels(maxVal, true); | ||
yBottom = yAxis.toPixels(minVal, true); | ||
drawPoint( | ||
clientX, | ||
hasThreshold ? Math.min(plotY, translatedThreshold) : plotY, | ||
hasThreshold ? Math.max(yBottom, translatedThreshold) : yBottom | ||
); | ||
addKDPoint(clientX, plotY, maxI); | ||
if (yBottom !== plotY) { | ||
addKDPoint(clientX, yBottom, minI); | ||
if (sampling) { | ||
if (minI === undefined || clientX === lastClientX) { | ||
if (!isRange) { | ||
low = y; | ||
} | ||
if (maxI === undefined || y > maxVal) { | ||
maxVal = y; | ||
maxI = i; | ||
} | ||
if (minI === undefined || low < minVal) { | ||
minVal = low; | ||
minI = i; | ||
} | ||
} | ||
if (clientX !== lastClientX) { // Add points and reset | ||
if (minI !== undefined) { // then maxI is also a number | ||
plotY = yAxis.toPixels(maxVal, true); | ||
yBottom = yAxis.toPixels(minVal, true); | ||
drawPoint( | ||
clientX, | ||
hasThreshold ? Math.min(plotY, translatedThreshold) : plotY, | ||
hasThreshold ? Math.max(yBottom, translatedThreshold) : yBottom | ||
); | ||
addKDPoint(clientX, plotY, maxI); | ||
if (yBottom !== plotY) { | ||
addKDPoint(clientX, yBottom, minI); | ||
} | ||
} | ||
minI = maxI = undefined; | ||
lastClientX = clientX; | ||
minI = maxI = undefined; | ||
lastClientX = clientX; | ||
} | ||
} else { | ||
plotY = Math.round(yAxis.toPixels(y, true)); | ||
drawPoint(clientX, plotY, yBottom); | ||
addKDPoint(clientX, plotY, i); | ||
} | ||
} else { | ||
plotY = Math.round(yAxis.toPixels(y, true)); | ||
drawPoint(clientX, plotY, yBottom); | ||
addKDPoint(clientX, plotY, i); | ||
} | ||
} | ||
wasNull = isNull && !connectNulls; | ||
wasNull = isNull && !connectNulls; | ||
if (i % CHUNK_SIZE === 0) { | ||
series.canvasToSVG(); | ||
if (i % CHUNK_SIZE === 0) { | ||
series.canvasToSVG(); | ||
} | ||
} | ||
} | ||
return !chartDestroyed; | ||
}, function () { | ||
var loadingDiv = chart.loadingDiv, | ||
loadingShown = chart.loadingShown; | ||
stroke(); | ||
series.canvasToSVG(); | ||
return !chartDestroyed; | ||
}, function() { | ||
var loadingDiv = chart.loadingDiv, | ||
loadingShown = chart.loadingShown; | ||
stroke(); | ||
series.canvasToSVG(); | ||
fireEvent(series, 'renderedCanvas'); | ||
fireEvent(series, 'renderedCanvas'); | ||
// Do not use chart.hideLoading, as it runs JS animation and will be blocked by buildKDTree. | ||
// CSS animation looks good, but then it must be deleted in timeout. If we add the module to core, | ||
// change hideLoading so we can skip this block. | ||
if (loadingShown) { | ||
extend(loadingDiv.style, { | ||
transition: 'opacity 250ms', | ||
opacity: 0 | ||
}); | ||
chart.loadingShown = false; | ||
destroyLoadingDiv = setTimeout(function () { | ||
if (loadingDiv.parentNode) { // In exporting it is falsy | ||
loadingDiv.parentNode.removeChild(loadingDiv); | ||
} | ||
chart.loadingDiv = chart.loadingSpan = null; | ||
}, 250); | ||
} | ||
// Do not use chart.hideLoading, as it runs JS animation and will be blocked by buildKDTree. | ||
// CSS animation looks good, but then it must be deleted in timeout. If we add the module to core, | ||
// change hideLoading so we can skip this block. | ||
if (loadingShown) { | ||
extend(loadingDiv.style, { | ||
transition: 'opacity 250ms', | ||
opacity: 0 | ||
}); | ||
chart.loadingShown = false; | ||
destroyLoadingDiv = setTimeout(function() { | ||
if (loadingDiv.parentNode) { // In exporting it is falsy | ||
loadingDiv.parentNode.removeChild(loadingDiv); | ||
} | ||
chart.loadingDiv = chart.loadingSpan = null; | ||
}, 250); | ||
} | ||
// Pass tests in Pointer. | ||
// Replace this with a single property, and replace when zooming in | ||
// below boostThreshold. | ||
series.directTouch = false; | ||
series.options.stickyTracking = true; | ||
// Pass tests in Pointer. | ||
// Replace this with a single property, and replace when zooming in | ||
// below boostThreshold. | ||
series.directTouch = false; | ||
series.options.stickyTracking = true; | ||
delete series.buildKDTree; // Go back to prototype, ready to build | ||
series.buildKDTree(); | ||
delete series.buildKDTree; // Go back to prototype, ready to build | ||
series.buildKDTree(); | ||
// Don't do async on export, the exportChart, getSVGForExport and getSVG methods are not chained for it. | ||
}, chart.renderer.forExport ? Number.MAX_VALUE : undefined); | ||
} | ||
}); | ||
// Don't do async on export, the exportChart, getSVGForExport and getSVG methods are not chained for it. | ||
}, chart.renderer.forExport ? Number.MAX_VALUE : undefined); | ||
} | ||
}); | ||
seriesTypes.scatter.prototype.cvsMarkerCircle = function (ctx, clientX, plotY, r) { | ||
ctx.moveTo(clientX, plotY); | ||
ctx.arc(clientX, plotY, r, 0, 2 * Math.PI, false); | ||
}; | ||
seriesTypes.scatter.prototype.cvsMarkerCircle = function(ctx, clientX, plotY, r) { | ||
ctx.moveTo(clientX, plotY); | ||
ctx.arc(clientX, plotY, r, 0, 2 * Math.PI, false); | ||
}; | ||
// Rect is twice as fast as arc, should be used for small markers | ||
seriesTypes.scatter.prototype.cvsMarkerSquare = function (ctx, clientX, plotY, r) { | ||
ctx.rect(clientX - r, plotY - r, r * 2, r * 2); | ||
}; | ||
seriesTypes.scatter.prototype.fill = true; | ||
// Rect is twice as fast as arc, should be used for small markers | ||
seriesTypes.scatter.prototype.cvsMarkerSquare = function(ctx, clientX, plotY, r) { | ||
ctx.rect(clientX - r, plotY - r, r * 2, r * 2); | ||
}; | ||
seriesTypes.scatter.prototype.fill = true; | ||
extend(seriesTypes.area.prototype, { | ||
cvsDrawPoint: function (ctx, clientX, plotY, yBottom, lastPoint) { | ||
if (lastPoint && clientX !== lastPoint.clientX) { | ||
ctx.moveTo(lastPoint.clientX, lastPoint.yBottom); | ||
ctx.lineTo(lastPoint.clientX, lastPoint.plotY); | ||
ctx.lineTo(clientX, plotY); | ||
ctx.lineTo(clientX, yBottom); | ||
} | ||
}, | ||
fill: true, | ||
fillOpacity: true, | ||
sampling: true | ||
}); | ||
extend(seriesTypes.area.prototype, { | ||
cvsDrawPoint: function(ctx, clientX, plotY, yBottom, lastPoint) { | ||
if (lastPoint && clientX !== lastPoint.clientX) { | ||
ctx.moveTo(lastPoint.clientX, lastPoint.yBottom); | ||
ctx.lineTo(lastPoint.clientX, lastPoint.plotY); | ||
ctx.lineTo(clientX, plotY); | ||
ctx.lineTo(clientX, yBottom); | ||
} | ||
}, | ||
fill: true, | ||
fillOpacity: true, | ||
sampling: true | ||
}); | ||
extend(seriesTypes.column.prototype, { | ||
cvsDrawPoint: function (ctx, clientX, plotY, yBottom) { | ||
ctx.rect(clientX - 1, plotY, 1, yBottom - plotY); | ||
}, | ||
fill: true, | ||
sampling: true | ||
}); | ||
extend(seriesTypes.column.prototype, { | ||
cvsDrawPoint: function(ctx, clientX, plotY, yBottom) { | ||
ctx.rect(clientX - 1, plotY, 1, yBottom - plotY); | ||
}, | ||
fill: true, | ||
sampling: true | ||
}); | ||
/** | ||
* Return a full Point object based on the index. The boost module uses stripped point objects | ||
* for performance reasons. | ||
* @param {Number} boostPoint A stripped-down point object | ||
* @returns {Object} A Point object as per http://api.highcharts.com/highcharts#Point | ||
*/ | ||
Series.prototype.getPoint = function (boostPoint) { | ||
var point = boostPoint; | ||
/** | ||
* Return a full Point object based on the index. The boost module uses stripped point objects | ||
* for performance reasons. | ||
* @param {Number} boostPoint A stripped-down point object | ||
* @returns {Object} A Point object as per http://api.highcharts.com/highcharts#Point | ||
*/ | ||
Series.prototype.getPoint = function(boostPoint) { | ||
var point = boostPoint; | ||
if (boostPoint && !(boostPoint instanceof this.pointClass)) { | ||
point = (new this.pointClass()).init(this, this.options.data[boostPoint.i]); | ||
point.category = point.x; | ||
if (boostPoint && !(boostPoint instanceof this.pointClass)) { | ||
point = (new this.pointClass()).init(this, this.options.data[boostPoint.i]); // eslint-disable-line new-cap | ||
point.category = point.x; | ||
point.dist = boostPoint.dist; | ||
point.distX = boostPoint.distX; | ||
point.plotX = boostPoint.plotX; | ||
point.plotY = boostPoint.plotY; | ||
} | ||
point.dist = boostPoint.dist; | ||
point.distX = boostPoint.distX; | ||
point.plotX = boostPoint.plotX; | ||
point.plotY = boostPoint.plotY; | ||
} | ||
return point; | ||
}; | ||
return point; | ||
}; | ||
/** | ||
* Extend series.destroy to also remove the fake k-d-tree points (#5137). Normally | ||
* this is handled by Series.destroy that calls Point.destroy, but the fake | ||
* search points are not registered like that. | ||
*/ | ||
wrap(Series.prototype, 'destroy', function (proceed) { | ||
var series = this, | ||
chart = series.chart; | ||
if (chart.hoverPoints) { | ||
chart.hoverPoints = grep(chart.hoverPoints, function (point) { | ||
return point.series === series; | ||
}); | ||
} | ||
/** | ||
* Extend series.destroy to also remove the fake k-d-tree points (#5137). Normally | ||
* this is handled by Series.destroy that calls Point.destroy, but the fake | ||
* search points are not registered like that. | ||
*/ | ||
wrap(Series.prototype, 'destroy', function(proceed) { | ||
var series = this, | ||
chart = series.chart; | ||
if (chart.hoverPoints) { | ||
chart.hoverPoints = grep(chart.hoverPoints, function(point) { | ||
return point.series === series; | ||
}); | ||
} | ||
if (chart.hoverPoint && chart.hoverPoint.series === series) { | ||
chart.hoverPoint = null; | ||
} | ||
proceed.call(this); | ||
}); | ||
if (chart.hoverPoint && chart.hoverPoint.series === series) { | ||
chart.hoverPoint = null; | ||
} | ||
proceed.call(this); | ||
}); | ||
/** | ||
* Return a point instance from the k-d-tree | ||
*/ | ||
wrap(Series.prototype, 'searchPoint', function (proceed) { | ||
return this.getPoint( | ||
proceed.apply(this, [].slice.call(arguments, 1)) | ||
); | ||
}); | ||
/** | ||
* Return a point instance from the k-d-tree | ||
*/ | ||
wrap(Series.prototype, 'searchPoint', function(proceed) { | ||
return this.getPoint( | ||
proceed.apply(this, [].slice.call(arguments, 1)) | ||
); | ||
}); | ||
}(Highcharts)); | ||
})); |
@@ -1,7 +0,14 @@ | ||
(function(f){typeof module==="object"&&module.exports?module.exports=f:f(Highcharts)})(function(f){function t(){return Array.prototype.slice.call(arguments,1)}function r(g){g.apply(this);this.drawBreaks(this.xAxis,["x"]);this.drawBreaks(this.yAxis,p(this.pointArrayMap,["y"]))}var p=f.pick,n=f.wrap,q=f.each,u=f.extend,s=f.fireEvent,o=f.Axis,v=f.Series;u(o.prototype,{isInBreak:function(g,e){var b=g.repeat||Infinity,c=g.from,a=g.to-g.from,b=e>=c?(e-c)%b:b-(c-e)%b;return g.inclusive?b<=a:b<a&&b!==0}, | ||
isInAnyBreak:function(g,e){var b=this.options.breaks,c=b&&b.length,a,d,k;if(c){for(;c--;)this.isInBreak(b[c],g)&&(a=!0,d||(d=p(b[c].showPoints,this.isXAxis?!1:!0)));k=a&&e?a&&!d:a}return k}});n(o.prototype,"setTickPositions",function(g){g.apply(this,Array.prototype.slice.call(arguments,1));if(this.options.breaks){var e=this.tickPositions,b=this.tickPositions.info,c=[],a;for(a=0;a<e.length;a++)this.isInAnyBreak(e[a])||c.push(e[a]);this.tickPositions=c;this.tickPositions.info=b}});n(o.prototype,"init", | ||
function(g,e,b){if(b.breaks&&b.breaks.length)b.ordinal=!1;g.call(this,e,b);if(this.options.breaks){var c=this;c.isBroken=!0;this.val2lin=function(a){var d=a,k,b;for(b=0;b<c.breakArray.length;b++)if(k=c.breakArray[b],k.to<=a)d-=k.len;else if(k.from>=a)break;else if(c.isInBreak(k,a)){d-=a-k.from;break}return d};this.lin2val=function(a){var d,b;for(b=0;b<c.breakArray.length;b++)if(d=c.breakArray[b],d.from>=a)break;else d.to<a?a+=d.len:c.isInBreak(d,a)&&(a+=d.len);return a};this.setExtremes=function(a, | ||
d,c,b,g){for(;this.isInAnyBreak(a);)a-=this.closestPointRange;for(;this.isInAnyBreak(d);)d-=this.closestPointRange;o.prototype.setExtremes.call(this,a,d,c,b,g)};this.setAxisTranslation=function(a){o.prototype.setAxisTranslation.call(this,a);var d=c.options.breaks,a=[],b=[],g=0,e,h,l=c.userMin||c.min,f=c.userMax||c.max,i,m;for(m in d)h=d[m],e=h.repeat||Infinity,c.isInBreak(h,l)&&(l+=h.to%e-l%e),c.isInBreak(h,f)&&(f-=f%e-h.from%e);for(m in d){h=d[m];i=h.from;for(e=h.repeat||Infinity;i-e>l;)i-=e;for(;i< | ||
l;)i+=e;for(;i<f;i+=e)a.push({value:i,move:"in"}),a.push({value:i+(h.to-h.from),move:"out",size:h.breakSize})}a.sort(function(a,b){return a.value===b.value?(a.move==="in"?0:1)-(b.move==="in"?0:1):a.value-b.value});d=0;i=l;for(m in a){h=a[m];d+=h.move==="in"?1:-1;if(d===1&&h.move==="in")i=h.value;d===0&&(b.push({from:i,to:h.value,len:h.value-i-(h.size||0)}),g+=h.value-i-(h.size||0))}c.breakArray=b;s(c,"afterBreaks");c.transA*=(f-c.min)/(f-l-g);c.min=l;c.max=f}}});n(v.prototype,"generatePoints",function(g){g.apply(this, | ||
t(arguments));var e=this.xAxis,b=this.yAxis,c=this.points,a,d=c.length,f=this.options.connectNulls,j;if(e&&b&&(e.options.breaks||b.options.breaks))for(;d--;)if(a=c[d],j=a.y===null&&f===!1,!j&&(e.isInAnyBreak(a.x,!0)||b.isInAnyBreak(a.y,!0)))c.splice(d,1),this.data[d]&&this.data[d].destroyElements()});f.Series.prototype.drawBreaks=function(g,e){var b=this,c=b.points,a,d,f,j;q(e,function(e){a=g.breakArray||[];d=g.isXAxis?g.min:p(b.options.threshold,g.min);q(c,function(b){j=p(b["stack"+e.toUpperCase()], | ||
b[e]);q(a,function(a){f=!1;if(d<a.from&&j>a.to||d>a.from&&j<a.from)f="pointBreak";else if(d<a.from&&j>a.from&&j<a.to||d>a.from&&j>a.to&&j<a.from)f="pointInBreak";f&&s(g,f,{point:b,brk:a})})})})};n(f.seriesTypes.column.prototype,"drawPoints",r);n(f.Series.prototype,"drawPoints",r)}); | ||
/* | ||
Highcharts JS v5.0.0 (2016-09-29) | ||
(c) 2009-2016 Torstein Honsi | ||
License: www.highcharts.com/license | ||
*/ | ||
(function(h){"object"===typeof module&&module.exports?module.exports=h:h(Highcharts)})(function(h){(function(d){function h(){return Array.prototype.slice.call(arguments,1)}function v(e){e.apply(this);this.drawBreaks(this.xAxis,["x"]);this.drawBreaks(this.yAxis,t(this.pointArrayMap,["y"]))}var t=d.pick,q=d.wrap,u=d.each,y=d.extend,w=d.fireEvent,r=d.Axis,z=d.Series;y(r.prototype,{isInBreak:function(e,g){var b=e.repeat||Infinity,c=e.from,a=e.to-e.from,b=g>=c?(g-c)%b:b-(c-g)%b;return e.inclusive?b<=a: | ||
b<a&&0!==b},isInAnyBreak:function(e,g){var b=this.options.breaks,c=b&&b.length,a,f,n;if(c){for(;c--;)this.isInBreak(b[c],e)&&(a=!0,f||(f=t(b[c].showPoints,this.isXAxis?!1:!0)));n=a&&g?a&&!f:a}return n}});q(r.prototype,"setTickPositions",function(e){e.apply(this,Array.prototype.slice.call(arguments,1));if(this.options.breaks){var g=this.tickPositions,b=this.tickPositions.info,c=[],a;for(a=0;a<g.length;a++)this.isInAnyBreak(g[a])||c.push(g[a]);this.tickPositions=c;this.tickPositions.info=b}});q(r.prototype, | ||
"init",function(e,g,b){b.breaks&&b.breaks.length&&(b.ordinal=!1);e.call(this,g,b);if(this.options.breaks){var c=this;c.isBroken=!0;this.val2lin=function(a){var f=a,n,b;for(b=0;b<c.breakArray.length;b++)if(n=c.breakArray[b],n.to<=a)f-=n.len;else if(n.from>=a)break;else if(c.isInBreak(n,a)){f-=a-n.from;break}return f};this.lin2val=function(a){var f,b;for(b=0;b<c.breakArray.length&&!(f=c.breakArray[b],f.from>=a);b++)f.to<a?a+=f.len:c.isInBreak(f,a)&&(a+=f.len);return a};this.setExtremes=function(a,c, | ||
b,e,g){for(;this.isInAnyBreak(a);)a-=this.closestPointRange;for(;this.isInAnyBreak(c);)c-=this.closestPointRange;r.prototype.setExtremes.call(this,a,c,b,e,g)};this.setAxisTranslation=function(a){r.prototype.setAxisTranslation.call(this,a);var b=c.options.breaks;a=[];var e=[],g=0,m,k,p=c.userMin||c.min,d=c.userMax||c.max,l,h;for(h in b)k=b[h],m=k.repeat||Infinity,c.isInBreak(k,p)&&(p+=k.to%m-p%m),c.isInBreak(k,d)&&(d-=d%m-k.from%m);for(h in b){k=b[h];l=k.from;for(m=k.repeat||Infinity;l-m>p;)l-=m;for(;l< | ||
p;)l+=m;for(;l<d;l+=m)a.push({value:l,move:"in"}),a.push({value:l+(k.to-k.from),move:"out",size:k.breakSize})}a.sort(function(b,a){return b.value===a.value?("in"===b.move?0:1)-("in"===a.move?0:1):b.value-a.value});b=0;l=p;for(h in a)k=a[h],b+="in"===k.move?1:-1,1===b&&"in"===k.move&&(l=k.value),0===b&&(e.push({from:l,to:k.value,len:k.value-l-(k.size||0)}),g+=k.value-l-(k.size||0));c.breakArray=e;w(c,"afterBreaks");c.transA*=(d-c.min)/(d-p-g);c.min=p;c.max=d}}});q(z.prototype,"generatePoints",function(e){e.apply(this, | ||
h(arguments));var g=this.xAxis,b=this.yAxis,c=this.points,a,f=c.length,d=this.options.connectNulls,x;if(g&&b&&(g.options.breaks||b.options.breaks))for(;f--;)a=c[f],x=null===a.y&&!1===d,x||!g.isInAnyBreak(a.x,!0)&&!b.isInAnyBreak(a.y,!0)||(c.splice(f,1),this.data[f]&&this.data[f].destroyElements())});d.Series.prototype.drawBreaks=function(e,g){var b=this,c=b.points,a,f,d,h;u(g,function(g){a=e.breakArray||[];f=e.isXAxis?e.min:t(b.options.threshold,e.min);u(c,function(b){h=t(b["stack"+g.toUpperCase()], | ||
b[g]);u(a,function(a){d=!1;if(f<a.from&&h>a.to||f>a.from&&h<a.from)d="pointBreak";else if(f<a.from&&h>a.from&&h<a.to||f>a.from&&h>a.to&&h<a.from)d="pointInBreak";d&&w(e,d,{point:b,brk:a})})})})};q(d.seriesTypes.column.prototype,"drawPoints",v);q(d.Series.prototype,"drawPoints",v)})(h)}); |
/** | ||
* Highcharts JS v4.2.7 (2016-09-21) | ||
* Highcharts Broken Axis module | ||
* | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* | ||
* (c) 2009-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(H) { | ||
/** | ||
* (c) 2009-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
'use strict'; | ||
(function (factory) { | ||
/*= if (!build.assembly) { =*/ | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
return; | ||
} | ||
/*= } =*/ | ||
factory(Highcharts); | ||
}(function (H) { | ||
var pick = H.pick, | ||
wrap = H.wrap, | ||
each = H.each, | ||
extend = H.extend, | ||
fireEvent = H.fireEvent, | ||
Axis = H.Axis, | ||
Series = H.Series; | ||
'use strict'; | ||
function stripArguments() { | ||
return Array.prototype.slice.call(arguments, 1); | ||
} | ||
var pick = H.pick, | ||
wrap = H.wrap, | ||
each = H.each, | ||
extend = H.extend, | ||
fireEvent = H.fireEvent, | ||
Axis = H.Axis, | ||
Series = H.Series; | ||
extend(Axis.prototype, { | ||
isInBreak: function(brk, val) { | ||
var ret, | ||
repeat = brk.repeat || Infinity, | ||
from = brk.from, | ||
length = brk.to - brk.from, | ||
test = (val >= from ? (val - from) % repeat : repeat - ((from - val) % repeat)); | ||
function stripArguments() { | ||
return Array.prototype.slice.call(arguments, 1); | ||
} | ||
if (!brk.inclusive) { | ||
ret = test < length && test !== 0; | ||
} else { | ||
ret = test <= length; | ||
} | ||
return ret; | ||
}, | ||
extend(Axis.prototype, { | ||
isInBreak: function (brk, val) { | ||
var ret, | ||
repeat = brk.repeat || Infinity, | ||
from = brk.from, | ||
length = brk.to - brk.from, | ||
test = (val >= from ? (val - from) % repeat : repeat - ((from - val) % repeat)); | ||
isInAnyBreak: function(val, testKeep) { | ||
if (!brk.inclusive) { | ||
ret = test < length && test !== 0; | ||
} else { | ||
ret = test <= length; | ||
} | ||
return ret; | ||
}, | ||
var breaks = this.options.breaks, | ||
i = breaks && breaks.length, | ||
inbrk, | ||
keep, | ||
ret; | ||
isInAnyBreak: function (val, testKeep) { | ||
var breaks = this.options.breaks, | ||
i = breaks && breaks.length, | ||
inbrk, | ||
keep, | ||
ret; | ||
if (i) { | ||
if (i) { | ||
while (i--) { | ||
if (this.isInBreak(breaks[i], val)) { | ||
inbrk = true; | ||
if (!keep) { | ||
keep = pick(breaks[i].showPoints, this.isXAxis ? false : true); | ||
} | ||
} | ||
} | ||
while (i--) { | ||
if (this.isInBreak(breaks[i], val)) { | ||
inbrk = true; | ||
if (!keep) { | ||
keep = pick(breaks[i].showPoints, this.isXAxis ? false : true); | ||
} | ||
} | ||
} | ||
if (inbrk && testKeep) { | ||
ret = inbrk && !keep; | ||
} else { | ||
ret = inbrk; | ||
} | ||
} | ||
return ret; | ||
} | ||
}); | ||
if (inbrk && testKeep) { | ||
ret = inbrk && !keep; | ||
} else { | ||
ret = inbrk; | ||
} | ||
} | ||
return ret; | ||
} | ||
}); | ||
wrap(Axis.prototype, 'setTickPositions', function(proceed) { | ||
proceed.apply(this, Array.prototype.slice.call(arguments, 1)); | ||
wrap(Axis.prototype, 'setTickPositions', function (proceed) { | ||
proceed.apply(this, Array.prototype.slice.call(arguments, 1)); | ||
if (this.options.breaks) { | ||
var axis = this, | ||
tickPositions = this.tickPositions, | ||
info = this.tickPositions.info, | ||
newPositions = [], | ||
i; | ||
if (this.options.breaks) { | ||
var axis = this, | ||
tickPositions = this.tickPositions, | ||
info = this.tickPositions.info, | ||
newPositions = [], | ||
i; | ||
for (i = 0; i < tickPositions.length; i++) { | ||
if (!axis.isInAnyBreak(tickPositions[i])) { | ||
newPositions.push(tickPositions[i]); | ||
} | ||
} | ||
for (i = 0; i < tickPositions.length; i++) { | ||
if (!axis.isInAnyBreak(tickPositions[i])) { | ||
newPositions.push(tickPositions[i]); | ||
} | ||
} | ||
this.tickPositions = newPositions; | ||
this.tickPositions.info = info; | ||
} | ||
}); | ||
wrap(Axis.prototype, 'init', function (proceed, chart, userOptions) { | ||
// Force Axis to be not-ordinal when breaks are defined | ||
if (userOptions.breaks && userOptions.breaks.length) { | ||
userOptions.ordinal = false; | ||
} | ||
this.tickPositions = newPositions; | ||
this.tickPositions.info = info; | ||
} | ||
}); | ||
proceed.call(this, chart, userOptions); | ||
wrap(Axis.prototype, 'init', function(proceed, chart, userOptions) { | ||
// Force Axis to be not-ordinal when breaks are defined | ||
if (userOptions.breaks && userOptions.breaks.length) { | ||
userOptions.ordinal = false; | ||
} | ||
if (this.options.breaks) { | ||
proceed.call(this, chart, userOptions); | ||
var axis = this; | ||
axis.isBroken = true; | ||
if (this.options.breaks) { | ||
this.val2lin = function (val) { | ||
var nval = val, | ||
brk, | ||
i; | ||
var axis = this; | ||
for (i = 0; i < axis.breakArray.length; i++) { | ||
brk = axis.breakArray[i]; | ||
if (brk.to <= val) { | ||
nval -= brk.len; | ||
} else if (brk.from >= val) { | ||
break; | ||
} else if (axis.isInBreak(brk, val)) { | ||
nval -= (val - brk.from); | ||
break; | ||
} | ||
} | ||
axis.isBroken = true; | ||
return nval; | ||
}; | ||
this.lin2val = function (val) { | ||
var nval = val, | ||
brk, | ||
i; | ||
this.val2lin = function(val) { | ||
var nval = val, | ||
brk, | ||
i; | ||
for (i = 0; i < axis.breakArray.length; i++) { | ||
brk = axis.breakArray[i]; | ||
if (brk.from >= nval) { | ||
break; | ||
} else if (brk.to < nval) { | ||
nval += brk.len; | ||
} else if (axis.isInBreak(brk, nval)) { | ||
nval += brk.len; | ||
} | ||
} | ||
return nval; | ||
}; | ||
for (i = 0; i < axis.breakArray.length; i++) { | ||
brk = axis.breakArray[i]; | ||
if (brk.to <= val) { | ||
nval -= brk.len; | ||
} else if (brk.from >= val) { | ||
break; | ||
} else if (axis.isInBreak(brk, val)) { | ||
nval -= (val - brk.from); | ||
break; | ||
} | ||
} | ||
this.setExtremes = function (newMin, newMax, redraw, animation, eventArguments) { | ||
// If trying to set extremes inside a break, extend it to before and after the break ( #3857 ) | ||
while (this.isInAnyBreak(newMin)) { | ||
newMin -= this.closestPointRange; | ||
} | ||
while (this.isInAnyBreak(newMax)) { | ||
newMax -= this.closestPointRange; | ||
} | ||
Axis.prototype.setExtremes.call(this, newMin, newMax, redraw, animation, eventArguments); | ||
}; | ||
return nval; | ||
}; | ||
this.setAxisTranslation = function (saveOld) { | ||
Axis.prototype.setAxisTranslation.call(this, saveOld); | ||
this.lin2val = function(val) { | ||
var nval = val, | ||
brk, | ||
i; | ||
var breaks = axis.options.breaks, | ||
breakArrayT = [], // Temporary one | ||
breakArray = [], | ||
length = 0, | ||
inBrk, | ||
repeat, | ||
brk, | ||
min = axis.userMin || axis.min, | ||
max = axis.userMax || axis.max, | ||
start, | ||
i, | ||
j; | ||
for (i = 0; i < axis.breakArray.length; i++) { | ||
brk = axis.breakArray[i]; | ||
if (brk.from >= nval) { | ||
break; | ||
} else if (brk.to < nval) { | ||
nval += brk.len; | ||
} else if (axis.isInBreak(brk, nval)) { | ||
nval += brk.len; | ||
} | ||
} | ||
return nval; | ||
}; | ||
// Min & max check (#4247) | ||
for (i in breaks) { | ||
brk = breaks[i]; | ||
repeat = brk.repeat || Infinity; | ||
if (axis.isInBreak(brk, min)) { | ||
min += (brk.to % repeat) - (min % repeat); | ||
} | ||
if (axis.isInBreak(brk, max)) { | ||
max -= (max % repeat) - (brk.from % repeat); | ||
} | ||
} | ||
this.setExtremes = function(newMin, newMax, redraw, animation, eventArguments) { | ||
// If trying to set extremes inside a break, extend it to before and after the break ( #3857 ) | ||
while (this.isInAnyBreak(newMin)) { | ||
newMin -= this.closestPointRange; | ||
} | ||
while (this.isInAnyBreak(newMax)) { | ||
newMax -= this.closestPointRange; | ||
} | ||
Axis.prototype.setExtremes.call(this, newMin, newMax, redraw, animation, eventArguments); | ||
}; | ||
// Construct an array holding all breaks in the axis | ||
for (i in breaks) { | ||
brk = breaks[i]; | ||
start = brk.from; | ||
repeat = brk.repeat || Infinity; | ||
this.setAxisTranslation = function(saveOld) { | ||
Axis.prototype.setAxisTranslation.call(this, saveOld); | ||
while (start - repeat > min) { | ||
start -= repeat; | ||
} | ||
while (start < min) { | ||
start += repeat; | ||
} | ||
var breaks = axis.options.breaks, | ||
breakArrayT = [], // Temporary one | ||
breakArray = [], | ||
length = 0, | ||
inBrk, | ||
repeat, | ||
brk, | ||
min = axis.userMin || axis.min, | ||
max = axis.userMax || axis.max, | ||
start, | ||
i, | ||
j; | ||
for (j = start; j < max; j += repeat) { | ||
breakArrayT.push({ | ||
value: j, | ||
move: 'in' | ||
}); | ||
breakArrayT.push({ | ||
value: j + (brk.to - brk.from), | ||
move: 'out', | ||
size: brk.breakSize | ||
}); | ||
} | ||
} | ||
// Min & max check (#4247) | ||
for (i in breaks) { | ||
brk = breaks[i]; | ||
repeat = brk.repeat || Infinity; | ||
if (axis.isInBreak(brk, min)) { | ||
min += (brk.to % repeat) - (min % repeat); | ||
} | ||
if (axis.isInBreak(brk, max)) { | ||
max -= (max % repeat) - (brk.from % repeat); | ||
} | ||
} | ||
breakArrayT.sort(function (a, b) { | ||
var ret; | ||
if (a.value === b.value) { | ||
ret = (a.move === 'in' ? 0 : 1) - (b.move === 'in' ? 0 : 1); | ||
} else { | ||
ret = a.value - b.value; | ||
} | ||
return ret; | ||
}); | ||
// Simplify the breaks | ||
inBrk = 0; | ||
start = min; | ||
// Construct an array holding all breaks in the axis | ||
for (i in breaks) { | ||
brk = breaks[i]; | ||
start = brk.from; | ||
repeat = brk.repeat || Infinity; | ||
for (i in breakArrayT) { | ||
brk = breakArrayT[i]; | ||
inBrk += (brk.move === 'in' ? 1 : -1); | ||
while (start - repeat > min) { | ||
start -= repeat; | ||
} | ||
while (start < min) { | ||
start += repeat; | ||
} | ||
if (inBrk === 1 && brk.move === 'in') { | ||
start = brk.value; | ||
} | ||
if (inBrk === 0) { | ||
breakArray.push({ | ||
from: start, | ||
to: brk.value, | ||
len: brk.value - start - (brk.size || 0) | ||
}); | ||
length += brk.value - start - (brk.size || 0); | ||
} | ||
} | ||
for (j = start; j < max; j += repeat) { | ||
breakArrayT.push({ | ||
value: j, | ||
move: 'in' | ||
}); | ||
breakArrayT.push({ | ||
value: j + (brk.to - brk.from), | ||
move: 'out', | ||
size: brk.breakSize | ||
}); | ||
} | ||
} | ||
axis.breakArray = breakArray; | ||
breakArrayT.sort(function(a, b) { | ||
var ret; | ||
if (a.value === b.value) { | ||
ret = (a.move === 'in' ? 0 : 1) - (b.move === 'in' ? 0 : 1); | ||
} else { | ||
ret = a.value - b.value; | ||
} | ||
return ret; | ||
}); | ||
fireEvent(axis, 'afterBreaks'); | ||
axis.transA *= ((max - axis.min) / (max - min - length)); | ||
// Simplify the breaks | ||
inBrk = 0; | ||
start = min; | ||
axis.min = min; | ||
axis.max = max; | ||
}; | ||
} | ||
}); | ||
for (i in breakArrayT) { | ||
brk = breakArrayT[i]; | ||
inBrk += (brk.move === 'in' ? 1 : -1); | ||
wrap(Series.prototype, 'generatePoints', function (proceed) { | ||
if (inBrk === 1 && brk.move === 'in') { | ||
start = brk.value; | ||
} | ||
if (inBrk === 0) { | ||
breakArray.push({ | ||
from: start, | ||
to: brk.value, | ||
len: brk.value - start - (brk.size || 0) | ||
}); | ||
length += brk.value - start - (brk.size || 0); | ||
} | ||
} | ||
proceed.apply(this, stripArguments(arguments)); | ||
axis.breakArray = breakArray; | ||
var series = this, | ||
xAxis = series.xAxis, | ||
yAxis = series.yAxis, | ||
points = series.points, | ||
point, | ||
i = points.length, | ||
connectNulls = series.options.connectNulls, | ||
nullGap; | ||
fireEvent(axis, 'afterBreaks'); | ||
axis.transA *= ((max - axis.min) / (max - min - length)); | ||
if (xAxis && yAxis && (xAxis.options.breaks || yAxis.options.breaks)) { | ||
while (i--) { | ||
point = points[i]; | ||
axis.min = min; | ||
axis.max = max; | ||
}; | ||
} | ||
}); | ||
nullGap = point.y === null && connectNulls === false; // respect nulls inside the break (#4275) | ||
if (!nullGap && (xAxis.isInAnyBreak(point.x, true) || yAxis.isInAnyBreak(point.y, true))) { | ||
points.splice(i, 1); | ||
if (this.data[i]) { | ||
this.data[i].destroyElements(); // removes the graphics for this point if they exist | ||
} | ||
} | ||
} | ||
} | ||
wrap(Series.prototype, 'generatePoints', function(proceed) { | ||
}); | ||
proceed.apply(this, stripArguments(arguments)); | ||
function drawPointsWrapped(proceed) { | ||
proceed.apply(this); | ||
this.drawBreaks(this.xAxis, ['x']); | ||
this.drawBreaks(this.yAxis, pick(this.pointArrayMap, ['y'])); | ||
} | ||
var series = this, | ||
xAxis = series.xAxis, | ||
yAxis = series.yAxis, | ||
points = series.points, | ||
point, | ||
i = points.length, | ||
connectNulls = series.options.connectNulls, | ||
nullGap; | ||
H.Series.prototype.drawBreaks = function (axis, keys) { | ||
var series = this, | ||
points = series.points, | ||
breaks, | ||
threshold, | ||
eventName, | ||
y; | ||
each(keys, function (key) { | ||
breaks = axis.breakArray || []; | ||
threshold = axis.isXAxis ? axis.min : pick(series.options.threshold, axis.min); | ||
each(points, function (point) { | ||
y = pick(point['stack' + key.toUpperCase()], point[key]); | ||
each(breaks, function (brk) { | ||
eventName = false; | ||
if (xAxis && yAxis && (xAxis.options.breaks || yAxis.options.breaks)) { | ||
while (i--) { | ||
point = points[i]; | ||
if ((threshold < brk.from && y > brk.to) || (threshold > brk.from && y < brk.from)) { | ||
eventName = 'pointBreak'; | ||
} else if ((threshold < brk.from && y > brk.from && y < brk.to) || (threshold > brk.from && y > brk.to && y < brk.from)) { // point falls inside the break | ||
eventName = 'pointInBreak'; | ||
} | ||
if (eventName) { | ||
fireEvent(axis, eventName, { point: point, brk: brk }); | ||
} | ||
}); | ||
}); | ||
}); | ||
}; | ||
nullGap = point.y === null && connectNulls === false; // respect nulls inside the break (#4275) | ||
if (!nullGap && (xAxis.isInAnyBreak(point.x, true) || yAxis.isInAnyBreak(point.y, true))) { | ||
points.splice(i, 1); | ||
if (this.data[i]) { | ||
this.data[i].destroyElements(); // removes the graphics for this point if they exist | ||
} | ||
} | ||
} | ||
} | ||
wrap(H.seriesTypes.column.prototype, 'drawPoints', drawPointsWrapped); | ||
wrap(H.Series.prototype, 'drawPoints', drawPointsWrapped); | ||
}); | ||
function drawPointsWrapped(proceed) { | ||
proceed.apply(this); | ||
this.drawBreaks(this.xAxis, ['x']); | ||
this.drawBreaks(this.yAxis, pick(this.pointArrayMap, ['y'])); | ||
} | ||
H.Series.prototype.drawBreaks = function(axis, keys) { | ||
var series = this, | ||
points = series.points, | ||
breaks, | ||
threshold, | ||
eventName, | ||
y; | ||
each(keys, function(key) { | ||
breaks = axis.breakArray || []; | ||
threshold = axis.isXAxis ? axis.min : pick(series.options.threshold, axis.min); | ||
each(points, function(point) { | ||
y = pick(point['stack' + key.toUpperCase()], point[key]); | ||
each(breaks, function(brk) { | ||
eventName = false; | ||
if ((threshold < brk.from && y > brk.to) || (threshold > brk.from && y < brk.from)) { | ||
eventName = 'pointBreak'; | ||
} else if ((threshold < brk.from && y > brk.from && y < brk.to) || (threshold > brk.from && y > brk.to && y < brk.from)) { // point falls inside the break | ||
eventName = 'pointInBreak'; | ||
} | ||
if (eventName) { | ||
fireEvent(axis, eventName, { | ||
point: point, | ||
brk: brk | ||
}); | ||
} | ||
}); | ||
}); | ||
}); | ||
}; | ||
wrap(H.seriesTypes.column.prototype, 'drawPoints', drawPointsWrapped); | ||
wrap(H.Series.prototype, 'drawPoints', drawPointsWrapped); | ||
}(Highcharts)); | ||
})); |
/* | ||
Highcharts JS v4.2.7 (2016-09-21) | ||
Highcharts JS v5.0.0 (2016-09-29) | ||
Data module | ||
@@ -9,19 +9,19 @@ | ||
*/ | ||
(function(g){typeof module==="object"&&module.exports?module.exports=g:g(Highcharts)})(function(g){var v=g.win.document,k=g.each,w=g.pick,s=g.inArray,t=g.isNumber,x=g.splat,l,p=function(b,a){this.init(b,a)};g.extend(p.prototype,{init:function(b,a){this.options=b;this.chartOptions=a;this.columns=b.columns||this.rowsToColumns(b.rows)||[];this.firstRowAsNames=w(b.firstRowAsNames,!0);this.decimalRegex=b.decimalPoint&&RegExp("^(-?[0-9]+)"+b.decimalPoint+"([0-9]+)$");this.rawColumns=[];this.columns.length? | ||
this.dataFound():(this.parseCSV(),this.parseTable(),this.parseGoogleSpreadsheet())},getColumnDistribution:function(){var b=this.chartOptions,a=this.options,e=[],f=function(b){return(g.seriesTypes[b||"line"].prototype.pointArrayMap||[0]).length},d=b&&b.chart&&b.chart.type,c=[],h=[],r=0,i;k(b&&b.series||[],function(b){c.push(f(b.type||d))});k(a&&a.seriesMapping||[],function(b){e.push(b.x||0)});e.length===0&&e.push(0);k(a&&a.seriesMapping||[],function(a){var e=new l,o,n=c[r]||f(d),m=g.seriesTypes[((b&& | ||
b.series||[])[r]||{}).type||d||"line"].prototype.pointArrayMap||["y"];e.addColumnReader(a.x,"x");for(o in a)a.hasOwnProperty(o)&&o!=="x"&&e.addColumnReader(a[o],o);for(i=0;i<n;i++)e.hasReader(m[i])||e.addColumnReader(void 0,m[i]);h.push(e);r++});a=g.seriesTypes[d||"line"].prototype.pointArrayMap;a===void 0&&(a=["y"]);this.valueCount={global:f(d),xColumns:e,individual:c,seriesBuilders:h,globalPointArrayMap:a}},dataFound:function(){if(this.options.switchRowsAndColumns)this.columns=this.rowsToColumns(this.columns); | ||
this.getColumnDistribution();this.parseTypes();this.parsed()!==!1&&this.complete()},parseCSV:function(){var b=this,a=this.options,e=a.csv,f=this.columns,d=a.startRow||0,c=a.endRow||Number.MAX_VALUE,h=a.startColumn||0,r=a.endColumn||Number.MAX_VALUE,i,g,u=0;e&&(g=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split(a.lineDelimiter||"\n"),i=a.itemDelimiter||(e.indexOf("\t")!==-1?"\t":","),k(g,function(a,e){var g=b.trim(a),q=g.indexOf("#")===0;e>=d&&e<=c&&!q&&g!==""&&(g=a.split(i),k(g,function(b,a){a>= | ||
h&&a<=r&&(f[a-h]||(f[a-h]=[]),f[a-h][u]=b)}),u+=1)}),this.dataFound())},parseTable:function(){var b=this.options,a=b.table,e=this.columns,f=b.startRow||0,d=b.endRow||Number.MAX_VALUE,c=b.startColumn||0,h=b.endColumn||Number.MAX_VALUE;a&&(typeof a==="string"&&(a=v.getElementById(a)),k(a.getElementsByTagName("tr"),function(b,a){a>=f&&a<=d&&k(b.children,function(b,d){if((b.tagName==="TD"||b.tagName==="TH")&&d>=c&&d<=h)e[d-c]||(e[d-c]=[]),e[d-c][a-f]=b.innerHTML})}),this.dataFound())},parseGoogleSpreadsheet:function(){var b= | ||
this,a=this.options,e=a.googleSpreadsheetKey,f=this.columns,d=a.startRow||0,c=a.endRow||Number.MAX_VALUE,h=a.startColumn||0,g=a.endColumn||Number.MAX_VALUE,i,q;e&&jQuery.ajax({dataType:"json",url:"https://spreadsheets.google.com/feeds/cells/"+e+"/"+(a.googleSpreadsheetWorksheet||"od6")+"/public/values?alt=json-in-script&callback=?",error:a.error,success:function(a){var a=a.feed.entry,e,n=a.length,m=0,l=0,j;for(j=0;j<n;j++)e=a[j],m=Math.max(m,e.gs$cell.col),l=Math.max(l,e.gs$cell.row);for(j=0;j<m;j++)if(j>= | ||
h&&j<=g)f[j-h]=[],f[j-h].length=Math.min(l,c-d);for(j=0;j<n;j++)if(e=a[j],i=e.gs$cell.row-1,q=e.gs$cell.col-1,q>=h&&q<=g&&i>=d&&i<=c)f[q-h][i-d]=e.content.$t;k(f,function(a){for(j=0;j<a.length;j++)a[j]===void 0&&(a[j]=null)});b.dataFound()}})},trim:function(b,a){typeof b==="string"&&(b=b.replace(/^\s+|\s+$/g,""),a&&/^[0-9\s]+$/.test(b)&&(b=b.replace(/\s/g,"")),this.decimalRegex&&(b=b.replace(this.decimalRegex,"$1.$2")));return b},parseTypes:function(){for(var b=this.columns,a=b.length;a--;)this.parseColumn(b[a], | ||
a)},parseColumn:function(b,a){var e=this.rawColumns,f=this.columns,d=b.length,c,h,g,i,l=this.firstRowAsNames,k=s(a,this.valueCount.xColumns)!==-1,o=[],n=this.chartOptions,m,p=(this.options.columnTypes||[])[a],n=k&&(n&&n.xAxis&&x(n.xAxis)[0].type==="category"||p==="string");for(e[a]||(e[a]=[]);d--;)if(c=o[d]||b[d],g=this.trim(c),i=this.trim(c,!0),h=parseFloat(i),e[a][d]===void 0&&(e[a][d]=g),n||d===0&&l)b[d]=g;else if(+i===h)b[d]=h,h>31536E6&&p!=="float"?b.isDatetime=!0:b.isNumeric=!0,b[d+1]!==void 0&& | ||
(m=h>b[d+1]);else if(h=this.parseDate(c),k&&t(h)&&p!=="float"){if(o[d]=c,b[d]=h,b.isDatetime=!0,b[d+1]!==void 0){c=h>b[d+1];if(c!==m&&m!==void 0)this.alternativeFormat?(this.dateFormat=this.alternativeFormat,d=b.length,this.alternativeFormat=this.dateFormats[this.dateFormat].alternative):b.unsorted=!0;m=c}}else if(b[d]=g===""?null:g,d!==0&&(b.isDatetime||b.isNumeric))b.mixed=!0;k&&b.mixed&&(f[a]=e[a]);if(k&&m&&this.options.sort)for(a=0;a<f.length;a++)f[a].reverse(),l&&f[a].unshift(f[a].pop())},dateFormats:{"YYYY-mm-dd":{regex:/^([0-9]{4})[\-\/\.]([0-9]{2})[\-\/\.]([0-9]{2})$/, | ||
parser:function(b){return Date.UTC(+b[1],b[2]-1,+b[3])}},"dd/mm/YYYY":{regex:/^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{4})$/,parser:function(b){return Date.UTC(+b[3],b[2]-1,+b[1])},alternative:"mm/dd/YYYY"},"mm/dd/YYYY":{regex:/^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{4})$/,parser:function(b){return Date.UTC(+b[3],b[1]-1,+b[2])}},"dd/mm/YY":{regex:/^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/,parser:function(b){return Date.UTC(+b[3]+2E3,b[2]-1,+b[1])},alternative:"mm/dd/YY"}, | ||
"mm/dd/YY":{regex:/^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/,parser:function(b){return Date.UTC(+b[3]+2E3,b[1]-1,+b[2])}}},parseDate:function(b){var a=this.options.parseDate,e,f,d=this.options.dateFormat||this.dateFormat,c;if(a)e=a(b);else if(typeof b==="string"){if(d)a=this.dateFormats[d],(c=b.match(a.regex))&&(e=a.parser(c));else for(f in this.dateFormats)if(a=this.dateFormats[f],c=b.match(a.regex)){this.dateFormat=f;this.alternativeFormat=a.alternative;e=a.parser(c);break}c||(c=Date.parse(b), | ||
typeof c==="object"&&c!==null&&c.getTime?e=c.getTime()-c.getTimezoneOffset()*6E4:t(c)&&(e=c-(new Date(c)).getTimezoneOffset()*6E4))}return e},rowsToColumns:function(b){var a,e,f,d,c;if(b){c=[];e=b.length;for(a=0;a<e;a++){d=b[a].length;for(f=0;f<d;f++)c[f]||(c[f]=[]),c[f][a]=b[a][f]}}return c},parsed:function(){if(this.options.parsed)return this.options.parsed.call(this,this.columns)},getFreeIndexes:function(b,a){var e,f,d=[],c=[],h;for(f=0;f<b;f+=1)d.push(!0);for(e=0;e<a.length;e+=1){h=a[e].getReferencedColumnIndexes(); | ||
for(f=0;f<h.length;f+=1)d[h[f]]=!1}for(f=0;f<d.length;f+=1)d[f]&&c.push(f);return c},complete:function(){var b=this.columns,a,e=this.options,f,d,c,h,g=[],i;if(e.complete||e.afterComplete){for(c=0;c<b.length;c++)if(this.firstRowAsNames)b[c].name=b[c].shift();f=[];d=this.getFreeIndexes(b.length,this.valueCount.seriesBuilders);for(c=0;c<this.valueCount.seriesBuilders.length;c++)i=this.valueCount.seriesBuilders[c],i.populateColumns(d)&&g.push(i);for(;d.length>0;){i=new l;i.addColumnReader(0,"x");c=s(0, | ||
d);c!==-1&&d.splice(c,1);for(c=0;c<this.valueCount.global;c++)i.addColumnReader(void 0,this.valueCount.globalPointArrayMap[c]);i.populateColumns(d)&&g.push(i)}g.length>0&&g[0].readers.length>0&&(i=b[g[0].readers[0].columnIndex],i!==void 0&&(i.isDatetime?a="datetime":i.isNumeric||(a="category")));if(a==="category")for(c=0;c<g.length;c++){i=g[c];for(d=0;d<i.readers.length;d++)if(i.readers[d].configName==="x")i.readers[d].configName="name"}for(c=0;c<g.length;c++){i=g[c];d=[];for(h=0;h<b[0].length;h++)d[h]= | ||
i.read(b,h);f[c]={data:d};if(i.name)f[c].name=i.name;if(a==="category")f[c].turboThreshold=0}b={series:f};if(a&&(b.xAxis={type:a},a==="category"))b.xAxis.nameToX=!1;e.complete&&e.complete(b);e.afterComplete&&e.afterComplete(b)}}});g.Data=p;g.data=function(b,a){return new p(b,a)};g.wrap(g.Chart.prototype,"init",function(b,a,e){var f=this;a&&a.data?g.data(g.extend(a.data,{afterComplete:function(d){var c,h;if(a.hasOwnProperty("series"))if(typeof a.series==="object")for(c=Math.max(a.series.length,d.series.length);c--;)h= | ||
a.series[c]||{},a.series[c]=g.merge(h,d.series[c]);else delete a.series;a=g.merge(d,a);b.call(f,a,e)}}),a):b.call(f,a,e)});l=function(){this.readers=[];this.pointIsArray=!0};l.prototype.populateColumns=function(b){var a=!0;k(this.readers,function(a){if(a.columnIndex===void 0)a.columnIndex=b.shift()});k(this.readers,function(b){b.columnIndex===void 0&&(a=!1)});return a};l.prototype.read=function(b,a){var e=this.pointIsArray,f=e?[]:{},d;k(this.readers,function(c){var d=b[c.columnIndex][a];e?f.push(d): | ||
f[c.configName]=d});if(this.name===void 0&&this.readers.length>=2&&(d=this.getReferencedColumnIndexes(),d.length>=2))d.shift(),d.sort(),this.name=b[d.shift()].name;return f};l.prototype.addColumnReader=function(b,a){this.readers.push({columnIndex:b,configName:a});if(!(a==="x"||a==="y"||a===void 0))this.pointIsArray=!1};l.prototype.getReferencedColumnIndexes=function(){var b,a=[],e;for(b=0;b<this.readers.length;b+=1)e=this.readers[b],e.columnIndex!==void 0&&a.push(e.columnIndex);return a};l.prototype.hasReader= | ||
function(b){var a,e;for(a=0;a<this.readers.length;a+=1)if(e=this.readers[a],e.configName===b)return!0}}); | ||
(function(q){"object"===typeof module&&module.exports?module.exports=q:q(Highcharts)})(function(q){(function(g){var q=g.win.document,m=g.each,A=g.pick,x=g.inArray,y=g.isNumber,B=g.splat,n,w=function(b,a){this.init(b,a)};g.extend(w.prototype,{init:function(b,a){this.options=b;this.chartOptions=a;this.columns=b.columns||this.rowsToColumns(b.rows)||[];this.firstRowAsNames=A(b.firstRowAsNames,!0);this.decimalRegex=b.decimalPoint&&new RegExp("^(-?[0-9]+)"+b.decimalPoint+"([0-9]+)$");this.rawColumns=[]; | ||
this.columns.length?this.dataFound():(this.parseCSV(),this.parseTable(),this.parseGoogleSpreadsheet())},getColumnDistribution:function(){var b=this.chartOptions,a=this.options,e=[],f=function(b){return(g.seriesTypes[b||"line"].prototype.pointArrayMap||[0]).length},d=b&&b.chart&&b.chart.type,c=[],h=[],v=0,k;m(b&&b.series||[],function(b){c.push(f(b.type||d))});m(a&&a.seriesMapping||[],function(b){e.push(b.x||0)});0===e.length&&e.push(0);m(a&&a.seriesMapping||[],function(a){var e=new n,t,r=c[v]||f(d), | ||
p=g.seriesTypes[((b&&b.series||[])[v]||{}).type||d||"line"].prototype.pointArrayMap||["y"];e.addColumnReader(a.x,"x");for(t in a)a.hasOwnProperty(t)&&"x"!==t&&e.addColumnReader(a[t],t);for(k=0;k<r;k++)e.hasReader(p[k])||e.addColumnReader(void 0,p[k]);h.push(e);v++});a=g.seriesTypes[d||"line"].prototype.pointArrayMap;void 0===a&&(a=["y"]);this.valueCount={global:f(d),xColumns:e,individual:c,seriesBuilders:h,globalPointArrayMap:a}},dataFound:function(){this.options.switchRowsAndColumns&&(this.columns= | ||
this.rowsToColumns(this.columns));this.getColumnDistribution();this.parseTypes();!1!==this.parsed()&&this.complete()},parseCSV:function(){var b=this,a=this.options,e=a.csv,f=this.columns,d=a.startRow||0,c=a.endRow||Number.MAX_VALUE,h=a.startColumn||0,v=a.endColumn||Number.MAX_VALUE,k,g,z=0;e&&(g=e.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split(a.lineDelimiter||"\n"),k=a.itemDelimiter||(-1!==e.indexOf("\t")?"\t":","),m(g,function(a,e){var g=b.trim(a),u=0===g.indexOf("#");e>=d&&e<=c&&!u&&""!==g&&(g= | ||
a.split(k),m(g,function(b,a){a>=h&&a<=v&&(f[a-h]||(f[a-h]=[]),f[a-h][z]=b)}),z+=1)}),this.dataFound())},parseTable:function(){var b=this.options,a=b.table,e=this.columns,f=b.startRow||0,d=b.endRow||Number.MAX_VALUE,c=b.startColumn||0,h=b.endColumn||Number.MAX_VALUE;a&&("string"===typeof a&&(a=q.getElementById(a)),m(a.getElementsByTagName("tr"),function(b,a){a>=f&&a<=d&&m(b.children,function(b,d){("TD"===b.tagName||"TH"===b.tagName)&&d>=c&&d<=h&&(e[d-c]||(e[d-c]=[]),e[d-c][a-f]=b.innerHTML)})}),this.dataFound())}, | ||
parseGoogleSpreadsheet:function(){var b=this,a=this.options,e=a.googleSpreadsheetKey,f=this.columns,d=a.startRow||0,c=a.endRow||Number.MAX_VALUE,h=a.startColumn||0,g=a.endColumn||Number.MAX_VALUE,k,u;e&&jQuery.ajax({dataType:"json",url:"https://spreadsheets.google.com/feeds/cells/"+e+"/"+(a.googleSpreadsheetWorksheet||"od6")+"/public/values?alt=json-in-script&callback=?",error:a.error,success:function(a){a=a.feed.entry;var e,r=a.length,p=0,n=0,l;for(l=0;l<r;l++)e=a[l],p=Math.max(p,e.gs$cell.col), | ||
n=Math.max(n,e.gs$cell.row);for(l=0;l<p;l++)l>=h&&l<=g&&(f[l-h]=[],f[l-h].length=Math.min(n,c-d));for(l=0;l<r;l++)e=a[l],k=e.gs$cell.row-1,u=e.gs$cell.col-1,u>=h&&u<=g&&k>=d&&k<=c&&(f[u-h][k-d]=e.content.$t);m(f,function(a){for(l=0;l<a.length;l++)void 0===a[l]&&(a[l]=null)});b.dataFound()}})},trim:function(b,a){"string"===typeof b&&(b=b.replace(/^\s+|\s+$/g,""),a&&/^[0-9\s]+$/.test(b)&&(b=b.replace(/\s/g,"")),this.decimalRegex&&(b=b.replace(this.decimalRegex,"$1.$2")));return b},parseTypes:function(){for(var b= | ||
this.columns,a=b.length;a--;)this.parseColumn(b[a],a)},parseColumn:function(b,a){var e=this.rawColumns,f=this.columns,d=b.length,c,h,g,k,n=this.firstRowAsNames,m=-1!==x(a,this.valueCount.xColumns),t=[],r=this.chartOptions,p,q=(this.options.columnTypes||[])[a],r=m&&(r&&r.xAxis&&"category"===B(r.xAxis)[0].type||"string"===q);for(e[a]||(e[a]=[]);d--;)c=t[d]||b[d],g=this.trim(c),k=this.trim(c,!0),h=parseFloat(k),void 0===e[a][d]&&(e[a][d]=g),r||0===d&&n?b[d]=g:+k===h?(b[d]=h,31536E6<h&&"float"!==q?b.isDatetime= | ||
!0:b.isNumeric=!0,void 0!==b[d+1]&&(p=h>b[d+1])):(h=this.parseDate(c),m&&y(h)&&"float"!==q?(t[d]=c,b[d]=h,b.isDatetime=!0,void 0!==b[d+1]&&(c=h>b[d+1],c!==p&&void 0!==p&&(this.alternativeFormat?(this.dateFormat=this.alternativeFormat,d=b.length,this.alternativeFormat=this.dateFormats[this.dateFormat].alternative):b.unsorted=!0),p=c)):(b[d]=""===g?null:g,0!==d&&(b.isDatetime||b.isNumeric)&&(b.mixed=!0)));m&&b.mixed&&(f[a]=e[a]);if(m&&p&&this.options.sort)for(a=0;a<f.length;a++)f[a].reverse(),n&&f[a].unshift(f[a].pop())}, | ||
dateFormats:{"YYYY-mm-dd":{regex:/^([0-9]{4})[\-\/\.]([0-9]{2})[\-\/\.]([0-9]{2})$/,parser:function(b){return Date.UTC(+b[1],b[2]-1,+b[3])}},"dd/mm/YYYY":{regex:/^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{4})$/,parser:function(b){return Date.UTC(+b[3],b[2]-1,+b[1])},alternative:"mm/dd/YYYY"},"mm/dd/YYYY":{regex:/^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{4})$/,parser:function(b){return Date.UTC(+b[3],b[1]-1,+b[2])}},"dd/mm/YY":{regex:/^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/, | ||
parser:function(b){return Date.UTC(+b[3]+2E3,b[2]-1,+b[1])},alternative:"mm/dd/YY"},"mm/dd/YY":{regex:/^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/,parser:function(b){return Date.UTC(+b[3]+2E3,b[1]-1,+b[2])}}},parseDate:function(b){var a=this.options.parseDate,e,f,d=this.options.dateFormat||this.dateFormat,c;if(a)e=a(b);else if("string"===typeof b){if(d)a=this.dateFormats[d],(c=b.match(a.regex))&&(e=a.parser(c));else for(f in this.dateFormats)if(a=this.dateFormats[f],c=b.match(a.regex)){this.dateFormat= | ||
f;this.alternativeFormat=a.alternative;e=a.parser(c);break}c||(c=Date.parse(b),"object"===typeof c&&null!==c&&c.getTime?e=c.getTime()-6E4*c.getTimezoneOffset():y(c)&&(e=c-6E4*(new Date(c)).getTimezoneOffset()))}return e},rowsToColumns:function(b){var a,e,f,d,c;if(b)for(c=[],e=b.length,a=0;a<e;a++)for(d=b[a].length,f=0;f<d;f++)c[f]||(c[f]=[]),c[f][a]=b[a][f];return c},parsed:function(){if(this.options.parsed)return this.options.parsed.call(this,this.columns)},getFreeIndexes:function(b,a){var e,f,d= | ||
[],c=[],h;for(f=0;f<b;f+=1)d.push(!0);for(e=0;e<a.length;e+=1)for(h=a[e].getReferencedColumnIndexes(),f=0;f<h.length;f+=1)d[h[f]]=!1;for(f=0;f<d.length;f+=1)d[f]&&c.push(f);return c},complete:function(){var b=this.columns,a,e=this.options,f,d,c,h,g=[],k;if(e.complete||e.afterComplete){for(c=0;c<b.length;c++)this.firstRowAsNames&&(b[c].name=b[c].shift());f=[];d=this.getFreeIndexes(b.length,this.valueCount.seriesBuilders);for(c=0;c<this.valueCount.seriesBuilders.length;c++)k=this.valueCount.seriesBuilders[c], | ||
k.populateColumns(d)&&g.push(k);for(;0<d.length;){k=new n;k.addColumnReader(0,"x");c=x(0,d);-1!==c&&d.splice(c,1);for(c=0;c<this.valueCount.global;c++)k.addColumnReader(void 0,this.valueCount.globalPointArrayMap[c]);k.populateColumns(d)&&g.push(k)}0<g.length&&0<g[0].readers.length&&(k=b[g[0].readers[0].columnIndex],void 0!==k&&(k.isDatetime?a="datetime":k.isNumeric||(a="category")));if("category"===a)for(c=0;c<g.length;c++)for(k=g[c],d=0;d<k.readers.length;d++)"x"===k.readers[d].configName&&(k.readers[d].configName= | ||
"name");for(c=0;c<g.length;c++){k=g[c];d=[];for(h=0;h<b[0].length;h++)d[h]=k.read(b,h);f[c]={data:d};k.name&&(f[c].name=k.name);"category"===a&&(f[c].turboThreshold=0)}b={series:f};a&&(b.xAxis={type:a},"category"===a&&(b.xAxis.nameToX=!1));e.complete&&e.complete(b);e.afterComplete&&e.afterComplete(b)}}});g.Data=w;g.data=function(b,a){return new w(b,a)};g.wrap(g.Chart.prototype,"init",function(b,a,e){var f=this;a&&a.data?g.data(g.extend(a.data,{afterComplete:function(d){var c,h;if(a.hasOwnProperty("series"))if("object"=== | ||
typeof a.series)for(c=Math.max(a.series.length,d.series.length);c--;)h=a.series[c]||{},a.series[c]=g.merge(h,d.series[c]);else delete a.series;a=g.merge(d,a);b.call(f,a,e)}}),a):b.call(f,a,e)});n=function(){this.readers=[];this.pointIsArray=!0};n.prototype.populateColumns=function(b){var a=!0;m(this.readers,function(a){void 0===a.columnIndex&&(a.columnIndex=b.shift())});m(this.readers,function(b){void 0===b.columnIndex&&(a=!1)});return a};n.prototype.read=function(b,a){var e=this.pointIsArray,f=e? | ||
[]:{},d;m(this.readers,function(c){var d=b[c.columnIndex][a];e?f.push(d):f[c.configName]=d});void 0===this.name&&2<=this.readers.length&&(d=this.getReferencedColumnIndexes(),2<=d.length&&(d.shift(),d.sort(),this.name=b[d.shift()].name));return f};n.prototype.addColumnReader=function(b,a){this.readers.push({columnIndex:b,configName:a});"x"!==a&&"y"!==a&&void 0!==a&&(this.pointIsArray=!1)};n.prototype.getReferencedColumnIndexes=function(){var b,a=[],e;for(b=0;b<this.readers.length;b+=1)e=this.readers[b], | ||
void 0!==e.columnIndex&&a.push(e.columnIndex);return a};n.prototype.hasReader=function(b){var a,e;for(a=0;a<this.readers.length;a+=1)if(e=this.readers[a],e.configName===b)return!0}})(q)}); |
/** | ||
* @license Highcharts JS v4.2.7 (2016-09-21) | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* Data module | ||
@@ -9,966 +9,974 @@ * | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(Highcharts) { | ||
/** | ||
* Data module | ||
* | ||
* (c) 2012-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
/*global jQuery */ | ||
(function (factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function (Highcharts) { | ||
// Utilities | ||
var win = Highcharts.win, | ||
doc = win.document, | ||
each = Highcharts.each, | ||
pick = Highcharts.pick, | ||
inArray = Highcharts.inArray, | ||
isNumber = Highcharts.isNumber, | ||
splat = Highcharts.splat, | ||
SeriesBuilder; | ||
// The Data constructor | ||
var Data = function (dataOptions, chartOptions) { | ||
this.init(dataOptions, chartOptions); | ||
}; | ||
// Set the prototype properties | ||
Highcharts.extend(Data.prototype, { | ||
/** | ||
* Initialize the Data object with the given options | ||
*/ | ||
init: function (options, chartOptions) { | ||
this.options = options; | ||
this.chartOptions = chartOptions; | ||
this.columns = options.columns || this.rowsToColumns(options.rows) || []; | ||
this.firstRowAsNames = pick(options.firstRowAsNames, true); | ||
this.decimalRegex = options.decimalPoint && new RegExp('^(-?[0-9]+)' + options.decimalPoint + '([0-9]+)$'); | ||
/* global jQuery */ | ||
'use strict'; | ||
// This is a two-dimensional array holding the raw, trimmed string values | ||
// with the same organisation as the columns array. It makes it possible | ||
// for example to revert from interpreted timestamps to string-based | ||
// categories. | ||
this.rawColumns = []; | ||
// Utilities | ||
var win = Highcharts.win, | ||
doc = win.document, | ||
each = Highcharts.each, | ||
pick = Highcharts.pick, | ||
inArray = Highcharts.inArray, | ||
isNumber = Highcharts.isNumber, | ||
splat = Highcharts.splat, | ||
SeriesBuilder; | ||
// No need to parse or interpret anything | ||
if (this.columns.length) { | ||
this.dataFound(); | ||
// Parse and interpret | ||
} else { | ||
// The Data constructor | ||
var Data = function(dataOptions, chartOptions) { | ||
this.init(dataOptions, chartOptions); | ||
}; | ||
// Parse a CSV string if options.csv is given | ||
this.parseCSV(); | ||
// Parse a HTML table if options.table is given | ||
this.parseTable(); | ||
// Set the prototype properties | ||
Highcharts.extend(Data.prototype, { | ||
// Parse a Google Spreadsheet | ||
this.parseGoogleSpreadsheet(); | ||
} | ||
/** | ||
* Initialize the Data object with the given options | ||
*/ | ||
init: function(options, chartOptions) { | ||
this.options = options; | ||
this.chartOptions = chartOptions; | ||
this.columns = options.columns || this.rowsToColumns(options.rows) || []; | ||
this.firstRowAsNames = pick(options.firstRowAsNames, true); | ||
this.decimalRegex = options.decimalPoint && new RegExp('^(-?[0-9]+)' + options.decimalPoint + '([0-9]+)$'); | ||
}, | ||
// This is a two-dimensional array holding the raw, trimmed string values | ||
// with the same organisation as the columns array. It makes it possible | ||
// for example to revert from interpreted timestamps to string-based | ||
// categories. | ||
this.rawColumns = []; | ||
/** | ||
* Get the column distribution. For example, a line series takes a single column for | ||
* Y values. A range series takes two columns for low and high values respectively, | ||
* and an OHLC series takes four columns. | ||
*/ | ||
getColumnDistribution: function () { | ||
var chartOptions = this.chartOptions, | ||
options = this.options, | ||
xColumns = [], | ||
getValueCount = function (type) { | ||
return (Highcharts.seriesTypes[type || 'line'].prototype.pointArrayMap || [0]).length; | ||
}, | ||
getPointArrayMap = function (type) { | ||
return Highcharts.seriesTypes[type || 'line'].prototype.pointArrayMap; | ||
}, | ||
globalType = chartOptions && chartOptions.chart && chartOptions.chart.type, | ||
individualCounts = [], | ||
seriesBuilders = [], | ||
seriesIndex = 0, | ||
i; | ||
// No need to parse or interpret anything | ||
if (this.columns.length) { | ||
this.dataFound(); | ||
each((chartOptions && chartOptions.series) || [], function (series) { | ||
individualCounts.push(getValueCount(series.type || globalType)); | ||
}); | ||
// Parse and interpret | ||
} else { | ||
// Collect the x-column indexes from seriesMapping | ||
each((options && options.seriesMapping) || [], function (mapping) { | ||
xColumns.push(mapping.x || 0); | ||
}); | ||
// Parse a CSV string if options.csv is given | ||
this.parseCSV(); | ||
// If there are no defined series with x-columns, use the first column as x column | ||
if (xColumns.length === 0) { | ||
xColumns.push(0); | ||
} | ||
// Parse a HTML table if options.table is given | ||
this.parseTable(); | ||
// Loop all seriesMappings and constructs SeriesBuilders from | ||
// the mapping options. | ||
each((options && options.seriesMapping) || [], function (mapping) { | ||
var builder = new SeriesBuilder(), | ||
name, | ||
numberOfValueColumnsNeeded = individualCounts[seriesIndex] || getValueCount(globalType), | ||
seriesArr = (chartOptions && chartOptions.series) || [], | ||
series = seriesArr[seriesIndex] || {}, | ||
pointArrayMap = getPointArrayMap(series.type || globalType) || ['y']; | ||
// Parse a Google Spreadsheet | ||
this.parseGoogleSpreadsheet(); | ||
} | ||
// Add an x reader from the x property or from an undefined column | ||
// if the property is not set. It will then be auto populated later. | ||
builder.addColumnReader(mapping.x, 'x'); | ||
}, | ||
// Add all column mappings | ||
for (name in mapping) { | ||
if (mapping.hasOwnProperty(name) && name !== 'x') { | ||
builder.addColumnReader(mapping[name], name); | ||
} | ||
} | ||
/** | ||
* Get the column distribution. For example, a line series takes a single column for | ||
* Y values. A range series takes two columns for low and high values respectively, | ||
* and an OHLC series takes four columns. | ||
*/ | ||
getColumnDistribution: function() { | ||
var chartOptions = this.chartOptions, | ||
options = this.options, | ||
xColumns = [], | ||
getValueCount = function(type) { | ||
return (Highcharts.seriesTypes[type || 'line'].prototype.pointArrayMap || [0]).length; | ||
}, | ||
getPointArrayMap = function(type) { | ||
return Highcharts.seriesTypes[type || 'line'].prototype.pointArrayMap; | ||
}, | ||
globalType = chartOptions && chartOptions.chart && chartOptions.chart.type, | ||
individualCounts = [], | ||
seriesBuilders = [], | ||
seriesIndex = 0, | ||
i; | ||
// Add missing columns | ||
for (i = 0; i < numberOfValueColumnsNeeded; i++) { | ||
if (!builder.hasReader(pointArrayMap[i])) { | ||
//builder.addNextColumnReader(pointArrayMap[i]); | ||
// Create and add a column reader for the next free column index | ||
builder.addColumnReader(undefined, pointArrayMap[i]); | ||
} | ||
} | ||
each((chartOptions && chartOptions.series) || [], function(series) { | ||
individualCounts.push(getValueCount(series.type || globalType)); | ||
}); | ||
seriesBuilders.push(builder); | ||
seriesIndex++; | ||
}); | ||
// Collect the x-column indexes from seriesMapping | ||
each((options && options.seriesMapping) || [], function(mapping) { | ||
xColumns.push(mapping.x || 0); | ||
}); | ||
var globalPointArrayMap = getPointArrayMap(globalType); | ||
if (globalPointArrayMap === undefined) { | ||
globalPointArrayMap = ['y']; | ||
} | ||
// If there are no defined series with x-columns, use the first column as x column | ||
if (xColumns.length === 0) { | ||
xColumns.push(0); | ||
} | ||
this.valueCount = { | ||
global: getValueCount(globalType), | ||
xColumns: xColumns, | ||
individual: individualCounts, | ||
seriesBuilders: seriesBuilders, | ||
globalPointArrayMap: globalPointArrayMap | ||
}; | ||
}, | ||
// Loop all seriesMappings and constructs SeriesBuilders from | ||
// the mapping options. | ||
each((options && options.seriesMapping) || [], function(mapping) { | ||
var builder = new SeriesBuilder(), | ||
name, | ||
numberOfValueColumnsNeeded = individualCounts[seriesIndex] || getValueCount(globalType), | ||
seriesArr = (chartOptions && chartOptions.series) || [], | ||
series = seriesArr[seriesIndex] || {}, | ||
pointArrayMap = getPointArrayMap(series.type || globalType) || ['y']; | ||
/** | ||
* When the data is parsed into columns, either by CSV, table, GS or direct input, | ||
* continue with other operations. | ||
*/ | ||
dataFound: function () { | ||
if (this.options.switchRowsAndColumns) { | ||
this.columns = this.rowsToColumns(this.columns); | ||
} | ||
// Add an x reader from the x property or from an undefined column | ||
// if the property is not set. It will then be auto populated later. | ||
builder.addColumnReader(mapping.x, 'x'); | ||
// Interpret the info about series and columns | ||
this.getColumnDistribution(); | ||
// Add all column mappings | ||
for (name in mapping) { | ||
if (mapping.hasOwnProperty(name) && name !== 'x') { | ||
builder.addColumnReader(mapping[name], name); | ||
} | ||
} | ||
// Interpret the values into right types | ||
this.parseTypes(); | ||
// Handle columns if a handleColumns callback is given | ||
if (this.parsed() !== false) { | ||
// Complete if a complete callback is given | ||
this.complete(); | ||
} | ||
}, | ||
/** | ||
* Parse a CSV input string | ||
*/ | ||
parseCSV: function () { | ||
var self = this, | ||
options = this.options, | ||
csv = options.csv, | ||
columns = this.columns, | ||
startRow = options.startRow || 0, | ||
endRow = options.endRow || Number.MAX_VALUE, | ||
startColumn = options.startColumn || 0, | ||
endColumn = options.endColumn || Number.MAX_VALUE, | ||
itemDelimiter, | ||
lines, | ||
activeRowNo = 0; | ||
if (csv) { | ||
lines = csv | ||
.replace(/\r\n/g, '\n') // Unix | ||
.replace(/\r/g, '\n') // Mac | ||
.split(options.lineDelimiter || '\n'); | ||
// Add missing columns | ||
for (i = 0; i < numberOfValueColumnsNeeded; i++) { | ||
if (!builder.hasReader(pointArrayMap[i])) { | ||
//builder.addNextColumnReader(pointArrayMap[i]); | ||
// Create and add a column reader for the next free column index | ||
builder.addColumnReader(undefined, pointArrayMap[i]); | ||
} | ||
} | ||
itemDelimiter = options.itemDelimiter || (csv.indexOf('\t') !== -1 ? '\t' : ','); | ||
each(lines, function (line, rowNo) { | ||
var trimmed = self.trim(line), | ||
isComment = trimmed.indexOf('#') === 0, | ||
isBlank = trimmed === '', | ||
items; | ||
if (rowNo >= startRow && rowNo <= endRow && !isComment && !isBlank) { | ||
items = line.split(itemDelimiter); | ||
each(items, function (item, colNo) { | ||
if (colNo >= startColumn && colNo <= endColumn) { | ||
if (!columns[colNo - startColumn]) { | ||
columns[colNo - startColumn] = []; | ||
} | ||
columns[colNo - startColumn][activeRowNo] = item; | ||
} | ||
}); | ||
activeRowNo += 1; | ||
} | ||
}); | ||
seriesBuilders.push(builder); | ||
seriesIndex++; | ||
}); | ||
this.dataFound(); | ||
} | ||
}, | ||
/** | ||
* Parse a HTML table | ||
*/ | ||
parseTable: function () { | ||
var options = this.options, | ||
table = options.table, | ||
columns = this.columns, | ||
startRow = options.startRow || 0, | ||
endRow = options.endRow || Number.MAX_VALUE, | ||
startColumn = options.startColumn || 0, | ||
endColumn = options.endColumn || Number.MAX_VALUE; | ||
var globalPointArrayMap = getPointArrayMap(globalType); | ||
if (globalPointArrayMap === undefined) { | ||
globalPointArrayMap = ['y']; | ||
} | ||
if (table) { | ||
if (typeof table === 'string') { | ||
table = doc.getElementById(table); | ||
} | ||
each(table.getElementsByTagName('tr'), function (tr, rowNo) { | ||
if (rowNo >= startRow && rowNo <= endRow) { | ||
each(tr.children, function (item, colNo) { | ||
if ((item.tagName === 'TD' || item.tagName === 'TH') && colNo >= startColumn && colNo <= endColumn) { | ||
if (!columns[colNo - startColumn]) { | ||
columns[colNo - startColumn] = []; | ||
} | ||
columns[colNo - startColumn][rowNo - startRow] = item.innerHTML; | ||
} | ||
}); | ||
} | ||
}); | ||
this.valueCount = { | ||
global: getValueCount(globalType), | ||
xColumns: xColumns, | ||
individual: individualCounts, | ||
seriesBuilders: seriesBuilders, | ||
globalPointArrayMap: globalPointArrayMap | ||
}; | ||
}, | ||
this.dataFound(); // continue | ||
} | ||
}, | ||
/** | ||
* When the data is parsed into columns, either by CSV, table, GS or direct input, | ||
* continue with other operations. | ||
*/ | ||
dataFound: function() { | ||
/** | ||
*/ | ||
parseGoogleSpreadsheet: function () { | ||
var self = this, | ||
options = this.options, | ||
googleSpreadsheetKey = options.googleSpreadsheetKey, | ||
columns = this.columns, | ||
startRow = options.startRow || 0, | ||
endRow = options.endRow || Number.MAX_VALUE, | ||
startColumn = options.startColumn || 0, | ||
endColumn = options.endColumn || Number.MAX_VALUE, | ||
gr, // google row | ||
gc; // google column | ||
if (this.options.switchRowsAndColumns) { | ||
this.columns = this.rowsToColumns(this.columns); | ||
} | ||
if (googleSpreadsheetKey) { | ||
jQuery.ajax({ | ||
dataType: 'json', | ||
url: 'https://spreadsheets.google.com/feeds/cells/' + | ||
googleSpreadsheetKey + '/' + (options.googleSpreadsheetWorksheet || 'od6') + | ||
'/public/values?alt=json-in-script&callback=?', | ||
error: options.error, | ||
success: function (json) { | ||
// Prepare the data from the spreadsheat | ||
var cells = json.feed.entry, | ||
cell, | ||
cellCount = cells.length, | ||
colCount = 0, | ||
rowCount = 0, | ||
i; | ||
// First, find the total number of columns and rows that | ||
// are actually filled with data | ||
for (i = 0; i < cellCount; i++) { | ||
cell = cells[i]; | ||
colCount = Math.max(colCount, cell.gs$cell.col); | ||
rowCount = Math.max(rowCount, cell.gs$cell.row); | ||
} | ||
// Set up arrays containing the column data | ||
for (i = 0; i < colCount; i++) { | ||
if (i >= startColumn && i <= endColumn) { | ||
// Create new columns with the length of either end-start or rowCount | ||
columns[i - startColumn] = []; | ||
// Interpret the info about series and columns | ||
this.getColumnDistribution(); | ||
// Setting the length to avoid jslint warning | ||
columns[i - startColumn].length = Math.min(rowCount, endRow - startRow); | ||
} | ||
} | ||
// Loop over the cells and assign the value to the right | ||
// place in the column arrays | ||
for (i = 0; i < cellCount; i++) { | ||
cell = cells[i]; | ||
gr = cell.gs$cell.row - 1; // rows start at 1 | ||
gc = cell.gs$cell.col - 1; // columns start at 1 | ||
// Interpret the values into right types | ||
this.parseTypes(); | ||
// If both row and col falls inside start and end | ||
// set the transposed cell value in the newly created columns | ||
if (gc >= startColumn && gc <= endColumn && | ||
gr >= startRow && gr <= endRow) { | ||
columns[gc - startColumn][gr - startRow] = cell.content.$t; | ||
} | ||
} | ||
// Handle columns if a handleColumns callback is given | ||
if (this.parsed() !== false) { | ||
// Insert null for empty spreadsheet cells (#5298) | ||
each(columns, function (column) { | ||
for (i = 0; i < column.length; i++) { | ||
if (column[i] === undefined) { | ||
column[i] = null; | ||
} | ||
} | ||
}); | ||
// Complete if a complete callback is given | ||
this.complete(); | ||
} | ||
self.dataFound(); | ||
} | ||
}); | ||
} | ||
}, | ||
/** | ||
* Trim a string from whitespace | ||
*/ | ||
trim: function (str, inside) { | ||
if (typeof str === 'string') { | ||
str = str.replace(/^\s+|\s+$/g, ''); | ||
}, | ||
// Clear white space insdie the string, like thousands separators | ||
if (inside && /^[0-9\s]+$/.test(str)) { | ||
str = str.replace(/\s/g, ''); | ||
} | ||
/** | ||
* Parse a CSV input string | ||
*/ | ||
parseCSV: function() { | ||
var self = this, | ||
options = this.options, | ||
csv = options.csv, | ||
columns = this.columns, | ||
startRow = options.startRow || 0, | ||
endRow = options.endRow || Number.MAX_VALUE, | ||
startColumn = options.startColumn || 0, | ||
endColumn = options.endColumn || Number.MAX_VALUE, | ||
itemDelimiter, | ||
lines, | ||
activeRowNo = 0; | ||
if (this.decimalRegex) { | ||
str = str.replace(this.decimalRegex, '$1.$2'); | ||
} | ||
} | ||
return str; | ||
}, | ||
/** | ||
* Parse numeric cells in to number types and date types in to true dates. | ||
*/ | ||
parseTypes: function () { | ||
var columns = this.columns, | ||
col = columns.length; | ||
if (csv) { | ||
while (col--) { | ||
this.parseColumn(columns[col], col); | ||
} | ||
lines = csv | ||
.replace(/\r\n/g, '\n') // Unix | ||
.replace(/\r/g, '\n') // Mac | ||
.split(options.lineDelimiter || '\n'); | ||
}, | ||
itemDelimiter = options.itemDelimiter || (csv.indexOf('\t') !== -1 ? '\t' : ','); | ||
/** | ||
* Parse a single column. Set properties like .isDatetime and .isNumeric. | ||
*/ | ||
parseColumn: function (column, col) { | ||
var rawColumns = this.rawColumns, | ||
columns = this.columns, | ||
row = column.length, | ||
val, | ||
floatVal, | ||
trimVal, | ||
trimInsideVal, | ||
firstRowAsNames = this.firstRowAsNames, | ||
isXColumn = inArray(col, this.valueCount.xColumns) !== -1, | ||
dateVal, | ||
backup = [], | ||
diff, | ||
chartOptions = this.chartOptions, | ||
descending, | ||
columnTypes = this.options.columnTypes || [], | ||
columnType = columnTypes[col], | ||
forceCategory = isXColumn && ((chartOptions && chartOptions.xAxis && splat(chartOptions.xAxis)[0].type === 'category') || columnType === 'string'); | ||
if (!rawColumns[col]) { | ||
rawColumns[col] = []; | ||
} | ||
while (row--) { | ||
val = backup[row] || column[row]; | ||
trimVal = this.trim(val); | ||
trimInsideVal = this.trim(val, true); | ||
floatVal = parseFloat(trimInsideVal); | ||
each(lines, function(line, rowNo) { | ||
var trimmed = self.trim(line), | ||
isComment = trimmed.indexOf('#') === 0, | ||
isBlank = trimmed === '', | ||
items; | ||
// Set it the first time | ||
if (rawColumns[col][row] === undefined) { | ||
rawColumns[col][row] = trimVal; | ||
} | ||
// Disable number or date parsing by setting the X axis type to category | ||
if (forceCategory || (row === 0 && firstRowAsNames)) { | ||
column[row] = trimVal; | ||
if (rowNo >= startRow && rowNo <= endRow && !isComment && !isBlank) { | ||
items = line.split(itemDelimiter); | ||
each(items, function(item, colNo) { | ||
if (colNo >= startColumn && colNo <= endColumn) { | ||
if (!columns[colNo - startColumn]) { | ||
columns[colNo - startColumn] = []; | ||
} | ||
} else if (+trimInsideVal === floatVal) { // is numeric | ||
column[row] = floatVal; | ||
// If the number is greater than milliseconds in a year, assume datetime | ||
if (floatVal > 365 * 24 * 3600 * 1000 && columnType !== 'float') { | ||
column.isDatetime = true; | ||
} else { | ||
column.isNumeric = true; | ||
} | ||
columns[colNo - startColumn][activeRowNo] = item; | ||
} | ||
}); | ||
activeRowNo += 1; | ||
} | ||
}); | ||
if (column[row + 1] !== undefined) { | ||
descending = floatVal > column[row + 1]; | ||
} | ||
// String, continue to determine if it is a date string or really a string | ||
} else { | ||
dateVal = this.parseDate(val); | ||
// Only allow parsing of dates if this column is an x-column | ||
if (isXColumn && isNumber(dateVal) && columnType !== 'float') { // is date | ||
backup[row] = val; | ||
column[row] = dateVal; | ||
column.isDatetime = true; | ||
this.dataFound(); | ||
} | ||
}, | ||
// Check if the dates are uniformly descending or ascending. If they | ||
// are not, chances are that they are a different time format, so check | ||
// for alternative. | ||
if (column[row + 1] !== undefined) { | ||
diff = dateVal > column[row + 1]; | ||
if (diff !== descending && descending !== undefined) { | ||
if (this.alternativeFormat) { | ||
this.dateFormat = this.alternativeFormat; | ||
row = column.length; | ||
this.alternativeFormat = this.dateFormats[this.dateFormat].alternative; | ||
} else { | ||
column.unsorted = true; | ||
} | ||
} | ||
descending = diff; | ||
} | ||
} else { // string | ||
column[row] = trimVal === '' ? null : trimVal; | ||
if (row !== 0 && (column.isDatetime || column.isNumeric)) { | ||
column.mixed = true; | ||
} | ||
} | ||
} | ||
} | ||
/** | ||
* Parse a HTML table | ||
*/ | ||
parseTable: function() { | ||
var options = this.options, | ||
table = options.table, | ||
columns = this.columns, | ||
startRow = options.startRow || 0, | ||
endRow = options.endRow || Number.MAX_VALUE, | ||
startColumn = options.startColumn || 0, | ||
endColumn = options.endColumn || Number.MAX_VALUE; | ||
// If strings are intermixed with numbers or dates in a parsed column, it is an indication | ||
// that parsing went wrong or the data was not intended to display as numbers or dates and | ||
// parsing is too aggressive. Fall back to categories. Demonstrated in the | ||
// highcharts/demo/column-drilldown sample. | ||
if (isXColumn && column.mixed) { | ||
columns[col] = rawColumns[col]; | ||
} | ||
if (table) { | ||
// If the 0 column is date or number and descending, reverse all columns. | ||
if (isXColumn && descending && this.options.sort) { | ||
for (col = 0; col < columns.length; col++) { | ||
columns[col].reverse(); | ||
if (firstRowAsNames) { | ||
columns[col].unshift(columns[col].pop()); | ||
} | ||
} | ||
} | ||
}, | ||
/** | ||
* A collection of available date formats, extendable from the outside to support | ||
* custom date formats. | ||
*/ | ||
dateFormats: { | ||
'YYYY-mm-dd': { | ||
regex: /^([0-9]{4})[\-\/\.]([0-9]{2})[\-\/\.]([0-9]{2})$/, | ||
parser: function (match) { | ||
return Date.UTC(+match[1], match[2] - 1, +match[3]); | ||
} | ||
}, | ||
'dd/mm/YYYY': { | ||
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{4})$/, | ||
parser: function (match) { | ||
return Date.UTC(+match[3], match[2] - 1, +match[1]); | ||
}, | ||
alternative: 'mm/dd/YYYY' // different format with the same regex | ||
}, | ||
'mm/dd/YYYY': { | ||
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{4})$/, | ||
parser: function (match) { | ||
return Date.UTC(+match[3], match[1] - 1, +match[2]); | ||
} | ||
}, | ||
'dd/mm/YY': { | ||
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/, | ||
parser: function (match) { | ||
return Date.UTC(+match[3] + 2000, match[2] - 1, +match[1]); | ||
}, | ||
alternative: 'mm/dd/YY' // different format with the same regex | ||
}, | ||
'mm/dd/YY': { | ||
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/, | ||
parser: function (match) { | ||
return Date.UTC(+match[3] + 2000, match[1] - 1, +match[2]); | ||
} | ||
} | ||
}, | ||
/** | ||
* Parse a date and return it as a number. Overridable through options.parseDate. | ||
*/ | ||
parseDate: function (val) { | ||
var parseDate = this.options.parseDate, | ||
ret, | ||
key, | ||
format, | ||
dateFormat = this.options.dateFormat || this.dateFormat, | ||
match; | ||
if (typeof table === 'string') { | ||
table = doc.getElementById(table); | ||
} | ||
if (parseDate) { | ||
ret = parseDate(val); | ||
} else if (typeof val === 'string') { | ||
// Auto-detect the date format the first time | ||
if (!dateFormat) { | ||
for (key in this.dateFormats) { | ||
format = this.dateFormats[key]; | ||
match = val.match(format.regex); | ||
if (match) { | ||
this.dateFormat = dateFormat = key; | ||
this.alternativeFormat = format.alternative; | ||
ret = format.parser(match); | ||
break; | ||
} | ||
} | ||
// Next time, use the one previously found | ||
} else { | ||
format = this.dateFormats[dateFormat]; | ||
match = val.match(format.regex); | ||
if (match) { | ||
ret = format.parser(match); | ||
} | ||
} | ||
// Fall back to Date.parse | ||
if (!match) { | ||
match = Date.parse(val); | ||
// External tools like Date.js and MooTools extend Date object and | ||
// returns a date. | ||
if (typeof match === 'object' && match !== null && match.getTime) { | ||
ret = match.getTime() - match.getTimezoneOffset() * 60000; | ||
// Timestamp | ||
} else if (isNumber(match)) { | ||
ret = match - (new Date(match)).getTimezoneOffset() * 60000; | ||
} | ||
} | ||
} | ||
return ret; | ||
}, | ||
/** | ||
* Reorganize rows into columns | ||
*/ | ||
rowsToColumns: function (rows) { | ||
var row, | ||
rowsLength, | ||
col, | ||
colsLength, | ||
columns; | ||
each(table.getElementsByTagName('tr'), function(tr, rowNo) { | ||
if (rowNo >= startRow && rowNo <= endRow) { | ||
each(tr.children, function(item, colNo) { | ||
if ((item.tagName === 'TD' || item.tagName === 'TH') && colNo >= startColumn && colNo <= endColumn) { | ||
if (!columns[colNo - startColumn]) { | ||
columns[colNo - startColumn] = []; | ||
} | ||
if (rows) { | ||
columns = []; | ||
rowsLength = rows.length; | ||
for (row = 0; row < rowsLength; row++) { | ||
colsLength = rows[row].length; | ||
for (col = 0; col < colsLength; col++) { | ||
if (!columns[col]) { | ||
columns[col] = []; | ||
} | ||
columns[col][row] = rows[row][col]; | ||
} | ||
} | ||
} | ||
return columns; | ||
}, | ||
/** | ||
* A hook for working directly on the parsed columns | ||
*/ | ||
parsed: function () { | ||
if (this.options.parsed) { | ||
return this.options.parsed.call(this, this.columns); | ||
} | ||
}, | ||
columns[colNo - startColumn][rowNo - startRow] = item.innerHTML; | ||
} | ||
}); | ||
} | ||
}); | ||
getFreeIndexes: function (numberOfColumns, seriesBuilders) { | ||
var s, | ||
i, | ||
freeIndexes = [], | ||
freeIndexValues = [], | ||
referencedIndexes; | ||
this.dataFound(); // continue | ||
} | ||
}, | ||
// Add all columns as free | ||
for (i = 0; i < numberOfColumns; i = i + 1) { | ||
freeIndexes.push(true); | ||
} | ||
/** | ||
*/ | ||
parseGoogleSpreadsheet: function() { | ||
var self = this, | ||
options = this.options, | ||
googleSpreadsheetKey = options.googleSpreadsheetKey, | ||
columns = this.columns, | ||
startRow = options.startRow || 0, | ||
endRow = options.endRow || Number.MAX_VALUE, | ||
startColumn = options.startColumn || 0, | ||
endColumn = options.endColumn || Number.MAX_VALUE, | ||
gr, // google row | ||
gc; // google column | ||
// Loop all defined builders and remove their referenced columns | ||
for (s = 0; s < seriesBuilders.length; s = s + 1) { | ||
referencedIndexes = seriesBuilders[s].getReferencedColumnIndexes(); | ||
if (googleSpreadsheetKey) { | ||
jQuery.ajax({ | ||
dataType: 'json', | ||
url: 'https://spreadsheets.google.com/feeds/cells/' + | ||
googleSpreadsheetKey + '/' + (options.googleSpreadsheetWorksheet || 'od6') + | ||
'/public/values?alt=json-in-script&callback=?', | ||
error: options.error, | ||
success: function(json) { | ||
// Prepare the data from the spreadsheat | ||
var cells = json.feed.entry, | ||
cell, | ||
cellCount = cells.length, | ||
colCount = 0, | ||
rowCount = 0, | ||
i; | ||
for (i = 0; i < referencedIndexes.length; i = i + 1) { | ||
freeIndexes[referencedIndexes[i]] = false; | ||
} | ||
} | ||
// First, find the total number of columns and rows that | ||
// are actually filled with data | ||
for (i = 0; i < cellCount; i++) { | ||
cell = cells[i]; | ||
colCount = Math.max(colCount, cell.gs$cell.col); | ||
rowCount = Math.max(rowCount, cell.gs$cell.row); | ||
} | ||
// Collect the values for the free indexes | ||
for (i = 0; i < freeIndexes.length; i = i + 1) { | ||
if (freeIndexes[i]) { | ||
freeIndexValues.push(i); | ||
} | ||
} | ||
// Set up arrays containing the column data | ||
for (i = 0; i < colCount; i++) { | ||
if (i >= startColumn && i <= endColumn) { | ||
// Create new columns with the length of either end-start or rowCount | ||
columns[i - startColumn] = []; | ||
return freeIndexValues; | ||
}, | ||
/** | ||
* If a complete callback function is provided in the options, interpret the | ||
* columns into a Highcharts options object. | ||
*/ | ||
complete: function () { | ||
var columns = this.columns, | ||
xColumns = [], | ||
type, | ||
options = this.options, | ||
series, | ||
data, | ||
i, | ||
j, | ||
r, | ||
seriesIndex, | ||
chartOptions, | ||
allSeriesBuilders = [], | ||
builder, | ||
freeIndexes, | ||
typeCol, | ||
index; | ||
// Setting the length to avoid jslint warning | ||
columns[i - startColumn].length = Math.min(rowCount, endRow - startRow); | ||
} | ||
} | ||
xColumns.length = columns.length; | ||
if (options.complete || options.afterComplete) { | ||
// Loop over the cells and assign the value to the right | ||
// place in the column arrays | ||
for (i = 0; i < cellCount; i++) { | ||
cell = cells[i]; | ||
gr = cell.gs$cell.row - 1; // rows start at 1 | ||
gc = cell.gs$cell.col - 1; // columns start at 1 | ||
// Get the names and shift the top row | ||
for (i = 0; i < columns.length; i++) { | ||
if (this.firstRowAsNames) { | ||
columns[i].name = columns[i].shift(); | ||
} | ||
} | ||
// Use the next columns for series | ||
series = []; | ||
freeIndexes = this.getFreeIndexes(columns.length, this.valueCount.seriesBuilders); | ||
// If both row and col falls inside start and end | ||
// set the transposed cell value in the newly created columns | ||
if (gc >= startColumn && gc <= endColumn && | ||
gr >= startRow && gr <= endRow) { | ||
columns[gc - startColumn][gr - startRow] = cell.content.$t; | ||
} | ||
} | ||
// Populate defined series | ||
for (seriesIndex = 0; seriesIndex < this.valueCount.seriesBuilders.length; seriesIndex++) { | ||
builder = this.valueCount.seriesBuilders[seriesIndex]; | ||
// Insert null for empty spreadsheet cells (#5298) | ||
each(columns, function(column) { | ||
for (i = 0; i < column.length; i++) { | ||
if (column[i] === undefined) { | ||
column[i] = null; | ||
} | ||
} | ||
}); | ||
// If the builder can be populated with remaining columns, then add it to allBuilders | ||
if (builder.populateColumns(freeIndexes)) { | ||
allSeriesBuilders.push(builder); | ||
} | ||
} | ||
self.dataFound(); | ||
} | ||
}); | ||
} | ||
}, | ||
// Populate dynamic series | ||
while (freeIndexes.length > 0) { | ||
builder = new SeriesBuilder(); | ||
builder.addColumnReader(0, 'x'); | ||
// Mark index as used (not free) | ||
index = inArray(0, freeIndexes); | ||
if (index !== -1) { | ||
freeIndexes.splice(index, 1); | ||
} | ||
/** | ||
* Trim a string from whitespace | ||
*/ | ||
trim: function(str, inside) { | ||
if (typeof str === 'string') { | ||
str = str.replace(/^\s+|\s+$/g, ''); | ||
for (i = 0; i < this.valueCount.global; i++) { | ||
// Create and add a column reader for the next free column index | ||
builder.addColumnReader(undefined, this.valueCount.globalPointArrayMap[i]); | ||
} | ||
// Clear white space insdie the string, like thousands separators | ||
if (inside && /^[0-9\s]+$/.test(str)) { | ||
str = str.replace(/\s/g, ''); | ||
} | ||
// If the builder can be populated with remaining columns, then add it to allBuilders | ||
if (builder.populateColumns(freeIndexes)) { | ||
allSeriesBuilders.push(builder); | ||
} | ||
} | ||
if (this.decimalRegex) { | ||
str = str.replace(this.decimalRegex, '$1.$2'); | ||
} | ||
} | ||
return str; | ||
}, | ||
// Get the data-type from the first series x column | ||
if (allSeriesBuilders.length > 0 && allSeriesBuilders[0].readers.length > 0) { | ||
typeCol = columns[allSeriesBuilders[0].readers[0].columnIndex]; | ||
if (typeCol !== undefined) { | ||
if (typeCol.isDatetime) { | ||
type = 'datetime'; | ||
} else if (!typeCol.isNumeric) { | ||
type = 'category'; | ||
} | ||
} | ||
} | ||
// Axis type is category, then the "x" column should be called "name" | ||
if (type === 'category') { | ||
for (seriesIndex = 0; seriesIndex < allSeriesBuilders.length; seriesIndex++) { | ||
builder = allSeriesBuilders[seriesIndex]; | ||
for (r = 0; r < builder.readers.length; r++) { | ||
if (builder.readers[r].configName === 'x') { | ||
builder.readers[r].configName = 'name'; | ||
} | ||
} | ||
} | ||
} | ||
/** | ||
* Parse numeric cells in to number types and date types in to true dates. | ||
*/ | ||
parseTypes: function() { | ||
var columns = this.columns, | ||
col = columns.length; | ||
// Read data for all builders | ||
for (seriesIndex = 0; seriesIndex < allSeriesBuilders.length; seriesIndex++) { | ||
builder = allSeriesBuilders[seriesIndex]; | ||
while (col--) { | ||
this.parseColumn(columns[col], col); | ||
} | ||
// Iterate down the cells of each column and add data to the series | ||
data = []; | ||
for (j = 0; j < columns[0].length; j++) { | ||
data[j] = builder.read(columns, j); | ||
} | ||
}, | ||
// Add the series | ||
series[seriesIndex] = { | ||
data: data | ||
}; | ||
if (builder.name) { | ||
series[seriesIndex].name = builder.name; | ||
} | ||
if (type === 'category') { | ||
series[seriesIndex].turboThreshold = 0; | ||
} | ||
} | ||
/** | ||
* Parse a single column. Set properties like .isDatetime and .isNumeric. | ||
*/ | ||
parseColumn: function(column, col) { | ||
var rawColumns = this.rawColumns, | ||
columns = this.columns, | ||
row = column.length, | ||
val, | ||
floatVal, | ||
trimVal, | ||
trimInsideVal, | ||
firstRowAsNames = this.firstRowAsNames, | ||
isXColumn = inArray(col, this.valueCount.xColumns) !== -1, | ||
dateVal, | ||
backup = [], | ||
diff, | ||
chartOptions = this.chartOptions, | ||
descending, | ||
columnTypes = this.options.columnTypes || [], | ||
columnType = columnTypes[col], | ||
forceCategory = isXColumn && ((chartOptions && chartOptions.xAxis && splat(chartOptions.xAxis)[0].type === 'category') || columnType === 'string'); | ||
if (!rawColumns[col]) { | ||
rawColumns[col] = []; | ||
} | ||
while (row--) { | ||
val = backup[row] || column[row]; | ||
trimVal = this.trim(val); | ||
trimInsideVal = this.trim(val, true); | ||
floatVal = parseFloat(trimInsideVal); | ||
// Do the callback | ||
chartOptions = { | ||
series: series | ||
}; | ||
if (type) { | ||
chartOptions.xAxis = { | ||
type: type | ||
}; | ||
if (type === 'category') { | ||
chartOptions.xAxis.nameToX = false; | ||
} | ||
} | ||
if (options.complete) { | ||
options.complete(chartOptions); | ||
} | ||
// Set it the first time | ||
if (rawColumns[col][row] === undefined) { | ||
rawColumns[col][row] = trimVal; | ||
} | ||
// The afterComplete hook is used internally to avoid conflict with the externally | ||
// available complete option. | ||
if (options.afterComplete) { | ||
options.afterComplete(chartOptions); | ||
} | ||
} | ||
} | ||
}); | ||
// Register the Data prototype and data function on Highcharts | ||
Highcharts.Data = Data; | ||
Highcharts.data = function (options, chartOptions) { | ||
return new Data(options, chartOptions); | ||
}; | ||
// Disable number or date parsing by setting the X axis type to category | ||
if (forceCategory || (row === 0 && firstRowAsNames)) { | ||
column[row] = trimVal; | ||
// Extend Chart.init so that the Chart constructor accepts a new configuration | ||
// option group, data. | ||
Highcharts.wrap(Highcharts.Chart.prototype, 'init', function (proceed, userOptions, callback) { | ||
var chart = this; | ||
} else if (+trimInsideVal === floatVal) { // is numeric | ||
if (userOptions && userOptions.data) { | ||
Highcharts.data(Highcharts.extend(userOptions.data, { | ||
column[row] = floatVal; | ||
afterComplete: function (dataOptions) { | ||
var i, series; | ||
// Merge series configs | ||
if (userOptions.hasOwnProperty('series')) { | ||
if (typeof userOptions.series === 'object') { | ||
i = Math.max(userOptions.series.length, dataOptions.series.length); | ||
while (i--) { | ||
series = userOptions.series[i] || {}; | ||
userOptions.series[i] = Highcharts.merge(series, dataOptions.series[i]); | ||
} | ||
} else { // Allow merging in dataOptions.series (#2856) | ||
delete userOptions.series; | ||
} | ||
} | ||
// If the number is greater than milliseconds in a year, assume datetime | ||
if (floatVal > 365 * 24 * 3600 * 1000 && columnType !== 'float') { | ||
column.isDatetime = true; | ||
} else { | ||
column.isNumeric = true; | ||
} | ||
// Do the merge | ||
userOptions = Highcharts.merge(dataOptions, userOptions); | ||
if (column[row + 1] !== undefined) { | ||
descending = floatVal > column[row + 1]; | ||
} | ||
proceed.call(chart, userOptions, callback); | ||
} | ||
}), userOptions); | ||
} else { | ||
proceed.call(chart, userOptions, callback); | ||
} | ||
}); | ||
// String, continue to determine if it is a date string or really a string | ||
} else { | ||
dateVal = this.parseDate(val); | ||
// Only allow parsing of dates if this column is an x-column | ||
if (isXColumn && isNumber(dateVal) && columnType !== 'float') { // is date | ||
backup[row] = val; | ||
column[row] = dateVal; | ||
column.isDatetime = true; | ||
/** | ||
* Creates a new SeriesBuilder. A SeriesBuilder consists of a number | ||
* of ColumnReaders that reads columns and give them a name. | ||
* Ex: A series builder can be constructed to read column 3 as 'x' and | ||
* column 7 and 8 as 'y1' and 'y2'. | ||
* The output would then be points/rows of the form {x: 11, y1: 22, y2: 33} | ||
* | ||
* The name of the builder is taken from the second column. In the above | ||
* example it would be the column with index 7. | ||
* @constructor | ||
*/ | ||
SeriesBuilder = function () { | ||
this.readers = []; | ||
this.pointIsArray = true; | ||
}; | ||
// Check if the dates are uniformly descending or ascending. If they | ||
// are not, chances are that they are a different time format, so check | ||
// for alternative. | ||
if (column[row + 1] !== undefined) { | ||
diff = dateVal > column[row + 1]; | ||
if (diff !== descending && descending !== undefined) { | ||
if (this.alternativeFormat) { | ||
this.dateFormat = this.alternativeFormat; | ||
row = column.length; | ||
this.alternativeFormat = this.dateFormats[this.dateFormat].alternative; | ||
} else { | ||
column.unsorted = true; | ||
} | ||
} | ||
descending = diff; | ||
} | ||
/** | ||
* Populates readers with column indexes. A reader can be added without | ||
* a specific index and for those readers the index is taken sequentially | ||
* from the free columns (this is handled by the ColumnCursor instance). | ||
* @returns {boolean} | ||
*/ | ||
SeriesBuilder.prototype.populateColumns = function (freeIndexes) { | ||
var builder = this, | ||
enoughColumns = true; | ||
} else { // string | ||
column[row] = trimVal === '' ? null : trimVal; | ||
if (row !== 0 && (column.isDatetime || column.isNumeric)) { | ||
column.mixed = true; | ||
} | ||
} | ||
} | ||
} | ||
// Loop each reader and give it an index if its missing. | ||
// The freeIndexes.shift() will return undefined if there | ||
// are no more columns. | ||
each(builder.readers, function (reader) { | ||
if (reader.columnIndex === undefined) { | ||
reader.columnIndex = freeIndexes.shift(); | ||
} | ||
}); | ||
// If strings are intermixed with numbers or dates in a parsed column, it is an indication | ||
// that parsing went wrong or the data was not intended to display as numbers or dates and | ||
// parsing is too aggressive. Fall back to categories. Demonstrated in the | ||
// highcharts/demo/column-drilldown sample. | ||
if (isXColumn && column.mixed) { | ||
columns[col] = rawColumns[col]; | ||
} | ||
// Now, all readers should have columns mapped. If not | ||
// then return false to signal that this series should | ||
// not be added. | ||
each(builder.readers, function (reader) { | ||
if (reader.columnIndex === undefined) { | ||
enoughColumns = false; | ||
} | ||
}); | ||
// If the 0 column is date or number and descending, reverse all columns. | ||
if (isXColumn && descending && this.options.sort) { | ||
for (col = 0; col < columns.length; col++) { | ||
columns[col].reverse(); | ||
if (firstRowAsNames) { | ||
columns[col].unshift(columns[col].pop()); | ||
} | ||
} | ||
} | ||
}, | ||
return enoughColumns; | ||
}; | ||
/** | ||
* A collection of available date formats, extendable from the outside to support | ||
* custom date formats. | ||
*/ | ||
dateFormats: { | ||
'YYYY-mm-dd': { | ||
regex: /^([0-9]{4})[\-\/\.]([0-9]{2})[\-\/\.]([0-9]{2})$/, | ||
parser: function(match) { | ||
return Date.UTC(+match[1], match[2] - 1, +match[3]); | ||
} | ||
}, | ||
'dd/mm/YYYY': { | ||
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{4})$/, | ||
parser: function(match) { | ||
return Date.UTC(+match[3], match[2] - 1, +match[1]); | ||
}, | ||
alternative: 'mm/dd/YYYY' // different format with the same regex | ||
}, | ||
'mm/dd/YYYY': { | ||
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{4})$/, | ||
parser: function(match) { | ||
return Date.UTC(+match[3], match[1] - 1, +match[2]); | ||
} | ||
}, | ||
'dd/mm/YY': { | ||
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/, | ||
parser: function(match) { | ||
return Date.UTC(+match[3] + 2000, match[2] - 1, +match[1]); | ||
}, | ||
alternative: 'mm/dd/YY' // different format with the same regex | ||
}, | ||
'mm/dd/YY': { | ||
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/, | ||
parser: function(match) { | ||
return Date.UTC(+match[3] + 2000, match[1] - 1, +match[2]); | ||
} | ||
} | ||
}, | ||
/** | ||
* Reads a row from the dataset and returns a point or array depending | ||
* on the names of the readers. | ||
* @param columns | ||
* @param rowIndex | ||
* @returns {Array | Object} | ||
*/ | ||
SeriesBuilder.prototype.read = function (columns, rowIndex) { | ||
var builder = this, | ||
pointIsArray = builder.pointIsArray, | ||
point = pointIsArray ? [] : {}, | ||
columnIndexes; | ||
/** | ||
* Parse a date and return it as a number. Overridable through options.parseDate. | ||
*/ | ||
parseDate: function(val) { | ||
var parseDate = this.options.parseDate, | ||
ret, | ||
key, | ||
format, | ||
dateFormat = this.options.dateFormat || this.dateFormat, | ||
match; | ||
// Loop each reader and ask it to read its value. | ||
// Then, build an array or point based on the readers names. | ||
each(builder.readers, function (reader) { | ||
var value = columns[reader.columnIndex][rowIndex]; | ||
if (pointIsArray) { | ||
point.push(value); | ||
} else { | ||
point[reader.configName] = value; | ||
} | ||
}); | ||
if (parseDate) { | ||
ret = parseDate(val); | ||
// The name comes from the first column (excluding the x column) | ||
if (this.name === undefined && builder.readers.length >= 2) { | ||
columnIndexes = builder.getReferencedColumnIndexes(); | ||
if (columnIndexes.length >= 2) { | ||
// remove the first one (x col) | ||
columnIndexes.shift(); | ||
} else if (typeof val === 'string') { | ||
// Auto-detect the date format the first time | ||
if (!dateFormat) { | ||
for (key in this.dateFormats) { | ||
format = this.dateFormats[key]; | ||
match = val.match(format.regex); | ||
if (match) { | ||
this.dateFormat = dateFormat = key; | ||
this.alternativeFormat = format.alternative; | ||
ret = format.parser(match); | ||
break; | ||
} | ||
} | ||
// Next time, use the one previously found | ||
} else { | ||
format = this.dateFormats[dateFormat]; | ||
match = val.match(format.regex); | ||
if (match) { | ||
ret = format.parser(match); | ||
} | ||
} | ||
// Fall back to Date.parse | ||
if (!match) { | ||
match = Date.parse(val); | ||
// External tools like Date.js and MooTools extend Date object and | ||
// returns a date. | ||
if (typeof match === 'object' && match !== null && match.getTime) { | ||
ret = match.getTime() - match.getTimezoneOffset() * 60000; | ||
// Sort the remaining | ||
columnIndexes.sort(); | ||
// Timestamp | ||
} else if (isNumber(match)) { | ||
ret = match - (new Date(match)).getTimezoneOffset() * 60000; | ||
} | ||
} | ||
} | ||
return ret; | ||
}, | ||
// Now use the lowest index as name column | ||
this.name = columns[columnIndexes.shift()].name; | ||
} | ||
} | ||
/** | ||
* Reorganize rows into columns | ||
*/ | ||
rowsToColumns: function(rows) { | ||
var row, | ||
rowsLength, | ||
col, | ||
colsLength, | ||
columns; | ||
return point; | ||
}; | ||
if (rows) { | ||
columns = []; | ||
rowsLength = rows.length; | ||
for (row = 0; row < rowsLength; row++) { | ||
colsLength = rows[row].length; | ||
for (col = 0; col < colsLength; col++) { | ||
if (!columns[col]) { | ||
columns[col] = []; | ||
} | ||
columns[col][row] = rows[row][col]; | ||
} | ||
} | ||
} | ||
return columns; | ||
}, | ||
/** | ||
* Creates and adds ColumnReader from the given columnIndex and configName. | ||
* ColumnIndex can be undefined and in that case the reader will be given | ||
* an index when columns are populated. | ||
* @param columnIndex {Number | undefined} | ||
* @param configName | ||
*/ | ||
SeriesBuilder.prototype.addColumnReader = function (columnIndex, configName) { | ||
this.readers.push({ | ||
columnIndex: columnIndex, | ||
configName: configName | ||
}); | ||
/** | ||
* A hook for working directly on the parsed columns | ||
*/ | ||
parsed: function() { | ||
if (this.options.parsed) { | ||
return this.options.parsed.call(this, this.columns); | ||
} | ||
}, | ||
if (!(configName === 'x' || configName === 'y' || configName === undefined)) { | ||
this.pointIsArray = false; | ||
} | ||
}; | ||
getFreeIndexes: function(numberOfColumns, seriesBuilders) { | ||
var s, | ||
i, | ||
freeIndexes = [], | ||
freeIndexValues = [], | ||
referencedIndexes; | ||
/** | ||
* Returns an array of column indexes that the builder will use when | ||
* reading data. | ||
* @returns {Array} | ||
*/ | ||
SeriesBuilder.prototype.getReferencedColumnIndexes = function () { | ||
var i, | ||
referencedColumnIndexes = [], | ||
columnReader; | ||
for (i = 0; i < this.readers.length; i = i + 1) { | ||
columnReader = this.readers[i]; | ||
if (columnReader.columnIndex !== undefined) { | ||
referencedColumnIndexes.push(columnReader.columnIndex); | ||
} | ||
} | ||
// Add all columns as free | ||
for (i = 0; i < numberOfColumns; i = i + 1) { | ||
freeIndexes.push(true); | ||
} | ||
return referencedColumnIndexes; | ||
}; | ||
// Loop all defined builders and remove their referenced columns | ||
for (s = 0; s < seriesBuilders.length; s = s + 1) { | ||
referencedIndexes = seriesBuilders[s].getReferencedColumnIndexes(); | ||
/** | ||
* Returns true if the builder has a reader for the given configName. | ||
* @param configName | ||
* @returns {boolean} | ||
*/ | ||
SeriesBuilder.prototype.hasReader = function (configName) { | ||
var i, columnReader; | ||
for (i = 0; i < this.readers.length; i = i + 1) { | ||
columnReader = this.readers[i]; | ||
if (columnReader.configName === configName) { | ||
return true; | ||
} | ||
} | ||
// Else return undefined | ||
}; | ||
for (i = 0; i < referencedIndexes.length; i = i + 1) { | ||
freeIndexes[referencedIndexes[i]] = false; | ||
} | ||
} | ||
// Collect the values for the free indexes | ||
for (i = 0; i < freeIndexes.length; i = i + 1) { | ||
if (freeIndexes[i]) { | ||
freeIndexValues.push(i); | ||
} | ||
} | ||
return freeIndexValues; | ||
}, | ||
/** | ||
* If a complete callback function is provided in the options, interpret the | ||
* columns into a Highcharts options object. | ||
*/ | ||
complete: function() { | ||
var columns = this.columns, | ||
xColumns = [], | ||
type, | ||
options = this.options, | ||
series, | ||
data, | ||
i, | ||
j, | ||
r, | ||
seriesIndex, | ||
chartOptions, | ||
allSeriesBuilders = [], | ||
builder, | ||
freeIndexes, | ||
typeCol, | ||
index; | ||
xColumns.length = columns.length; | ||
if (options.complete || options.afterComplete) { | ||
// Get the names and shift the top row | ||
for (i = 0; i < columns.length; i++) { | ||
if (this.firstRowAsNames) { | ||
columns[i].name = columns[i].shift(); | ||
} | ||
} | ||
// Use the next columns for series | ||
series = []; | ||
freeIndexes = this.getFreeIndexes(columns.length, this.valueCount.seriesBuilders); | ||
// Populate defined series | ||
for (seriesIndex = 0; seriesIndex < this.valueCount.seriesBuilders.length; seriesIndex++) { | ||
builder = this.valueCount.seriesBuilders[seriesIndex]; | ||
// If the builder can be populated with remaining columns, then add it to allBuilders | ||
if (builder.populateColumns(freeIndexes)) { | ||
allSeriesBuilders.push(builder); | ||
} | ||
} | ||
// Populate dynamic series | ||
while (freeIndexes.length > 0) { | ||
builder = new SeriesBuilder(); | ||
builder.addColumnReader(0, 'x'); | ||
// Mark index as used (not free) | ||
index = inArray(0, freeIndexes); | ||
if (index !== -1) { | ||
freeIndexes.splice(index, 1); | ||
} | ||
for (i = 0; i < this.valueCount.global; i++) { | ||
// Create and add a column reader for the next free column index | ||
builder.addColumnReader(undefined, this.valueCount.globalPointArrayMap[i]); | ||
} | ||
// If the builder can be populated with remaining columns, then add it to allBuilders | ||
if (builder.populateColumns(freeIndexes)) { | ||
allSeriesBuilders.push(builder); | ||
} | ||
} | ||
// Get the data-type from the first series x column | ||
if (allSeriesBuilders.length > 0 && allSeriesBuilders[0].readers.length > 0) { | ||
typeCol = columns[allSeriesBuilders[0].readers[0].columnIndex]; | ||
if (typeCol !== undefined) { | ||
if (typeCol.isDatetime) { | ||
type = 'datetime'; | ||
} else if (!typeCol.isNumeric) { | ||
type = 'category'; | ||
} | ||
} | ||
} | ||
// Axis type is category, then the "x" column should be called "name" | ||
if (type === 'category') { | ||
for (seriesIndex = 0; seriesIndex < allSeriesBuilders.length; seriesIndex++) { | ||
builder = allSeriesBuilders[seriesIndex]; | ||
for (r = 0; r < builder.readers.length; r++) { | ||
if (builder.readers[r].configName === 'x') { | ||
builder.readers[r].configName = 'name'; | ||
} | ||
} | ||
} | ||
} | ||
// Read data for all builders | ||
for (seriesIndex = 0; seriesIndex < allSeriesBuilders.length; seriesIndex++) { | ||
builder = allSeriesBuilders[seriesIndex]; | ||
// Iterate down the cells of each column and add data to the series | ||
data = []; | ||
for (j = 0; j < columns[0].length; j++) { | ||
data[j] = builder.read(columns, j); | ||
} | ||
// Add the series | ||
series[seriesIndex] = { | ||
data: data | ||
}; | ||
if (builder.name) { | ||
series[seriesIndex].name = builder.name; | ||
} | ||
if (type === 'category') { | ||
series[seriesIndex].turboThreshold = 0; | ||
} | ||
} | ||
// Do the callback | ||
chartOptions = { | ||
series: series | ||
}; | ||
if (type) { | ||
chartOptions.xAxis = { | ||
type: type | ||
}; | ||
if (type === 'category') { | ||
chartOptions.xAxis.nameToX = false; | ||
} | ||
} | ||
if (options.complete) { | ||
options.complete(chartOptions); | ||
} | ||
// The afterComplete hook is used internally to avoid conflict with the externally | ||
// available complete option. | ||
if (options.afterComplete) { | ||
options.afterComplete(chartOptions); | ||
} | ||
} | ||
} | ||
}); | ||
// Register the Data prototype and data function on Highcharts | ||
Highcharts.Data = Data; | ||
Highcharts.data = function(options, chartOptions) { | ||
return new Data(options, chartOptions); | ||
}; | ||
// Extend Chart.init so that the Chart constructor accepts a new configuration | ||
// option group, data. | ||
Highcharts.wrap(Highcharts.Chart.prototype, 'init', function(proceed, userOptions, callback) { | ||
var chart = this; | ||
if (userOptions && userOptions.data) { | ||
Highcharts.data(Highcharts.extend(userOptions.data, { | ||
afterComplete: function(dataOptions) { | ||
var i, series; | ||
// Merge series configs | ||
if (userOptions.hasOwnProperty('series')) { | ||
if (typeof userOptions.series === 'object') { | ||
i = Math.max(userOptions.series.length, dataOptions.series.length); | ||
while (i--) { | ||
series = userOptions.series[i] || {}; | ||
userOptions.series[i] = Highcharts.merge(series, dataOptions.series[i]); | ||
} | ||
} else { // Allow merging in dataOptions.series (#2856) | ||
delete userOptions.series; | ||
} | ||
} | ||
// Do the merge | ||
userOptions = Highcharts.merge(dataOptions, userOptions); | ||
proceed.call(chart, userOptions, callback); | ||
} | ||
}), userOptions); | ||
} else { | ||
proceed.call(chart, userOptions, callback); | ||
} | ||
}); | ||
/** | ||
* Creates a new SeriesBuilder. A SeriesBuilder consists of a number | ||
* of ColumnReaders that reads columns and give them a name. | ||
* Ex: A series builder can be constructed to read column 3 as 'x' and | ||
* column 7 and 8 as 'y1' and 'y2'. | ||
* The output would then be points/rows of the form {x: 11, y1: 22, y2: 33} | ||
* | ||
* The name of the builder is taken from the second column. In the above | ||
* example it would be the column with index 7. | ||
* @constructor | ||
*/ | ||
SeriesBuilder = function() { | ||
this.readers = []; | ||
this.pointIsArray = true; | ||
}; | ||
/** | ||
* Populates readers with column indexes. A reader can be added without | ||
* a specific index and for those readers the index is taken sequentially | ||
* from the free columns (this is handled by the ColumnCursor instance). | ||
* @returns {boolean} | ||
*/ | ||
SeriesBuilder.prototype.populateColumns = function(freeIndexes) { | ||
var builder = this, | ||
enoughColumns = true; | ||
// Loop each reader and give it an index if its missing. | ||
// The freeIndexes.shift() will return undefined if there | ||
// are no more columns. | ||
each(builder.readers, function(reader) { | ||
if (reader.columnIndex === undefined) { | ||
reader.columnIndex = freeIndexes.shift(); | ||
} | ||
}); | ||
// Now, all readers should have columns mapped. If not | ||
// then return false to signal that this series should | ||
// not be added. | ||
each(builder.readers, function(reader) { | ||
if (reader.columnIndex === undefined) { | ||
enoughColumns = false; | ||
} | ||
}); | ||
return enoughColumns; | ||
}; | ||
/** | ||
* Reads a row from the dataset and returns a point or array depending | ||
* on the names of the readers. | ||
* @param columns | ||
* @param rowIndex | ||
* @returns {Array | Object} | ||
*/ | ||
SeriesBuilder.prototype.read = function(columns, rowIndex) { | ||
var builder = this, | ||
pointIsArray = builder.pointIsArray, | ||
point = pointIsArray ? [] : {}, | ||
columnIndexes; | ||
// Loop each reader and ask it to read its value. | ||
// Then, build an array or point based on the readers names. | ||
each(builder.readers, function(reader) { | ||
var value = columns[reader.columnIndex][rowIndex]; | ||
if (pointIsArray) { | ||
point.push(value); | ||
} else { | ||
point[reader.configName] = value; | ||
} | ||
}); | ||
// The name comes from the first column (excluding the x column) | ||
if (this.name === undefined && builder.readers.length >= 2) { | ||
columnIndexes = builder.getReferencedColumnIndexes(); | ||
if (columnIndexes.length >= 2) { | ||
// remove the first one (x col) | ||
columnIndexes.shift(); | ||
// Sort the remaining | ||
columnIndexes.sort(); | ||
// Now use the lowest index as name column | ||
this.name = columns[columnIndexes.shift()].name; | ||
} | ||
} | ||
return point; | ||
}; | ||
/** | ||
* Creates and adds ColumnReader from the given columnIndex and configName. | ||
* ColumnIndex can be undefined and in that case the reader will be given | ||
* an index when columns are populated. | ||
* @param columnIndex {Number | undefined} | ||
* @param configName | ||
*/ | ||
SeriesBuilder.prototype.addColumnReader = function(columnIndex, configName) { | ||
this.readers.push({ | ||
columnIndex: columnIndex, | ||
configName: configName | ||
}); | ||
if (!(configName === 'x' || configName === 'y' || configName === undefined)) { | ||
this.pointIsArray = false; | ||
} | ||
}; | ||
/** | ||
* Returns an array of column indexes that the builder will use when | ||
* reading data. | ||
* @returns {Array} | ||
*/ | ||
SeriesBuilder.prototype.getReferencedColumnIndexes = function() { | ||
var i, | ||
referencedColumnIndexes = [], | ||
columnReader; | ||
for (i = 0; i < this.readers.length; i = i + 1) { | ||
columnReader = this.readers[i]; | ||
if (columnReader.columnIndex !== undefined) { | ||
referencedColumnIndexes.push(columnReader.columnIndex); | ||
} | ||
} | ||
return referencedColumnIndexes; | ||
}; | ||
/** | ||
* Returns true if the builder has a reader for the given configName. | ||
* @param configName | ||
* @returns {boolean} | ||
*/ | ||
SeriesBuilder.prototype.hasReader = function(configName) { | ||
var i, columnReader; | ||
for (i = 0; i < this.readers.length; i = i + 1) { | ||
columnReader = this.readers[i]; | ||
if (columnReader.configName === configName) { | ||
return true; | ||
} | ||
} | ||
// Else return undefined | ||
}; | ||
}(Highcharts)); | ||
})); |
@@ -1,18 +0,26 @@ | ||
(function(d){typeof module==="object"&&module.exports?module.exports=d:d(Highcharts)})(function(d){function A(b,a,f){var c;!a.rgba.length||!b.rgba.length?b=a.input||"none":(b=b.rgba,a=a.rgba,c=a[3]!==1||b[3]!==1,b=(c?"rgba(":"rgb(")+Math.round(a[0]+(b[0]-a[0])*(1-f))+","+Math.round(a[1]+(b[1]-a[1])*(1-f))+","+Math.round(a[2]+(b[2]-a[2])*(1-f))+(c?","+(a[3]+(b[3]-a[3])*(1-f)):"")+")");return b}var u=function(){},q=d.getOptions(),i=d.each,o=d.extend,B=d.format,C=d.merge,v=d.pick,r=d.wrap,l=d.Chart, | ||
p=d.seriesTypes,w=p.pie,m=p.column,x=d.Tick,s=d.fireEvent,y=d.inArray,z=1;i(["fill","stroke"],function(b){d.Fx.prototype[b+"Setter"]=function(){this.elem.attr(b,A(d.Color(this.start),d.Color(this.end),this.pos))}});o(q.lang,{drillUpText:"\u25c1 Back to {series.name}"});q.drilldown={activeAxisLabelStyle:{cursor:"pointer",color:"#0d233a",fontWeight:"bold",textDecoration:"underline"},activeDataLabelStyle:{cursor:"pointer",fontWeight:"bold",textDecoration:"underline"},animation:{duration:500},drillUpButton:{position:{align:"right", | ||
x:-10,y:10}}};d.SVGRenderer.prototype.Element.prototype.fadeIn=function(b){this.attr({opacity:0.1,visibility:"inherit"}).animate({opacity:v(this.newOpacity,1)},b||{duration:250})};l.prototype.addSeriesAsDrilldown=function(b,a){this.addSingleSeriesAsDrilldown(b,a);this.applyDrilldown()};l.prototype.addSingleSeriesAsDrilldown=function(b,a){var f=b.series,c=f.xAxis,g=f.yAxis,e;e=b.color||f.color;var h,d=[],j=[],k,n;if(!this.drilldownLevels)this.drilldownLevels=[];k=f.options._levelNumber||0;(n=this.drilldownLevels[this.drilldownLevels.length- | ||
1])&&n.levelNumber!==k&&(n=void 0);if(!a.color)a.color=e;a._ddSeriesId=z++;h=y(b,f.points);i(f.chart.series,function(a){if(a.xAxis===c&&!a.isDrilling)a.options._ddSeriesId=a.options._ddSeriesId||z++,a.options._colorIndex=a.userOptions._colorIndex,a.options._levelNumber=a.options._levelNumber||k,n?(d=n.levelSeries,j=n.levelSeriesOptions):(d.push(a),j.push(a.options))});e={levelNumber:k,seriesOptions:f.options,levelSeriesOptions:j,levelSeries:d,shapeArgs:b.shapeArgs,bBox:b.graphic?b.graphic.getBBox(): | ||
{},color:b.isNull?(new Highcharts.Color(e)).setOpacity(0).get():e,lowerSeriesOptions:a,pointOptions:f.options.data[h],pointIndex:h,oldExtremes:{xMin:c&&c.userMin,xMax:c&&c.userMax,yMin:g&&g.userMin,yMax:g&&g.userMax}};this.drilldownLevels.push(e);e=e.lowerSeries=this.addSeries(a,!1);e.options._levelNumber=k+1;if(c)c.oldPos=c.pos,c.userMin=c.userMax=null,g.userMin=g.userMax=null;if(f.type===e.type)e.animate=e.animateDrilldown||u,e.options.animation=!0};l.prototype.applyDrilldown=function(){var b=this.drilldownLevels, | ||
a;if(b&&b.length>0)a=b[b.length-1].levelNumber,i(this.drilldownLevels,function(b){b.levelNumber===a&&i(b.levelSeries,function(b){b.options&&b.options._levelNumber===a&&b.remove(!1)})});this.redraw();this.showDrillUpButton()};l.prototype.getDrilldownBackText=function(){var b=this.drilldownLevels;if(b&&b.length>0)return b=b[b.length-1],b.series=b.seriesOptions,B(this.options.lang.drillUpText,b)};l.prototype.showDrillUpButton=function(){var b=this,a=this.getDrilldownBackText(),f=b.options.drilldown.drillUpButton, | ||
c,g;this.drillUpButton?this.drillUpButton.attr({text:a}).align():(g=(c=f.theme)&&c.states,this.drillUpButton=this.renderer.button(a,null,null,function(){b.drillUp()},c,g&&g.hover,g&&g.select).attr({align:f.position.align,zIndex:9}).add().align(f.position,!1,f.relativeTo||"plotBox"))};l.prototype.drillUp=function(){for(var b=this,a=b.drilldownLevels,f=a[a.length-1].levelNumber,c=a.length,g=b.series,e,h,d,j,k=function(a){var c;i(g,function(b){b.options._ddSeriesId===a._ddSeriesId&&(c=b)});c=c||b.addSeries(a, | ||
!1);if(c.type===d.type&&c.animateDrillupTo)c.animate=c.animateDrillupTo;a===h.seriesOptions&&(j=c)};c--;)if(h=a[c],h.levelNumber===f){a.pop();d=h.lowerSeries;if(!d.chart)for(e=g.length;e--;)if(g[e].options.id===h.lowerSeriesOptions.id&&g[e].options._levelNumber===f+1){d=g[e];break}d.xData=[];i(h.levelSeriesOptions,k);s(b,"drillup",{seriesOptions:h.seriesOptions});if(j.type===d.type)j.drilldownLevel=h,j.options.animation=b.options.drilldown.animation,d.animateDrillupFrom&&d.chart&&d.animateDrillupFrom(h); | ||
j.options._levelNumber=f;d.remove(!1);if(j.xAxis)e=h.oldExtremes,j.xAxis.setExtremes(e.xMin,e.xMax,!1),j.yAxis.setExtremes(e.yMin,e.yMax,!1)}s(b,"drillupall");this.redraw();this.drilldownLevels.length===0?this.drillUpButton=this.drillUpButton.destroy():this.drillUpButton.attr({text:this.getDrilldownBackText()}).align();this.ddDupes.length=[]};m.prototype.supportsDrilldown=!0;m.prototype.animateDrillupTo=function(b){if(!b){var a=this,f=a.drilldownLevel;i(this.points,function(a){a.graphic&&a.graphic.hide(); | ||
a.dataLabel&&a.dataLabel.hide();a.connector&&a.connector.hide()});setTimeout(function(){a.points&&i(a.points,function(a,b){var e=b===(f&&f.pointIndex)?"show":"fadeIn",d=e==="show"?!0:void 0;if(a.graphic)a.graphic[e](d);if(a.dataLabel)a.dataLabel[e](d);if(a.connector)a.connector[e](d)})},Math.max(this.chart.options.drilldown.animation.duration-50,0));this.animate=u}};m.prototype.animateDrilldown=function(b){var a=this,f=this.chart.drilldownLevels,c,g=this.chart.options.drilldown.animation,e=this.xAxis; | ||
if(!b)i(f,function(b){if(a.options._ddSeriesId===b.lowerSeriesOptions._ddSeriesId)c=b.shapeArgs,c.fill=b.color}),c.x+=v(e.oldPos,e.pos)-e.pos,i(this.points,function(b){b.graphic&&b.graphic.attr(c).animate(o(b.shapeArgs,{fill:b.color||a.color}),g);b.dataLabel&&b.dataLabel.fadeIn(g)}),this.animate=null};m.prototype.animateDrillupFrom=function(b){var a=this.chart.options.drilldown.animation,f=this.group,c=this;i(c.trackerGroups,function(a){if(c[a])c[a].on("mouseover")});delete this.group;i(this.points, | ||
function(c){var e=c.graphic,h=function(){e.destroy();f&&(f=f.destroy())};e&&(delete c.graphic,a?e.animate(o(b.shapeArgs,{fill:b.color}),d.merge(a,{complete:h})):(e.attr(b.shapeArgs),h()))})};w&&o(w.prototype,{supportsDrilldown:!0,animateDrillupTo:m.prototype.animateDrillupTo,animateDrillupFrom:m.prototype.animateDrillupFrom,animateDrilldown:function(b){var a=this.chart.drilldownLevels[this.chart.drilldownLevels.length-1],f=this.chart.options.drilldown.animation,c=a.shapeArgs,g=c.start,e=(c.end-g)/ | ||
this.points.length;if(!b)i(this.points,function(b,i){if(b.graphic)b.graphic.attr(d.merge(c,{start:g+i*e,end:g+(i+1)*e,fill:a.color}))[f?"animate":"attr"](o(b.shapeArgs,{fill:b.color}),f)}),this.animate=null}});d.Point.prototype.doDrilldown=function(b,a,f){var c=this.series.chart,d=c.options.drilldown,e=(d.series||[]).length,h;if(!c.ddDupes)c.ddDupes=[];for(;e--&&!h;)d.series[e].id===this.drilldown&&y(this.drilldown,c.ddDupes)===-1&&(h=d.series[e],c.ddDupes.push(this.drilldown));s(c,"drilldown",{point:this, | ||
seriesOptions:h,category:a,originalEvent:f,points:a!==void 0&&this.series.xAxis.getDDPoints(a).slice(0)},function(a){var c=a.point.series&&a.point.series.chart,e=a.seriesOptions;c&&e&&(b?c.addSingleSeriesAsDrilldown(a.point,e):c.addSeriesAsDrilldown(a.point,e))})};d.Axis.prototype.drilldownCategory=function(b,a){var f,c,d=this.getDDPoints(b);for(f in d)(c=d[f])&&c.series&&c.series.visible&&c.doDrilldown&&c.doDrilldown(!0,b,a);this.chart.applyDrilldown()};d.Axis.prototype.getDDPoints=function(b){var a= | ||
[];i(this.series,function(f){var c,d=f.xData,e=f.points;for(c=0;c<d.length;c++)if(d[c]===b&&f.options.data[c].drilldown){a.push(e?e[c]:!0);break}});return a};x.prototype.drillable=function(){var b=this.pos,a=this.label,f=this.axis,c=f.coll==="xAxis"&&f.getDDPoints,g=c&&f.getDDPoints(b);if(c)if(a&&g.length){if(!a.basicStyles)a.basicStyles=d.merge(a.styles);a.addClass("highcharts-drilldown-axis-label").css(f.chart.options.drilldown.activeAxisLabelStyle).on("click",function(a){f.drilldownCategory(b, | ||
a)})}else if(a&&a.basicStyles)a.styles={},a.css(a.basicStyles),a.on("click",null)};r(x.prototype,"addLabel",function(b){b.call(this);this.drillable()});r(d.Point.prototype,"init",function(b,a,f,c){var g=b.call(this,a,f,c),b=(b=a.xAxis)&&b.ticks[c];g.drilldown&&d.addEvent(g,"click",function(b){a.xAxis&&a.chart.options.drilldown.allowPointDrilldown===!1?a.xAxis.drilldownCategory(c,b):g.doDrilldown(void 0,void 0,b)});b&&b.drillable();return g});r(d.Series.prototype,"drawDataLabels",function(b){var a= | ||
this,d=a.chart.options.drilldown.activeDataLabelStyle,c=a.chart.renderer;b.call(a);i(a.points,function(b){var e={};if(b.drilldown&&b.dataLabel){if(d.color==="contrast")e.color=c.getContrast(b.color||a.color);b.dataLabel.attr({"class":"highcharts-drilldown-data-label"}).css(C(d,e))}})});var t,q=function(b){b.call(this);i(this.points,function(a){a.drilldown&&a.graphic&&a.graphic.attr({"class":"highcharts-drilldown-point"}).css({cursor:"pointer"})})};for(t in p)p[t].prototype.supportsDrilldown&&r(p[t].prototype, | ||
"drawTracker",q)}); | ||
/* | ||
Highcharts JS v5.0.0 (2016-09-29) | ||
Highcharts Drilldown module | ||
Author: Torstein Honsi | ||
License: www.highcharts.com/license | ||
*/ | ||
(function(n){"object"===typeof module&&module.exports?module.exports=n:n(Highcharts)})(function(n){(function(e){function n(b,a,d){var c;a.rgba.length&&b.rgba.length?(b=b.rgba,a=a.rgba,c=1!==a[3]||1!==b[3],b=(c?"rgba(":"rgb(")+Math.round(a[0]+(b[0]-a[0])*(1-d))+","+Math.round(a[1]+(b[1]-a[1])*(1-d))+","+Math.round(a[2]+(b[2]-a[2])*(1-d))+(c?","+(a[3]+(b[3]-a[3])*(1-d)):"")+")"):b=a.input||"none";return b}var A=e.noop,B=e.color,u=e.defaultOptions,h=e.each,p=e.extend,H=e.format,C=e.pick,v=e.wrap,q=e.Chart, | ||
t=e.seriesTypes,D=t.pie,r=t.column,E=e.Tick,w=e.fireEvent,F=e.inArray,G=1;h(["fill","stroke"],function(b){e.Fx.prototype[b+"Setter"]=function(){this.elem.attr(b,n(B(this.start),B(this.end),this.pos))}});p(u.lang,{drillUpText:"\u25c1 Back to {series.name}"});u.drilldown={activeAxisLabelStyle:{cursor:"pointer",color:"#003399",fontWeight:"bold",textDecoration:"underline"},activeDataLabelStyle:{cursor:"pointer",color:"#003399",fontWeight:"bold",textDecoration:"underline"},animation:{duration:500},drillUpButton:{position:{align:"right", | ||
x:-10,y:10}}};e.SVGRenderer.prototype.Element.prototype.fadeIn=function(b){this.attr({opacity:.1,visibility:"inherit"}).animate({opacity:C(this.newOpacity,1)},b||{duration:250})};q.prototype.addSeriesAsDrilldown=function(b,a){this.addSingleSeriesAsDrilldown(b,a);this.applyDrilldown()};q.prototype.addSingleSeriesAsDrilldown=function(b,a){var d=b.series,c=d.xAxis,g=d.yAxis,f,k=[],x=[],e,m,y;y={color:b.color||d.color};this.drilldownLevels||(this.drilldownLevels=[]);e=d.options._levelNumber||0;(m=this.drilldownLevels[this.drilldownLevels.length- | ||
1])&&m.levelNumber!==e&&(m=void 0);a=p(p({_ddSeriesId:G++},y),a);f=F(b,d.points);h(d.chart.series,function(a){a.xAxis!==c||a.isDrilling||(a.options._ddSeriesId=a.options._ddSeriesId||G++,a.options._colorIndex=a.userOptions._colorIndex,a.options._levelNumber=a.options._levelNumber||e,m?(k=m.levelSeries,x=m.levelSeriesOptions):(k.push(a),x.push(a.options)))});f=p({levelNumber:e,seriesOptions:d.options,levelSeriesOptions:x,levelSeries:k,shapeArgs:b.shapeArgs,bBox:b.graphic?b.graphic.getBBox():{},lowerSeriesOptions:a, | ||
pointOptions:d.options.data[f],pointIndex:f,oldExtremes:{xMin:c&&c.userMin,xMax:c&&c.userMax,yMin:g&&g.userMin,yMax:g&&g.userMax}},y);this.drilldownLevels.push(f);f=f.lowerSeries=this.addSeries(a,!1);f.options._levelNumber=e+1;c&&(c.oldPos=c.pos,c.userMin=c.userMax=null,g.userMin=g.userMax=null);d.type===f.type&&(f.animate=f.animateDrilldown||A,f.options.animation=!0)};q.prototype.applyDrilldown=function(){var b=this.drilldownLevels,a;b&&0<b.length&&(a=b[b.length-1].levelNumber,h(this.drilldownLevels, | ||
function(b){b.levelNumber===a&&h(b.levelSeries,function(c){c.options&&c.options._levelNumber===a&&c.remove(!1)})}));this.redraw();this.showDrillUpButton()};q.prototype.getDrilldownBackText=function(){var b=this.drilldownLevels;if(b&&0<b.length)return b=b[b.length-1],b.series=b.seriesOptions,H(this.options.lang.drillUpText,b)};q.prototype.showDrillUpButton=function(){var b=this,a=this.getDrilldownBackText(),d=b.options.drilldown.drillUpButton,c,g;this.drillUpButton?this.drillUpButton.attr({text:a}).align(): | ||
(g=(c=d.theme)&&c.states,this.drillUpButton=this.renderer.button(a,null,null,function(){b.drillUp()},c,g&&g.hover,g&&g.select).addClass("highcharts-drillup-button").attr({align:d.position.align,zIndex:7}).add().align(d.position,!1,d.relativeTo||"plotBox"))};q.prototype.drillUp=function(){for(var b=this,a=b.drilldownLevels,d=a[a.length-1].levelNumber,c=a.length,g=b.series,f,k,e,l,m=function(a){var c;h(g,function(b){b.options._ddSeriesId===a._ddSeriesId&&(c=b)});c=c||b.addSeries(a,!1);c.type===e.type&& | ||
c.animateDrillupTo&&(c.animate=c.animateDrillupTo);a===k.seriesOptions&&(l=c)};c--;)if(k=a[c],k.levelNumber===d){a.pop();e=k.lowerSeries;if(!e.chart)for(f=g.length;f--;)if(g[f].options.id===k.lowerSeriesOptions.id&&g[f].options._levelNumber===d+1){e=g[f];break}e.xData=[];h(k.levelSeriesOptions,m);w(b,"drillup",{seriesOptions:k.seriesOptions});l.type===e.type&&(l.drilldownLevel=k,l.options.animation=b.options.drilldown.animation,e.animateDrillupFrom&&e.chart&&e.animateDrillupFrom(k));l.options._levelNumber= | ||
d;e.remove(!1);l.xAxis&&(f=k.oldExtremes,l.xAxis.setExtremes(f.xMin,f.xMax,!1),l.yAxis.setExtremes(f.yMin,f.yMax,!1))}w(b,"drillupall");this.redraw();0===this.drilldownLevels.length?this.drillUpButton=this.drillUpButton.destroy():this.drillUpButton.attr({text:this.getDrilldownBackText()}).align();this.ddDupes.length=[]};r.prototype.supportsDrilldown=!0;r.prototype.animateDrillupTo=function(b){if(!b){var a=this,d=a.drilldownLevel;h(this.points,function(a){a.graphic&&a.graphic.hide();a.dataLabel&&a.dataLabel.hide(); | ||
a.connector&&a.connector.hide()});setTimeout(function(){a.points&&h(a.points,function(a,b){var f=b===(d&&d.pointIndex)?"show":"fadeIn",k="show"===f?!0:void 0;if(a.graphic)a.graphic[f](k);if(a.dataLabel)a.dataLabel[f](k);if(a.connector)a.connector[f](k)})},Math.max(this.chart.options.drilldown.animation.duration-50,0));this.animate=A}};r.prototype.animateDrilldown=function(b){var a=this,d=this.chart.drilldownLevels,c,g=this.chart.options.drilldown.animation,f=this.xAxis;b||(h(d,function(b){a.options._ddSeriesId=== | ||
b.lowerSeriesOptions._ddSeriesId&&(c=b.shapeArgs,c.fill=b.color)}),c.x+=C(f.oldPos,f.pos)-f.pos,h(this.points,function(b){b.shapeArgs.fill=b.color;b.graphic&&b.graphic.attr(c).animate(p(b.shapeArgs,{fill:b.color||a.color}),g);b.dataLabel&&b.dataLabel.fadeIn(g)}),this.animate=null)};r.prototype.animateDrillupFrom=function(b){var a=this.chart.options.drilldown.animation,d=this.group,c=this;h(c.trackerGroups,function(a){if(c[a])c[a].on("mouseover")});delete this.group;h(this.points,function(c){var f= | ||
c.graphic,k=b.shapeArgs,h=function(){f.destroy();d&&(d=d.destroy())};f&&(delete c.graphic,k.fill=b.color,a?f.animate(k,e.merge(a,{complete:h})):(f.attr(k),h()))})};D&&p(D.prototype,{supportsDrilldown:!0,animateDrillupTo:r.prototype.animateDrillupTo,animateDrillupFrom:r.prototype.animateDrillupFrom,animateDrilldown:function(b){var a=this.chart.drilldownLevels[this.chart.drilldownLevels.length-1],d=this.chart.options.drilldown.animation,c=a.shapeArgs,g=c.start,f=(c.end-g)/this.points.length;b||(h(this.points, | ||
function(b,h){var l=b.shapeArgs;c.fill=a.color;l.fill=b.color;if(b.graphic)b.graphic.attr(e.merge(c,{start:g+h*f,end:g+(h+1)*f}))[d?"animate":"attr"](l,d)}),this.animate=null)}});e.Point.prototype.doDrilldown=function(b,a,d){var c=this.series.chart,g=c.options.drilldown,f=(g.series||[]).length,e;c.ddDupes||(c.ddDupes=[]);for(;f--&&!e;)g.series[f].id===this.drilldown&&-1===F(this.drilldown,c.ddDupes)&&(e=g.series[f],c.ddDupes.push(this.drilldown));w(c,"drilldown",{point:this,seriesOptions:e,category:a, | ||
originalEvent:d,points:void 0!==a&&this.series.xAxis.getDDPoints(a).slice(0)},function(a){var c=a.point.series&&a.point.series.chart,d=a.seriesOptions;c&&d&&(b?c.addSingleSeriesAsDrilldown(a.point,d):c.addSeriesAsDrilldown(a.point,d))})};e.Axis.prototype.drilldownCategory=function(b,a){var d,c,e=this.getDDPoints(b);for(d in e)(c=e[d])&&c.series&&c.series.visible&&c.doDrilldown&&c.doDrilldown(!0,b,a);this.chart.applyDrilldown()};e.Axis.prototype.getDDPoints=function(b){var a=[];h(this.series,function(d){var c, | ||
e=d.xData,f=d.points;for(c=0;c<e.length;c++)if(e[c]===b&&d.options.data[c].drilldown){a.push(f?f[c]:!0);break}});return a};E.prototype.drillable=function(){var b=this.pos,a=this.label,d=this.axis,c="xAxis"===d.coll&&d.getDDPoints,g=c&&d.getDDPoints(b);c&&(a&&g.length?(a.drillable=!0,a.basicStyles||(a.basicStyles=e.merge(a.styles)),a.addClass("highcharts-drilldown-axis-label").css(d.chart.options.drilldown.activeAxisLabelStyle).on("click",function(a){d.drilldownCategory(b,a)})):a&&a.drillable&&(a.styles= | ||
{},a.css(a.basicStyles),a.on("click",null),a.removeClass("highcharts-drilldown-axis-label")))};v(E.prototype,"addLabel",function(b){b.call(this);this.drillable()});v(e.Point.prototype,"init",function(b,a,d,c){var g=b.call(this,a,d,c);b=(b=a.xAxis)&&b.ticks[c];g.drilldown&&e.addEvent(g,"click",function(b){a.xAxis&&!1===a.chart.options.drilldown.allowPointDrilldown?a.xAxis.drilldownCategory(c,b):g.doDrilldown(void 0,void 0,b)});b&&b.drillable();return g});v(e.Series.prototype,"drawDataLabels",function(b){var a= | ||
this.chart.options.drilldown.activeDataLabelStyle,d=this.chart.renderer;b.call(this);h(this.points,function(b){var e={};b.drilldown&&b.dataLabel&&("contrast"===a.color&&(e.color=d.getContrast(b.color||this.color)),b.dataLabel.addClass("highcharts-drilldown-data-label"),b.dataLabel.css(a).css(e))},this)});var z,u=function(b){b.call(this);h(this.points,function(a){a.drilldown&&a.graphic&&(a.graphic.addClass("highcharts-drilldown-point"),a.graphic.css({cursor:"pointer"}))})};for(z in t)t[z].prototype.supportsDrilldown&& | ||
v(t[z].prototype,"drawTracker",u)})(n)}); |
/** | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* Highcharts Drilldown module | ||
@@ -8,725 +9,784 @@ * | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(H) { | ||
/** | ||
* Highcharts Drilldown module | ||
* | ||
* Author: Torstein Honsi | ||
* License: www.highcharts.com/license | ||
* | ||
*/ | ||
(function (factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function (H) { | ||
'use strict'; | ||
'use strict'; | ||
var noop = H.noop, | ||
color = H.color, | ||
defaultOptions = H.defaultOptions, | ||
each = H.each, | ||
extend = H.extend, | ||
format = H.format, | ||
pick = H.pick, | ||
wrap = H.wrap, | ||
Chart = H.Chart, | ||
seriesTypes = H.seriesTypes, | ||
PieSeries = seriesTypes.pie, | ||
ColumnSeries = seriesTypes.column, | ||
Tick = H.Tick, | ||
fireEvent = H.fireEvent, | ||
inArray = H.inArray, | ||
ddSeriesId = 1; | ||
var noop = function () {}, | ||
defaultOptions = H.getOptions(), | ||
each = H.each, | ||
extend = H.extend, | ||
format = H.format, | ||
merge = H.merge, | ||
pick = H.pick, | ||
wrap = H.wrap, | ||
Chart = H.Chart, | ||
seriesTypes = H.seriesTypes, | ||
PieSeries = seriesTypes.pie, | ||
ColumnSeries = seriesTypes.column, | ||
Tick = H.Tick, | ||
fireEvent = H.fireEvent, | ||
inArray = H.inArray, | ||
ddSeriesId = 1; | ||
// Utilities | ||
/* | ||
* Return an intermediate color between two colors, according to pos where 0 | ||
* is the from color and 1 is the to color. This method is copied from ColorAxis.js | ||
* and should always be kept updated, until we get AMD support. | ||
*/ | ||
function tweenColors(from, to, pos) { | ||
// Check for has alpha, because rgba colors perform worse due to lack of | ||
// support in WebKit. | ||
var hasAlpha, | ||
ret; | ||
// Utilities | ||
/* | ||
* Return an intermediate color between two colors, according to pos where 0 | ||
* is the from color and 1 is the to color. This method is copied from ColorAxis.js | ||
* and should always be kept updated, until we get AMD support. | ||
*/ | ||
function tweenColors(from, to, pos) { | ||
// Check for has alpha, because rgba colors perform worse due to lack of | ||
// support in WebKit. | ||
var hasAlpha, | ||
ret; | ||
// Unsupported color, return to-color (#3920) | ||
if (!to.rgba.length || !from.rgba.length) { | ||
ret = to.input || 'none'; | ||
// Unsupported color, return to-color (#3920) | ||
if (!to.rgba.length || !from.rgba.length) { | ||
ret = to.input || 'none'; | ||
// Interpolate | ||
} else { | ||
from = from.rgba; | ||
to = to.rgba; | ||
hasAlpha = (to[3] !== 1 || from[3] !== 1); | ||
ret = (hasAlpha ? 'rgba(' : 'rgb(') + | ||
Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' + | ||
Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' + | ||
Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) + | ||
(hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')'; | ||
} | ||
return ret; | ||
} | ||
/** | ||
* Handle animation of the color attributes directly | ||
*/ | ||
each(['fill', 'stroke'], function(prop) { | ||
H.Fx.prototype[prop + 'Setter'] = function() { | ||
this.elem.attr(prop, tweenColors(color(this.start), color(this.end), this.pos)); | ||
}; | ||
}); | ||
// Interpolate | ||
} else { | ||
from = from.rgba; | ||
to = to.rgba; | ||
hasAlpha = (to[3] !== 1 || from[3] !== 1); | ||
ret = (hasAlpha ? 'rgba(' : 'rgb(') + | ||
Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' + | ||
Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' + | ||
Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) + | ||
(hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')'; | ||
} | ||
return ret; | ||
} | ||
/** | ||
* Handle animation of the color attributes directly | ||
*/ | ||
each(['fill', 'stroke'], function (prop) { | ||
H.Fx.prototype[prop + 'Setter'] = function () { | ||
this.elem.attr(prop, tweenColors(H.Color(this.start), H.Color(this.end), this.pos)); | ||
}; | ||
}); | ||
// Add language | ||
extend(defaultOptions.lang, { | ||
drillUpText: '◁ Back to {series.name}' | ||
}); | ||
defaultOptions.drilldown = { | ||
// Add language | ||
extend(defaultOptions.lang, { | ||
drillUpText: '◁ Back to {series.name}' | ||
}); | ||
defaultOptions.drilldown = { | ||
activeAxisLabelStyle: { | ||
cursor: 'pointer', | ||
color: '#0d233a', | ||
fontWeight: 'bold', | ||
textDecoration: 'underline' | ||
}, | ||
activeDataLabelStyle: { | ||
cursor: 'pointer', | ||
fontWeight: 'bold', | ||
textDecoration: 'underline' | ||
}, | ||
animation: { | ||
duration: 500 | ||
}, | ||
drillUpButton: { | ||
position: { | ||
align: 'right', | ||
x: -10, | ||
y: 10 | ||
} | ||
// relativeTo: 'plotBox' | ||
// theme | ||
} | ||
}; | ||
activeAxisLabelStyle: { | ||
cursor: 'pointer', | ||
color: '#003399', | ||
fontWeight: 'bold', | ||
textDecoration: 'underline' | ||
}, | ||
activeDataLabelStyle: { | ||
cursor: 'pointer', | ||
color: '#003399', | ||
fontWeight: 'bold', | ||
textDecoration: 'underline' | ||
}, | ||
/** | ||
* A general fadeIn method | ||
*/ | ||
H.SVGRenderer.prototype.Element.prototype.fadeIn = function (animation) { | ||
this | ||
.attr({ | ||
opacity: 0.1, | ||
visibility: 'inherit' | ||
}) | ||
.animate({ | ||
opacity: pick(this.newOpacity, 1) // newOpacity used in maps | ||
}, animation || { | ||
duration: 250 | ||
}); | ||
}; | ||
animation: { | ||
duration: 500 | ||
}, | ||
drillUpButton: { | ||
position: { | ||
align: 'right', | ||
x: -10, | ||
y: 10 | ||
} | ||
// relativeTo: 'plotBox' | ||
// theme | ||
} | ||
}; | ||
Chart.prototype.addSeriesAsDrilldown = function (point, ddOptions) { | ||
this.addSingleSeriesAsDrilldown(point, ddOptions); | ||
this.applyDrilldown(); | ||
}; | ||
Chart.prototype.addSingleSeriesAsDrilldown = function (point, ddOptions) { | ||
var oldSeries = point.series, | ||
xAxis = oldSeries.xAxis, | ||
yAxis = oldSeries.yAxis, | ||
newSeries, | ||
color = point.color || oldSeries.color, | ||
pointIndex, | ||
levelSeries = [], | ||
levelSeriesOptions = [], | ||
level, | ||
levelNumber, | ||
last; | ||
/** | ||
* A general fadeIn method | ||
*/ | ||
H.SVGRenderer.prototype.Element.prototype.fadeIn = function(animation) { | ||
this | ||
.attr({ | ||
opacity: 0.1, | ||
visibility: 'inherit' | ||
}) | ||
.animate({ | ||
opacity: pick(this.newOpacity, 1) // newOpacity used in maps | ||
}, animation || { | ||
duration: 250 | ||
}); | ||
}; | ||
if (!this.drilldownLevels) { | ||
this.drilldownLevels = []; | ||
} | ||
levelNumber = oldSeries.options._levelNumber || 0; | ||
Chart.prototype.addSeriesAsDrilldown = function(point, ddOptions) { | ||
this.addSingleSeriesAsDrilldown(point, ddOptions); | ||
this.applyDrilldown(); | ||
}; | ||
Chart.prototype.addSingleSeriesAsDrilldown = function(point, ddOptions) { | ||
var oldSeries = point.series, | ||
xAxis = oldSeries.xAxis, | ||
yAxis = oldSeries.yAxis, | ||
newSeries, | ||
pointIndex, | ||
levelSeries = [], | ||
levelSeriesOptions = [], | ||
level, | ||
levelNumber, | ||
last, | ||
colorProp; | ||
// See if we can reuse the registered series from last run | ||
last = this.drilldownLevels[this.drilldownLevels.length - 1]; | ||
if (last && last.levelNumber !== levelNumber) { | ||
last = undefined; | ||
} | ||
if (!ddOptions.color) { | ||
ddOptions.color = color; | ||
} | ||
ddOptions._ddSeriesId = ddSeriesId++; | ||
pointIndex = inArray(point, oldSeries.points); | ||
// Record options for all current series | ||
each(oldSeries.chart.series, function (series) { | ||
if (series.xAxis === xAxis && !series.isDrilling) { | ||
series.options._ddSeriesId = series.options._ddSeriesId || ddSeriesId++; | ||
series.options._colorIndex = series.userOptions._colorIndex; | ||
series.options._levelNumber = series.options._levelNumber || levelNumber; // #3182 | ||
colorProp = { | ||
color: point.color || oldSeries.color | ||
}; | ||
if (last) { | ||
levelSeries = last.levelSeries; | ||
levelSeriesOptions = last.levelSeriesOptions; | ||
} else { | ||
levelSeries.push(series); | ||
levelSeriesOptions.push(series.options); | ||
} | ||
} | ||
}); | ||
// Add a record of properties for each drilldown level | ||
level = { | ||
levelNumber: levelNumber, | ||
seriesOptions: oldSeries.options, | ||
levelSeriesOptions: levelSeriesOptions, | ||
levelSeries: levelSeries, | ||
shapeArgs: point.shapeArgs, | ||
bBox: point.graphic ? point.graphic.getBBox() : {}, // no graphic in line series with markers disabled | ||
color: point.isNull ? new Highcharts.Color(color).setOpacity(0).get() : color, | ||
lowerSeriesOptions: ddOptions, | ||
pointOptions: oldSeries.options.data[pointIndex], | ||
pointIndex: pointIndex, | ||
oldExtremes: { | ||
xMin: xAxis && xAxis.userMin, | ||
xMax: xAxis && xAxis.userMax, | ||
yMin: yAxis && yAxis.userMin, | ||
yMax: yAxis && yAxis.userMax | ||
} | ||
}; | ||
if (!this.drilldownLevels) { | ||
this.drilldownLevels = []; | ||
} | ||
// Push it to the lookup array | ||
this.drilldownLevels.push(level); | ||
levelNumber = oldSeries.options._levelNumber || 0; | ||
newSeries = level.lowerSeries = this.addSeries(ddOptions, false); | ||
newSeries.options._levelNumber = levelNumber + 1; | ||
if (xAxis) { | ||
xAxis.oldPos = xAxis.pos; | ||
xAxis.userMin = xAxis.userMax = null; | ||
yAxis.userMin = yAxis.userMax = null; | ||
} | ||
// See if we can reuse the registered series from last run | ||
last = this.drilldownLevels[this.drilldownLevels.length - 1]; | ||
if (last && last.levelNumber !== levelNumber) { | ||
last = undefined; | ||
} | ||
// Run fancy cross-animation on supported and equal types | ||
if (oldSeries.type === newSeries.type) { | ||
newSeries.animate = newSeries.animateDrilldown || noop; | ||
newSeries.options.animation = true; | ||
} | ||
}; | ||
ddOptions = extend(extend({ | ||
_ddSeriesId: ddSeriesId++ | ||
}, colorProp), ddOptions); | ||
pointIndex = inArray(point, oldSeries.points); | ||
Chart.prototype.applyDrilldown = function () { | ||
var drilldownLevels = this.drilldownLevels, | ||
levelToRemove; | ||
if (drilldownLevels && drilldownLevels.length > 0) { // #3352, async loading | ||
levelToRemove = drilldownLevels[drilldownLevels.length - 1].levelNumber; | ||
each(this.drilldownLevels, function (level) { | ||
if (level.levelNumber === levelToRemove) { | ||
each(level.levelSeries, function (series) { | ||
if (series.options && series.options._levelNumber === levelToRemove) { // Not removed, not added as part of a multi-series drilldown | ||
series.remove(false); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
this.redraw(); | ||
this.showDrillUpButton(); | ||
}; | ||
// Record options for all current series | ||
each(oldSeries.chart.series, function(series) { | ||
if (series.xAxis === xAxis && !series.isDrilling) { | ||
series.options._ddSeriesId = series.options._ddSeriesId || ddSeriesId++; | ||
series.options._colorIndex = series.userOptions._colorIndex; | ||
series.options._levelNumber = series.options._levelNumber || levelNumber; // #3182 | ||
Chart.prototype.getDrilldownBackText = function () { | ||
var drilldownLevels = this.drilldownLevels, | ||
lastLevel; | ||
if (drilldownLevels && drilldownLevels.length > 0) { // #3352, async loading | ||
lastLevel = drilldownLevels[drilldownLevels.length - 1]; | ||
lastLevel.series = lastLevel.seriesOptions; | ||
return format(this.options.lang.drillUpText, lastLevel); | ||
} | ||
if (last) { | ||
levelSeries = last.levelSeries; | ||
levelSeriesOptions = last.levelSeriesOptions; | ||
} else { | ||
levelSeries.push(series); | ||
levelSeriesOptions.push(series.options); | ||
} | ||
} | ||
}); | ||
}; | ||
// Add a record of properties for each drilldown level | ||
level = extend({ | ||
levelNumber: levelNumber, | ||
seriesOptions: oldSeries.options, | ||
levelSeriesOptions: levelSeriesOptions, | ||
levelSeries: levelSeries, | ||
shapeArgs: point.shapeArgs, | ||
bBox: point.graphic ? point.graphic.getBBox() : {}, // no graphic in line series with markers disabled | ||
lowerSeriesOptions: ddOptions, | ||
pointOptions: oldSeries.options.data[pointIndex], | ||
pointIndex: pointIndex, | ||
oldExtremes: { | ||
xMin: xAxis && xAxis.userMin, | ||
xMax: xAxis && xAxis.userMax, | ||
yMin: yAxis && yAxis.userMin, | ||
yMax: yAxis && yAxis.userMax | ||
} | ||
}, colorProp); | ||
Chart.prototype.showDrillUpButton = function () { | ||
var chart = this, | ||
backText = this.getDrilldownBackText(), | ||
buttonOptions = chart.options.drilldown.drillUpButton, | ||
attr, | ||
states; | ||
// Push it to the lookup array | ||
this.drilldownLevels.push(level); | ||
if (!this.drillUpButton) { | ||
attr = buttonOptions.theme; | ||
states = attr && attr.states; | ||
this.drillUpButton = this.renderer.button( | ||
backText, | ||
null, | ||
null, | ||
function () { | ||
chart.drillUp(); | ||
}, | ||
attr, | ||
states && states.hover, | ||
states && states.select | ||
) | ||
.attr({ | ||
align: buttonOptions.position.align, | ||
zIndex: 9 | ||
}) | ||
.add() | ||
.align(buttonOptions.position, false, buttonOptions.relativeTo || 'plotBox'); | ||
} else { | ||
this.drillUpButton.attr({ | ||
text: backText | ||
}) | ||
.align(); | ||
} | ||
}; | ||
newSeries = level.lowerSeries = this.addSeries(ddOptions, false); | ||
newSeries.options._levelNumber = levelNumber + 1; | ||
if (xAxis) { | ||
xAxis.oldPos = xAxis.pos; | ||
xAxis.userMin = xAxis.userMax = null; | ||
yAxis.userMin = yAxis.userMax = null; | ||
} | ||
Chart.prototype.drillUp = function () { | ||
var chart = this, | ||
drilldownLevels = chart.drilldownLevels, | ||
levelNumber = drilldownLevels[drilldownLevels.length - 1].levelNumber, | ||
i = drilldownLevels.length, | ||
chartSeries = chart.series, | ||
seriesI, | ||
level, | ||
oldSeries, | ||
newSeries, | ||
oldExtremes, | ||
addSeries = function (seriesOptions) { | ||
var addedSeries; | ||
each(chartSeries, function (series) { | ||
if (series.options._ddSeriesId === seriesOptions._ddSeriesId) { | ||
addedSeries = series; | ||
} | ||
}); | ||
// Run fancy cross-animation on supported and equal types | ||
if (oldSeries.type === newSeries.type) { | ||
newSeries.animate = newSeries.animateDrilldown || noop; | ||
newSeries.options.animation = true; | ||
} | ||
}; | ||
addedSeries = addedSeries || chart.addSeries(seriesOptions, false); | ||
if (addedSeries.type === oldSeries.type && addedSeries.animateDrillupTo) { | ||
addedSeries.animate = addedSeries.animateDrillupTo; | ||
} | ||
if (seriesOptions === level.seriesOptions) { | ||
newSeries = addedSeries; | ||
} | ||
}; | ||
Chart.prototype.applyDrilldown = function() { | ||
var drilldownLevels = this.drilldownLevels, | ||
levelToRemove; | ||
while (i--) { | ||
if (drilldownLevels && drilldownLevels.length > 0) { // #3352, async loading | ||
levelToRemove = drilldownLevels[drilldownLevels.length - 1].levelNumber; | ||
each(this.drilldownLevels, function(level) { | ||
if (level.levelNumber === levelToRemove) { | ||
each(level.levelSeries, function(series) { | ||
if (series.options && series.options._levelNumber === levelToRemove) { // Not removed, not added as part of a multi-series drilldown | ||
series.remove(false); | ||
} | ||
}); | ||
} | ||
}); | ||
} | ||
level = drilldownLevels[i]; | ||
if (level.levelNumber === levelNumber) { | ||
drilldownLevels.pop(); | ||
// Get the lower series by reference or id | ||
oldSeries = level.lowerSeries; | ||
if (!oldSeries.chart) { // #2786 | ||
seriesI = chartSeries.length; // #2919 | ||
while (seriesI--) { | ||
if (chartSeries[seriesI].options.id === level.lowerSeriesOptions.id && | ||
chartSeries[seriesI].options._levelNumber === levelNumber + 1) { // #3867 | ||
oldSeries = chartSeries[seriesI]; | ||
break; | ||
} | ||
} | ||
} | ||
oldSeries.xData = []; // Overcome problems with minRange (#2898) | ||
this.redraw(); | ||
this.showDrillUpButton(); | ||
}; | ||
each(level.levelSeriesOptions, addSeries); | ||
fireEvent(chart, 'drillup', { seriesOptions: level.seriesOptions }); | ||
Chart.prototype.getDrilldownBackText = function() { | ||
var drilldownLevels = this.drilldownLevels, | ||
lastLevel; | ||
if (drilldownLevels && drilldownLevels.length > 0) { // #3352, async loading | ||
lastLevel = drilldownLevels[drilldownLevels.length - 1]; | ||
lastLevel.series = lastLevel.seriesOptions; | ||
return format(this.options.lang.drillUpText, lastLevel); | ||
} | ||
if (newSeries.type === oldSeries.type) { | ||
newSeries.drilldownLevel = level; | ||
newSeries.options.animation = chart.options.drilldown.animation; | ||
}; | ||
if (oldSeries.animateDrillupFrom && oldSeries.chart) { // #2919 | ||
oldSeries.animateDrillupFrom(level); | ||
} | ||
} | ||
newSeries.options._levelNumber = levelNumber; | ||
oldSeries.remove(false); | ||
Chart.prototype.showDrillUpButton = function() { | ||
var chart = this, | ||
backText = this.getDrilldownBackText(), | ||
buttonOptions = chart.options.drilldown.drillUpButton, | ||
attr, | ||
states; | ||
// Reset the zoom level of the upper series | ||
if (newSeries.xAxis) { | ||
oldExtremes = level.oldExtremes; | ||
newSeries.xAxis.setExtremes(oldExtremes.xMin, oldExtremes.xMax, false); | ||
newSeries.yAxis.setExtremes(oldExtremes.yMin, oldExtremes.yMax, false); | ||
} | ||
} | ||
} | ||
// Fire a once-off event after all series have been drilled up (#5158) | ||
fireEvent(chart, 'drillupall'); | ||
if (!this.drillUpButton) { | ||
attr = buttonOptions.theme; | ||
states = attr && attr.states; | ||
this.redraw(); | ||
this.drillUpButton = this.renderer.button( | ||
backText, | ||
null, | ||
null, | ||
function() { | ||
chart.drillUp(); | ||
}, | ||
attr, | ||
states && states.hover, | ||
states && states.select | ||
) | ||
.addClass('highcharts-drillup-button') | ||
.attr({ | ||
align: buttonOptions.position.align, | ||
zIndex: 7 | ||
}) | ||
.add() | ||
.align(buttonOptions.position, false, buttonOptions.relativeTo || 'plotBox'); | ||
} else { | ||
this.drillUpButton.attr({ | ||
text: backText | ||
}) | ||
.align(); | ||
} | ||
}; | ||
if (this.drilldownLevels.length === 0) { | ||
this.drillUpButton = this.drillUpButton.destroy(); | ||
} else { | ||
this.drillUpButton.attr({ | ||
text: this.getDrilldownBackText() | ||
}) | ||
.align(); | ||
} | ||
Chart.prototype.drillUp = function() { | ||
var chart = this, | ||
drilldownLevels = chart.drilldownLevels, | ||
levelNumber = drilldownLevels[drilldownLevels.length - 1].levelNumber, | ||
i = drilldownLevels.length, | ||
chartSeries = chart.series, | ||
seriesI, | ||
level, | ||
oldSeries, | ||
newSeries, | ||
oldExtremes, | ||
addSeries = function(seriesOptions) { | ||
var addedSeries; | ||
each(chartSeries, function(series) { | ||
if (series.options._ddSeriesId === seriesOptions._ddSeriesId) { | ||
addedSeries = series; | ||
} | ||
}); | ||
this.ddDupes.length = []; // #3315 | ||
}; | ||
addedSeries = addedSeries || chart.addSeries(seriesOptions, false); | ||
if (addedSeries.type === oldSeries.type && addedSeries.animateDrillupTo) { | ||
addedSeries.animate = addedSeries.animateDrillupTo; | ||
} | ||
if (seriesOptions === level.seriesOptions) { | ||
newSeries = addedSeries; | ||
} | ||
}; | ||
while (i--) { | ||
ColumnSeries.prototype.supportsDrilldown = true; | ||
/** | ||
* When drilling up, keep the upper series invisible until the lower series has | ||
* moved into place | ||
*/ | ||
ColumnSeries.prototype.animateDrillupTo = function (init) { | ||
if (!init) { | ||
var newSeries = this, | ||
level = newSeries.drilldownLevel; | ||
level = drilldownLevels[i]; | ||
if (level.levelNumber === levelNumber) { | ||
drilldownLevels.pop(); | ||
each(this.points, function (point) { | ||
if (point.graphic) { // #3407 | ||
point.graphic.hide(); | ||
} | ||
if (point.dataLabel) { | ||
point.dataLabel.hide(); | ||
} | ||
if (point.connector) { | ||
point.connector.hide(); | ||
} | ||
}); | ||
// Get the lower series by reference or id | ||
oldSeries = level.lowerSeries; | ||
if (!oldSeries.chart) { // #2786 | ||
seriesI = chartSeries.length; // #2919 | ||
while (seriesI--) { | ||
if (chartSeries[seriesI].options.id === level.lowerSeriesOptions.id && | ||
chartSeries[seriesI].options._levelNumber === levelNumber + 1) { // #3867 | ||
oldSeries = chartSeries[seriesI]; | ||
break; | ||
} | ||
} | ||
} | ||
oldSeries.xData = []; // Overcome problems with minRange (#2898) | ||
each(level.levelSeriesOptions, addSeries); | ||
// Do dummy animation on first point to get to complete | ||
setTimeout(function () { | ||
if (newSeries.points) { // May be destroyed in the meantime, #3389 | ||
each(newSeries.points, function (point, i) { | ||
// Fade in other points | ||
var verb = i === (level && level.pointIndex) ? 'show' : 'fadeIn', | ||
inherit = verb === 'show' ? true : undefined; | ||
if (point.graphic) { // #3407 | ||
point.graphic[verb](inherit); | ||
} | ||
if (point.dataLabel) { | ||
point.dataLabel[verb](inherit); | ||
} | ||
if (point.connector) { | ||
point.connector[verb](inherit); | ||
} | ||
}); | ||
} | ||
}, Math.max(this.chart.options.drilldown.animation.duration - 50, 0)); | ||
fireEvent(chart, 'drillup', { | ||
seriesOptions: level.seriesOptions | ||
}); | ||
// Reset | ||
this.animate = noop; | ||
} | ||
if (newSeries.type === oldSeries.type) { | ||
newSeries.drilldownLevel = level; | ||
newSeries.options.animation = chart.options.drilldown.animation; | ||
}; | ||
ColumnSeries.prototype.animateDrilldown = function (init) { | ||
var series = this, | ||
drilldownLevels = this.chart.drilldownLevels, | ||
animateFrom, | ||
animationOptions = this.chart.options.drilldown.animation, | ||
xAxis = this.xAxis; | ||
if (!init) { | ||
each(drilldownLevels, function (level) { | ||
if (series.options._ddSeriesId === level.lowerSeriesOptions._ddSeriesId) { | ||
animateFrom = level.shapeArgs; | ||
animateFrom.fill = level.color; | ||
} | ||
}); | ||
if (oldSeries.animateDrillupFrom && oldSeries.chart) { // #2919 | ||
oldSeries.animateDrillupFrom(level); | ||
} | ||
} | ||
newSeries.options._levelNumber = levelNumber; | ||
animateFrom.x += (pick(xAxis.oldPos, xAxis.pos) - xAxis.pos); | ||
oldSeries.remove(false); | ||
each(this.points, function (point) { | ||
if (point.graphic) { | ||
point.graphic | ||
.attr(animateFrom) | ||
.animate( | ||
extend(point.shapeArgs, { fill: point.color || series.color }), | ||
animationOptions | ||
); | ||
} | ||
if (point.dataLabel) { | ||
point.dataLabel.fadeIn(animationOptions); | ||
} | ||
}); | ||
this.animate = null; | ||
} | ||
}; | ||
// Reset the zoom level of the upper series | ||
if (newSeries.xAxis) { | ||
oldExtremes = level.oldExtremes; | ||
newSeries.xAxis.setExtremes(oldExtremes.xMin, oldExtremes.xMax, false); | ||
newSeries.yAxis.setExtremes(oldExtremes.yMin, oldExtremes.yMax, false); | ||
} | ||
} | ||
} | ||
/** | ||
* When drilling up, pull out the individual point graphics from the lower series | ||
* and animate them into the origin point in the upper series. | ||
*/ | ||
ColumnSeries.prototype.animateDrillupFrom = function (level) { | ||
var animationOptions = this.chart.options.drilldown.animation, | ||
group = this.group, | ||
series = this; | ||
// Fire a once-off event after all series have been drilled up (#5158) | ||
fireEvent(chart, 'drillupall'); | ||
// Cancel mouse events on the series group (#2787) | ||
each(series.trackerGroups, function (key) { | ||
if (series[key]) { // we don't always have dataLabelsGroup | ||
series[key].on('mouseover'); | ||
} | ||
}); | ||
this.redraw(); | ||
delete this.group; | ||
each(this.points, function (point) { | ||
var graphic = point.graphic, | ||
complete = function () { | ||
graphic.destroy(); | ||
if (group) { | ||
group = group.destroy(); | ||
} | ||
}; | ||
if (this.drilldownLevels.length === 0) { | ||
this.drillUpButton = this.drillUpButton.destroy(); | ||
} else { | ||
this.drillUpButton.attr({ | ||
text: this.getDrilldownBackText() | ||
}) | ||
.align(); | ||
} | ||
if (graphic) { | ||
delete point.graphic; | ||
this.ddDupes.length = []; // #3315 | ||
}; | ||
if (animationOptions) { | ||
graphic.animate( | ||
extend(level.shapeArgs, { fill: level.color }), | ||
H.merge(animationOptions, { complete: complete }) | ||
); | ||
} else { | ||
graphic.attr(level.shapeArgs); | ||
complete(); | ||
} | ||
} | ||
}); | ||
}; | ||
if (PieSeries) { | ||
extend(PieSeries.prototype, { | ||
supportsDrilldown: true, | ||
animateDrillupTo: ColumnSeries.prototype.animateDrillupTo, | ||
animateDrillupFrom: ColumnSeries.prototype.animateDrillupFrom, | ||
ColumnSeries.prototype.supportsDrilldown = true; | ||
animateDrilldown: function (init) { | ||
var level = this.chart.drilldownLevels[this.chart.drilldownLevels.length - 1], | ||
animationOptions = this.chart.options.drilldown.animation, | ||
animateFrom = level.shapeArgs, | ||
start = animateFrom.start, | ||
angle = animateFrom.end - start, | ||
startAngle = angle / this.points.length; | ||
/** | ||
* When drilling up, keep the upper series invisible until the lower series has | ||
* moved into place | ||
*/ | ||
ColumnSeries.prototype.animateDrillupTo = function(init) { | ||
if (!init) { | ||
var newSeries = this, | ||
level = newSeries.drilldownLevel; | ||
if (!init) { | ||
each(this.points, function (point, i) { | ||
if (point.graphic) { | ||
point.graphic | ||
.attr(H.merge(animateFrom, { | ||
start: start + i * startAngle, | ||
end: start + (i + 1) * startAngle, | ||
fill: level.color | ||
}))[animationOptions ? 'animate' : 'attr']( | ||
extend(point.shapeArgs, { fill: point.color }), | ||
animationOptions | ||
); | ||
} | ||
}); | ||
this.animate = null; | ||
} | ||
} | ||
}); | ||
} | ||
H.Point.prototype.doDrilldown = function (_holdRedraw, category, originalEvent) { | ||
var series = this.series, | ||
chart = series.chart, | ||
drilldown = chart.options.drilldown, | ||
i = (drilldown.series || []).length, | ||
seriesOptions; | ||
each(this.points, function(point) { | ||
if (point.graphic) { // #3407 | ||
point.graphic.hide(); | ||
} | ||
if (point.dataLabel) { | ||
point.dataLabel.hide(); | ||
} | ||
if (point.connector) { | ||
point.connector.hide(); | ||
} | ||
}); | ||
if (!chart.ddDupes) { | ||
chart.ddDupes = []; | ||
} | ||
while (i-- && !seriesOptions) { | ||
if (drilldown.series[i].id === this.drilldown && inArray(this.drilldown, chart.ddDupes) === -1) { | ||
seriesOptions = drilldown.series[i]; | ||
chart.ddDupes.push(this.drilldown); | ||
} | ||
} | ||
// Fire the event. If seriesOptions is undefined, the implementer can check for | ||
// seriesOptions, and call addSeriesAsDrilldown async if necessary. | ||
fireEvent(chart, 'drilldown', { | ||
point: this, | ||
seriesOptions: seriesOptions, | ||
category: category, | ||
originalEvent: originalEvent, | ||
points: category !== undefined && this.series.xAxis.getDDPoints(category).slice(0) | ||
}, function (e) { | ||
var chart = e.point.series && e.point.series.chart, | ||
seriesOptions = e.seriesOptions; | ||
if (chart && seriesOptions) { | ||
if (_holdRedraw) { | ||
chart.addSingleSeriesAsDrilldown(e.point, seriesOptions); | ||
} else { | ||
chart.addSeriesAsDrilldown(e.point, seriesOptions); | ||
} | ||
} | ||
}); | ||
// Do dummy animation on first point to get to complete | ||
setTimeout(function() { | ||
if (newSeries.points) { // May be destroyed in the meantime, #3389 | ||
each(newSeries.points, function(point, i) { | ||
// Fade in other points | ||
var verb = i === (level && level.pointIndex) ? 'show' : 'fadeIn', | ||
inherit = verb === 'show' ? true : undefined; | ||
if (point.graphic) { // #3407 | ||
point.graphic[verb](inherit); | ||
} | ||
if (point.dataLabel) { | ||
point.dataLabel[verb](inherit); | ||
} | ||
if (point.connector) { | ||
point.connector[verb](inherit); | ||
} | ||
}); | ||
} | ||
}, Math.max(this.chart.options.drilldown.animation.duration - 50, 0)); | ||
}; | ||
// Reset | ||
this.animate = noop; | ||
} | ||
/** | ||
* Drill down to a given category. This is the same as clicking on an axis label. | ||
*/ | ||
H.Axis.prototype.drilldownCategory = function (x, e) { | ||
var key, | ||
point, | ||
ddPointsX = this.getDDPoints(x); | ||
for (key in ddPointsX) { | ||
point = ddPointsX[key]; | ||
if (point && point.series && point.series.visible && point.doDrilldown) { // #3197 | ||
point.doDrilldown(true, x, e); | ||
} | ||
} | ||
this.chart.applyDrilldown(); | ||
}; | ||
}; | ||
/** | ||
* Return drillable points for this specific X value | ||
*/ | ||
H.Axis.prototype.getDDPoints = function (x) { | ||
var ret = []; | ||
each(this.series, function (series) { | ||
var i, | ||
xData = series.xData, | ||
points = series.points; | ||
for (i = 0; i < xData.length; i++) { | ||
if (xData[i] === x && series.options.data[i].drilldown) { | ||
ret.push(points ? points[i] : true); | ||
break; | ||
} | ||
} | ||
}); | ||
return ret; | ||
}; | ||
ColumnSeries.prototype.animateDrilldown = function(init) { | ||
var series = this, | ||
drilldownLevels = this.chart.drilldownLevels, | ||
animateFrom, | ||
animationOptions = this.chart.options.drilldown.animation, | ||
xAxis = this.xAxis; | ||
if (!init) { | ||
each(drilldownLevels, function(level) { | ||
if (series.options._ddSeriesId === level.lowerSeriesOptions._ddSeriesId) { | ||
animateFrom = level.shapeArgs; | ||
/** | ||
* Make a tick label drillable, or remove drilling on update | ||
*/ | ||
Tick.prototype.drillable = function () { | ||
var pos = this.pos, | ||
label = this.label, | ||
axis = this.axis, | ||
isDrillable = axis.coll === 'xAxis' && axis.getDDPoints, | ||
ddPointsX = isDrillable && axis.getDDPoints(pos); | ||
// Add the point colors to animate from | ||
animateFrom.fill = level.color; | ||
if (isDrillable) { | ||
if (label && ddPointsX.length) { | ||
if (!label.basicStyles) { | ||
label.basicStyles = H.merge(label.styles); | ||
} | ||
label | ||
.addClass('highcharts-drilldown-axis-label') | ||
.css(axis.chart.options.drilldown.activeAxisLabelStyle) | ||
.on('click', function (e) { | ||
axis.drilldownCategory(pos, e); | ||
}); | ||
} | ||
}); | ||
} else if (label && label.basicStyles) { | ||
label.styles = {}; // reset for full overwrite of styles | ||
label.css(label.basicStyles); | ||
label.on('click', null); // #3806 | ||
} | ||
} | ||
}; | ||
animateFrom.x += (pick(xAxis.oldPos, xAxis.pos) - xAxis.pos); | ||
/** | ||
* Always keep the drillability updated (#3951) | ||
*/ | ||
wrap(Tick.prototype, 'addLabel', function (proceed) { | ||
proceed.call(this); | ||
this.drillable(); | ||
}); | ||
each(this.points, function(point) { | ||
var animateTo = point.shapeArgs; | ||
/** | ||
* On initialization of each point, identify its label and make it clickable. Also, provide a | ||
* list of points associated to that label. | ||
*/ | ||
wrap(H.Point.prototype, 'init', function (proceed, series, options, x) { | ||
var point = proceed.call(this, series, options, x), | ||
xAxis = series.xAxis, | ||
tick = xAxis && xAxis.ticks[x]; | ||
if (point.drilldown) { | ||
// Add the click event to the point | ||
H.addEvent(point, 'click', function (e) { | ||
if (series.xAxis && series.chart.options.drilldown.allowPointDrilldown === false) { | ||
series.xAxis.drilldownCategory(x, e); | ||
} else { | ||
point.doDrilldown(undefined, undefined, e); | ||
} | ||
}); | ||
/*wrap(point, 'importEvents', function (proceed) { // wrapping importEvents makes point.click event work | ||
if (!this.hasImportedEvents) { | ||
proceed.call(this); | ||
H.addEvent(this, 'click', function () { | ||
this.doDrilldown(); | ||
}); | ||
} | ||
});*/ | ||
// Add the point colors to animate to | ||
animateTo.fill = point.color; | ||
} | ||
// Add or remove click handler and style on the tick label | ||
if (tick) { | ||
tick.drillable(); | ||
} | ||
if (point.graphic) { | ||
point.graphic | ||
.attr(animateFrom) | ||
.animate( | ||
extend(point.shapeArgs, { | ||
fill: point.color || series.color | ||
}), | ||
animationOptions | ||
); | ||
} | ||
if (point.dataLabel) { | ||
point.dataLabel.fadeIn(animationOptions); | ||
} | ||
}); | ||
this.animate = null; | ||
} | ||
return point; | ||
}); | ||
}; | ||
wrap(H.Series.prototype, 'drawDataLabels', function (proceed) { | ||
var series = this, | ||
css = series.chart.options.drilldown.activeDataLabelStyle, | ||
renderer = series.chart.renderer; | ||
/** | ||
* When drilling up, pull out the individual point graphics from the lower series | ||
* and animate them into the origin point in the upper series. | ||
*/ | ||
ColumnSeries.prototype.animateDrillupFrom = function(level) { | ||
var animationOptions = this.chart.options.drilldown.animation, | ||
group = this.group, | ||
series = this; | ||
proceed.call(series); | ||
// Cancel mouse events on the series group (#2787) | ||
each(series.trackerGroups, function(key) { | ||
if (series[key]) { // we don't always have dataLabelsGroup | ||
series[key].on('mouseover'); | ||
} | ||
}); | ||
each(series.points, function (point) { | ||
var pointCss = {}; | ||
if (point.drilldown && point.dataLabel) { | ||
if (css.color === 'contrast') { | ||
pointCss.color = renderer.getContrast(point.color || series.color); | ||
} | ||
point.dataLabel | ||
.attr({ | ||
'class': 'highcharts-drilldown-data-label' | ||
}) | ||
.css(merge(css, pointCss)); | ||
} | ||
}); | ||
}); | ||
// Mark the trackers with a pointer | ||
var type, | ||
drawTrackerWrapper = function (proceed) { | ||
proceed.call(this); | ||
each(this.points, function (point) { | ||
if (point.drilldown && point.graphic) { | ||
point.graphic | ||
.attr({ | ||
'class': 'highcharts-drilldown-point' | ||
}) | ||
.css({ cursor: 'pointer' }); | ||
} | ||
}); | ||
}; | ||
for (type in seriesTypes) { | ||
if (seriesTypes[type].prototype.supportsDrilldown) { | ||
wrap(seriesTypes[type].prototype, 'drawTracker', drawTrackerWrapper); | ||
} | ||
} | ||
delete this.group; | ||
each(this.points, function(point) { | ||
var graphic = point.graphic, | ||
animateTo = level.shapeArgs, | ||
complete = function() { | ||
graphic.destroy(); | ||
if (group) { | ||
group = group.destroy(); | ||
} | ||
}; | ||
if (graphic) { | ||
delete point.graphic; | ||
animateTo.fill = level.color; | ||
if (animationOptions) { | ||
graphic.animate( | ||
animateTo, | ||
H.merge(animationOptions, { | ||
complete: complete | ||
}) | ||
); | ||
} else { | ||
graphic.attr(animateTo); | ||
complete(); | ||
} | ||
} | ||
}); | ||
}; | ||
if (PieSeries) { | ||
extend(PieSeries.prototype, { | ||
supportsDrilldown: true, | ||
animateDrillupTo: ColumnSeries.prototype.animateDrillupTo, | ||
animateDrillupFrom: ColumnSeries.prototype.animateDrillupFrom, | ||
animateDrilldown: function(init) { | ||
var level = this.chart.drilldownLevels[this.chart.drilldownLevels.length - 1], | ||
animationOptions = this.chart.options.drilldown.animation, | ||
animateFrom = level.shapeArgs, | ||
start = animateFrom.start, | ||
angle = animateFrom.end - start, | ||
startAngle = angle / this.points.length; | ||
if (!init) { | ||
each(this.points, function(point, i) { | ||
var animateTo = point.shapeArgs; | ||
animateFrom.fill = level.color; | ||
animateTo.fill = point.color; | ||
if (point.graphic) { | ||
point.graphic | ||
.attr(H.merge(animateFrom, { | ||
start: start + i * startAngle, | ||
end: start + (i + 1) * startAngle | ||
}))[animationOptions ? 'animate' : 'attr']( | ||
animateTo, | ||
animationOptions | ||
); | ||
} | ||
}); | ||
this.animate = null; | ||
} | ||
} | ||
}); | ||
} | ||
H.Point.prototype.doDrilldown = function(_holdRedraw, category, originalEvent) { | ||
var series = this.series, | ||
chart = series.chart, | ||
drilldown = chart.options.drilldown, | ||
i = (drilldown.series || []).length, | ||
seriesOptions; | ||
if (!chart.ddDupes) { | ||
chart.ddDupes = []; | ||
} | ||
while (i-- && !seriesOptions) { | ||
if (drilldown.series[i].id === this.drilldown && inArray(this.drilldown, chart.ddDupes) === -1) { | ||
seriesOptions = drilldown.series[i]; | ||
chart.ddDupes.push(this.drilldown); | ||
} | ||
} | ||
// Fire the event. If seriesOptions is undefined, the implementer can check for | ||
// seriesOptions, and call addSeriesAsDrilldown async if necessary. | ||
fireEvent(chart, 'drilldown', { | ||
point: this, | ||
seriesOptions: seriesOptions, | ||
category: category, | ||
originalEvent: originalEvent, | ||
points: category !== undefined && this.series.xAxis.getDDPoints(category).slice(0) | ||
}, function(e) { | ||
var chart = e.point.series && e.point.series.chart, | ||
seriesOptions = e.seriesOptions; | ||
if (chart && seriesOptions) { | ||
if (_holdRedraw) { | ||
chart.addSingleSeriesAsDrilldown(e.point, seriesOptions); | ||
} else { | ||
chart.addSeriesAsDrilldown(e.point, seriesOptions); | ||
} | ||
} | ||
}); | ||
}; | ||
/** | ||
* Drill down to a given category. This is the same as clicking on an axis label. | ||
*/ | ||
H.Axis.prototype.drilldownCategory = function(x, e) { | ||
var key, | ||
point, | ||
ddPointsX = this.getDDPoints(x); | ||
for (key in ddPointsX) { | ||
point = ddPointsX[key]; | ||
if (point && point.series && point.series.visible && point.doDrilldown) { // #3197 | ||
point.doDrilldown(true, x, e); | ||
} | ||
} | ||
this.chart.applyDrilldown(); | ||
}; | ||
/** | ||
* Return drillable points for this specific X value | ||
*/ | ||
H.Axis.prototype.getDDPoints = function(x) { | ||
var ret = []; | ||
each(this.series, function(series) { | ||
var i, | ||
xData = series.xData, | ||
points = series.points; | ||
for (i = 0; i < xData.length; i++) { | ||
if (xData[i] === x && series.options.data[i].drilldown) { | ||
ret.push(points ? points[i] : true); | ||
break; | ||
} | ||
} | ||
}); | ||
return ret; | ||
}; | ||
/** | ||
* Make a tick label drillable, or remove drilling on update | ||
*/ | ||
Tick.prototype.drillable = function() { | ||
var pos = this.pos, | ||
label = this.label, | ||
axis = this.axis, | ||
isDrillable = axis.coll === 'xAxis' && axis.getDDPoints, | ||
ddPointsX = isDrillable && axis.getDDPoints(pos); | ||
if (isDrillable) { | ||
if (label && ddPointsX.length) { | ||
label.drillable = true; | ||
if (!label.basicStyles) { | ||
label.basicStyles = H.merge(label.styles); | ||
} | ||
label | ||
.addClass('highcharts-drilldown-axis-label') | ||
.css(axis.chart.options.drilldown.activeAxisLabelStyle) | ||
.on('click', function(e) { | ||
axis.drilldownCategory(pos, e); | ||
}); | ||
} else if (label && label.drillable) { | ||
label.styles = {}; // reset for full overwrite of styles | ||
label.css(label.basicStyles); | ||
label.on('click', null); // #3806 | ||
label.removeClass('highcharts-drilldown-axis-label'); | ||
} | ||
} | ||
}; | ||
/** | ||
* Always keep the drillability updated (#3951) | ||
*/ | ||
wrap(Tick.prototype, 'addLabel', function(proceed) { | ||
proceed.call(this); | ||
this.drillable(); | ||
}); | ||
/** | ||
* On initialization of each point, identify its label and make it clickable. Also, provide a | ||
* list of points associated to that label. | ||
*/ | ||
wrap(H.Point.prototype, 'init', function(proceed, series, options, x) { | ||
var point = proceed.call(this, series, options, x), | ||
xAxis = series.xAxis, | ||
tick = xAxis && xAxis.ticks[x]; | ||
if (point.drilldown) { | ||
// Add the click event to the point | ||
H.addEvent(point, 'click', function(e) { | ||
if (series.xAxis && series.chart.options.drilldown.allowPointDrilldown === false) { | ||
series.xAxis.drilldownCategory(x, e); | ||
} else { | ||
point.doDrilldown(undefined, undefined, e); | ||
} | ||
}); | ||
/*wrap(point, 'importEvents', function (proceed) { // wrapping importEvents makes point.click event work | ||
if (!this.hasImportedEvents) { | ||
proceed.call(this); | ||
H.addEvent(this, 'click', function () { | ||
this.doDrilldown(); | ||
}); | ||
} | ||
});*/ | ||
} | ||
// Add or remove click handler and style on the tick label | ||
if (tick) { | ||
tick.drillable(); | ||
} | ||
return point; | ||
}); | ||
wrap(H.Series.prototype, 'drawDataLabels', function(proceed) { | ||
var css = this.chart.options.drilldown.activeDataLabelStyle, | ||
renderer = this.chart.renderer; | ||
proceed.call(this); | ||
each(this.points, function(point) { | ||
var pointCSS = {}; | ||
if (point.drilldown && point.dataLabel) { | ||
if (css.color === 'contrast') { | ||
pointCSS.color = renderer.getContrast(point.color || this.color); | ||
} | ||
point.dataLabel | ||
.addClass('highcharts-drilldown-data-label'); | ||
point.dataLabel | ||
.css(css) | ||
.css(pointCSS); | ||
} | ||
}, this); | ||
}); | ||
// Mark the trackers with a pointer | ||
var type, | ||
drawTrackerWrapper = function(proceed) { | ||
proceed.call(this); | ||
each(this.points, function(point) { | ||
if (point.drilldown && point.graphic) { | ||
point.graphic.addClass('highcharts-drilldown-point'); | ||
point.graphic.css({ | ||
cursor: 'pointer' | ||
}); | ||
} | ||
}); | ||
}; | ||
for (type in seriesTypes) { | ||
if (seriesTypes[type].prototype.supportsDrilldown) { | ||
wrap(seriesTypes[type].prototype, 'drawTracker', drawTrackerWrapper); | ||
} | ||
} | ||
}(Highcharts)); | ||
})); |
/* | ||
Highcharts JS v4.2.7 (2016-09-21) | ||
Highcharts JS v5.0.0 (2016-09-29) | ||
Exporting module | ||
@@ -9,18 +9,19 @@ | ||
*/ | ||
(function(f){typeof module==="object"&&module.exports?module.exports=f:f(Highcharts)})(function(f){var s=f.win,j=s.document,B=f.Chart,u=f.addEvent,C=f.removeEvent,D=f.fireEvent,r=f.createElement,t=f.discardElement,w=f.css,l=f.merge,m=f.each,q=f.extend,F=f.splat,G=Math.max,H=f.isTouchDevice,I=f.Renderer.prototype.symbols,z=f.getOptions(),A;q(z.lang,{printChart:"Print chart",downloadPNG:"Download PNG image",downloadJPEG:"Download JPEG image",downloadPDF:"Download PDF document",downloadSVG:"Download SVG vector image", | ||
contextButtonTitle:"Chart context menu"});z.navigation={menuStyle:{border:"1px solid #A0A0A0",background:"#FFFFFF",padding:"5px 0"},menuItemStyle:{padding:"0 10px",background:"none",color:"#303030",fontSize:H?"14px":"11px"},menuItemHoverStyle:{background:"#4572A5",color:"#FFFFFF"},buttonOptions:{symbolFill:"#E0E0E0",symbolSize:14,symbolStroke:"#666",symbolStrokeWidth:3,symbolX:12.5,symbolY:10.5,align:"right",buttonSpacing:3,height:22,theme:{fill:"white",stroke:"none"},verticalAlign:"top",width:24}}; | ||
z.exporting={type:"image/png",url:"https://export.highcharts.com/",printMaxWidth:780,scale:2,buttons:{contextButton:{menuClassName:"highcharts-contextmenu",symbol:"menu",_titleKey:"contextButtonTitle",menuItems:[{textKey:"printChart",onclick:function(){this.print()}},{separator:!0},{textKey:"downloadPNG",onclick:function(){this.exportChart()}},{textKey:"downloadJPEG",onclick:function(){this.exportChart({type:"image/jpeg"})}},{textKey:"downloadPDF",onclick:function(){this.exportChart({type:"application/pdf"})}}, | ||
{textKey:"downloadSVG",onclick:function(){this.exportChart({type:"image/svg+xml"})}}]}}};f.post=function(a,b,e){var c,a=r("form",l({method:"post",action:a,enctype:"multipart/form-data"},e),{display:"none"},j.body);for(c in b)r("input",{type:"hidden",name:c,value:b[c]},null,a);a.submit();t(a)};q(B.prototype,{sanitizeSVG:function(a){return a.replace(/zIndex="[^"]+"/g,"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/url\(("|")(\S+)("|")\)/g, | ||
"url($2)").replace(/url\([^#]+#/g,"url(#").replace(/<svg /,'<svg xmlns:xlink="http://www.w3.org/1999/xlink" ').replace(/ (NS[0-9]+\:)?href=/g," xlink:href=").replace(/\n/," ").replace(/<\/svg>.*?$/,"</svg>").replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g,'$1="rgb($2)" $1-opacity="$3"').replace(/ /g,"\u00a0").replace(/­/g,"\u00ad").replace(/<IMG /g,"<image ").replace(/<(\/?)TITLE>/g,"<$1title>").replace(/height=([^" ]+)/g,'height="$1"').replace(/width=([^" ]+)/g, | ||
'width="$1"').replace(/hc-svg-href="([^"]+)">/g,'xlink:href="$1"/>').replace(/ id=([^" >]+)/g,' id="$1"').replace(/class=([^" >]+)/g,'class="$1"').replace(/ transform /g," ").replace(/:(path|rect)/g,"$1").replace(/style="([^"]+)"/g,function(a){return a.toLowerCase()})},getChartHTML:function(){return this.container.innerHTML},getSVG:function(a){var b=this,e,c,g,k,h,d=l(b.options,a),n=d.exporting.allowHTML;if(!j.createElementNS)j.createElementNS=function(a,b){return j.createElement(b)};c=r("div",null, | ||
{position:"absolute",top:"-9999em",width:b.chartWidth+"px",height:b.chartHeight+"px"},j.body);g=b.renderTo.style.width;h=b.renderTo.style.height;g=d.exporting.sourceWidth||d.chart.width||/px$/.test(g)&&parseInt(g,10)||600;h=d.exporting.sourceHeight||d.chart.height||/px$/.test(h)&&parseInt(h,10)||400;q(d.chart,{animation:!1,renderTo:c,forExport:!0,renderer:"SVGRenderer",width:g,height:h});d.exporting.enabled=!1;delete d.data;d.series=[];m(b.series,function(a){k=l(a.userOptions,{animation:!1,enableMouseTracking:!1, | ||
showCheckbox:!1,visible:a.visible});k.isInternal||d.series.push(k)});a&&m(["xAxis","yAxis"],function(b){m(F(a[b]),function(a,c){d[b][c]=l(d[b][c],a)})});e=new f.Chart(d,b.callback);m(["xAxis","yAxis"],function(a){m(b[a],function(b,c){var d=e[a][c],f=b.getExtremes(),g=f.userMin,f=f.userMax;d&&(g!==void 0||f!==void 0)&&d.setExtremes(g,f,!0,!1)})});g=e.getChartHTML();d=null;e.destroy();t(c);if(n&&(c=g.match(/<\/svg>(.*?$)/)))c='<foreignObject x="0" y="0" width="200" height="200"><body xmlns="http://www.w3.org/1999/xhtml">'+ | ||
c[1]+"</body></foreignObject>",g=g.replace("</svg>",c+"</svg>");g=this.sanitizeSVG(g);return g=g.replace(/(url\(#highcharts-[0-9]+)"/g,"$1").replace(/"/g,"'")},getSVGForExport:function(a,b){var e=this.options.exporting;return this.getSVG(l({chart:{borderRadius:0}},e.chartOptions,b,{exporting:{sourceWidth:a&&a.sourceWidth||e.sourceWidth,sourceHeight:a&&a.sourceHeight||e.sourceHeight}}))},exportChart:function(a,b){var e=this.getSVGForExport(a,b),a=l(this.options.exporting,a);f.post(a.url, | ||
{filename:a.filename||"chart",type:a.type,width:a.width||0,scale:a.scale,svg:e},a.formAttributes)},print:function(){var a=this,b=a.container,e=[],c=b.parentNode,f=j.body,k=f.childNodes,h=a.options.exporting.printMaxWidth,d,n;if(!a.isPrinting){a.isPrinting=!0;a.pointer.reset(null,0);D(a,"beforePrint");if(n=h&&a.chartWidth>h)d=[a.options.chart.width,void 0,!1],a.setSize(h,void 0,!1);m(k,function(a,b){if(a.nodeType===1)e[b]=a.style.display,a.style.display="none"});f.appendChild(b);s.focus();s.print(); | ||
setTimeout(function(){c.appendChild(b);m(k,function(a,b){if(a.nodeType===1)a.style.display=e[b]});a.isPrinting=!1;n&&a.setSize.apply(a,d);D(a,"afterPrint")},1E3)}},contextMenu:function(a,b,e,c,f,k,h){var d=this,n=d.options.navigation,l=n.menuItemStyle,o=d.chartWidth,p=d.chartHeight,E="cache-"+a,i=d[E],v=G(f,k),x,y,s,t=function(b){d.pointer.inClass(b.target,a)||y()};if(!i)d[E]=i=r("div",{className:a},{position:"absolute",zIndex:1E3,padding:v+"px"},d.container),x=r("div",null,q({MozBoxShadow:"3px 3px 10px #888", | ||
WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},n.menuStyle),i),y=function(){w(i,{display:"none"});h&&h.setState(0);d.openMenu=!1},u(i,"mouseleave",function(){s=setTimeout(y,500)}),u(i,"mouseenter",function(){clearTimeout(s)}),u(j,"mouseup",t),u(d,"destroy",function(){C(j,"mouseup",t)}),m(b,function(a){if(a){var b=a.separator?r("hr",null,null,x):r("div",{onmouseover:function(){w(this,n.menuItemHoverStyle)},onmouseout:function(){w(this,l)},onclick:function(b){b&&b.stopPropagation(); | ||
y();a.onclick&&a.onclick.apply(d,arguments)},innerHTML:a.text||d.options.lang[a.textKey]},q({cursor:"pointer"},l),x);d.exportDivElements.push(b)}}),d.exportDivElements.push(x,i),d.exportMenuWidth=i.offsetWidth,d.exportMenuHeight=i.offsetHeight;b={display:"block"};e+d.exportMenuWidth>o?b.right=o-e-f-v+"px":b.left=e-v+"px";c+k+d.exportMenuHeight>p&&h.alignOptions.verticalAlign!=="top"?b.bottom=p-c-v+"px":b.top=c+k-v+"px";w(i,b);d.openMenu=!0},addButton:function(a){var b=this,e=b.renderer,c=l(b.options.navigation.buttonOptions, | ||
a),g=c.onclick,k=c.menuItems,h,d,n={stroke:c.symbolStroke,fill:c.symbolFill},j=c.symbolSize||12;if(!b.btnCount)b.btnCount=0;if(!b.exportDivElements)b.exportDivElements=[],b.exportSVGElements=[];if(c.enabled!==!1){var o=c.theme,p=o.states,m=p&&p.hover,p=p&&p.select,i;delete o.states;g?i=function(a){a.stopPropagation();g.call(b,a)}:k&&(i=function(){b.contextMenu(d.menuClassName,k,d.translateX,d.translateY,d.width,d.height,d);d.setState(2)});c.text&&c.symbol?o.paddingLeft=f.pick(o.paddingLeft,25):c.text|| | ||
q(o,{width:c.width,height:c.height,padding:0});d=e.button(c.text,0,0,i,o,m,p).attr({title:b.options.lang[c._titleKey],"stroke-linecap":"round",zIndex:3});d.menuClassName=a.menuClassName||"highcharts-menu-"+b.btnCount++;c.symbol&&(h=e.symbol(c.symbol,c.symbolX-j/2,c.symbolY-j/2,j,j).attr(q(n,{"stroke-width":c.symbolStrokeWidth||1,zIndex:1})).add(d));d.add().align(q(c,{width:d.width,x:f.pick(c.x,A)}),!0,"spacingBox");A+=(d.width+c.buttonSpacing)*(c.align==="right"?-1:1);b.exportSVGElements.push(d,h)}}, | ||
destroyExport:function(a){var a=a.target,b,e;for(b=0;b<a.exportSVGElements.length;b++)if(e=a.exportSVGElements[b])e.onclick=e.ontouchstart=null,a.exportSVGElements[b]=e.destroy();for(b=0;b<a.exportDivElements.length;b++)e=a.exportDivElements[b],C(e,"mouseleave"),a.exportDivElements[b]=e.onmouseout=e.onmouseover=e.ontouchstart=e.onclick=null,t(e)}});I.menu=function(a,b,e,c){return["M",a,b+2.5,"L",a+e,b+2.5,"M",a,b+c/2+0.5,"L",a+e,b+c/2+0.5,"M",a,b+c-1.5,"L",a+e,b+c-1.5]};B.prototype.callbacks.push(function(a){var b, | ||
e=a.options.exporting,c=e.buttons;A=0;if(e.enabled!==!1){for(b in c)a.addButton(c[b]);u(a,"destroy",a.destroyExport)}})}); | ||
(function(h){"object"===typeof module&&module.exports?module.exports=h:h(Highcharts)})(function(h){(function(f){var h=f.defaultOptions,q=f.doc,u=f.Chart,v=f.addEvent,D=f.removeEvent,E=f.fireEvent,r=f.createElement,w=f.discardElement,x=f.css,p=f.merge,B=f.pick,k=f.each,t=f.extend,H=f.splat,I=f.isTouchDevice,F=f.win,J=f.Renderer.prototype.symbols;t(h.lang,{printChart:"Print chart",downloadPNG:"Download PNG image",downloadJPEG:"Download JPEG image",downloadPDF:"Download PDF document",downloadSVG:"Download SVG vector image", | ||
contextButtonTitle:"Chart context menu"});h.navigation={buttonOptions:{theme:{},symbolSize:14,symbolX:12.5,symbolY:10.5,align:"right",buttonSpacing:3,height:22,verticalAlign:"top",width:24}};p(!0,h.navigation,{menuStyle:{border:"1px solid #999999",background:"#ffffff",padding:"5px 0"},menuItemStyle:{padding:"0.5em 1em",background:"none",color:"#333333",fontSize:I?"14px":"11px",transition:"background 250ms, color 250ms"},menuItemHoverStyle:{background:"#335cad",color:"#ffffff"},buttonOptions:{symbolFill:"#666666", | ||
symbolStroke:"#666666",symbolStrokeWidth:3,theme:{fill:"#ffffff",stroke:"none",padding:5}}});h.exporting={type:"image/png",url:"https://export.highcharts.com/",printMaxWidth:780,scale:2,buttons:{contextButton:{className:"highcharts-contextbutton",menuClassName:"highcharts-contextmenu",symbol:"menu",_titleKey:"contextButtonTitle",menuItems:[{textKey:"printChart",onclick:function(){this.print()}},{separator:!0},{textKey:"downloadPNG",onclick:function(){this.exportChart()}},{textKey:"downloadJPEG",onclick:function(){this.exportChart({type:"image/jpeg"})}}, | ||
{textKey:"downloadPDF",onclick:function(){this.exportChart({type:"application/pdf"})}},{textKey:"downloadSVG",onclick:function(){this.exportChart({type:"image/svg+xml"})}}]}}};f.post=function(a,c,e){var b;a=r("form",p({method:"post",action:a,enctype:"multipart/form-data"},e),{display:"none"},q.body);for(b in c)r("input",{type:"hidden",name:b,value:c[b]},null,a);a.submit();w(a)};t(u.prototype,{sanitizeSVG:function(a){a=a.replace(/zIndex="[^"]+"/g,"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g, | ||
"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/url\(("|")(\S+)("|")\)/g,"url($2)").replace(/url\([^#]+#/g,"url(#").replace(/<svg /,'<svg xmlns:xlink="http://www.w3.org/1999/xlink" ').replace(/ (NS[0-9]+\:)?href=/g," xlink:href=").replace(/\n/," ").replace(/<\/svg>.*?$/,"</svg>").replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g,'$1="rgb($2)" $1-opacity="$3"').replace(/ /g,"\u00a0").replace(/­/g,"\u00ad");return a=a.replace(/<IMG /g,"<image ").replace(/<(\/?)TITLE>/g, | ||
"<$1title>").replace(/height=([^" ]+)/g,'height="$1"').replace(/width=([^" ]+)/g,'width="$1"').replace(/hc-svg-href="([^"]+)">/g,'xlink:href="$1"/>').replace(/ id=([^" >]+)/g,' id="$1"').replace(/class=([^" >]+)/g,'class="$1"').replace(/ transform /g," ").replace(/:(path|rect)/g,"$1").replace(/style="([^"]+)"/g,function(a){return a.toLowerCase()})},getChartHTML:function(){return this.container.innerHTML},getSVG:function(a){var c=this,e,b,g,C,l,d=p(c.options,a),m=d.exporting.allowHTML;q.createElementNS|| | ||
(q.createElementNS=function(a,b){return q.createElement(b)});b=r("div",null,{position:"absolute",top:"-9999em",width:c.chartWidth+"px",height:c.chartHeight+"px"},q.body);g=c.renderTo.style.width;l=c.renderTo.style.height;g=d.exporting.sourceWidth||d.chart.width||/px$/.test(g)&&parseInt(g,10)||600;l=d.exporting.sourceHeight||d.chart.height||/px$/.test(l)&&parseInt(l,10)||400;t(d.chart,{animation:!1,renderTo:b,forExport:!0,renderer:"SVGRenderer",width:g,height:l});d.exporting.enabled=!1;delete d.data; | ||
d.series=[];k(c.series,function(a){C=p(a.userOptions,{animation:!1,enableMouseTracking:!1,showCheckbox:!1,visible:a.visible});C.isInternal||d.series.push(C)});a&&k(["xAxis","yAxis"],function(b){k(H(a[b]),function(a,c){d[b][c]=p(d[b][c],a)})});e=new f.Chart(d,c.callback);k(["xAxis","yAxis"],function(a){k(c[a],function(b,c){var d=e[a][c],g=b.getExtremes(),f=g.userMin,g=g.userMax;!d||void 0===f&&void 0===g||d.setExtremes(f,g,!0,!1)})});g=e.getChartHTML();d=null;e.destroy();w(b);m&&(b=g.match(/<\/svg>(.*?$)/))&& | ||
(b='<foreignObject x="0" y="0" width="200" height="200"><body xmlns="http://www.w3.org/1999/xhtml">'+b[1]+"</body></foreignObject>",g=g.replace("</svg>",b+"</svg>"));g=this.sanitizeSVG(g);return g=g.replace(/(url\(#highcharts-[0-9]+)"/g,"$1").replace(/"/g,"'")},getSVGForExport:function(a,c){var e=this.options.exporting;return this.getSVG(p({chart:{borderRadius:0}},e.chartOptions,c,{exporting:{sourceWidth:a&&a.sourceWidth||e.sourceWidth,sourceHeight:a&&a.sourceHeight||e.sourceHeight}}))}, | ||
exportChart:function(a,c){var e=this.getSVGForExport(a,c);a=p(this.options.exporting,a);f.post(a.url,{filename:a.filename||"chart",type:a.type,width:a.width||0,scale:a.scale,svg:e},a.formAttributes)},print:function(){var a=this,c=a.container,e=[],b=c.parentNode,g=q.body,f=g.childNodes,l=a.options.exporting.printMaxWidth,d,m;if(!a.isPrinting){a.isPrinting=!0;a.pointer.reset(null,0);E(a,"beforePrint");if(m=l&&a.chartWidth>l)d=[a.options.chart.width,void 0,!1],a.setSize(l,void 0,!1);k(f,function(a,b){1=== | ||
a.nodeType&&(e[b]=a.style.display,a.style.display="none")});g.appendChild(c);F.focus();F.print();setTimeout(function(){b.appendChild(c);k(f,function(a,b){1===a.nodeType&&(a.style.display=e[b])});a.isPrinting=!1;m&&a.setSize.apply(a,d);E(a,"afterPrint")},1E3)}},contextMenu:function(a,c,e,b,g,f,l){var d=this,m=d.options.navigation,h=d.chartWidth,p=d.chartHeight,G="cache-"+a,n=d[G],y=Math.max(g,f),z,A,u,w=function(b){d.pointer.inClass(b.target,a)||A()};n||(d[G]=n=r("div",{className:a},{position:"absolute", | ||
zIndex:1E3,padding:y+"px"},d.container),z=r("div",{className:"highcharts-menu"},null,n),x(z,t({MozBoxShadow:"3px 3px 10px #888",WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},m.menuStyle)),A=function(){x(n,{display:"none"});l&&l.setState(0);d.openMenu=!1},v(n,"mouseleave",function(){u=setTimeout(A,500)}),v(n,"mouseenter",function(){clearTimeout(u)}),v(q,"mouseup",w),v(d,"destroy",function(){D(q,"mouseup",w)}),k(c,function(a){if(a){var b;a.separator?b=r("hr",null,null,z):(b=r("div", | ||
{className:"highcharts-menu-item",onclick:function(b){b&&b.stopPropagation();A();a.onclick&&a.onclick.apply(d,arguments)},innerHTML:a.text||d.options.lang[a.textKey]},null,z),b.onmouseover=function(){x(this,m.menuItemHoverStyle)},b.onmouseout=function(){x(this,m.menuItemStyle)},x(b,t({cursor:"pointer"},m.menuItemStyle)));d.exportDivElements.push(b)}}),d.exportDivElements.push(z,n),d.exportMenuWidth=n.offsetWidth,d.exportMenuHeight=n.offsetHeight);c={display:"block"};e+d.exportMenuWidth>h?c.right= | ||
h-e-g-y+"px":c.left=e-y+"px";b+f+d.exportMenuHeight>p&&"top"!==l.alignOptions.verticalAlign?c.bottom=p-b-y+"px":c.top=b+f-y+"px";x(n,c);d.openMenu=!0},addButton:function(a){var c=this,e=c.renderer,b=p(c.options.navigation.buttonOptions,a),g=b.onclick,f=b.menuItems,l,d,m=b.symbolSize||12;c.btnCount||(c.btnCount=0);c.exportDivElements||(c.exportDivElements=[],c.exportSVGElements=[]);if(!1!==b.enabled){var h=b.theme,k=h.states,q=k&&k.hover,k=k&&k.select,n;delete h.states;g?n=function(a){a.stopPropagation(); | ||
g.call(c,a)}:f&&(n=function(){c.contextMenu(d.menuClassName,f,d.translateX,d.translateY,d.width,d.height,d);d.setState(2)});b.text&&b.symbol?h.paddingLeft=B(h.paddingLeft,25):b.text||t(h,{width:b.width,height:b.height,padding:0});d=e.button(b.text,0,0,n,h,q,k).addClass(a.className).attr({"stroke-linecap":"round",title:c.options.lang[b._titleKey],zIndex:3});d.menuClassName=a.menuClassName||"highcharts-menu-"+c.btnCount++;b.symbol&&(l=e.symbol(b.symbol,b.symbolX-m/2,b.symbolY-m/2,m,m).addClass("highcharts-button-symbol").attr({zIndex:1}).add(d), | ||
l.attr({stroke:b.symbolStroke,fill:b.symbolFill,"stroke-width":b.symbolStrokeWidth||1}));d.add().align(t(b,{width:d.width,x:B(b.x,c.buttonOffset)}),!0,"spacingBox");c.buttonOffset+=(d.width+b.buttonSpacing)*("right"===b.align?-1:1);c.exportSVGElements.push(d,l)}},destroyExport:function(a){var c=a?a.target:this;a=c.exportSVGElements;var e=c.exportDivElements;a&&(k(a,function(a,e){a&&(a.onclick=a.ontouchstart=null,c.exportSVGElements[e]=a.destroy())}),a.length=0);e&&(k(e,function(a,e){D(a,"mouseleave"); | ||
c.exportDivElements[e]=a.onmouseout=a.onmouseover=a.ontouchstart=a.onclick=null;w(a)}),e.length=0)}});J.menu=function(a,c,e,b){return["M",a,c+2.5,"L",a+e,c+2.5,"M",a,c+b/2+.5,"L",a+e,c+b/2+.5,"M",a,c+b-1.5,"L",a+e,c+b-1.5]};u.prototype.renderExporting=function(){var a,c=this.options.exporting,e=c.buttons,b=this.isDirtyExporting||!this.exportSVGElements;this.buttonOffset=0;this.isDirtyExporting&&this.destroyExport();if(b&&!1!==c.enabled){for(a in e)this.addButton(e[a]);this.isDirtyExporting=!1}v(this, | ||
"destroy",this.destroyExport)};u.prototype.callbacks.push(function(a){a.renderExporting();v(a,"redraw",a.renderExporting);k(["exporting","navigation"],function(c){a[c]={update:function(e,b){a.isDirtyExporting=!0;p(!0,a.options[c],e);B(b,!0)&&a.redraw()}}})})})(h)}); |
/** | ||
* @license Highcharts JS v4.2.7 (2016-09-21) | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* Exporting module | ||
@@ -9,5 +9,3 @@ * | ||
*/ | ||
/* eslint indent:0 */ | ||
(function (factory) { | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
@@ -18,783 +16,864 @@ module.exports = factory; | ||
} | ||
}(function (Highcharts) { | ||
}(function(Highcharts) { | ||
(function(H) { | ||
/** | ||
* Exporting module | ||
* | ||
* (c) 2010-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
// create shortcuts | ||
var win = Highcharts.win, | ||
doc = win.document, | ||
Chart = Highcharts.Chart, | ||
addEvent = Highcharts.addEvent, | ||
removeEvent = Highcharts.removeEvent, | ||
fireEvent = Highcharts.fireEvent, | ||
createElement = Highcharts.createElement, | ||
discardElement = Highcharts.discardElement, | ||
css = Highcharts.css, | ||
merge = Highcharts.merge, | ||
each = Highcharts.each, | ||
extend = Highcharts.extend, | ||
splat = Highcharts.splat, | ||
math = Math, | ||
mathMax = math.max, | ||
isTouchDevice = Highcharts.isTouchDevice, | ||
M = 'M', | ||
L = 'L', | ||
DIV = 'div', | ||
HIDDEN = 'hidden', | ||
NONE = 'none', | ||
PREFIX = 'highcharts-', | ||
ABSOLUTE = 'absolute', | ||
PX = 'px', | ||
UNDEFINED, | ||
symbols = Highcharts.Renderer.prototype.symbols, | ||
defaultOptions = Highcharts.getOptions(), | ||
buttonOffset; | ||
/* eslint indent:0 */ | ||
'use strict'; | ||
// Add language | ||
extend(defaultOptions.lang, { | ||
printChart: 'Print chart', | ||
downloadPNG: 'Download PNG image', | ||
downloadJPEG: 'Download JPEG image', | ||
downloadPDF: 'Download PDF document', | ||
downloadSVG: 'Download SVG vector image', | ||
contextButtonTitle: 'Chart context menu' | ||
}); | ||
// create shortcuts | ||
var defaultOptions = H.defaultOptions, | ||
doc = H.doc, | ||
Chart = H.Chart, | ||
addEvent = H.addEvent, | ||
removeEvent = H.removeEvent, | ||
fireEvent = H.fireEvent, | ||
createElement = H.createElement, | ||
discardElement = H.discardElement, | ||
css = H.css, | ||
merge = H.merge, | ||
pick = H.pick, | ||
each = H.each, | ||
extend = H.extend, | ||
splat = H.splat, | ||
isTouchDevice = H.isTouchDevice, | ||
win = H.win, | ||
SVGRenderer = H.SVGRenderer; | ||
// Buttons and menus are collected in a separate config option set called 'navigation'. | ||
// This can be extended later to add control buttons like zoom and pan right click menus. | ||
defaultOptions.navigation = { | ||
menuStyle: { | ||
border: '1px solid #A0A0A0', | ||
background: '#FFFFFF', | ||
padding: '5px 0' | ||
}, | ||
menuItemStyle: { | ||
padding: '0 10px', | ||
background: NONE, | ||
color: '#303030', | ||
fontSize: isTouchDevice ? '14px' : '11px' | ||
}, | ||
menuItemHoverStyle: { | ||
background: '#4572A5', | ||
color: '#FFFFFF' | ||
}, | ||
var symbols = H.Renderer.prototype.symbols; | ||
buttonOptions: { | ||
symbolFill: '#E0E0E0', | ||
symbolSize: 14, | ||
symbolStroke: '#666', | ||
symbolStrokeWidth: 3, | ||
symbolX: 12.5, | ||
symbolY: 10.5, | ||
align: 'right', | ||
buttonSpacing: 3, | ||
height: 22, | ||
// text: null, | ||
theme: { | ||
fill: 'white', // capture hover | ||
stroke: 'none' | ||
}, | ||
verticalAlign: 'top', | ||
width: 24 | ||
} | ||
}; | ||
// Add language | ||
extend(defaultOptions.lang, { | ||
printChart: 'Print chart', | ||
downloadPNG: 'Download PNG image', | ||
downloadJPEG: 'Download JPEG image', | ||
downloadPDF: 'Download PDF document', | ||
downloadSVG: 'Download SVG vector image', | ||
contextButtonTitle: 'Chart context menu' | ||
}); | ||
// Buttons and menus are collected in a separate config option set called 'navigation'. | ||
// This can be extended later to add control buttons like zoom and pan right click menus. | ||
defaultOptions.navigation = { | ||
buttonOptions: { | ||
theme: {}, | ||
symbolSize: 14, | ||
symbolX: 12.5, | ||
symbolY: 10.5, | ||
align: 'right', | ||
buttonSpacing: 3, | ||
height: 22, | ||
// text: null, | ||
verticalAlign: 'top', | ||
width: 24 | ||
} | ||
}; | ||
// Add the export related options | ||
defaultOptions.exporting = { | ||
//enabled: true, | ||
//filename: 'chart', | ||
type: 'image/png', | ||
url: 'https://export.highcharts.com/', | ||
//width: undefined, | ||
printMaxWidth: 780, | ||
scale: 2, | ||
buttons: { | ||
contextButton: { | ||
menuClassName: PREFIX + 'contextmenu', | ||
//x: -10, | ||
symbol: 'menu', | ||
_titleKey: 'contextButtonTitle', | ||
menuItems: [{ | ||
textKey: 'printChart', | ||
onclick: function () { | ||
this.print(); | ||
} | ||
}, { | ||
separator: true | ||
}, { | ||
textKey: 'downloadPNG', | ||
onclick: function () { | ||
this.exportChart(); | ||
} | ||
}, { | ||
textKey: 'downloadJPEG', | ||
onclick: function () { | ||
this.exportChart({ | ||
type: 'image/jpeg' | ||
}); | ||
} | ||
}, { | ||
textKey: 'downloadPDF', | ||
onclick: function () { | ||
this.exportChart({ | ||
type: 'application/pdf' | ||
}); | ||
} | ||
}, { | ||
textKey: 'downloadSVG', | ||
onclick: function () { | ||
this.exportChart({ | ||
type: 'image/svg+xml' | ||
}); | ||
} | ||
} | ||
// Enable this block to add "View SVG" to the dropdown menu | ||
/* | ||
,{ | ||
// Presentational attributes | ||
merge(true, defaultOptions.navigation, { | ||
menuStyle: { | ||
border: '1px solid #999999', | ||
background: '#ffffff', | ||
padding: '5px 0' | ||
}, | ||
menuItemStyle: { | ||
padding: '0.5em 1em', | ||
background: 'none', | ||
color: '#333333', | ||
fontSize: isTouchDevice ? '14px' : '11px', | ||
transition: 'background 250ms, color 250ms' | ||
}, | ||
menuItemHoverStyle: { | ||
background: '#335cad', | ||
color: '#ffffff' | ||
}, | ||
buttonOptions: { | ||
symbolFill: '#666666', | ||
symbolStroke: '#666666', | ||
symbolStrokeWidth: 3, | ||
theme: { | ||
fill: '#ffffff', // capture hover | ||
stroke: 'none', | ||
padding: 5 | ||
} | ||
} | ||
}); | ||
text: 'View SVG', | ||
onclick: function () { | ||
var svg = this.getSVG() | ||
.replace(/</g, '\n<') | ||
.replace(/>/g, '>'); | ||
doc.body.innerHTML = '<pre>' + svg + '</pre>'; | ||
} | ||
} // */ | ||
] | ||
} | ||
} | ||
}; | ||
// Add the Highcharts.post utility | ||
Highcharts.post = function (url, data, formAttributes) { | ||
var name, | ||
form; | ||
// Add the export related options | ||
defaultOptions.exporting = { | ||
//enabled: true, | ||
//filename: 'chart', | ||
type: 'image/png', | ||
url: 'https://export.highcharts.com/', | ||
//width: undefined, | ||
printMaxWidth: 780, | ||
scale: 2, | ||
buttons: { | ||
contextButton: { | ||
className: 'highcharts-contextbutton', | ||
menuClassName: 'highcharts-contextmenu', | ||
//x: -10, | ||
symbol: 'menu', | ||
_titleKey: 'contextButtonTitle', | ||
menuItems: [{ | ||
textKey: 'printChart', | ||
onclick: function() { | ||
this.print(); | ||
} | ||
}, { | ||
separator: true | ||
}, { | ||
textKey: 'downloadPNG', | ||
onclick: function() { | ||
this.exportChart(); | ||
} | ||
}, { | ||
textKey: 'downloadJPEG', | ||
onclick: function() { | ||
this.exportChart({ | ||
type: 'image/jpeg' | ||
}); | ||
} | ||
}, { | ||
textKey: 'downloadPDF', | ||
onclick: function() { | ||
this.exportChart({ | ||
type: 'application/pdf' | ||
}); | ||
} | ||
}, { | ||
textKey: 'downloadSVG', | ||
onclick: function() { | ||
this.exportChart({ | ||
type: 'image/svg+xml' | ||
}); | ||
} | ||
} | ||
// Enable this block to add "View SVG" to the dropdown menu | ||
/* | ||
,{ | ||
// create the form | ||
form = createElement('form', merge({ | ||
method: 'post', | ||
action: url, | ||
enctype: 'multipart/form-data' | ||
}, formAttributes), { | ||
display: NONE | ||
}, doc.body); | ||
text: 'View SVG', | ||
onclick: function () { | ||
var svg = this.getSVG() | ||
.replace(/</g, '\n<') | ||
.replace(/>/g, '>'); | ||
// add the data | ||
for (name in data) { | ||
createElement('input', { | ||
type: HIDDEN, | ||
name: name, | ||
value: data[name] | ||
}, null, form); | ||
} | ||
doc.body.innerHTML = '<pre>' + svg + '</pre>'; | ||
} | ||
} // */ | ||
] | ||
} | ||
} | ||
}; | ||
// submit | ||
form.submit(); | ||
// Add the H.post utility | ||
H.post = function(url, data, formAttributes) { | ||
var name, | ||
form; | ||
// clean up | ||
discardElement(form); | ||
}; | ||
// create the form | ||
form = createElement('form', merge({ | ||
method: 'post', | ||
action: url, | ||
enctype: 'multipart/form-data' | ||
}, formAttributes), { | ||
display: 'none' | ||
}, doc.body); | ||
extend(Chart.prototype, { | ||
// add the data | ||
for (name in data) { | ||
createElement('input', { | ||
type: 'hidden', | ||
name: name, | ||
value: data[name] | ||
}, null, form); | ||
} | ||
/** | ||
* A collection of regex fixes on the produces SVG to account for expando properties, | ||
* browser bugs, VML problems and other. Returns a cleaned SVG. | ||
*/ | ||
sanitizeSVG: function (svg) { | ||
return svg | ||
.replace(/zIndex="[^"]+"/g, '') | ||
.replace(/isShadow="[^"]+"/g, '') | ||
.replace(/symbolName="[^"]+"/g, '') | ||
.replace(/jQuery[0-9]+="[^"]+"/g, '') | ||
.replace(/url\(("|")(\S+)("|")\)/g, 'url($2)') | ||
.replace(/url\([^#]+#/g, 'url(#') | ||
.replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ') | ||
.replace(/ (NS[0-9]+\:)?href=/g, ' xlink:href=') // #3567 | ||
.replace(/\n/, ' ') | ||
// Any HTML added to the container after the SVG (#894) | ||
.replace(/<\/svg>.*?$/, '</svg>') | ||
// Batik doesn't support rgba fills and strokes (#3095) | ||
.replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g, '$1="rgb($2)" $1-opacity="$3"') | ||
/* This fails in IE < 8 | ||
.replace(/([0-9]+)\.([0-9]+)/g, function(s1, s2, s3) { // round off to save weight | ||
return s2 +'.'+ s3[0]; | ||
})*/ | ||
// submit | ||
form.submit(); | ||
// Replace HTML entities, issue #347 | ||
.replace(/ /g, '\u00A0') // no-break space | ||
.replace(/­/g, '\u00AD') // soft hyphen | ||
// clean up | ||
discardElement(form); | ||
}; | ||
// IE specific | ||
.replace(/<IMG /g, '<image ') | ||
.replace(/<(\/?)TITLE>/g, '<$1title>') | ||
.replace(/height=([^" ]+)/g, 'height="$1"') | ||
.replace(/width=([^" ]+)/g, 'width="$1"') | ||
.replace(/hc-svg-href="([^"]+)">/g, 'xlink:href="$1"/>') | ||
.replace(/ id=([^" >]+)/g, ' id="$1"') // #4003 | ||
.replace(/class=([^" >]+)/g, 'class="$1"') | ||
.replace(/ transform /g, ' ') | ||
.replace(/:(path|rect)/g, '$1') | ||
.replace(/style="([^"]+)"/g, function (s) { | ||
return s.toLowerCase(); | ||
}); | ||
}, | ||
extend(Chart.prototype, { | ||
/** | ||
* Return innerHTML of chart. Used as hook for plugins. | ||
*/ | ||
getChartHTML: function () { | ||
return this.container.innerHTML; | ||
}, | ||
/** | ||
* A collection of regex fixes on the produces SVG to account for expando properties, | ||
* browser bugs, VML problems and other. Returns a cleaned SVG. | ||
*/ | ||
sanitizeSVG: function(svg) { | ||
svg = svg | ||
.replace(/zIndex="[^"]+"/g, '') | ||
.replace(/isShadow="[^"]+"/g, '') | ||
.replace(/symbolName="[^"]+"/g, '') | ||
.replace(/jQuery[0-9]+="[^"]+"/g, '') | ||
.replace(/url\(("|")(\S+)("|")\)/g, 'url($2)') | ||
.replace(/url\([^#]+#/g, 'url(#') | ||
.replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ') | ||
.replace(/ (NS[0-9]+\:)?href=/g, ' xlink:href=') // #3567 | ||
.replace(/\n/, ' ') | ||
// Any HTML added to the container after the SVG (#894) | ||
.replace(/<\/svg>.*?$/, '</svg>') | ||
// Batik doesn't support rgba fills and strokes (#3095) | ||
.replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g, '$1="rgb($2)" $1-opacity="$3"') | ||
/* This fails in IE < 8 | ||
.replace(/([0-9]+)\.([0-9]+)/g, function(s1, s2, s3) { // round off to save weight | ||
return s2 +'.'+ s3[0]; | ||
})*/ | ||
/** | ||
* Return an SVG representation of the chart | ||
* | ||
* @param additionalOptions {Object} Additional chart options for the generated SVG representation | ||
*/ | ||
getSVG: function (additionalOptions) { | ||
var chart = this, | ||
chartCopy, | ||
sandbox, | ||
svg, | ||
seriesOptions, | ||
sourceWidth, | ||
sourceHeight, | ||
cssWidth, | ||
cssHeight, | ||
html, | ||
options = merge(chart.options, additionalOptions), // copy the options and add extra options | ||
allowHTML = options.exporting.allowHTML; | ||
// Replace HTML entities, issue #347 | ||
.replace(/ /g, '\u00A0') // no-break space | ||
.replace(/­/g, '\u00AD'); // soft hyphen | ||
// IE compatibility hack for generating SVG content that it doesn't really understand | ||
if (!doc.createElementNS) { | ||
doc.createElementNS = function (ns, tagName) { | ||
return doc.createElement(tagName); | ||
}; | ||
} | ||
// IE specific | ||
svg = svg | ||
.replace(/<IMG /g, '<image ') | ||
.replace(/<(\/?)TITLE>/g, '<$1title>') | ||
.replace(/height=([^" ]+)/g, 'height="$1"') | ||
.replace(/width=([^" ]+)/g, 'width="$1"') | ||
.replace(/hc-svg-href="([^"]+)">/g, 'xlink:href="$1"/>') | ||
.replace(/ id=([^" >]+)/g, ' id="$1"') // #4003 | ||
.replace(/class=([^" >]+)/g, 'class="$1"') | ||
.replace(/ transform /g, ' ') | ||
.replace(/:(path|rect)/g, '$1') | ||
.replace(/style="([^"]+)"/g, function(s) { | ||
return s.toLowerCase(); | ||
}); | ||
// create a sandbox where a new chart will be generated | ||
sandbox = createElement(DIV, null, { | ||
position: ABSOLUTE, | ||
top: '-9999em', | ||
width: chart.chartWidth + PX, | ||
height: chart.chartHeight + PX | ||
}, doc.body); | ||
// get the source size | ||
cssWidth = chart.renderTo.style.width; | ||
cssHeight = chart.renderTo.style.height; | ||
sourceWidth = options.exporting.sourceWidth || | ||
options.chart.width || | ||
(/px$/.test(cssWidth) && parseInt(cssWidth, 10)) || | ||
600; | ||
sourceHeight = options.exporting.sourceHeight || | ||
options.chart.height || | ||
(/px$/.test(cssHeight) && parseInt(cssHeight, 10)) || | ||
400; | ||
return svg; | ||
}, | ||
// override some options | ||
extend(options.chart, { | ||
animation: false, | ||
renderTo: sandbox, | ||
forExport: true, | ||
renderer: 'SVGRenderer', | ||
width: sourceWidth, | ||
height: sourceHeight | ||
}); | ||
options.exporting.enabled = false; // hide buttons in print | ||
delete options.data; // #3004 | ||
/** | ||
* Return innerHTML of chart. Used as hook for plugins. | ||
*/ | ||
getChartHTML: function() { | ||
// prepare for replicating the chart | ||
options.series = []; | ||
each(chart.series, function (serie) { | ||
seriesOptions = merge(serie.userOptions, { // #4912 | ||
animation: false, // turn off animation | ||
enableMouseTracking: false, | ||
showCheckbox: false, | ||
visible: serie.visible | ||
}); | ||
return this.container.innerHTML; | ||
}, | ||
if (!seriesOptions.isInternal) { // used for the navigator series that has its own option set | ||
options.series.push(seriesOptions); | ||
} | ||
}); | ||
/** | ||
* Return an SVG representation of the chart | ||
* | ||
* @param additionalOptions {Object} Additional chart options for the generated SVG representation | ||
*/ | ||
getSVG: function(additionalOptions) { | ||
var chart = this, | ||
chartCopy, | ||
sandbox, | ||
svg, | ||
seriesOptions, | ||
sourceWidth, | ||
sourceHeight, | ||
cssWidth, | ||
cssHeight, | ||
html, | ||
options = merge(chart.options, additionalOptions), // copy the options and add extra options | ||
allowHTML = options.exporting.allowHTML; | ||
// Axis options must be merged in one by one, since it may be an array or an object (#2022, #3900) | ||
if (additionalOptions) { | ||
each(['xAxis', 'yAxis'], function (axisType) { | ||
each(splat(additionalOptions[axisType]), function (axisOptions, i) { | ||
options[axisType][i] = merge(options[axisType][i], axisOptions); | ||
}); | ||
}); | ||
} | ||
// generate the chart copy | ||
chartCopy = new Highcharts.Chart(options, chart.callback); | ||
// IE compatibility hack for generating SVG content that it doesn't really understand | ||
if (!doc.createElementNS) { | ||
doc.createElementNS = function(ns, tagName) { | ||
return doc.createElement(tagName); | ||
}; | ||
} | ||
// reflect axis extremes in the export | ||
each(['xAxis', 'yAxis'], function (axisType) { | ||
each(chart[axisType], function (axis, i) { | ||
var axisCopy = chartCopy[axisType][i], | ||
extremes = axis.getExtremes(), | ||
userMin = extremes.userMin, | ||
userMax = extremes.userMax; | ||
// create a sandbox where a new chart will be generated | ||
sandbox = createElement('div', null, { | ||
position: 'absolute', | ||
top: '-9999em', | ||
width: chart.chartWidth + 'px', | ||
height: chart.chartHeight + 'px' | ||
}, doc.body); | ||
if (axisCopy && (userMin !== UNDEFINED || userMax !== UNDEFINED)) { | ||
axisCopy.setExtremes(userMin, userMax, true, false); | ||
} | ||
}); | ||
}); | ||
// get the source size | ||
cssWidth = chart.renderTo.style.width; | ||
cssHeight = chart.renderTo.style.height; | ||
sourceWidth = options.exporting.sourceWidth || | ||
options.chart.width || | ||
(/px$/.test(cssWidth) && parseInt(cssWidth, 10)) || | ||
600; | ||
sourceHeight = options.exporting.sourceHeight || | ||
options.chart.height || | ||
(/px$/.test(cssHeight) && parseInt(cssHeight, 10)) || | ||
400; | ||
// get the SVG from the container's innerHTML | ||
svg = chartCopy.getChartHTML(); | ||
// override some options | ||
extend(options.chart, { | ||
animation: false, | ||
renderTo: sandbox, | ||
forExport: true, | ||
renderer: 'SVGRenderer', | ||
width: sourceWidth, | ||
height: sourceHeight | ||
}); | ||
options.exporting.enabled = false; // hide buttons in print | ||
delete options.data; // #3004 | ||
// free up memory | ||
options = null; | ||
chartCopy.destroy(); | ||
discardElement(sandbox); | ||
// prepare for replicating the chart | ||
options.series = []; | ||
each(chart.series, function(serie) { | ||
seriesOptions = merge(serie.userOptions, { // #4912 | ||
animation: false, // turn off animation | ||
enableMouseTracking: false, | ||
showCheckbox: false, | ||
visible: serie.visible | ||
}); | ||
// Move HTML into a foreignObject | ||
if (allowHTML) { | ||
html = svg.match(/<\/svg>(.*?$)/); | ||
if (html) { | ||
html = '<foreignObject x="0" y="0" width="200" height="200">' + | ||
'<body xmlns="http://www.w3.org/1999/xhtml">' + | ||
html[1] + | ||
'</body>' + | ||
'</foreignObject>'; | ||
svg = svg.replace('</svg>', html + '</svg>'); | ||
} | ||
} | ||
if (!seriesOptions.isInternal) { // used for the navigator series that has its own option set | ||
options.series.push(seriesOptions); | ||
} | ||
}); | ||
// sanitize | ||
svg = this.sanitizeSVG(svg); | ||
// Axis options must be merged in one by one, since it may be an array or an object (#2022, #3900) | ||
if (additionalOptions) { | ||
each(['xAxis', 'yAxis'], function(axisType) { | ||
each(splat(additionalOptions[axisType]), function(axisOptions, i) { | ||
options[axisType][i] = merge(options[axisType][i], axisOptions); | ||
}); | ||
}); | ||
} | ||
// IE9 beta bugs with innerHTML. Test again with final IE9. | ||
svg = svg.replace(/(url\(#highcharts-[0-9]+)"/g, '$1') | ||
.replace(/"/g, '\''); | ||
// generate the chart copy | ||
chartCopy = new H.Chart(options, chart.callback); | ||
return svg; | ||
}, | ||
// reflect axis extremes in the export | ||
each(['xAxis', 'yAxis'], function(axisType) { | ||
each(chart[axisType], function(axis, i) { | ||
var axisCopy = chartCopy[axisType][i], | ||
extremes = axis.getExtremes(), | ||
userMin = extremes.userMin, | ||
userMax = extremes.userMax; | ||
getSVGForExport: function (options, chartOptions) { | ||
var chartExportingOptions = this.options.exporting; | ||
if (axisCopy && (userMin !== undefined || userMax !== undefined)) { | ||
axisCopy.setExtremes(userMin, userMax, true, false); | ||
} | ||
}); | ||
}); | ||
return this.getSVG(merge( | ||
{ chart: { borderRadius: 0 } }, | ||
chartExportingOptions.chartOptions, | ||
chartOptions, | ||
{ | ||
exporting: { | ||
sourceWidth: (options && options.sourceWidth) || chartExportingOptions.sourceWidth, | ||
sourceHeight: (options && options.sourceHeight) || chartExportingOptions.sourceHeight | ||
} | ||
} | ||
)); | ||
}, | ||
// get the SVG from the container's innerHTML | ||
svg = chartCopy.getChartHTML(); | ||
/** | ||
* Submit the SVG representation of the chart to the server | ||
* @param {Object} options Exporting options. Possible members are url, type, width and formAttributes. | ||
* @param {Object} chartOptions Additional chart options for the SVG representation of the chart | ||
*/ | ||
exportChart: function (options, chartOptions) { | ||
// free up memory | ||
options = null; | ||
chartCopy.destroy(); | ||
discardElement(sandbox); | ||
var svg = this.getSVGForExport(options, chartOptions); | ||
// Move HTML into a foreignObject | ||
if (allowHTML) { | ||
html = svg.match(/<\/svg>(.*?$)/); | ||
if (html) { | ||
html = '<foreignObject x="0" y="0" width="200" height="200">' + | ||
'<body xmlns="http://www.w3.org/1999/xhtml">' + | ||
html[1] + | ||
'</body>' + | ||
'</foreignObject>'; | ||
svg = svg.replace('</svg>', html + '</svg>'); | ||
} | ||
} | ||
// merge the options | ||
options = merge(this.options.exporting, options); | ||
// sanitize | ||
svg = this.sanitizeSVG(svg); | ||
// do the post | ||
Highcharts.post(options.url, { | ||
filename: options.filename || 'chart', | ||
type: options.type, | ||
width: options.width || 0, // IE8 fails to post undefined correctly, so use 0 | ||
scale: options.scale, | ||
svg: svg | ||
}, options.formAttributes); | ||
// IE9 beta bugs with innerHTML. Test again with final IE9. | ||
svg = svg.replace(/(url\(#highcharts-[0-9]+)"/g, '$1') | ||
.replace(/"/g, '\''); | ||
}, | ||
return svg; | ||
}, | ||
/** | ||
* Print the chart | ||
*/ | ||
print: function () { | ||
getSVGForExport: function(options, chartOptions) { | ||
var chartExportingOptions = this.options.exporting; | ||
var chart = this, | ||
container = chart.container, | ||
origDisplay = [], | ||
origParent = container.parentNode, | ||
body = doc.body, | ||
childNodes = body.childNodes, | ||
printMaxWidth = chart.options.exporting.printMaxWidth, | ||
resetParams, | ||
handleMaxWidth; | ||
return this.getSVG(merge({ | ||
chart: { | ||
borderRadius: 0 | ||
} | ||
}, | ||
chartExportingOptions.chartOptions, | ||
chartOptions, { | ||
exporting: { | ||
sourceWidth: (options && options.sourceWidth) || chartExportingOptions.sourceWidth, | ||
sourceHeight: (options && options.sourceHeight) || chartExportingOptions.sourceHeight | ||
} | ||
} | ||
)); | ||
}, | ||
if (chart.isPrinting) { // block the button while in printing mode | ||
return; | ||
} | ||
/** | ||
* Submit the SVG representation of the chart to the server | ||
* @param {Object} options Exporting options. Possible members are url, type, width and formAttributes. | ||
* @param {Object} chartOptions Additional chart options for the SVG representation of the chart | ||
*/ | ||
exportChart: function(options, chartOptions) { | ||
chart.isPrinting = true; | ||
chart.pointer.reset(null, 0); | ||
var svg = this.getSVGForExport(options, chartOptions); | ||
fireEvent(chart, 'beforePrint'); | ||
// merge the options | ||
options = merge(this.options.exporting, options); | ||
// Handle printMaxWidth | ||
handleMaxWidth = printMaxWidth && chart.chartWidth > printMaxWidth; | ||
if (handleMaxWidth) { | ||
resetParams = [chart.options.chart.width, undefined, false]; | ||
chart.setSize(printMaxWidth, undefined, false); | ||
} | ||
// do the post | ||
H.post(options.url, { | ||
filename: options.filename || 'chart', | ||
type: options.type, | ||
width: options.width || 0, // IE8 fails to post undefined correctly, so use 0 | ||
scale: options.scale, | ||
svg: svg | ||
}, options.formAttributes); | ||
// hide all body content | ||
each(childNodes, function (node, i) { | ||
if (node.nodeType === 1) { | ||
origDisplay[i] = node.style.display; | ||
node.style.display = NONE; | ||
} | ||
}); | ||
}, | ||
// pull out the chart | ||
body.appendChild(container); | ||
/** | ||
* Print the chart | ||
*/ | ||
print: function() { | ||
win.focus(); // #1510 | ||
win.print(); | ||
var chart = this, | ||
container = chart.container, | ||
origDisplay = [], | ||
origParent = container.parentNode, | ||
body = doc.body, | ||
childNodes = body.childNodes, | ||
printMaxWidth = chart.options.exporting.printMaxWidth, | ||
resetParams, | ||
handleMaxWidth; | ||
// allow the browser to prepare before reverting | ||
setTimeout(function () { | ||
if (chart.isPrinting) { // block the button while in printing mode | ||
return; | ||
} | ||
// put the chart back in | ||
origParent.appendChild(container); | ||
chart.isPrinting = true; | ||
chart.pointer.reset(null, 0); | ||
// restore all body content | ||
each(childNodes, function (node, i) { | ||
if (node.nodeType === 1) { | ||
node.style.display = origDisplay[i]; | ||
} | ||
}); | ||
fireEvent(chart, 'beforePrint'); | ||
chart.isPrinting = false; | ||
// Handle printMaxWidth | ||
handleMaxWidth = printMaxWidth && chart.chartWidth > printMaxWidth; | ||
if (handleMaxWidth) { | ||
resetParams = [chart.options.chart.width, undefined, false]; | ||
chart.setSize(printMaxWidth, undefined, false); | ||
} | ||
// Reset printMaxWidth | ||
if (handleMaxWidth) { | ||
chart.setSize.apply(chart, resetParams); | ||
} | ||
// hide all body content | ||
each(childNodes, function(node, i) { | ||
if (node.nodeType === 1) { | ||
origDisplay[i] = node.style.display; | ||
node.style.display = 'none'; | ||
} | ||
}); | ||
fireEvent(chart, 'afterPrint'); | ||
// pull out the chart | ||
body.appendChild(container); | ||
}, 1000); | ||
win.focus(); // #1510 | ||
win.print(); | ||
}, | ||
// allow the browser to prepare before reverting | ||
setTimeout(function() { | ||
/** | ||
* Display a popup menu for choosing the export type | ||
* | ||
* @param {String} className An identifier for the menu | ||
* @param {Array} items A collection with text and onclicks for the items | ||
* @param {Number} x The x position of the opener button | ||
* @param {Number} y The y position of the opener button | ||
* @param {Number} width The width of the opener button | ||
* @param {Number} height The height of the opener button | ||
*/ | ||
contextMenu: function (className, items, x, y, width, height, button) { | ||
var chart = this, | ||
navOptions = chart.options.navigation, | ||
menuItemStyle = navOptions.menuItemStyle, | ||
chartWidth = chart.chartWidth, | ||
chartHeight = chart.chartHeight, | ||
cacheName = 'cache-' + className, | ||
menu = chart[cacheName], | ||
menuPadding = mathMax(width, height), // for mouse leave detection | ||
boxShadow = '3px 3px 10px #888', | ||
innerMenu, | ||
hide, | ||
hideTimer, | ||
menuStyle, | ||
docMouseUpHandler = function (e) { | ||
if (!chart.pointer.inClass(e.target, className)) { | ||
hide(); | ||
} | ||
}; | ||
// put the chart back in | ||
origParent.appendChild(container); | ||
// create the menu only the first time | ||
if (!menu) { | ||
// restore all body content | ||
each(childNodes, function(node, i) { | ||
if (node.nodeType === 1) { | ||
node.style.display = origDisplay[i]; | ||
} | ||
}); | ||
// create a HTML element above the SVG | ||
chart[cacheName] = menu = createElement(DIV, { | ||
className: className | ||
}, { | ||
position: ABSOLUTE, | ||
zIndex: 1000, | ||
padding: menuPadding + PX | ||
}, chart.container); | ||
chart.isPrinting = false; | ||
innerMenu = createElement(DIV, null, | ||
extend({ | ||
MozBoxShadow: boxShadow, | ||
WebkitBoxShadow: boxShadow, | ||
boxShadow: boxShadow | ||
}, navOptions.menuStyle), menu); | ||
// Reset printMaxWidth | ||
if (handleMaxWidth) { | ||
chart.setSize.apply(chart, resetParams); | ||
} | ||
// hide on mouse out | ||
hide = function () { | ||
css(menu, { display: NONE }); | ||
if (button) { | ||
button.setState(0); | ||
} | ||
chart.openMenu = false; | ||
}; | ||
fireEvent(chart, 'afterPrint'); | ||
// Hide the menu some time after mouse leave (#1357) | ||
addEvent(menu, 'mouseleave', function () { | ||
hideTimer = setTimeout(hide, 500); | ||
}); | ||
addEvent(menu, 'mouseenter', function () { | ||
clearTimeout(hideTimer); | ||
}); | ||
}, 1000); | ||
}, | ||
// Hide it on clicking or touching outside the menu (#2258, #2335, #2407) | ||
addEvent(doc, 'mouseup', docMouseUpHandler); | ||
addEvent(chart, 'destroy', function () { | ||
removeEvent(doc, 'mouseup', docMouseUpHandler); | ||
}); | ||
/** | ||
* Display a popup menu for choosing the export type | ||
* | ||
* @param {String} className An identifier for the menu | ||
* @param {Array} items A collection with text and onclicks for the items | ||
* @param {Number} x The x position of the opener button | ||
* @param {Number} y The y position of the opener button | ||
* @param {Number} width The width of the opener button | ||
* @param {Number} height The height of the opener button | ||
*/ | ||
contextMenu: function(className, items, x, y, width, height, button) { | ||
var chart = this, | ||
navOptions = chart.options.navigation, | ||
chartWidth = chart.chartWidth, | ||
chartHeight = chart.chartHeight, | ||
cacheName = 'cache-' + className, | ||
menu = chart[cacheName], | ||
menuPadding = Math.max(width, height), // for mouse leave detection | ||
innerMenu, | ||
hide, | ||
hideTimer, | ||
menuStyle, | ||
docMouseUpHandler = function(e) { | ||
if (!chart.pointer.inClass(e.target, className)) { | ||
hide(); | ||
} | ||
}; | ||
// create the menu only the first time | ||
if (!menu) { | ||
// create the items | ||
each(items, function (item) { | ||
if (item) { | ||
var element = item.separator ? | ||
createElement('hr', null, null, innerMenu) : | ||
createElement(DIV, { | ||
onmouseover: function () { | ||
css(this, navOptions.menuItemHoverStyle); | ||
}, | ||
onmouseout: function () { | ||
css(this, menuItemStyle); | ||
}, | ||
onclick: function (e) { | ||
if (e) { // IE7 | ||
e.stopPropagation(); | ||
} | ||
hide(); | ||
if (item.onclick) { | ||
item.onclick.apply(chart, arguments); | ||
} | ||
}, | ||
innerHTML: item.text || chart.options.lang[item.textKey] | ||
}, extend({ | ||
cursor: 'pointer' | ||
}, menuItemStyle), innerMenu); | ||
// create a HTML element above the SVG | ||
chart[cacheName] = menu = createElement('div', { | ||
className: className | ||
}, { | ||
position: 'absolute', | ||
zIndex: 1000, | ||
padding: menuPadding + 'px' | ||
}, chart.container); | ||
innerMenu = createElement('div', { | ||
className: 'highcharts-menu' | ||
}, null, menu); | ||
// Keep references to menu divs to be able to destroy them | ||
chart.exportDivElements.push(element); | ||
} | ||
}); | ||
// Keep references to menu and innerMenu div to be able to destroy them | ||
chart.exportDivElements.push(innerMenu, menu); | ||
// Presentational CSS | ||
css(innerMenu, extend({ | ||
MozBoxShadow: '3px 3px 10px #888', | ||
WebkitBoxShadow: '3px 3px 10px #888', | ||
boxShadow: '3px 3px 10px #888' | ||
}, navOptions.menuStyle)); | ||
chart.exportMenuWidth = menu.offsetWidth; | ||
chart.exportMenuHeight = menu.offsetHeight; | ||
} | ||
menuStyle = { display: 'block' }; | ||
// hide on mouse out | ||
hide = function() { | ||
css(menu, { | ||
display: 'none' | ||
}); | ||
if (button) { | ||
button.setState(0); | ||
} | ||
chart.openMenu = false; | ||
}; | ||
// if outside right, right align it | ||
if (x + chart.exportMenuWidth > chartWidth) { | ||
menuStyle.right = (chartWidth - x - width - menuPadding) + PX; | ||
} else { | ||
menuStyle.left = (x - menuPadding) + PX; | ||
} | ||
// if outside bottom, bottom align it | ||
if (y + height + chart.exportMenuHeight > chartHeight && button.alignOptions.verticalAlign !== 'top') { | ||
menuStyle.bottom = (chartHeight - y - menuPadding) + PX; | ||
} else { | ||
menuStyle.top = (y + height - menuPadding) + PX; | ||
} | ||
// Hide the menu some time after mouse leave (#1357) | ||
addEvent(menu, 'mouseleave', function() { | ||
hideTimer = setTimeout(hide, 500); | ||
}); | ||
addEvent(menu, 'mouseenter', function() { | ||
clearTimeout(hideTimer); | ||
}); | ||
css(menu, menuStyle); | ||
chart.openMenu = true; | ||
}, | ||
/** | ||
* Add the export button to the chart | ||
*/ | ||
addButton: function (options) { | ||
var chart = this, | ||
renderer = chart.renderer, | ||
btnOptions = merge(chart.options.navigation.buttonOptions, options), | ||
onclick = btnOptions.onclick, | ||
menuItems = btnOptions.menuItems, | ||
symbol, | ||
button, | ||
symbolAttr = { | ||
stroke: btnOptions.symbolStroke, | ||
fill: btnOptions.symbolFill | ||
}, | ||
symbolSize = btnOptions.symbolSize || 12; | ||
if (!chart.btnCount) { | ||
chart.btnCount = 0; | ||
} | ||
// Hide it on clicking or touching outside the menu (#2258, #2335, #2407) | ||
addEvent(doc, 'mouseup', docMouseUpHandler); | ||
addEvent(chart, 'destroy', function() { | ||
removeEvent(doc, 'mouseup', docMouseUpHandler); | ||
}); | ||
// Keeps references to the button elements | ||
if (!chart.exportDivElements) { | ||
chart.exportDivElements = []; | ||
chart.exportSVGElements = []; | ||
} | ||
if (btnOptions.enabled === false) { | ||
return; | ||
} | ||
// create the items | ||
each(items, function(item) { | ||
if (item) { | ||
var element; | ||
if (item.separator) { | ||
element = createElement('hr', null, null, innerMenu); | ||
var attr = btnOptions.theme, | ||
states = attr.states, | ||
hover = states && states.hover, | ||
select = states && states.select, | ||
callback; | ||
} else { | ||
element = createElement('div', { | ||
className: 'highcharts-menu-item', | ||
onclick: function(e) { | ||
if (e) { // IE7 | ||
e.stopPropagation(); | ||
} | ||
hide(); | ||
if (item.onclick) { | ||
item.onclick.apply(chart, arguments); | ||
} | ||
}, | ||
innerHTML: item.text || chart.options.lang[item.textKey] | ||
}, null, innerMenu); | ||
delete attr.states; | ||
if (onclick) { | ||
callback = function (e) { | ||
e.stopPropagation(); | ||
onclick.call(chart, e); | ||
}; | ||
element.onmouseover = function() { | ||
css(this, navOptions.menuItemHoverStyle); | ||
}; | ||
element.onmouseout = function() { | ||
css(this, navOptions.menuItemStyle); | ||
}; | ||
css(element, extend({ | ||
cursor: 'pointer' | ||
}, navOptions.menuItemStyle)); | ||
} else if (menuItems) { | ||
callback = function () { | ||
chart.contextMenu( | ||
button.menuClassName, | ||
menuItems, | ||
button.translateX, | ||
button.translateY, | ||
button.width, | ||
button.height, | ||
button | ||
); | ||
button.setState(2); | ||
}; | ||
} | ||
} | ||
// Keep references to menu divs to be able to destroy them | ||
chart.exportDivElements.push(element); | ||
} | ||
}); | ||
if (btnOptions.text && btnOptions.symbol) { | ||
attr.paddingLeft = Highcharts.pick(attr.paddingLeft, 25); | ||
// Keep references to menu and innerMenu div to be able to destroy them | ||
chart.exportDivElements.push(innerMenu, menu); | ||
} else if (!btnOptions.text) { | ||
extend(attr, { | ||
width: btnOptions.width, | ||
height: btnOptions.height, | ||
padding: 0 | ||
}); | ||
} | ||
chart.exportMenuWidth = menu.offsetWidth; | ||
chart.exportMenuHeight = menu.offsetHeight; | ||
} | ||
button = renderer.button(btnOptions.text, 0, 0, callback, attr, hover, select) | ||
.attr({ | ||
title: chart.options.lang[btnOptions._titleKey], | ||
'stroke-linecap': 'round', | ||
zIndex: 3 // #4955 | ||
}); | ||
button.menuClassName = options.menuClassName || PREFIX + 'menu-' + chart.btnCount++; | ||
menuStyle = { | ||
display: 'block' | ||
}; | ||
if (btnOptions.symbol) { | ||
symbol = renderer.symbol( | ||
btnOptions.symbol, | ||
btnOptions.symbolX - (symbolSize / 2), | ||
btnOptions.symbolY - (symbolSize / 2), | ||
symbolSize, | ||
symbolSize | ||
) | ||
.attr(extend(symbolAttr, { | ||
'stroke-width': btnOptions.symbolStrokeWidth || 1, | ||
zIndex: 1 | ||
})).add(button); | ||
} | ||
// if outside right, right align it | ||
if (x + chart.exportMenuWidth > chartWidth) { | ||
menuStyle.right = (chartWidth - x - width - menuPadding) + 'px'; | ||
} else { | ||
menuStyle.left = (x - menuPadding) + 'px'; | ||
} | ||
// if outside bottom, bottom align it | ||
if (y + height + chart.exportMenuHeight > chartHeight && button.alignOptions.verticalAlign !== 'top') { | ||
menuStyle.bottom = (chartHeight - y - menuPadding) + 'px'; | ||
} else { | ||
menuStyle.top = (y + height - menuPadding) + 'px'; | ||
} | ||
button.add() | ||
.align(extend(btnOptions, { | ||
width: button.width, | ||
x: Highcharts.pick(btnOptions.x, buttonOffset) // #1654 | ||
}), true, 'spacingBox'); | ||
css(menu, menuStyle); | ||
chart.openMenu = true; | ||
}, | ||
buttonOffset += (button.width + btnOptions.buttonSpacing) * (btnOptions.align === 'right' ? -1 : 1); | ||
/** | ||
* Add the export button to the chart | ||
*/ | ||
addButton: function(options) { | ||
var chart = this, | ||
renderer = chart.renderer, | ||
btnOptions = merge(chart.options.navigation.buttonOptions, options), | ||
onclick = btnOptions.onclick, | ||
menuItems = btnOptions.menuItems, | ||
symbol, | ||
button, | ||
symbolSize = btnOptions.symbolSize || 12; | ||
if (!chart.btnCount) { | ||
chart.btnCount = 0; | ||
} | ||
chart.exportSVGElements.push(button, symbol); | ||
// Keeps references to the button elements | ||
if (!chart.exportDivElements) { | ||
chart.exportDivElements = []; | ||
chart.exportSVGElements = []; | ||
} | ||
}, | ||
if (btnOptions.enabled === false) { | ||
return; | ||
} | ||
/** | ||
* Destroy the buttons. | ||
*/ | ||
destroyExport: function (e) { | ||
var chart = e.target, | ||
i, | ||
elem; | ||
// Destroy the extra buttons added | ||
for (i = 0; i < chart.exportSVGElements.length; i++) { | ||
elem = chart.exportSVGElements[i]; | ||
var attr = btnOptions.theme, | ||
states = attr.states, | ||
hover = states && states.hover, | ||
select = states && states.select, | ||
callback; | ||
// Destroy and null the svg/vml elements | ||
if (elem) { // #1822 | ||
elem.onclick = elem.ontouchstart = null; | ||
chart.exportSVGElements[i] = elem.destroy(); | ||
} | ||
} | ||
delete attr.states; | ||
// Destroy the divs for the menu | ||
for (i = 0; i < chart.exportDivElements.length; i++) { | ||
elem = chart.exportDivElements[i]; | ||
if (onclick) { | ||
callback = function(e) { | ||
e.stopPropagation(); | ||
onclick.call(chart, e); | ||
}; | ||
// Remove the event handler | ||
removeEvent(elem, 'mouseleave'); | ||
} else if (menuItems) { | ||
callback = function() { | ||
chart.contextMenu( | ||
button.menuClassName, | ||
menuItems, | ||
button.translateX, | ||
button.translateY, | ||
button.width, | ||
button.height, | ||
button | ||
); | ||
button.setState(2); | ||
}; | ||
} | ||
// Remove inline events | ||
chart.exportDivElements[i] = elem.onmouseout = elem.onmouseover = elem.ontouchstart = elem.onclick = null; | ||
// Destroy the div by moving to garbage bin | ||
discardElement(elem); | ||
} | ||
} | ||
}); | ||
if (btnOptions.text && btnOptions.symbol) { | ||
attr.paddingLeft = pick(attr.paddingLeft, 25); | ||
} else if (!btnOptions.text) { | ||
extend(attr, { | ||
width: btnOptions.width, | ||
height: btnOptions.height, | ||
padding: 0 | ||
}); | ||
} | ||
symbols.menu = function (x, y, width, height) { | ||
var arr = [ | ||
M, x, y + 2.5, | ||
L, x + width, y + 2.5, | ||
M, x, y + height / 2 + 0.5, | ||
L, x + width, y + height / 2 + 0.5, | ||
M, x, y + height - 1.5, | ||
L, x + width, y + height - 1.5 | ||
]; | ||
return arr; | ||
}; | ||
button = renderer.button(btnOptions.text, 0, 0, callback, attr, hover, select) | ||
.addClass(options.className) | ||
.attr({ | ||
// Add the buttons on chart load | ||
Chart.prototype.callbacks.push(function (chart) { | ||
var n, | ||
exportingOptions = chart.options.exporting, | ||
buttons = exportingOptions.buttons; | ||
'stroke-linecap': 'round', | ||
buttonOffset = 0; | ||
title: chart.options.lang[btnOptions._titleKey], | ||
zIndex: 3 // #4955 | ||
}); | ||
button.menuClassName = options.menuClassName || 'highcharts-menu-' + chart.btnCount++; | ||
if (exportingOptions.enabled !== false) { | ||
if (btnOptions.symbol) { | ||
symbol = renderer.symbol( | ||
btnOptions.symbol, | ||
btnOptions.symbolX - (symbolSize / 2), | ||
btnOptions.symbolY - (symbolSize / 2), | ||
symbolSize, | ||
symbolSize | ||
) | ||
.addClass('highcharts-button-symbol') | ||
.attr({ | ||
zIndex: 1 | ||
}).add(button); | ||
for (n in buttons) { | ||
chart.addButton(buttons[n]); | ||
} | ||
// Destroy the export elements at chart destroy | ||
addEvent(chart, 'destroy', chart.destroyExport); | ||
} | ||
symbol.attr({ | ||
stroke: btnOptions.symbolStroke, | ||
fill: btnOptions.symbolFill, | ||
'stroke-width': btnOptions.symbolStrokeWidth || 1 | ||
}); | ||
}); | ||
} | ||
button.add() | ||
.align(extend(btnOptions, { | ||
width: button.width, | ||
x: pick(btnOptions.x, chart.buttonOffset) // #1654 | ||
}), true, 'spacingBox'); | ||
chart.buttonOffset += (button.width + btnOptions.buttonSpacing) * (btnOptions.align === 'right' ? -1 : 1); | ||
chart.exportSVGElements.push(button, symbol); | ||
}, | ||
/** | ||
* Destroy the buttons. | ||
*/ | ||
destroyExport: function(e) { | ||
var chart = e ? e.target : this, | ||
exportSVGElements = chart.exportSVGElements, | ||
exportDivElements = chart.exportDivElements; | ||
// Destroy the extra buttons added | ||
if (exportSVGElements) { | ||
each(exportSVGElements, function(elem, i) { | ||
// Destroy and null the svg/vml elements | ||
if (elem) { // #1822 | ||
elem.onclick = elem.ontouchstart = null; | ||
chart.exportSVGElements[i] = elem.destroy(); | ||
} | ||
}); | ||
exportSVGElements.length = 0; | ||
} | ||
// Destroy the divs for the menu | ||
if (exportDivElements) { | ||
each(exportDivElements, function(elem, i) { | ||
// Remove the event handler | ||
removeEvent(elem, 'mouseleave'); | ||
// Remove inline events | ||
chart.exportDivElements[i] = elem.onmouseout = elem.onmouseover = elem.ontouchstart = elem.onclick = null; | ||
// Destroy the div by moving to garbage bin | ||
discardElement(elem); | ||
}); | ||
exportDivElements.length = 0; | ||
} | ||
} | ||
}); | ||
symbols.menu = function(x, y, width, height) { | ||
var arr = [ | ||
'M', x, y + 2.5, | ||
'L', x + width, y + 2.5, | ||
'M', x, y + height / 2 + 0.5, | ||
'L', x + width, y + height / 2 + 0.5, | ||
'M', x, y + height - 1.5, | ||
'L', x + width, y + height - 1.5 | ||
]; | ||
return arr; | ||
}; | ||
// Add the buttons on chart load | ||
Chart.prototype.renderExporting = function() { | ||
var n, | ||
exportingOptions = this.options.exporting, | ||
buttons = exportingOptions.buttons, | ||
isDirty = this.isDirtyExporting || !this.exportSVGElements; | ||
this.buttonOffset = 0; | ||
if (this.isDirtyExporting) { | ||
this.destroyExport(); | ||
} | ||
if (isDirty && exportingOptions.enabled !== false) { | ||
for (n in buttons) { | ||
this.addButton(buttons[n]); | ||
} | ||
this.isDirtyExporting = false; | ||
} | ||
// Destroy the export elements at chart destroy | ||
addEvent(this, 'destroy', this.destroyExport); | ||
}; | ||
Chart.prototype.callbacks.push(function(chart) { | ||
function update(prop, options, redraw) { | ||
chart.isDirtyExporting = true; | ||
merge(true, chart.options[prop], options); | ||
if (pick(redraw, true)) { | ||
chart.redraw(); | ||
} | ||
} | ||
chart.renderExporting(); | ||
addEvent(chart, 'redraw', chart.renderExporting); | ||
// Add update methods to handle chart.update and chart.exporting.update | ||
// and chart.navigation.update. | ||
each(['exporting', 'navigation'], function(prop) { | ||
chart[prop] = { | ||
update: function(options, redraw) { | ||
update(prop, options, redraw); | ||
} | ||
}; | ||
}); | ||
}); | ||
}(Highcharts)); | ||
})); |
/* | ||
Highcharts JS v5.0.0 (2016-09-29) | ||
Highcharts funnel module | ||
@@ -9,6 +9,5 @@ | ||
*/ | ||
(function(b){typeof module==="object"&&module.exports?module.exports=b:b(Highcharts)})(function(b){var r=b.getOptions(),x=r.plotOptions,s=b.seriesTypes,F=b.merge,E=function(){},B=b.each;x.funnel=F(x.pie,{animation:!1,center:["50%","50%"],width:"90%",neckWidth:"30%",height:"100%",neckHeight:"25%",reversed:!1,dataLabels:{connectorWidth:1,connectorColor:"#606060"},size:!0,states:{select:{color:"#C0C0C0",borderColor:"#000000",shadow:!1}}});s.funnel=b.extendClass(s.pie,{type:"funnel",animate:E,translate:function(){var a= | ||
function(i,a){return/%$/.test(i)?a*parseInt(i,10)/100:parseInt(i,10)},b=0,d=this.chart,c=this.options,e=c.reversed,f=c.ignoreHiddenPoint,p=d.plotWidth,d=d.plotHeight,n=0,r=c.center,g=a(r[0],p),o=a(r[1],d),s=a(c.width,p),j,t,k=a(c.height,d),u=a(c.neckWidth,p),C=a(c.neckHeight,d),v=o-k/2+k-C,a=this.data,y,z,x=c.dataLabels.position==="left"?1:0,A,l,D,q,h,w,m;this.getWidthAt=t=function(i){var a=o-k/2;return i>v||k===C?u:u+(s-u)*(1-(i-a)/(k-C))};this.getX=function(i,a){return g+(a?-1:1)*(t(e?2*o-i:i)/ | ||
2+c.dataLabels.distance)};this.center=[g,o,k];this.centerX=g;B(a,function(a){if(!f||a.visible!==!1)b+=a.y});B(a,function(a){m=null;z=b?a.y/b:0;l=o-k/2+n*k;h=l+z*k;j=t(l);A=g-j/2;D=A+j;j=t(h);q=g-j/2;w=q+j;l>v?(A=q=g-u/2,D=w=g+u/2):h>v&&(m=h,j=t(v),q=g-j/2,w=q+j,h=v);e&&(l=2*o-l,h=2*o-h,m=m?2*o-m:null);y=["M",A,l,"L",D,l,w,h];m&&y.push(w,m,q,m);y.push(q,h,"Z");a.shapeType="path";a.shapeArgs={d:y};a.percentage=z*100;a.plotX=g;a.plotY=(l+(m||h))/2;a.tooltipPos=[g,a.plotY];a.slice=E;a.half=x;if(!f||a.visible!== | ||
!1)n+=z})},drawPoints:function(){var a=this,b=a.chart.renderer,d,c,e;B(a.data,function(f){e=f.graphic;c=f.shapeArgs;d=f.pointAttr[f.selected?"select":""];e?e.attr(d).animate(c):f.graphic=b.path(c).attr(d).add(a.group)})},sortByAngle:function(a){a.sort(function(a,b){return a.plotY-b.plotY})},drawDataLabels:function(){var a=this.data,b=this.options.dataLabels.distance,d,c,e,f=a.length,p,n;for(this.center[2]-=2*b;f--;)e=a[f],c=(d=e.half)?1:-1,n=e.plotY,p=this.getX(n,d),e.labelPos=[0,n,p+(b-5)*c,n,p+ | ||
b*c,n,d?"right":"left",0];s.pie.prototype.drawDataLabels.call(this)}});r.plotOptions.pyramid=b.merge(r.plotOptions.funnel,{neckWidth:"0%",neckHeight:"0%",reversed:!0});b.seriesTypes.pyramid=b.extendClass(b.seriesTypes.funnel,{type:"pyramid"})}); | ||
(function(c){"object"===typeof module&&module.exports?module.exports=c:c(Highcharts)})(function(c){(function(c){var n=c.seriesType,z=c.seriesTypes,F=c.noop,G=c.each;n("funnel","pie",{animation:!1,center:["50%","50%"],width:"90%",neckWidth:"30%",height:"100%",neckHeight:"25%",reversed:!1,size:!0,dataLabels:{connectorWidth:1},states:{select:{color:"#cccccc",borderColor:"#000000",shadow:!1}}},{animate:F,translate:function(){var b=function(a,b){return/%$/.test(a)?b*parseInt(a,10)/100:parseInt(a,10)}, | ||
c=0,e=this.chart,d=this.options,r=d.reversed,H=d.ignoreHiddenPoint,t=e.plotWidth,e=e.plotHeight,p=0,n=d.center,f=b(n[0],t),q=b(n[1],e),z=b(d.width,t),h,v,k=b(d.height,e),w=b(d.neckWidth,t),D=b(d.neckHeight,e),x=q-k/2+k-D,b=this.data,A,B,I="left"===d.dataLabels.position?1:0,C,l,E,u,g,y,m;this.getWidthAt=v=function(a){var b=q-k/2;return a>x||k===D?w:w+(z-w)*(1-(a-b)/(k-D))};this.getX=function(a,b){return f+(b?-1:1)*(v(r?2*q-a:a)/2+d.dataLabels.distance)};this.center=[f,q,k];this.centerX=f;G(b,function(a){H&& | ||
!1===a.visible||(c+=a.y)});G(b,function(a){m=null;B=c?a.y/c:0;l=q-k/2+p*k;g=l+B*k;h=v(l);C=f-h/2;E=C+h;h=v(g);u=f-h/2;y=u+h;l>x?(C=u=f-w/2,E=y=f+w/2):g>x&&(m=g,h=v(x),u=f-h/2,y=u+h,g=x);r&&(l=2*q-l,g=2*q-g,m=m?2*q-m:null);A=["M",C,l,"L",E,l,y,g];m&&A.push(y,m,u,m);A.push(u,g,"Z");a.shapeType="path";a.shapeArgs={d:A};a.percentage=100*B;a.plotX=f;a.plotY=(l+(m||g))/2;a.tooltipPos=[f,a.plotY];a.slice=F;a.half=I;H&&!1===a.visible||(p+=B)})},drawPoints:z.column.prototype.drawPoints,sortByAngle:function(b){b.sort(function(b, | ||
c){return b.plotY-c.plotY})},drawDataLabels:function(){var b=this.data,c=this.options.dataLabels.distance,e,d,r,n=b.length,t,p;for(this.center[2]-=2*c;n--;)r=b[n],d=(e=r.half)?1:-1,p=r.plotY,t=this.getX(p,e),r.labelPos=[0,p,t+(c-5)*d,p,t+c*d,p,e?"right":"left",0];z.pie.prototype.drawDataLabels.call(this)}});n("pyramid","funnel",{neckWidth:"0%",neckHeight:"0%",reversed:!0})})(c)}); |
/** | ||
* @license | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* Highcharts funnel module | ||
@@ -9,4 +9,3 @@ * | ||
*/ | ||
/* eslint indent:0 */ | ||
(function (factory) { | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
@@ -17,306 +16,291 @@ module.exports = factory; | ||
} | ||
}(function (Highcharts) { | ||
'use strict'; | ||
}(function(Highcharts) { | ||
(function(Highcharts) { | ||
/** | ||
* Highcharts funnel module | ||
* | ||
* (c) 2010-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
/* eslint indent:0 */ | ||
'use strict'; | ||
// create shortcuts | ||
var defaultOptions = Highcharts.getOptions(), | ||
defaultPlotOptions = defaultOptions.plotOptions, | ||
seriesTypes = Highcharts.seriesTypes, | ||
merge = Highcharts.merge, | ||
noop = function () {}, | ||
each = Highcharts.each; | ||
// create shortcuts | ||
var seriesType = Highcharts.seriesType, | ||
seriesTypes = Highcharts.seriesTypes, | ||
noop = Highcharts.noop, | ||
each = Highcharts.each; | ||
// set default options | ||
defaultPlotOptions.funnel = merge(defaultPlotOptions.pie, { | ||
animation: false, | ||
center: ['50%', '50%'], | ||
width: '90%', | ||
neckWidth: '30%', | ||
height: '100%', | ||
neckHeight: '25%', | ||
reversed: false, | ||
dataLabels: { | ||
//position: 'right', | ||
connectorWidth: 1, | ||
connectorColor: '#606060' | ||
}, | ||
size: true, // to avoid adapting to data label size in Pie.drawDataLabels | ||
states: { | ||
select: { | ||
color: '#C0C0C0', | ||
borderColor: '#000000', | ||
shadow: false | ||
} | ||
} | ||
}); | ||
seriesType('funnel', 'pie', { | ||
animation: false, | ||
center: ['50%', '50%'], | ||
width: '90%', | ||
neckWidth: '30%', | ||
height: '100%', | ||
neckHeight: '25%', | ||
reversed: false, | ||
size: true, // to avoid adapting to data label size in Pie.drawDataLabels | ||
seriesTypes.funnel = Highcharts.extendClass(seriesTypes.pie, { | ||
type: 'funnel', | ||
animate: noop, | ||
/** | ||
* Overrides the pie translate method | ||
*/ | ||
translate: function () { | ||
var | ||
// Get positions - either an integer or a percentage string must be given | ||
getLength = function (length, relativeTo) { | ||
return (/%$/).test(length) ? | ||
relativeTo * parseInt(length, 10) / 100 : | ||
parseInt(length, 10); | ||
}, | ||
sum = 0, | ||
series = this, | ||
chart = series.chart, | ||
options = series.options, | ||
reversed = options.reversed, | ||
ignoreHiddenPoint = options.ignoreHiddenPoint, | ||
plotWidth = chart.plotWidth, | ||
plotHeight = chart.plotHeight, | ||
cumulative = 0, // start at top | ||
center = options.center, | ||
centerX = getLength(center[0], plotWidth), | ||
centerY = getLength(center[1], plotHeight), | ||
width = getLength(options.width, plotWidth), | ||
tempWidth, | ||
getWidthAt, | ||
height = getLength(options.height, plotHeight), | ||
neckWidth = getLength(options.neckWidth, plotWidth), | ||
neckHeight = getLength(options.neckHeight, plotHeight), | ||
neckY = (centerY - height / 2) + height - neckHeight, | ||
data = series.data, | ||
path, | ||
fraction, | ||
half = options.dataLabels.position === 'left' ? 1 : 0, | ||
// Presentational | ||
dataLabels: { | ||
//position: 'right', | ||
connectorWidth: 1 | ||
//connectorColor: null | ||
}, | ||
states: { | ||
select: { | ||
color: '#cccccc', | ||
borderColor: '#000000', | ||
shadow: false | ||
} | ||
} | ||
x1, | ||
y1, | ||
x2, | ||
x3, | ||
y3, | ||
x4, | ||
y5; | ||
}, | ||
// Return the width at a specific y coordinate | ||
series.getWidthAt = getWidthAt = function (y) { | ||
var top = (centerY - height / 2); | ||
return y > neckY || height === neckHeight ? | ||
neckWidth : | ||
neckWidth + (width - neckWidth) * (1 - (y - top) / (height - neckHeight)); | ||
}; | ||
series.getX = function (y, half) { | ||
return centerX + (half ? -1 : 1) * ((getWidthAt(reversed ? 2 * centerY - y : y) / 2) + options.dataLabels.distance); | ||
}; | ||
// Properties | ||
{ | ||
animate: noop, | ||
// Expose | ||
series.center = [centerX, centerY, height]; | ||
series.centerX = centerX; | ||
/** | ||
* Overrides the pie translate method | ||
*/ | ||
translate: function() { | ||
/* | ||
* Individual point coordinate naming: | ||
* | ||
* x1,y1 _________________ x2,y1 | ||
* \ / | ||
* \ / | ||
* \ / | ||
* \ / | ||
* \ / | ||
* x3,y3 _________ x4,y3 | ||
* | ||
* Additional for the base of the neck: | ||
* | ||
* | | | ||
* | | | ||
* | | | ||
* x3,y5 _________ x4,y5 | ||
*/ | ||
var | ||
// Get positions - either an integer or a percentage string must be given | ||
getLength = function(length, relativeTo) { | ||
return (/%$/).test(length) ? | ||
relativeTo * parseInt(length, 10) / 100 : | ||
parseInt(length, 10); | ||
}, | ||
sum = 0, | ||
series = this, | ||
chart = series.chart, | ||
options = series.options, | ||
reversed = options.reversed, | ||
ignoreHiddenPoint = options.ignoreHiddenPoint, | ||
plotWidth = chart.plotWidth, | ||
plotHeight = chart.plotHeight, | ||
cumulative = 0, // start at top | ||
center = options.center, | ||
centerX = getLength(center[0], plotWidth), | ||
centerY = getLength(center[1], plotHeight), | ||
width = getLength(options.width, plotWidth), | ||
tempWidth, | ||
getWidthAt, | ||
height = getLength(options.height, plotHeight), | ||
neckWidth = getLength(options.neckWidth, plotWidth), | ||
neckHeight = getLength(options.neckHeight, plotHeight), | ||
neckY = (centerY - height / 2) + height - neckHeight, | ||
data = series.data, | ||
path, | ||
fraction, | ||
half = options.dataLabels.position === 'left' ? 1 : 0, | ||
x1, | ||
y1, | ||
x2, | ||
x3, | ||
y3, | ||
x4, | ||
y5; | ||
// Return the width at a specific y coordinate | ||
series.getWidthAt = getWidthAt = function(y) { | ||
var top = (centerY - height / 2); | ||
// get the total sum | ||
each(data, function (point) { | ||
if (!ignoreHiddenPoint || point.visible !== false) { | ||
sum += point.y; | ||
} | ||
}); | ||
return y > neckY || height === neckHeight ? | ||
neckWidth : | ||
neckWidth + (width - neckWidth) * (1 - (y - top) / (height - neckHeight)); | ||
}; | ||
series.getX = function(y, half) { | ||
return centerX + (half ? -1 : 1) * ((getWidthAt(reversed ? 2 * centerY - y : y) / 2) + options.dataLabels.distance); | ||
}; | ||
each(data, function (point) { | ||
// set start and end positions | ||
y5 = null; | ||
fraction = sum ? point.y / sum : 0; | ||
y1 = centerY - height / 2 + cumulative * height; | ||
y3 = y1 + fraction * height; | ||
//tempWidth = neckWidth + (width - neckWidth) * ((height - neckHeight - y1) / (height - neckHeight)); | ||
tempWidth = getWidthAt(y1); | ||
x1 = centerX - tempWidth / 2; | ||
x2 = x1 + tempWidth; | ||
tempWidth = getWidthAt(y3); | ||
x3 = centerX - tempWidth / 2; | ||
x4 = x3 + tempWidth; | ||
// Expose | ||
series.center = [centerX, centerY, height]; | ||
series.centerX = centerX; | ||
// the entire point is within the neck | ||
if (y1 > neckY) { | ||
x1 = x3 = centerX - neckWidth / 2; | ||
x2 = x4 = centerX + neckWidth / 2; | ||
// the base of the neck | ||
} else if (y3 > neckY) { | ||
y5 = y3; | ||
/* | ||
* Individual point coordinate naming: | ||
* | ||
* x1,y1 _________________ x2,y1 | ||
* \ / | ||
* \ / | ||
* \ / | ||
* \ / | ||
* \ / | ||
* x3,y3 _________ x4,y3 | ||
* | ||
* Additional for the base of the neck: | ||
* | ||
* | | | ||
* | | | ||
* | | | ||
* x3,y5 _________ x4,y5 | ||
*/ | ||
tempWidth = getWidthAt(neckY); | ||
x3 = centerX - tempWidth / 2; | ||
x4 = x3 + tempWidth; | ||
y3 = neckY; | ||
} | ||
if (reversed) { | ||
y1 = 2 * centerY - y1; | ||
y3 = 2 * centerY - y3; | ||
y5 = (y5 ? 2 * centerY - y5 : null); | ||
} | ||
// save the path | ||
path = [ | ||
'M', | ||
x1, y1, | ||
'L', | ||
x2, y1, | ||
x4, y3 | ||
]; | ||
if (y5) { | ||
path.push(x4, y5, x3, y5); | ||
} | ||
path.push(x3, y3, 'Z'); | ||
// prepare for using shared dr | ||
point.shapeType = 'path'; | ||
point.shapeArgs = { d: path }; | ||
// get the total sum | ||
each(data, function(point) { | ||
if (!ignoreHiddenPoint || point.visible !== false) { | ||
sum += point.y; | ||
} | ||
}); | ||
each(data, function(point) { | ||
// set start and end positions | ||
y5 = null; | ||
fraction = sum ? point.y / sum : 0; | ||
y1 = centerY - height / 2 + cumulative * height; | ||
y3 = y1 + fraction * height; | ||
//tempWidth = neckWidth + (width - neckWidth) * ((height - neckHeight - y1) / (height - neckHeight)); | ||
tempWidth = getWidthAt(y1); | ||
x1 = centerX - tempWidth / 2; | ||
x2 = x1 + tempWidth; | ||
tempWidth = getWidthAt(y3); | ||
x3 = centerX - tempWidth / 2; | ||
x4 = x3 + tempWidth; | ||
// for tooltips and data labels | ||
point.percentage = fraction * 100; | ||
point.plotX = centerX; | ||
point.plotY = (y1 + (y5 || y3)) / 2; | ||
// the entire point is within the neck | ||
if (y1 > neckY) { | ||
x1 = x3 = centerX - neckWidth / 2; | ||
x2 = x4 = centerX + neckWidth / 2; | ||
// Placement of tooltips and data labels | ||
point.tooltipPos = [ | ||
centerX, | ||
point.plotY | ||
]; | ||
// the base of the neck | ||
} else if (y3 > neckY) { | ||
y5 = y3; | ||
// Slice is a noop on funnel points | ||
point.slice = noop; | ||
// Mimicking pie data label placement logic | ||
point.half = half; | ||
tempWidth = getWidthAt(neckY); | ||
x3 = centerX - tempWidth / 2; | ||
x4 = x3 + tempWidth; | ||
if (!ignoreHiddenPoint || point.visible !== false) { | ||
cumulative += fraction; | ||
} | ||
}); | ||
}, | ||
/** | ||
* Draw a single point (wedge) | ||
* @param {Object} point The point object | ||
* @param {Object} color The color of the point | ||
* @param {Number} brightness The brightness relative to the color | ||
*/ | ||
drawPoints: function () { | ||
var series = this, | ||
chart = series.chart, | ||
renderer = chart.renderer, | ||
pointAttr, | ||
shapeArgs, | ||
graphic; | ||
y3 = neckY; | ||
} | ||
each(series.data, function (point) { | ||
graphic = point.graphic; | ||
shapeArgs = point.shapeArgs; | ||
if (reversed) { | ||
y1 = 2 * centerY - y1; | ||
y3 = 2 * centerY - y3; | ||
y5 = (y5 ? 2 * centerY - y5 : null); | ||
} | ||
// save the path | ||
path = [ | ||
'M', | ||
x1, y1, | ||
'L', | ||
x2, y1, | ||
x4, y3 | ||
]; | ||
if (y5) { | ||
path.push(x4, y5, x3, y5); | ||
} | ||
path.push(x3, y3, 'Z'); | ||
pointAttr = point.pointAttr[point.selected ? 'select' : '']; | ||
// prepare for using shared dr | ||
point.shapeType = 'path'; | ||
point.shapeArgs = { | ||
d: path | ||
}; | ||
if (!graphic) { // Create the shapes | ||
point.graphic = renderer.path(shapeArgs) | ||
.attr(pointAttr) | ||
.add(series.group); | ||
} else { // Update the shapes | ||
graphic.attr(pointAttr).animate(shapeArgs); | ||
} | ||
}); | ||
}, | ||
/** | ||
* Funnel items don't have angles (#2289) | ||
*/ | ||
sortByAngle: function (points) { | ||
points.sort(function (a, b) { | ||
return a.plotY - b.plotY; | ||
}); | ||
}, | ||
/** | ||
* Extend the pie data label method | ||
*/ | ||
drawDataLabels: function () { | ||
var data = this.data, | ||
labelDistance = this.options.dataLabels.distance, | ||
leftSide, | ||
sign, | ||
point, | ||
i = data.length, | ||
x, | ||
y; | ||
// In the original pie label anticollision logic, the slots are distributed | ||
// from one labelDistance above to one labelDistance below the pie. In funnels | ||
// we don't want this. | ||
this.center[2] -= 2 * labelDistance; | ||
// Set the label position array for each point. | ||
while (i--) { | ||
point = data[i]; | ||
leftSide = point.half; | ||
sign = leftSide ? 1 : -1; | ||
y = point.plotY; | ||
x = this.getX(y, leftSide); | ||
// set the anchor point for data labels | ||
point.labelPos = [ | ||
0, // first break of connector | ||
y, // a/a | ||
x + (labelDistance - 5) * sign, // second break, right outside point shape | ||
y, // a/a | ||
x + labelDistance * sign, // landing point for connector | ||
y, // a/a | ||
leftSide ? 'right' : 'left', // alignment | ||
0 // center angle | ||
]; | ||
} | ||
seriesTypes.pie.prototype.drawDataLabels.call(this); | ||
} | ||
// for tooltips and data labels | ||
point.percentage = fraction * 100; | ||
point.plotX = centerX; | ||
point.plotY = (y1 + (y5 || y3)) / 2; | ||
}); | ||
// Placement of tooltips and data labels | ||
point.tooltipPos = [ | ||
centerX, | ||
point.plotY | ||
]; | ||
/** | ||
* Pyramid series type. | ||
* A pyramid series is a special type of funnel, without neck and reversed by default. | ||
*/ | ||
defaultOptions.plotOptions.pyramid = Highcharts.merge(defaultOptions.plotOptions.funnel, { | ||
neckWidth: '0%', | ||
neckHeight: '0%', | ||
reversed: true | ||
}); | ||
Highcharts.seriesTypes.pyramid = Highcharts.extendClass(Highcharts.seriesTypes.funnel, { | ||
type: 'pyramid' | ||
}); | ||
// Slice is a noop on funnel points | ||
point.slice = noop; | ||
// Mimicking pie data label placement logic | ||
point.half = half; | ||
if (!ignoreHiddenPoint || point.visible !== false) { | ||
cumulative += fraction; | ||
} | ||
}); | ||
}, | ||
/** | ||
* Draw a single point (wedge) | ||
* @param {Object} point The point object | ||
* @param {Object} color The color of the point | ||
* @param {Number} brightness The brightness relative to the color | ||
*/ | ||
drawPoints: seriesTypes.column.prototype.drawPoints, | ||
/** | ||
* Funnel items don't have angles (#2289) | ||
*/ | ||
sortByAngle: function(points) { | ||
points.sort(function(a, b) { | ||
return a.plotY - b.plotY; | ||
}); | ||
}, | ||
/** | ||
* Extend the pie data label method | ||
*/ | ||
drawDataLabels: function() { | ||
var data = this.data, | ||
labelDistance = this.options.dataLabels.distance, | ||
leftSide, | ||
sign, | ||
point, | ||
i = data.length, | ||
x, | ||
y; | ||
// In the original pie label anticollision logic, the slots are distributed | ||
// from one labelDistance above to one labelDistance below the pie. In funnels | ||
// we don't want this. | ||
this.center[2] -= 2 * labelDistance; | ||
// Set the label position array for each point. | ||
while (i--) { | ||
point = data[i]; | ||
leftSide = point.half; | ||
sign = leftSide ? 1 : -1; | ||
y = point.plotY; | ||
x = this.getX(y, leftSide); | ||
// set the anchor point for data labels | ||
point.labelPos = [ | ||
0, // first break of connector | ||
y, // a/a | ||
x + (labelDistance - 5) * sign, // second break, right outside point shape | ||
y, // a/a | ||
x + labelDistance * sign, // landing point for connector | ||
y, // a/a | ||
leftSide ? 'right' : 'left', // alignment | ||
0 // center angle | ||
]; | ||
} | ||
seriesTypes.pie.prototype.drawDataLabels.call(this); | ||
} | ||
}); | ||
/** | ||
* Pyramid series type. | ||
* A pyramid series is a special type of funnel, without neck and reversed by default. | ||
*/ | ||
seriesType('pyramid', 'funnel', { | ||
neckWidth: '0%', | ||
neckHeight: '0%', | ||
reversed: true | ||
}); | ||
}(Highcharts)); | ||
})); |
/* | ||
Highcharts JS v4.2.7 (2016-09-21) | ||
Highcharts JS v5.0.0 (2016-09-29) | ||
(c) 2011-2016 Torstein Honsi | ||
(c) 2009-2016 Torstein Honsi | ||
License: www.highcharts.com/license | ||
*/ | ||
(function(d){typeof module==="object"&&module.exports?module.exports=d:d(Highcharts)})(function(d){var m=d.Axis,q=d.Chart,i=d.Color,x=d.Legend,s=d.LegendSymbolMixin,t=d.Series,y=d.Point,u=d.getOptions(),h=d.each,r=d.extend,v=d.extendClass,z=d.isNumber,j=d.merge,k=d.pick,o=d.seriesTypes,w=d.wrap,n=function(){},p=d.ColorAxis=function(){this.init.apply(this,arguments)};r(p.prototype,m.prototype);r(p.prototype,{defaultColorAxisOptions:{lineWidth:0,minPadding:0,maxPadding:0,gridLineWidth:1,tickPixelInterval:72, | ||
startOnTick:!0,endOnTick:!0,offset:0,marker:{animation:{duration:50},color:"gray",width:0.01},labels:{overflow:"justify"},minColor:"#EFEFFF",maxColor:"#003875",tickLength:5,showInLegend:!0},init:function(a,b){var c=a.options.legend.layout!=="vertical",f;this.coll="colorAxis";f=j(this.defaultColorAxisOptions,{side:c?2:1,reversed:!c},b,{opposite:!c,showEmpty:!1,title:null});m.prototype.init.call(this,a,f);b.dataClasses&&this.initDataClasses(b);this.initStops(b);this.horiz=c;this.zoomEnabled=!1;this.defaultLegendLength= | ||
200},tweenColors:function(a,b,c){var f;!b.rgba.length||!a.rgba.length?a=b.input||"none":(a=a.rgba,b=b.rgba,f=b[3]!==1||a[3]!==1,a=(f?"rgba(":"rgb(")+Math.round(b[0]+(a[0]-b[0])*(1-c))+","+Math.round(b[1]+(a[1]-b[1])*(1-c))+","+Math.round(b[2]+(a[2]-b[2])*(1-c))+(f?","+(b[3]+(a[3]-b[3])*(1-c)):"")+")");return a},initDataClasses:function(a){var b=this,c=this.chart,f,e=0,l=this.options,g=a.dataClasses.length;this.dataClasses=f=[];this.legendItems=[];h(a.dataClasses,function(a,d){var h,a=j(a);f.push(a); | ||
if(!a.color)l.dataClassColor==="category"?(h=c.options.colors,a.color=h[e++],e===h.length&&(e=0)):a.color=b.tweenColors(i(l.minColor),i(l.maxColor),g<2?0.5:d/(g-1))})},initStops:function(a){this.stops=a.stops||[[0,this.options.minColor],[1,this.options.maxColor]];h(this.stops,function(a){a.color=i(a[1])})},setOptions:function(a){m.prototype.setOptions.call(this,a);this.options.crosshair=this.options.marker},setAxisSize:function(){var a=this.legendSymbol,b=this.chart,c=b.options.legend||{},f,e;a?(this.left= | ||
c=a.attr("x"),this.top=f=a.attr("y"),this.width=e=a.attr("width"),this.height=a=a.attr("height"),this.right=b.chartWidth-c-e,this.bottom=b.chartHeight-f-a,this.len=this.horiz?e:a,this.pos=this.horiz?c:f):this.len=(this.horiz?c.symbolWidth:c.symbolHeight)||this.defaultLegendLength},toColor:function(a,b){var c,f=this.stops,e,l=this.dataClasses,g,d;if(l)for(d=l.length;d--;){if(g=l[d],e=g.from,f=g.to,(e===void 0||a>=e)&&(f===void 0||a<=f)){c=g.color;if(b)b.dataClass=d;break}}else{this.isLog&&(a=this.val2lin(a)); | ||
c=1-(this.max-a)/(this.max-this.min||1);for(d=f.length;d--;)if(c>f[d][0])break;e=f[d]||f[d+1];f=f[d+1]||e;c=1-(f[0]-c)/(f[0]-e[0]||1);c=this.tweenColors(e.color,f.color,c)}return c},getOffset:function(){var a=this.legendGroup,b=this.chart.axisOffset[this.side];if(a){this.axisParent=a;m.prototype.getOffset.call(this);if(!this.added)this.added=!0,this.labelLeft=0,this.labelRight=this.width;this.chart.axisOffset[this.side]=b}},setLegendColor:function(){var a,b=this.options,c=this.reversed;a=c?1:0;c= | ||
c?0:1;a=this.horiz?[a,0,c,0]:[0,c,0,a];this.legendColor={linearGradient:{x1:a[0],y1:a[1],x2:a[2],y2:a[3]},stops:b.stops||[[0,b.minColor],[1,b.maxColor]]}},drawLegendSymbol:function(a,b){var c=a.padding,f=a.options,e=this.horiz,d=k(f.symbolWidth,e?this.defaultLegendLength:12),g=k(f.symbolHeight,e?12:this.defaultLegendLength),h=k(f.labelPadding,e?16:30),f=k(f.itemDistance,10);this.setLegendColor();b.legendSymbol=this.chart.renderer.rect(0,a.baseline-11,d,g).attr({zIndex:1}).add(b.legendGroup);this.legendItemWidth= | ||
d+c+(e?f:h);this.legendItemHeight=g+c+(e?h:0)},setState:n,visible:!0,setVisible:n,getSeriesExtremes:function(){var a;if(this.series.length)a=this.series[0],this.dataMin=a.valueMin,this.dataMax=a.valueMax},drawCrosshair:function(a,b){var c=b&&b.plotX,f=b&&b.plotY,e,d=this.pos,g=this.len;if(b)e=this.toPixels(b[b.series.colorKey]),e<d?e=d-2:e>d+g&&(e=d+g+2),b.plotX=e,b.plotY=this.len-e,m.prototype.drawCrosshair.call(this,a,b),b.plotX=c,b.plotY=f,this.cross&&this.cross.attr({fill:this.crosshair.color}).add(this.legendGroup)}, | ||
getPlotLinePath:function(a,b,c,f,e){return z(e)?this.horiz?["M",e-4,this.top-6,"L",e+4,this.top-6,e,this.top,"Z"]:["M",this.left,e,"L",this.left-6,e+6,this.left-6,e-6,"Z"]:m.prototype.getPlotLinePath.call(this,a,b,c,f)},update:function(a,b){var c=this.chart,f=c.legend;h(this.series,function(a){a.isDirtyData=!0});if(a.dataClasses&&f.allItems)h(f.allItems,function(a){a.isDataClass&&a.legendGroup.destroy()}),c.isDirtyLegend=!0;c.options[this.coll]=j(this.userOptions,a);m.prototype.update.call(this,a, | ||
b);this.legendItem&&(this.setLegendColor(),f.colorizeItem(this,!0))},getDataClassLegendSymbols:function(){var a=this,b=this.chart,c=this.legendItems,f=b.options.legend,e=f.valueDecimals,l=f.valueSuffix||"",g;c.length||h(this.dataClasses,function(f,m){var i=!0,j=f.from,k=f.to;g="";j===void 0?g="< ":k===void 0&&(g="> ");j!==void 0&&(g+=d.numberFormat(j,e)+l);j!==void 0&&k!==void 0&&(g+=" - ");k!==void 0&&(g+=d.numberFormat(k,e)+l);c.push(r({chart:b,name:g,options:{},drawLegendSymbol:s.drawRectangle, | ||
visible:!0,setState:n,isDataClass:!0,setVisible:function(){i=this.visible=!i;h(a.series,function(a){h(a.points,function(a){a.dataClass===m&&a.setVisible(i)})});b.legend.colorizeItem(this,i)}},f))});return c},name:""});h(["fill","stroke"],function(a){d.Fx.prototype[a+"Setter"]=function(){this.elem.attr(a,p.prototype.tweenColors(i(this.start),i(this.end),this.pos))}});w(q.prototype,"getAxes",function(a){var b=this.options.colorAxis;a.call(this);this.colorAxis=[];b&&new p(this,b)});w(x.prototype,"getAllItems", | ||
function(a){var b=[],c=this.chart.colorAxis[0];c&&(c.options.showInLegend&&(c.options.dataClasses?b=b.concat(c.getDataClassLegendSymbols()):b.push(c)),h(c.series,function(a){a.options.showInLegend=!1}));return b.concat(a.call(this))});q={pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color",dashstyle:"dashStyle"},pointArrayMap:["value"],axisTypes:["xAxis","yAxis","colorAxis"],optionalAxis:"colorAxis",trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:n, | ||
parallelArrays:["x","y","value"],colorKey:"value",translateColors:function(){var a=this,b=this.options.nullColor,c=this.colorAxis,f=this.colorKey;h(this.data,function(e){var d=e[f];if(d=e.options.color||(d===null?b:c&&d!==void 0?c.toColor(d,e):e.color||a.color))e.color=d})}};u.plotOptions.heatmap=j(u.plotOptions.scatter,{animation:!1,borderWidth:0,nullColor:"#F8F8F8",dataLabels:{formatter:function(){return this.point.value},inside:!0,verticalAlign:"middle",crop:!1,overflow:!1,padding:0},marker:null, | ||
pointRange:null,tooltip:{pointFormat:"{point.x}, {point.y}: {point.value}<br/>"},states:{normal:{animation:!0},hover:{halo:!1,brightness:0.2}}});o.heatmap=v(o.scatter,j(q,{type:"heatmap",pointArrayMap:["y","value"],hasPointSpecificOptions:!0,pointClass:v(y,{setVisible:function(a){var b=this,c=a?"show":"hide";h(["graphic","dataLabel"],function(a){if(b[a])b[a][c]()})}}),supportsDrilldown:!0,getExtremesFromAll:!0,directTouch:!0,init:function(){var a;o.scatter.prototype.init.apply(this,arguments);a=this.options; | ||
a.pointRange=k(a.pointRange,a.colsize||1);this.yAxis.axisPointRange=a.rowsize||1},translate:function(){var a=this.options,b=this.xAxis,c=this.yAxis,f=function(a,b,c){return Math.min(Math.max(b,a),c)};this.generatePoints();h(this.points,function(e){var d=(a.colsize||1)/2,g=(a.rowsize||1)/2,h=f(Math.round(b.len-b.translate(e.x-d,0,1,0,1)),-b.len,2*b.len),d=f(Math.round(b.len-b.translate(e.x+d,0,1,0,1)),-b.len,2*b.len),i=f(Math.round(c.translate(e.y-g,0,1,0,1)),-c.len,2*c.len),g=f(Math.round(c.translate(e.y+ | ||
g,0,1,0,1)),-c.len,2*c.len);e.plotX=e.clientX=(h+d)/2;e.plotY=(i+g)/2;e.shapeType="rect";e.shapeArgs={x:Math.min(h,d),y:Math.min(i,g),width:Math.abs(d-h),height:Math.abs(g-i)}});this.translateColors();this.chart.hasRendered&&h(this.points,function(a){a.shapeArgs.fill=a.options.color||a.color})},drawPoints:o.column.prototype.drawPoints,animate:n,getBox:n,drawLegendSymbol:s.drawRectangle,alignDataLabel:o.column.prototype.alignDataLabel,getExtremes:function(){t.prototype.getExtremes.call(this,this.valueData); | ||
this.valueMin=this.dataMin;this.valueMax=this.dataMax;t.prototype.getExtremes.call(this)}}))}); | ||
(function(p){"object"===typeof module&&module.exports?module.exports=p:p(Highcharts)})(function(p){(function(b){var h=b.Axis,t=b.Chart,l=b.color,k,n=b.each,w=b.extend,x=b.isNumber,q=b.Legend,m=b.LegendSymbolMixin,f=b.noop,r=b.merge,v=b.pick,u=b.wrap;k=b.ColorAxis=function(){this.init.apply(this,arguments)};w(k.prototype,h.prototype);w(k.prototype,{defaultColorAxisOptions:{lineWidth:0,minPadding:0,maxPadding:0,gridLineWidth:1,tickPixelInterval:72,startOnTick:!0,endOnTick:!0,offset:0,marker:{animation:{duration:50}, | ||
width:.01,color:"#999999"},labels:{overflow:"justify"},minColor:"#e6ebf5",maxColor:"#003399",tickLength:5,showInLegend:!0},init:function(a,c){var d="vertical"!==a.options.legend.layout,e;this.coll="colorAxis";e=r(this.defaultColorAxisOptions,{side:d?2:1,reversed:!d},c,{opposite:!d,showEmpty:!1,title:null});h.prototype.init.call(this,a,e);c.dataClasses&&this.initDataClasses(c);this.initStops(c);this.horiz=d;this.zoomEnabled=!1;this.defaultLegendLength=200},tweenColors:function(a,c,d){var e;c.rgba.length&& | ||
a.rgba.length?(a=a.rgba,c=c.rgba,e=1!==c[3]||1!==a[3],a=(e?"rgba(":"rgb(")+Math.round(c[0]+(a[0]-c[0])*(1-d))+","+Math.round(c[1]+(a[1]-c[1])*(1-d))+","+Math.round(c[2]+(a[2]-c[2])*(1-d))+(e?","+(c[3]+(a[3]-c[3])*(1-d)):"")+")"):a=c.input||"none";return a},initDataClasses:function(a){var c=this,d=this.chart,e,g=0,b=d.options.chart.colorCount,y=this.options,m=a.dataClasses.length;this.dataClasses=e=[];this.legendItems=[];n(a.dataClasses,function(a,n){var f;a=r(a);e.push(a);a.color||("category"===y.dataClassColor? | ||
(f=d.options.colors,b=f.length,a.color=f[g],a.colorIndex=g,g++,g===b&&(g=0)):a.color=c.tweenColors(l(y.minColor),l(y.maxColor),2>m?.5:n/(m-1)))})},initStops:function(a){this.stops=a.stops||[[0,this.options.minColor],[1,this.options.maxColor]];n(this.stops,function(a){a.color=l(a[1])})},setOptions:function(a){h.prototype.setOptions.call(this,a);this.options.crosshair=this.options.marker},setAxisSize:function(){var a=this.legendSymbol,c=this.chart,d=c.options.legend||{},e,g;a?(this.left=d=a.attr("x"), | ||
this.top=e=a.attr("y"),this.width=g=a.attr("width"),this.height=a=a.attr("height"),this.right=c.chartWidth-d-g,this.bottom=c.chartHeight-e-a,this.len=this.horiz?g:a,this.pos=this.horiz?d:e):this.len=(this.horiz?d.symbolWidth:d.symbolHeight)||this.defaultLegendLength},toColor:function(a,c){var d,e=this.stops,g,b=this.dataClasses,m,f;if(b)for(f=b.length;f--;){if(m=b[f],g=m.from,e=m.to,(void 0===g||a>=g)&&(void 0===e||a<=e)){d=m.color;c&&(c.dataClass=f,c.colorIndex=m.colorIndex);break}}else{this.isLog&& | ||
(a=this.val2lin(a));d=1-(this.max-a)/(this.max-this.min||1);for(f=e.length;f--&&!(d>e[f][0]););g=e[f]||e[f+1];e=e[f+1]||g;d=1-(e[0]-d)/(e[0]-g[0]||1);d=this.tweenColors(g.color,e.color,d)}return d},getOffset:function(){var a=this.legendGroup,c=this.chart.axisOffset[this.side];a&&(this.axisParent=a,h.prototype.getOffset.call(this),this.added||(this.added=!0,this.labelLeft=0,this.labelRight=this.width),this.chart.axisOffset[this.side]=c)},setLegendColor:function(){var a,c=this.options,d=this.reversed; | ||
a=d?1:0;d=d?0:1;a=this.horiz?[a,0,d,0]:[0,d,0,a];this.legendColor={linearGradient:{x1:a[0],y1:a[1],x2:a[2],y2:a[3]},stops:c.stops||[[0,c.minColor],[1,c.maxColor]]}},drawLegendSymbol:function(a,c){var d=a.padding,e=a.options,g=this.horiz,b=v(e.symbolWidth,g?this.defaultLegendLength:12),f=v(e.symbolHeight,g?12:this.defaultLegendLength),m=v(e.labelPadding,g?16:30),e=v(e.itemDistance,10);this.setLegendColor();c.legendSymbol=this.chart.renderer.rect(0,a.baseline-11,b,f).attr({zIndex:1}).add(c.legendGroup); | ||
this.legendItemWidth=b+d+(g?e:m);this.legendItemHeight=f+d+(g?m:0)},setState:f,visible:!0,setVisible:f,getSeriesExtremes:function(){var a;this.series.length&&(a=this.series[0],this.dataMin=a.valueMin,this.dataMax=a.valueMax)},drawCrosshair:function(a,c){var d=c&&c.plotX,e=c&&c.plotY,g,b=this.pos,f=this.len;c&&(g=this.toPixels(c[c.series.colorKey]),g<b?g=b-2:g>b+f&&(g=b+f+2),c.plotX=g,c.plotY=this.len-g,h.prototype.drawCrosshair.call(this,a,c),c.plotX=d,c.plotY=e,this.cross&&(this.cross.addClass("highcharts-coloraxis-marker").add(this.legendGroup), | ||
this.cross.attr({fill:this.crosshair.color})))},getPlotLinePath:function(a,c,d,e,b){return x(b)?this.horiz?["M",b-4,this.top-6,"L",b+4,this.top-6,b,this.top,"Z"]:["M",this.left,b,"L",this.left-6,b+6,this.left-6,b-6,"Z"]:h.prototype.getPlotLinePath.call(this,a,c,d,e)},update:function(a,c){var d=this.chart,b=d.legend;n(this.series,function(a){a.isDirtyData=!0});a.dataClasses&&b.allItems&&(n(b.allItems,function(a){a.isDataClass&&a.legendGroup.destroy()}),d.isDirtyLegend=!0);d.options[this.coll]=r(this.userOptions, | ||
a);h.prototype.update.call(this,a,c);this.legendItem&&(this.setLegendColor(),b.colorizeItem(this,!0))},getDataClassLegendSymbols:function(){var a=this,c=this.chart,d=this.legendItems,e=c.options.legend,g=e.valueDecimals,u=e.valueSuffix||"",h;d.length||n(this.dataClasses,function(e,q){var k=!0,r=e.from,l=e.to;h="";void 0===r?h="< ":void 0===l&&(h="> ");void 0!==r&&(h+=b.numberFormat(r,g)+u);void 0!==r&&void 0!==l&&(h+=" - ");void 0!==l&&(h+=b.numberFormat(l,g)+u);d.push(w({chart:c,name:h,options:{}, | ||
drawLegendSymbol:m.drawRectangle,visible:!0,setState:f,isDataClass:!0,setVisible:function(){k=this.visible=!k;n(a.series,function(a){n(a.points,function(a){a.dataClass===q&&a.setVisible(k)})});c.legend.colorizeItem(this,k)}},e))});return d},name:""});n(["fill","stroke"],function(a){b.Fx.prototype[a+"Setter"]=function(){this.elem.attr(a,k.prototype.tweenColors(l(this.start),l(this.end),this.pos))}});u(t.prototype,"getAxes",function(a){var c=this.options.colorAxis;a.call(this);this.colorAxis=[];c&& | ||
new k(this,c)});u(q.prototype,"getAllItems",function(a){var c=[],d=this.chart.colorAxis[0];d&&d.options&&(d.options.showInLegend&&(d.options.dataClasses?c=c.concat(d.getDataClassLegendSymbols()):c.push(d)),n(d.series,function(a){a.options.showInLegend=!1}));return c.concat(a.call(this))});u(q.prototype,"colorizeItem",function(a,c,d){a.call(this,c,d);d&&c.legendColor&&c.legendSymbol.attr({fill:c.legendColor})})})(p);(function(b){var h=b.defined,t=b.each,l=b.noop,k=b.seriesTypes;b.colorPointMixin={setVisible:function(b){var h= | ||
this,k=b?"show":"hide";t(["graphic","dataLabel"],function(b){if(h[b])h[b][k]()})}};b.colorSeriesMixin={pointArrayMap:["value"],axisTypes:["xAxis","yAxis","colorAxis"],optionalAxis:"colorAxis",trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:l,parallelArrays:["x","y","value"],colorKey:"value",pointAttribs:k.column.prototype.pointAttribs,translateColors:function(){var b=this,h=this.options.nullColor,k=this.colorAxis,l=this.colorKey;t(this.data,function(m){var f=m[l];if(f=m.options.color|| | ||
(null===f?h:k&&void 0!==f?k.toColor(f,m):m.color||b.color))m.color=f})},colorAttribs:function(b){var k={};h(b.color)&&(k[this.colorProp||"fill"]=b.color);return k}}})(p);(function(b){var h=b.colorPointMixin,t=b.each,l=b.merge,k=b.noop,n=b.pick,p=b.Series,x=b.seriesType,q=b.seriesTypes;x("heatmap","scatter",{animation:!1,borderWidth:0,nullColor:"#f7f7f7",dataLabels:{formatter:function(){return this.point.value},inside:!0,verticalAlign:"middle",crop:!1,overflow:!1,padding:0},marker:null,pointRange:null, | ||
tooltip:{pointFormat:"{point.x}, {point.y}: {point.value}<br/>"},states:{normal:{animation:!0},hover:{halo:!1,brightness:.2}}},l(b.colorSeriesMixin,{pointArrayMap:["y","value"],hasPointSpecificOptions:!0,supportsDrilldown:!0,getExtremesFromAll:!0,directTouch:!0,init:function(){var b;q.scatter.prototype.init.apply(this,arguments);b=this.options;b.pointRange=n(b.pointRange,b.colsize||1);this.yAxis.axisPointRange=b.rowsize||1},translate:function(){var b=this.options,f=this.xAxis,h=this.yAxis,k=function(b, | ||
a,c){return Math.min(Math.max(a,b),c)};this.generatePoints();t(this.points,function(l){var a=(b.colsize||1)/2,c=(b.rowsize||1)/2,d=k(Math.round(f.len-f.translate(l.x-a,0,1,0,1)),-f.len,2*f.len),a=k(Math.round(f.len-f.translate(l.x+a,0,1,0,1)),-f.len,2*f.len),e=k(Math.round(h.translate(l.y-c,0,1,0,1)),-h.len,2*h.len),c=k(Math.round(h.translate(l.y+c,0,1,0,1)),-h.len,2*h.len);l.plotX=l.clientX=(d+a)/2;l.plotY=(e+c)/2;l.shapeType="rect";l.shapeArgs={x:Math.min(d,a),y:Math.min(e,c),width:Math.abs(a-d), | ||
height:Math.abs(c-e)}});this.translateColors()},drawPoints:function(){q.column.prototype.drawPoints.call(this);t(this.points,function(b){b.graphic.attr(this.colorAttribs(b,b.state))},this)},animate:k,getBox:k,drawLegendSymbol:b.LegendSymbolMixin.drawRectangle,alignDataLabel:q.column.prototype.alignDataLabel,getExtremes:function(){p.prototype.getExtremes.call(this,this.valueData);this.valueMin=this.dataMin;this.valueMax=this.dataMax;p.prototype.getExtremes.call(this)}}),h)})(p)}); |
/** | ||
* @license Highcharts JS v4.2.7 (2016-09-21) | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* | ||
* (c) 2011-2016 Torstein Honsi | ||
* (c) 2009-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
/* eslint indent: [2, 4] */ | ||
(function (factory) { | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
@@ -15,707 +14,764 @@ module.exports = factory; | ||
} | ||
}(function (Highcharts) { | ||
}(function(Highcharts) { | ||
(function(H) { | ||
/** | ||
* (c) 2010-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
'use strict'; | ||
var Axis = H.Axis, | ||
Chart = H.Chart, | ||
color = H.color, | ||
ColorAxis, | ||
each = H.each, | ||
extend = H.extend, | ||
isNumber = H.isNumber, | ||
Legend = H.Legend, | ||
LegendSymbolMixin = H.LegendSymbolMixin, | ||
noop = H.noop, | ||
merge = H.merge, | ||
pick = H.pick, | ||
wrap = H.wrap; | ||
/** | ||
* The ColorAxis object for inclusion in gradient legends | ||
*/ | ||
ColorAxis = H.ColorAxis = function() { | ||
this.init.apply(this, arguments); | ||
}; | ||
extend(ColorAxis.prototype, Axis.prototype); | ||
extend(ColorAxis.prototype, { | ||
defaultColorAxisOptions: { | ||
lineWidth: 0, | ||
minPadding: 0, | ||
maxPadding: 0, | ||
gridLineWidth: 1, | ||
tickPixelInterval: 72, | ||
startOnTick: true, | ||
endOnTick: true, | ||
offset: 0, | ||
marker: { | ||
animation: { | ||
duration: 50 | ||
}, | ||
width: 0.01, | ||
var UNDEFINED, | ||
Axis = Highcharts.Axis, | ||
Chart = Highcharts.Chart, | ||
Color = Highcharts.Color, | ||
Legend = Highcharts.Legend, | ||
LegendSymbolMixin = Highcharts.LegendSymbolMixin, | ||
Series = Highcharts.Series, | ||
Point = Highcharts.Point, | ||
color: '#999999' | ||
defaultOptions = Highcharts.getOptions(), | ||
each = Highcharts.each, | ||
extend = Highcharts.extend, | ||
extendClass = Highcharts.extendClass, | ||
isNumber = Highcharts.isNumber, | ||
merge = Highcharts.merge, | ||
pick = Highcharts.pick, | ||
seriesTypes = Highcharts.seriesTypes, | ||
wrap = Highcharts.wrap, | ||
noop = function () {}; | ||
}, | ||
labels: { | ||
overflow: 'justify' | ||
}, | ||
minColor: '#e6ebf5', | ||
maxColor: '#003399', | ||
tickLength: 5, | ||
showInLegend: true | ||
}, | ||
init: function(chart, userOptions) { | ||
var horiz = chart.options.legend.layout !== 'vertical', | ||
options; | ||
this.coll = 'colorAxis'; | ||
// Build the options | ||
options = merge(this.defaultColorAxisOptions, { | ||
side: horiz ? 2 : 1, | ||
reversed: !horiz | ||
}, userOptions, { | ||
opposite: !horiz, | ||
showEmpty: false, | ||
title: null | ||
}); | ||
/** | ||
* The ColorAxis object for inclusion in gradient legends | ||
*/ | ||
var ColorAxis = Highcharts.ColorAxis = function () { | ||
this.init.apply(this, arguments); | ||
}; | ||
extend(ColorAxis.prototype, Axis.prototype); | ||
extend(ColorAxis.prototype, { | ||
defaultColorAxisOptions: { | ||
lineWidth: 0, | ||
minPadding: 0, | ||
maxPadding: 0, | ||
gridLineWidth: 1, | ||
tickPixelInterval: 72, | ||
startOnTick: true, | ||
endOnTick: true, | ||
offset: 0, | ||
marker: { | ||
animation: { | ||
duration: 50 | ||
}, | ||
color: 'gray', | ||
width: 0.01 | ||
Axis.prototype.init.call(this, chart, options); | ||
// Base init() pushes it to the xAxis array, now pop it again | ||
//chart[this.isXAxis ? 'xAxis' : 'yAxis'].pop(); | ||
// Prepare data classes | ||
if (userOptions.dataClasses) { | ||
this.initDataClasses(userOptions); | ||
} | ||
this.initStops(userOptions); | ||
// Override original axis properties | ||
this.horiz = horiz; | ||
this.zoomEnabled = false; | ||
// Add default values | ||
this.defaultLegendLength = 200; | ||
}, | ||
labels: { | ||
overflow: 'justify' | ||
/* | ||
* Return an intermediate color between two colors, according to pos where 0 | ||
* is the from color and 1 is the to color. | ||
* NOTE: Changes here should be copied | ||
* to the same function in drilldown.src.js and solid-gauge-src.js. | ||
*/ | ||
tweenColors: function(from, to, pos) { | ||
// Check for has alpha, because rgba colors perform worse due to lack of | ||
// support in WebKit. | ||
var hasAlpha, | ||
ret; | ||
// Unsupported color, return to-color (#3920) | ||
if (!to.rgba.length || !from.rgba.length) { | ||
ret = to.input || 'none'; | ||
// Interpolate | ||
} else { | ||
from = from.rgba; | ||
to = to.rgba; | ||
hasAlpha = (to[3] !== 1 || from[3] !== 1); | ||
ret = (hasAlpha ? 'rgba(' : 'rgb(') + | ||
Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' + | ||
Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' + | ||
Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) + | ||
(hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')'; | ||
} | ||
return ret; | ||
}, | ||
minColor: '#EFEFFF', | ||
maxColor: '#003875', | ||
tickLength: 5, | ||
showInLegend: true | ||
}, | ||
init: function (chart, userOptions) { | ||
var horiz = chart.options.legend.layout !== 'vertical', | ||
options; | ||
this.coll = 'colorAxis'; | ||
initDataClasses: function(userOptions) { | ||
var axis = this, | ||
chart = this.chart, | ||
dataClasses, | ||
colorCounter = 0, | ||
colorCount = chart.options.chart.colorCount, | ||
options = this.options, | ||
len = userOptions.dataClasses.length; | ||
this.dataClasses = dataClasses = []; | ||
this.legendItems = []; | ||
// Build the options | ||
options = merge(this.defaultColorAxisOptions, { | ||
side: horiz ? 2 : 1, | ||
reversed: !horiz | ||
}, userOptions, { | ||
opposite: !horiz, | ||
showEmpty: false, | ||
title: null | ||
}); | ||
each(userOptions.dataClasses, function(dataClass, i) { | ||
var colors; | ||
Axis.prototype.init.call(this, chart, options); | ||
dataClass = merge(dataClass); | ||
dataClasses.push(dataClass); | ||
if (!dataClass.color) { | ||
if (options.dataClassColor === 'category') { | ||
// Base init() pushes it to the xAxis array, now pop it again | ||
//chart[this.isXAxis ? 'xAxis' : 'yAxis'].pop(); | ||
colors = chart.options.colors; | ||
colorCount = colors.length; | ||
dataClass.color = colors[colorCounter]; | ||
// Prepare data classes | ||
if (userOptions.dataClasses) { | ||
this.initDataClasses(userOptions); | ||
} | ||
this.initStops(userOptions); | ||
dataClass.colorIndex = colorCounter; | ||
// Override original axis properties | ||
this.horiz = horiz; | ||
this.zoomEnabled = false; | ||
// Add default values | ||
this.defaultLegendLength = 200; | ||
}, | ||
// increase and loop back to zero | ||
colorCounter++; | ||
if (colorCounter === colorCount) { | ||
colorCounter = 0; | ||
} | ||
} else { | ||
dataClass.color = axis.tweenColors( | ||
color(options.minColor), | ||
color(options.maxColor), | ||
len < 2 ? 0.5 : i / (len - 1) // #3219 | ||
); | ||
} | ||
} | ||
}); | ||
}, | ||
/* | ||
* Return an intermediate color between two colors, according to pos where 0 | ||
* is the from color and 1 is the to color. | ||
* NOTE: Changes here should be copied | ||
* to the same function in drilldown.src.js and solid-gauge-src.js. | ||
*/ | ||
tweenColors: function (from, to, pos) { | ||
// Check for has alpha, because rgba colors perform worse due to lack of | ||
// support in WebKit. | ||
var hasAlpha, | ||
ret; | ||
initStops: function(userOptions) { | ||
this.stops = userOptions.stops || [ | ||
[0, this.options.minColor], | ||
[1, this.options.maxColor] | ||
]; | ||
each(this.stops, function(stop) { | ||
stop.color = color(stop[1]); | ||
}); | ||
}, | ||
// Unsupported color, return to-color (#3920) | ||
if (!to.rgba.length || !from.rgba.length) { | ||
ret = to.input || 'none'; | ||
/** | ||
* Extend the setOptions method to process extreme colors and color | ||
* stops. | ||
*/ | ||
setOptions: function(userOptions) { | ||
Axis.prototype.setOptions.call(this, userOptions); | ||
// Interpolate | ||
} else { | ||
from = from.rgba; | ||
to = to.rgba; | ||
hasAlpha = (to[3] !== 1 || from[3] !== 1); | ||
ret = (hasAlpha ? 'rgba(' : 'rgb(') + | ||
Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' + | ||
Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' + | ||
Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) + | ||
(hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')'; | ||
} | ||
return ret; | ||
}, | ||
this.options.crosshair = this.options.marker; | ||
}, | ||
initDataClasses: function (userOptions) { | ||
var axis = this, | ||
chart = this.chart, | ||
dataClasses, | ||
colorCounter = 0, | ||
options = this.options, | ||
len = userOptions.dataClasses.length; | ||
this.dataClasses = dataClasses = []; | ||
this.legendItems = []; | ||
setAxisSize: function() { | ||
var symbol = this.legendSymbol, | ||
chart = this.chart, | ||
legendOptions = chart.options.legend || {}, | ||
x, | ||
y, | ||
width, | ||
height; | ||
each(userOptions.dataClasses, function (dataClass, i) { | ||
var colors; | ||
if (symbol) { | ||
this.left = x = symbol.attr('x'); | ||
this.top = y = symbol.attr('y'); | ||
this.width = width = symbol.attr('width'); | ||
this.height = height = symbol.attr('height'); | ||
this.right = chart.chartWidth - x - width; | ||
this.bottom = chart.chartHeight - y - height; | ||
dataClass = merge(dataClass); | ||
dataClasses.push(dataClass); | ||
if (!dataClass.color) { | ||
if (options.dataClassColor === 'category') { | ||
colors = chart.options.colors; | ||
dataClass.color = colors[colorCounter++]; | ||
// loop back to zero | ||
if (colorCounter === colors.length) { | ||
colorCounter = 0; | ||
this.len = this.horiz ? width : height; | ||
this.pos = this.horiz ? x : y; | ||
} else { | ||
// Fake length for disabled legend to avoid tick issues and such (#5205) | ||
this.len = (this.horiz ? legendOptions.symbolWidth : legendOptions.symbolHeight) || this.defaultLegendLength; | ||
} | ||
}, | ||
/** | ||
* Translate from a value to a color | ||
*/ | ||
toColor: function(value, point) { | ||
var pos, | ||
stops = this.stops, | ||
from, | ||
to, | ||
color, | ||
dataClasses = this.dataClasses, | ||
dataClass, | ||
i; | ||
if (dataClasses) { | ||
i = dataClasses.length; | ||
while (i--) { | ||
dataClass = dataClasses[i]; | ||
from = dataClass.from; | ||
to = dataClass.to; | ||
if ((from === undefined || value >= from) && (to === undefined || value <= to)) { | ||
color = dataClass.color; | ||
if (point) { | ||
point.dataClass = i; | ||
point.colorIndex = dataClass.colorIndex; | ||
} | ||
break; | ||
} | ||
} else { | ||
dataClass.color = axis.tweenColors( | ||
Color(options.minColor), | ||
Color(options.maxColor), | ||
len < 2 ? 0.5 : i / (len - 1) // #3219 | ||
); | ||
} | ||
} else { | ||
if (this.isLog) { | ||
value = this.val2lin(value); | ||
} | ||
pos = 1 - ((this.max - value) / ((this.max - this.min) || 1)); | ||
i = stops.length; | ||
while (i--) { | ||
if (pos > stops[i][0]) { | ||
break; | ||
} | ||
} | ||
from = stops[i] || stops[i + 1]; | ||
to = stops[i + 1] || from; | ||
// The position within the gradient | ||
pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1); | ||
color = this.tweenColors( | ||
from.color, | ||
to.color, | ||
pos | ||
); | ||
} | ||
}); | ||
}, | ||
return color; | ||
}, | ||
initStops: function (userOptions) { | ||
this.stops = userOptions.stops || [ | ||
[0, this.options.minColor], | ||
[1, this.options.maxColor] | ||
]; | ||
each(this.stops, function (stop) { | ||
stop.color = Color(stop[1]); | ||
}); | ||
}, | ||
/** | ||
* Override the getOffset method to add the whole axis groups inside the legend. | ||
*/ | ||
getOffset: function() { | ||
var group = this.legendGroup, | ||
sideOffset = this.chart.axisOffset[this.side]; | ||
/** | ||
* Extend the setOptions method to process extreme colors and color | ||
* stops. | ||
*/ | ||
setOptions: function (userOptions) { | ||
Axis.prototype.setOptions.call(this, userOptions); | ||
if (group) { | ||
this.options.crosshair = this.options.marker; | ||
}, | ||
// Hook for the getOffset method to add groups to this parent group | ||
this.axisParent = group; | ||
setAxisSize: function () { | ||
var symbol = this.legendSymbol, | ||
chart = this.chart, | ||
legendOptions = chart.options.legend || {}, | ||
x, | ||
y, | ||
width, | ||
height; | ||
// Call the base | ||
Axis.prototype.getOffset.call(this); | ||
if (symbol) { | ||
this.left = x = symbol.attr('x'); | ||
this.top = y = symbol.attr('y'); | ||
this.width = width = symbol.attr('width'); | ||
this.height = height = symbol.attr('height'); | ||
this.right = chart.chartWidth - x - width; | ||
this.bottom = chart.chartHeight - y - height; | ||
// First time only | ||
if (!this.added) { | ||
this.len = this.horiz ? width : height; | ||
this.pos = this.horiz ? x : y; | ||
} else { | ||
// Fake length for disabled legend to avoid tick issues and such (#5205) | ||
this.len = (this.horiz ? legendOptions.symbolWidth : legendOptions.symbolHeight) || this.defaultLegendLength; | ||
} | ||
}, | ||
this.added = true; | ||
/** | ||
* Translate from a value to a color | ||
*/ | ||
toColor: function (value, point) { | ||
var pos, | ||
stops = this.stops, | ||
from, | ||
to, | ||
color, | ||
dataClasses = this.dataClasses, | ||
dataClass, | ||
i; | ||
if (dataClasses) { | ||
i = dataClasses.length; | ||
while (i--) { | ||
dataClass = dataClasses[i]; | ||
from = dataClass.from; | ||
to = dataClass.to; | ||
if ((from === UNDEFINED || value >= from) && (to === UNDEFINED || value <= to)) { | ||
color = dataClass.color; | ||
if (point) { | ||
point.dataClass = i; | ||
} | ||
break; | ||
this.labelLeft = 0; | ||
this.labelRight = this.width; | ||
} | ||
// Reset it to avoid color axis reserving space | ||
this.chart.axisOffset[this.side] = sideOffset; | ||
} | ||
}, | ||
} else { | ||
/** | ||
* Create the color gradient | ||
*/ | ||
setLegendColor: function() { | ||
var grad, | ||
horiz = this.horiz, | ||
options = this.options, | ||
reversed = this.reversed, | ||
one = reversed ? 1 : 0, | ||
zero = reversed ? 0 : 1; | ||
if (this.isLog) { | ||
value = this.val2lin(value); | ||
grad = horiz ? [one, 0, zero, 0] : [0, zero, 0, one]; // #3190 | ||
this.legendColor = { | ||
linearGradient: { | ||
x1: grad[0], | ||
y1: grad[1], | ||
x2: grad[2], | ||
y2: grad[3] | ||
}, | ||
stops: options.stops || [ | ||
[0, options.minColor], | ||
[1, options.maxColor] | ||
] | ||
}; | ||
}, | ||
/** | ||
* The color axis appears inside the legend and has its own legend symbol | ||
*/ | ||
drawLegendSymbol: function(legend, item) { | ||
var padding = legend.padding, | ||
legendOptions = legend.options, | ||
horiz = this.horiz, | ||
width = pick(legendOptions.symbolWidth, horiz ? this.defaultLegendLength : 12), | ||
height = pick(legendOptions.symbolHeight, horiz ? 12 : this.defaultLegendLength), | ||
labelPadding = pick(legendOptions.labelPadding, horiz ? 16 : 30), | ||
itemDistance = pick(legendOptions.itemDistance, 10); | ||
this.setLegendColor(); | ||
// Create the gradient | ||
item.legendSymbol = this.chart.renderer.rect( | ||
0, | ||
legend.baseline - 11, | ||
width, | ||
height | ||
).attr({ | ||
zIndex: 1 | ||
}).add(item.legendGroup); | ||
// Set how much space this legend item takes up | ||
this.legendItemWidth = width + padding + (horiz ? itemDistance : labelPadding); | ||
this.legendItemHeight = height + padding + (horiz ? labelPadding : 0); | ||
}, | ||
/** | ||
* Fool the legend | ||
*/ | ||
setState: noop, | ||
visible: true, | ||
setVisible: noop, | ||
getSeriesExtremes: function() { | ||
var series; | ||
if (this.series.length) { | ||
series = this.series[0]; | ||
this.dataMin = series.valueMin; | ||
this.dataMax = series.valueMax; | ||
} | ||
pos = 1 - ((this.max - value) / ((this.max - this.min) || 1)); | ||
i = stops.length; | ||
while (i--) { | ||
if (pos > stops[i][0]) { | ||
break; | ||
}, | ||
drawCrosshair: function(e, point) { | ||
var plotX = point && point.plotX, | ||
plotY = point && point.plotY, | ||
crossPos, | ||
axisPos = this.pos, | ||
axisLen = this.len; | ||
if (point) { | ||
crossPos = this.toPixels(point[point.series.colorKey]); | ||
if (crossPos < axisPos) { | ||
crossPos = axisPos - 2; | ||
} else if (crossPos > axisPos + axisLen) { | ||
crossPos = axisPos + axisLen + 2; | ||
} | ||
point.plotX = crossPos; | ||
point.plotY = this.len - crossPos; | ||
Axis.prototype.drawCrosshair.call(this, e, point); | ||
point.plotX = plotX; | ||
point.plotY = plotY; | ||
if (this.cross) { | ||
this.cross | ||
.addClass('highcharts-coloraxis-marker') | ||
.add(this.legendGroup); | ||
this.cross.attr({ | ||
fill: this.crosshair.color | ||
}); | ||
} | ||
} | ||
from = stops[i] || stops[i + 1]; | ||
to = stops[i + 1] || from; | ||
}, | ||
getPlotLinePath: function(a, b, c, d, pos) { | ||
return isNumber(pos) ? // crosshairs only // #3969 pos can be 0 !! | ||
(this.horiz ? ['M', pos - 4, this.top - 6, 'L', pos + 4, this.top - 6, pos, this.top, 'Z'] : ['M', this.left, pos, 'L', this.left - 6, pos + 6, this.left - 6, pos - 6, 'Z']) : | ||
Axis.prototype.getPlotLinePath.call(this, a, b, c, d); | ||
}, | ||
// The position within the gradient | ||
pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1); | ||
update: function(newOptions, redraw) { | ||
var chart = this.chart, | ||
legend = chart.legend; | ||
color = this.tweenColors( | ||
from.color, | ||
to.color, | ||
pos | ||
); | ||
} | ||
return color; | ||
}, | ||
each(this.series, function(series) { | ||
series.isDirtyData = true; // Needed for Axis.update when choropleth colors change | ||
}); | ||
/** | ||
* Override the getOffset method to add the whole axis groups inside the legend. | ||
*/ | ||
getOffset: function () { | ||
var group = this.legendGroup, | ||
sideOffset = this.chart.axisOffset[this.side]; | ||
// When updating data classes, destroy old items and make sure new ones are created (#3207) | ||
if (newOptions.dataClasses && legend.allItems) { | ||
each(legend.allItems, function(item) { | ||
if (item.isDataClass) { | ||
item.legendGroup.destroy(); | ||
} | ||
}); | ||
chart.isDirtyLegend = true; | ||
} | ||
if (group) { | ||
// Keep the options structure updated for export. Unlike xAxis and yAxis, the colorAxis is | ||
// not an array. (#3207) | ||
chart.options[this.coll] = merge(this.userOptions, newOptions); | ||
// Hook for the getOffset method to add groups to this parent group | ||
this.axisParent = group; | ||
Axis.prototype.update.call(this, newOptions, redraw); | ||
if (this.legendItem) { | ||
this.setLegendColor(); | ||
legend.colorizeItem(this, true); | ||
} | ||
}, | ||
// Call the base | ||
Axis.prototype.getOffset.call(this); | ||
/** | ||
* Get the legend item symbols for data classes | ||
*/ | ||
getDataClassLegendSymbols: function() { | ||
var axis = this, | ||
chart = this.chart, | ||
legendItems = this.legendItems, | ||
legendOptions = chart.options.legend, | ||
valueDecimals = legendOptions.valueDecimals, | ||
valueSuffix = legendOptions.valueSuffix || '', | ||
name; | ||
// First time only | ||
if (!this.added) { | ||
if (!legendItems.length) { | ||
each(this.dataClasses, function(dataClass, i) { | ||
var vis = true, | ||
from = dataClass.from, | ||
to = dataClass.to; | ||
this.added = true; | ||
// Assemble the default name. This can be overridden by legend.options.labelFormatter | ||
name = ''; | ||
if (from === undefined) { | ||
name = '< '; | ||
} else if (to === undefined) { | ||
name = '> '; | ||
} | ||
if (from !== undefined) { | ||
name += H.numberFormat(from, valueDecimals) + valueSuffix; | ||
} | ||
if (from !== undefined && to !== undefined) { | ||
name += ' - '; | ||
} | ||
if (to !== undefined) { | ||
name += H.numberFormat(to, valueDecimals) + valueSuffix; | ||
} | ||
// Add a mock object to the legend items | ||
legendItems.push(extend({ | ||
chart: chart, | ||
name: name, | ||
options: {}, | ||
drawLegendSymbol: LegendSymbolMixin.drawRectangle, | ||
visible: true, | ||
setState: noop, | ||
isDataClass: true, | ||
setVisible: function() { | ||
vis = this.visible = !vis; | ||
each(axis.series, function(series) { | ||
each(series.points, function(point) { | ||
if (point.dataClass === i) { | ||
point.setVisible(vis); | ||
} | ||
}); | ||
}); | ||
this.labelLeft = 0; | ||
this.labelRight = this.width; | ||
chart.legend.colorizeItem(this, vis); | ||
} | ||
}, dataClass)); | ||
}); | ||
} | ||
// Reset it to avoid color axis reserving space | ||
this.chart.axisOffset[this.side] = sideOffset; | ||
} | ||
}, | ||
return legendItems; | ||
}, | ||
name: '' // Prevents 'undefined' in legend in IE8 | ||
}); | ||
/** | ||
* Create the color gradient | ||
* Handle animation of the color attributes directly | ||
*/ | ||
setLegendColor: function () { | ||
var grad, | ||
horiz = this.horiz, | ||
options = this.options, | ||
reversed = this.reversed, | ||
one = reversed ? 1 : 0, | ||
zero = reversed ? 0 : 1; | ||
grad = horiz ? [one, 0, zero, 0] : [0, zero, 0, one]; // #3190 | ||
this.legendColor = { | ||
linearGradient: { x1: grad[0], y1: grad[1], x2: grad[2], y2: grad[3] }, | ||
stops: options.stops || [ | ||
[0, options.minColor], | ||
[1, options.maxColor] | ||
] | ||
each(['fill', 'stroke'], function(prop) { | ||
H.Fx.prototype[prop + 'Setter'] = function() { | ||
this.elem.attr(prop, ColorAxis.prototype.tweenColors(color(this.start), color(this.end), this.pos)); | ||
}; | ||
}, | ||
}); | ||
/** | ||
* The color axis appears inside the legend and has its own legend symbol | ||
* Extend the chart getAxes method to also get the color axis | ||
*/ | ||
drawLegendSymbol: function (legend, item) { | ||
var padding = legend.padding, | ||
legendOptions = legend.options, | ||
horiz = this.horiz, | ||
width = pick(legendOptions.symbolWidth, horiz ? this.defaultLegendLength : 12), | ||
height = pick(legendOptions.symbolHeight, horiz ? 12 : this.defaultLegendLength), | ||
labelPadding = pick(legendOptions.labelPadding, horiz ? 16 : 30), | ||
itemDistance = pick(legendOptions.itemDistance, 10); | ||
wrap(Chart.prototype, 'getAxes', function(proceed) { | ||
this.setLegendColor(); | ||
var options = this.options, | ||
colorAxisOptions = options.colorAxis; | ||
// Create the gradient | ||
item.legendSymbol = this.chart.renderer.rect( | ||
0, | ||
legend.baseline - 11, | ||
width, | ||
height | ||
).attr({ | ||
zIndex: 1 | ||
}).add(item.legendGroup); | ||
proceed.call(this); | ||
// Set how much space this legend item takes up | ||
this.legendItemWidth = width + padding + (horiz ? itemDistance : labelPadding); | ||
this.legendItemHeight = height + padding + (horiz ? labelPadding : 0); | ||
}, | ||
/** | ||
* Fool the legend | ||
*/ | ||
setState: noop, | ||
visible: true, | ||
setVisible: noop, | ||
getSeriesExtremes: function () { | ||
var series; | ||
if (this.series.length) { | ||
series = this.series[0]; | ||
this.dataMin = series.valueMin; | ||
this.dataMax = series.valueMax; | ||
this.colorAxis = []; | ||
if (colorAxisOptions) { | ||
new ColorAxis(this, colorAxisOptions); // eslint-disable-line no-new | ||
} | ||
}, | ||
drawCrosshair: function (e, point) { | ||
var plotX = point && point.plotX, | ||
plotY = point && point.plotY, | ||
crossPos, | ||
axisPos = this.pos, | ||
axisLen = this.len; | ||
}); | ||
if (point) { | ||
crossPos = this.toPixels(point[point.series.colorKey]); | ||
if (crossPos < axisPos) { | ||
crossPos = axisPos - 2; | ||
} else if (crossPos > axisPos + axisLen) { | ||
crossPos = axisPos + axisLen + 2; | ||
} | ||
point.plotX = crossPos; | ||
point.plotY = this.len - crossPos; | ||
Axis.prototype.drawCrosshair.call(this, e, point); | ||
point.plotX = plotX; | ||
point.plotY = plotY; | ||
/** | ||
* Wrap the legend getAllItems method to add the color axis. This also removes the | ||
* axis' own series to prevent them from showing up individually. | ||
*/ | ||
wrap(Legend.prototype, 'getAllItems', function(proceed) { | ||
var allItems = [], | ||
colorAxis = this.chart.colorAxis[0]; | ||
if (this.cross) { | ||
this.cross | ||
.attr({ | ||
fill: this.crosshair.color | ||
}) | ||
.add(this.legendGroup); | ||
if (colorAxis && colorAxis.options) { | ||
if (colorAxis.options.showInLegend) { | ||
// Data classes | ||
if (colorAxis.options.dataClasses) { | ||
allItems = allItems.concat(colorAxis.getDataClassLegendSymbols()); | ||
// Gradient legend | ||
} else { | ||
// Add this axis on top | ||
allItems.push(colorAxis); | ||
} | ||
} | ||
} | ||
}, | ||
getPlotLinePath: function (a, b, c, d, pos) { | ||
return isNumber(pos) ? // crosshairs only // #3969 pos can be 0 !! | ||
(this.horiz ? | ||
['M', pos - 4, this.top - 6, 'L', pos + 4, this.top - 6, pos, this.top, 'Z'] : | ||
['M', this.left, pos, 'L', this.left - 6, pos + 6, this.left - 6, pos - 6, 'Z'] | ||
) : | ||
Axis.prototype.getPlotLinePath.call(this, a, b, c, d); | ||
}, | ||
update: function (newOptions, redraw) { | ||
var chart = this.chart, | ||
legend = chart.legend; | ||
each(this.series, function (series) { | ||
series.isDirtyData = true; // Needed for Axis.update when choropleth colors change | ||
}); | ||
// When updating data classes, destroy old items and make sure new ones are created (#3207) | ||
if (newOptions.dataClasses && legend.allItems) { | ||
each(legend.allItems, function (item) { | ||
if (item.isDataClass) { | ||
item.legendGroup.destroy(); | ||
} | ||
// Don't add the color axis' series | ||
each(colorAxis.series, function(series) { | ||
series.options.showInLegend = false; | ||
}); | ||
chart.isDirtyLegend = true; | ||
} | ||
// Keep the options structure updated for export. Unlike xAxis and yAxis, the colorAxis is | ||
// not an array. (#3207) | ||
chart.options[this.coll] = merge(this.userOptions, newOptions); | ||
return allItems.concat(proceed.call(this)); | ||
}); | ||
Axis.prototype.update.call(this, newOptions, redraw); | ||
if (this.legendItem) { | ||
this.setLegendColor(); | ||
legend.colorizeItem(this, true); | ||
wrap(Legend.prototype, 'colorizeItem', function(proceed, item, visible) { | ||
proceed.call(this, item, visible); | ||
if (visible && item.legendColor) { | ||
item.legendSymbol.attr({ | ||
fill: item.legendColor | ||
}); | ||
} | ||
}, | ||
}); | ||
}(Highcharts)); | ||
(function(H) { | ||
/** | ||
* Get the legend item symbols for data classes | ||
* (c) 2010-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
getDataClassLegendSymbols: function () { | ||
var axis = this, | ||
chart = this.chart, | ||
legendItems = this.legendItems, | ||
legendOptions = chart.options.legend, | ||
valueDecimals = legendOptions.valueDecimals, | ||
valueSuffix = legendOptions.valueSuffix || '', | ||
name; | ||
'use strict'; | ||
var defined = H.defined, | ||
each = H.each, | ||
noop = H.noop, | ||
seriesTypes = H.seriesTypes; | ||
if (!legendItems.length) { | ||
each(this.dataClasses, function (dataClass, i) { | ||
var vis = true, | ||
from = dataClass.from, | ||
to = dataClass.to; | ||
/** | ||
* Mixin for maps and heatmaps | ||
*/ | ||
H.colorPointMixin = { | ||
/** | ||
* Set the visibility of a single point | ||
*/ | ||
setVisible: function(vis) { | ||
var point = this, | ||
method = vis ? 'show' : 'hide'; | ||
// Assemble the default name. This can be overridden by legend.options.labelFormatter | ||
name = ''; | ||
if (from === UNDEFINED) { | ||
name = '< '; | ||
} else if (to === UNDEFINED) { | ||
name = '> '; | ||
// Show and hide associated elements | ||
each(['graphic', 'dataLabel'], function(key) { | ||
if (point[key]) { | ||
point[key][method](); | ||
} | ||
if (from !== UNDEFINED) { | ||
name += Highcharts.numberFormat(from, valueDecimals) + valueSuffix; | ||
} | ||
if (from !== UNDEFINED && to !== UNDEFINED) { | ||
name += ' - '; | ||
} | ||
if (to !== UNDEFINED) { | ||
name += Highcharts.numberFormat(to, valueDecimals) + valueSuffix; | ||
} | ||
// Add a mock object to the legend items | ||
legendItems.push(extend({ | ||
chart: chart, | ||
name: name, | ||
options: {}, | ||
drawLegendSymbol: LegendSymbolMixin.drawRectangle, | ||
visible: true, | ||
setState: noop, | ||
isDataClass: true, | ||
setVisible: function () { | ||
vis = this.visible = !vis; | ||
each(axis.series, function (series) { | ||
each(series.points, function (point) { | ||
if (point.dataClass === i) { | ||
point.setVisible(vis); | ||
} | ||
}); | ||
}); | ||
chart.legend.colorizeItem(this, vis); | ||
} | ||
}, dataClass)); | ||
}); | ||
} | ||
return legendItems; | ||
}, | ||
name: '' // Prevents 'undefined' in legend in IE8 | ||
}); | ||
/** | ||
* Handle animation of the color attributes directly | ||
*/ | ||
each(['fill', 'stroke'], function (prop) { | ||
Highcharts.Fx.prototype[prop + 'Setter'] = function () { | ||
this.elem.attr(prop, ColorAxis.prototype.tweenColors(Color(this.start), Color(this.end), this.pos)); | ||
}; | ||
}); | ||
/** | ||
* Extend the chart getAxes method to also get the color axis | ||
*/ | ||
wrap(Chart.prototype, 'getAxes', function (proceed) { | ||
H.colorSeriesMixin = { | ||
pointArrayMap: ['value'], | ||
axisTypes: ['xAxis', 'yAxis', 'colorAxis'], | ||
optionalAxis: 'colorAxis', | ||
trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'], | ||
getSymbol: noop, | ||
parallelArrays: ['x', 'y', 'value'], | ||
colorKey: 'value', | ||
var options = this.options, | ||
colorAxisOptions = options.colorAxis; | ||
proceed.call(this); | ||
pointAttribs: seriesTypes.column.prototype.pointAttribs, | ||
this.colorAxis = []; | ||
if (colorAxisOptions) { | ||
new ColorAxis(this, colorAxisOptions); // eslint-disable-line no-new | ||
} | ||
}); | ||
/** | ||
* In choropleth maps, the color is a result of the value, so this needs translation too | ||
*/ | ||
translateColors: function() { | ||
var series = this, | ||
nullColor = this.options.nullColor, | ||
colorAxis = this.colorAxis, | ||
colorKey = this.colorKey; | ||
/** | ||
* Wrap the legend getAllItems method to add the color axis. This also removes the | ||
* axis' own series to prevent them from showing up individually. | ||
*/ | ||
wrap(Legend.prototype, 'getAllItems', function (proceed) { | ||
var allItems = [], | ||
colorAxis = this.chart.colorAxis[0]; | ||
each(this.data, function(point) { | ||
var value = point[colorKey], | ||
color; | ||
if (colorAxis) { | ||
if (colorAxis.options.showInLegend) { | ||
// Data classes | ||
if (colorAxis.options.dataClasses) { | ||
allItems = allItems.concat(colorAxis.getDataClassLegendSymbols()); | ||
// Gradient legend | ||
} else { | ||
// Add this axis on top | ||
allItems.push(colorAxis); | ||
} | ||
} | ||
color = point.options.color || | ||
(value === null ? nullColor : (colorAxis && value !== undefined) ? colorAxis.toColor(value, point) : point.color || series.color); | ||
// Don't add the color axis' series | ||
each(colorAxis.series, function (series) { | ||
series.options.showInLegend = false; | ||
}); | ||
} | ||
if (color) { | ||
point.color = color; | ||
} | ||
}); | ||
}, | ||
return allItems.concat(proceed.call(this)); | ||
}); | ||
/** | ||
* Mixin for maps and heatmaps | ||
*/ | ||
var colorPointMixin = { | ||
/** | ||
* Set the visibility of a single point | ||
*/ | ||
setVisible: function (vis) { | ||
var point = this, | ||
method = vis ? 'show' : 'hide'; | ||
// Show and hide associated elements | ||
each(['graphic', 'dataLabel'], function (key) { | ||
if (point[key]) { | ||
point[key][method](); | ||
/** | ||
* Get the color attibutes to apply on the graphic | ||
*/ | ||
colorAttribs: function(point) { | ||
var ret = {}; | ||
if (defined(point.color)) { | ||
ret[this.colorProp || 'fill'] = point.color; | ||
} | ||
}); | ||
} | ||
}; | ||
var colorSeriesMixin = { | ||
return ret; | ||
} | ||
}; | ||
pointAttrToOptions: { // mapping between SVG attributes and the corresponding options | ||
stroke: 'borderColor', | ||
'stroke-width': 'borderWidth', | ||
fill: 'color', | ||
dashstyle: 'dashStyle' | ||
}, | ||
pointArrayMap: ['value'], | ||
axisTypes: ['xAxis', 'yAxis', 'colorAxis'], | ||
optionalAxis: 'colorAxis', | ||
trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'], | ||
getSymbol: noop, | ||
parallelArrays: ['x', 'y', 'value'], | ||
colorKey: 'value', | ||
}(Highcharts)); | ||
(function(H) { | ||
/** | ||
* In choropleth maps, the color is a result of the value, so this needs translation too | ||
* (c) 2010-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
translateColors: function () { | ||
var series = this, | ||
nullColor = this.options.nullColor, | ||
colorAxis = this.colorAxis, | ||
colorKey = this.colorKey; | ||
'use strict'; | ||
var colorPointMixin = H.colorPointMixin, | ||
colorSeriesMixin = H.colorSeriesMixin, | ||
each = H.each, | ||
LegendSymbolMixin = H.LegendSymbolMixin, | ||
merge = H.merge, | ||
noop = H.noop, | ||
pick = H.pick, | ||
Series = H.Series, | ||
seriesType = H.seriesType, | ||
seriesTypes = H.seriesTypes; | ||
each(this.data, function (point) { | ||
var value = point[colorKey], | ||
color; | ||
// The Heatmap series type | ||
seriesType('heatmap', 'scatter', { | ||
animation: false, | ||
borderWidth: 0, | ||
color = point.options.color || | ||
(value === null ? nullColor : (colorAxis && value !== undefined) ? colorAxis.toColor(value, point) : point.color || series.color); | ||
nullColor: '#f7f7f7', | ||
if (color) { | ||
point.color = color; | ||
} | ||
}); | ||
} | ||
}; | ||
/** | ||
* Extend the default options with map options | ||
*/ | ||
defaultOptions.plotOptions.heatmap = merge(defaultOptions.plotOptions.scatter, { | ||
animation: false, | ||
borderWidth: 0, | ||
nullColor: '#F8F8F8', | ||
dataLabels: { | ||
formatter: function () { // #2945 | ||
return this.point.value; | ||
dataLabels: { | ||
formatter: function() { // #2945 | ||
return this.point.value; | ||
}, | ||
inside: true, | ||
verticalAlign: 'middle', | ||
crop: false, | ||
overflow: false, | ||
padding: 0 // #3837 | ||
}, | ||
inside: true, | ||
verticalAlign: 'middle', | ||
crop: false, | ||
overflow: false, | ||
padding: 0 // #3837 | ||
}, | ||
marker: null, | ||
pointRange: null, // dynamically set to colsize by default | ||
tooltip: { | ||
pointFormat: '{point.x}, {point.y}: {point.value}<br/>' | ||
}, | ||
states: { | ||
normal: { | ||
animation: true | ||
marker: null, | ||
pointRange: null, // dynamically set to colsize by default | ||
tooltip: { | ||
pointFormat: '{point.x}, {point.y}: {point.value}<br/>' | ||
}, | ||
hover: { | ||
halo: false, // #3406, halo is not required on heatmaps | ||
brightness: 0.2 | ||
states: { | ||
normal: { | ||
animation: true | ||
}, | ||
hover: { | ||
halo: false, // #3406, halo is not required on heatmaps | ||
brightness: 0.2 | ||
} | ||
} | ||
} | ||
}); | ||
}, merge(colorSeriesMixin, { | ||
pointArrayMap: ['y', 'value'], | ||
hasPointSpecificOptions: true, | ||
supportsDrilldown: true, | ||
getExtremesFromAll: true, | ||
directTouch: true, | ||
// The Heatmap series type | ||
seriesTypes.heatmap = extendClass(seriesTypes.scatter, merge(colorSeriesMixin, { | ||
type: 'heatmap', | ||
pointArrayMap: ['y', 'value'], | ||
hasPointSpecificOptions: true, | ||
pointClass: extendClass(Point, colorPointMixin), | ||
supportsDrilldown: true, | ||
getExtremesFromAll: true, | ||
directTouch: true, | ||
/** | ||
* Override the init method to add point ranges on both axes. | ||
*/ | ||
init: function() { | ||
var options; | ||
seriesTypes.scatter.prototype.init.apply(this, arguments); | ||
/** | ||
* Override the init method to add point ranges on both axes. | ||
*/ | ||
init: function () { | ||
var options; | ||
seriesTypes.scatter.prototype.init.apply(this, arguments); | ||
options = this.options; | ||
options.pointRange = pick(options.pointRange, options.colsize || 1); // #3758, prevent resetting in setData | ||
this.yAxis.axisPointRange = options.rowsize || 1; // general point range | ||
}, | ||
translate: function() { | ||
var series = this, | ||
options = series.options, | ||
xAxis = series.xAxis, | ||
yAxis = series.yAxis, | ||
between = function(x, a, b) { | ||
return Math.min(Math.max(a, x), b); | ||
}; | ||
options = this.options; | ||
options.pointRange = pick(options.pointRange, options.colsize || 1); // #3758, prevent resetting in setData | ||
this.yAxis.axisPointRange = options.rowsize || 1; // general point range | ||
}, | ||
translate: function () { | ||
var series = this, | ||
options = series.options, | ||
xAxis = series.xAxis, | ||
yAxis = series.yAxis, | ||
between = function (x, a, b) { | ||
return Math.min(Math.max(a, x), b); | ||
}; | ||
series.generatePoints(); | ||
series.generatePoints(); | ||
each(series.points, function(point) { | ||
var xPad = (options.colsize || 1) / 2, | ||
yPad = (options.rowsize || 1) / 2, | ||
x1 = between(Math.round(xAxis.len - xAxis.translate(point.x - xPad, 0, 1, 0, 1)), -xAxis.len, 2 * xAxis.len), | ||
x2 = between(Math.round(xAxis.len - xAxis.translate(point.x + xPad, 0, 1, 0, 1)), -xAxis.len, 2 * xAxis.len), | ||
y1 = between(Math.round(yAxis.translate(point.y - yPad, 0, 1, 0, 1)), -yAxis.len, 2 * yAxis.len), | ||
y2 = between(Math.round(yAxis.translate(point.y + yPad, 0, 1, 0, 1)), -yAxis.len, 2 * yAxis.len); | ||
each(series.points, function (point) { | ||
var xPad = (options.colsize || 1) / 2, | ||
yPad = (options.rowsize || 1) / 2, | ||
x1 = between(Math.round(xAxis.len - xAxis.translate(point.x - xPad, 0, 1, 0, 1)), -xAxis.len, 2 * xAxis.len), | ||
x2 = between(Math.round(xAxis.len - xAxis.translate(point.x + xPad, 0, 1, 0, 1)), -xAxis.len, 2 * xAxis.len), | ||
y1 = between(Math.round(yAxis.translate(point.y - yPad, 0, 1, 0, 1)), -yAxis.len, 2 * yAxis.len), | ||
y2 = between(Math.round(yAxis.translate(point.y + yPad, 0, 1, 0, 1)), -yAxis.len, 2 * yAxis.len); | ||
// Set plotX and plotY for use in K-D-Tree and more | ||
point.plotX = point.clientX = (x1 + x2) / 2; | ||
point.plotY = (y1 + y2) / 2; | ||
// Set plotX and plotY for use in K-D-Tree and more | ||
point.plotX = point.clientX = (x1 + x2) / 2; | ||
point.plotY = (y1 + y2) / 2; | ||
point.shapeType = 'rect'; | ||
point.shapeArgs = { | ||
x: Math.min(x1, x2), | ||
y: Math.min(y1, y2), | ||
width: Math.abs(x2 - x1), | ||
height: Math.abs(y2 - y1) | ||
}; | ||
}); | ||
point.shapeType = 'rect'; | ||
point.shapeArgs = { | ||
x: Math.min(x1, x2), | ||
y: Math.min(y1, y2), | ||
width: Math.abs(x2 - x1), | ||
height: Math.abs(y2 - y1) | ||
}; | ||
}); | ||
series.translateColors(); | ||
}, | ||
drawPoints: function() { | ||
seriesTypes.column.prototype.drawPoints.call(this); | ||
series.translateColors(); | ||
each(this.points, function(point) { | ||
point.graphic.attr(this.colorAttribs(point, point.state)); | ||
}, this); | ||
}, | ||
animate: noop, | ||
getBox: noop, | ||
drawLegendSymbol: LegendSymbolMixin.drawRectangle, | ||
alignDataLabel: seriesTypes.column.prototype.alignDataLabel, | ||
getExtremes: function() { | ||
// Get the extremes from the value data | ||
Series.prototype.getExtremes.call(this, this.valueData); | ||
this.valueMin = this.dataMin; | ||
this.valueMax = this.dataMax; | ||
// Make sure colors are updated on colorAxis update (#2893) | ||
if (this.chart.hasRendered) { | ||
each(series.points, function (point) { | ||
point.shapeArgs.fill = point.options.color || point.color; // #3311 | ||
}); | ||
// Get the extremes from the y data | ||
Series.prototype.getExtremes.call(this); | ||
} | ||
}, | ||
drawPoints: seriesTypes.column.prototype.drawPoints, | ||
animate: noop, | ||
getBox: noop, | ||
drawLegendSymbol: LegendSymbolMixin.drawRectangle, | ||
alignDataLabel: seriesTypes.column.prototype.alignDataLabel, | ||
getExtremes: function () { | ||
// Get the extremes from the value data | ||
Series.prototype.getExtremes.call(this, this.valueData); | ||
this.valueMin = this.dataMin; | ||
this.valueMax = this.dataMax; | ||
// Get the extremes from the y data | ||
Series.prototype.getExtremes.call(this); | ||
} | ||
}), colorPointMixin); | ||
})); | ||
}(Highcharts)); | ||
})); |
/* | ||
Highmaps JS v4.2.7 (2016-09-21) | ||
Highmaps JS v5.0.0 (2016-09-29) | ||
Highmaps as a plugin for Highcharts 4.1.x or Highstock 2.1.x (x being the patch version of this file) | ||
@@ -9,51 +9,54 @@ | ||
*/ | ||
(function(h){typeof module==="object"&&module.exports?module.exports=h:h(Highcharts)})(function(h){function H(a){if(a)a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0}function M(a,b){var c,d,e,f,g=!1,i=a.x,k=a.y;for(c=0,d=b.length-1;c<b.length;d=c++)e=b[c][1]>k,f=b[d][1]>k,e!==f&&i<(b[d][0]-b[c][0])*(k-b[c][1])/(b[d][1]-b[c][1])+b[c][0]&&(g=!g);return g}function N(a,b,c,d,e,f,g,i){return["M",a+e,b,"L",a+c-f,b,"C",a+c-f/2,b,a+c,b+f/2,a+c,b+f,"L",a+c,b+d- | ||
g,"C",a+c,b+d-g/2,a+c-g/2,b+d,a+c-g,b+d,"L",a+i,b+d,"C",a+i/2,b+d,a,b+d-i/2,a,b+d-i,"L",a,b+e,"C",a,b+e/2,a+e/2,b,a+e,b,"Z"]}var T=h.animObject,n=h.Axis,q=h.Chart,w=h.Color,s=h.Point,I=h.Pointer,D=h.Legend,J=h.LegendSymbolMixin,U=h.Renderer,y=h.Series,K=h.SVGRenderer,O=h.VMLRenderer,A=h.win,P=A.document,L=h.addEvent,l=h.each,E=h.error,o=h.extend,t=h.extendClass,Q=h.format,V=h.map,F=h.isNumber,p=h.merge,m=h.pick,B=h.getOptions(),j=h.seriesTypes,v=B.plotOptions,u=h.wrap,r=function(){};u(n.prototype, | ||
"getSeriesExtremes",function(a){var b=this.isXAxis,c,d,e=[],f;b&&l(this.series,function(a,b){if(a.useMapGeometry)e[b]=a.xData,a.xData=[]});a.call(this);if(b&&(c=m(this.dataMin,Number.MAX_VALUE),d=m(this.dataMax,-Number.MAX_VALUE),l(this.series,function(a,b){if(a.useMapGeometry)c=Math.min(c,m(a.minX,c)),d=Math.max(d,m(a.maxX,c)),a.xData=e[b],f=!0}),f))this.dataMin=c,this.dataMax=d});u(n.prototype,"setAxisTranslation",function(a){var b=this.chart,c=b.plotWidth/b.plotHeight,b=b.xAxis[0],d;a.call(this); | ||
this.coll==="yAxis"&&b.transA!==void 0&&l(this.series,function(a){a.preserveAspectRatio&&(d=!0)});if(d&&(this.transA=b.transA=Math.min(this.transA,b.transA),a=c/((b.max-b.min)/(this.max-this.min)),a=a<1?this:b,c=(a.max-a.min)*a.transA,a.pixelPadding=a.len-c,a.minPixelPadding=a.pixelPadding/2,c=a.fixTo)){c=c[1]-a.toValue(c[0],!0);c*=a.transA;if(Math.abs(c)>a.minPixelPadding||a.min===a.dataMin&&a.max===a.dataMax)c=0;a.minPixelPadding-=c}});u(n.prototype,"render",function(a){a.call(this);this.fixTo= | ||
null});var C=h.ColorAxis=function(){this.init.apply(this,arguments)};o(C.prototype,n.prototype);o(C.prototype,{defaultColorAxisOptions:{lineWidth:0,minPadding:0,maxPadding:0,gridLineWidth:1,tickPixelInterval:72,startOnTick:!0,endOnTick:!0,offset:0,marker:{animation:{duration:50},color:"gray",width:0.01},labels:{overflow:"justify"},minColor:"#EFEFFF",maxColor:"#003875",tickLength:5,showInLegend:!0},init:function(a,b){var c=a.options.legend.layout!=="vertical",d;this.coll="colorAxis";d=p(this.defaultColorAxisOptions, | ||
{side:c?2:1,reversed:!c},b,{opposite:!c,showEmpty:!1,title:null});n.prototype.init.call(this,a,d);b.dataClasses&&this.initDataClasses(b);this.initStops(b);this.horiz=c;this.zoomEnabled=!1;this.defaultLegendLength=200},tweenColors:function(a,b,c){var d;!b.rgba.length||!a.rgba.length?a=b.input||"none":(a=a.rgba,b=b.rgba,d=b[3]!==1||a[3]!==1,a=(d?"rgba(":"rgb(")+Math.round(b[0]+(a[0]-b[0])*(1-c))+","+Math.round(b[1]+(a[1]-b[1])*(1-c))+","+Math.round(b[2]+(a[2]-b[2])*(1-c))+(d?","+(b[3]+(a[3]-b[3])*(1- | ||
c)):"")+")");return a},initDataClasses:function(a){var b=this,c=this.chart,d,e=0,f=this.options,g=a.dataClasses.length;this.dataClasses=d=[];this.legendItems=[];l(a.dataClasses,function(a,k){var h,a=p(a);d.push(a);if(!a.color)f.dataClassColor==="category"?(h=c.options.colors,a.color=h[e++],e===h.length&&(e=0)):a.color=b.tweenColors(w(f.minColor),w(f.maxColor),g<2?0.5:k/(g-1))})},initStops:function(a){this.stops=a.stops||[[0,this.options.minColor],[1,this.options.maxColor]];l(this.stops,function(a){a.color= | ||
w(a[1])})},setOptions:function(a){n.prototype.setOptions.call(this,a);this.options.crosshair=this.options.marker},setAxisSize:function(){var a=this.legendSymbol,b=this.chart,c=b.options.legend||{},d,e;a?(this.left=c=a.attr("x"),this.top=d=a.attr("y"),this.width=e=a.attr("width"),this.height=a=a.attr("height"),this.right=b.chartWidth-c-e,this.bottom=b.chartHeight-d-a,this.len=this.horiz?e:a,this.pos=this.horiz?c:d):this.len=(this.horiz?c.symbolWidth:c.symbolHeight)||this.defaultLegendLength},toColor:function(a, | ||
b){var c,d=this.stops,e,f=this.dataClasses,g,i;if(f)for(i=f.length;i--;){if(g=f[i],e=g.from,d=g.to,(e===void 0||a>=e)&&(d===void 0||a<=d)){c=g.color;if(b)b.dataClass=i;break}}else{this.isLog&&(a=this.val2lin(a));c=1-(this.max-a)/(this.max-this.min||1);for(i=d.length;i--;)if(c>d[i][0])break;e=d[i]||d[i+1];d=d[i+1]||e;c=1-(d[0]-c)/(d[0]-e[0]||1);c=this.tweenColors(e.color,d.color,c)}return c},getOffset:function(){var a=this.legendGroup,b=this.chart.axisOffset[this.side];if(a){this.axisParent=a;n.prototype.getOffset.call(this); | ||
if(!this.added)this.added=!0,this.labelLeft=0,this.labelRight=this.width;this.chart.axisOffset[this.side]=b}},setLegendColor:function(){var a,b=this.options,c=this.reversed;a=c?1:0;c=c?0:1;a=this.horiz?[a,0,c,0]:[0,c,0,a];this.legendColor={linearGradient:{x1:a[0],y1:a[1],x2:a[2],y2:a[3]},stops:b.stops||[[0,b.minColor],[1,b.maxColor]]}},drawLegendSymbol:function(a,b){var c=a.padding,d=a.options,e=this.horiz,f=m(d.symbolWidth,e?this.defaultLegendLength:12),g=m(d.symbolHeight,e?12:this.defaultLegendLength), | ||
i=m(d.labelPadding,e?16:30),d=m(d.itemDistance,10);this.setLegendColor();b.legendSymbol=this.chart.renderer.rect(0,a.baseline-11,f,g).attr({zIndex:1}).add(b.legendGroup);this.legendItemWidth=f+c+(e?d:i);this.legendItemHeight=g+c+(e?i:0)},setState:r,visible:!0,setVisible:r,getSeriesExtremes:function(){var a;if(this.series.length)a=this.series[0],this.dataMin=a.valueMin,this.dataMax=a.valueMax},drawCrosshair:function(a,b){var c=b&&b.plotX,d=b&&b.plotY,e,f=this.pos,g=this.len;if(b)e=this.toPixels(b[b.series.colorKey]), | ||
e<f?e=f-2:e>f+g&&(e=f+g+2),b.plotX=e,b.plotY=this.len-e,n.prototype.drawCrosshair.call(this,a,b),b.plotX=c,b.plotY=d,this.cross&&this.cross.attr({fill:this.crosshair.color}).add(this.legendGroup)},getPlotLinePath:function(a,b,c,d,e){return F(e)?this.horiz?["M",e-4,this.top-6,"L",e+4,this.top-6,e,this.top,"Z"]:["M",this.left,e,"L",this.left-6,e+6,this.left-6,e-6,"Z"]:n.prototype.getPlotLinePath.call(this,a,b,c,d)},update:function(a,b){var c=this.chart,d=c.legend;l(this.series,function(a){a.isDirtyData= | ||
!0});if(a.dataClasses&&d.allItems)l(d.allItems,function(a){a.isDataClass&&a.legendGroup.destroy()}),c.isDirtyLegend=!0;c.options[this.coll]=p(this.userOptions,a);n.prototype.update.call(this,a,b);this.legendItem&&(this.setLegendColor(),d.colorizeItem(this,!0))},getDataClassLegendSymbols:function(){var a=this,b=this.chart,c=this.legendItems,d=b.options.legend,e=d.valueDecimals,f=d.valueSuffix||"",g;c.length||l(this.dataClasses,function(d,k){var x=!0,z=d.from,m=d.to;g="";z===void 0?g="< ":m===void 0&& | ||
(g="> ");z!==void 0&&(g+=h.numberFormat(z,e)+f);z!==void 0&&m!==void 0&&(g+=" - ");m!==void 0&&(g+=h.numberFormat(m,e)+f);c.push(o({chart:b,name:g,options:{},drawLegendSymbol:J.drawRectangle,visible:!0,setState:r,isDataClass:!0,setVisible:function(){x=this.visible=!x;l(a.series,function(a){l(a.points,function(a){a.dataClass===k&&a.setVisible(x)})});b.legend.colorizeItem(this,x)}},d))});return c},name:""});l(["fill","stroke"],function(a){h.Fx.prototype[a+"Setter"]=function(){this.elem.attr(a,C.prototype.tweenColors(w(this.start), | ||
w(this.end),this.pos))}});u(q.prototype,"getAxes",function(a){var b=this.options.colorAxis;a.call(this);this.colorAxis=[];b&&new C(this,b)});u(D.prototype,"getAllItems",function(a){var b=[],c=this.chart.colorAxis[0];c&&(c.options.showInLegend&&(c.options.dataClasses?b=b.concat(c.getDataClassLegendSymbols()):b.push(c)),l(c.series,function(a){a.options.showInLegend=!1}));return b.concat(a.call(this))});var D={setVisible:function(a){var b=this,c=a?"show":"hide";l(["graphic","dataLabel"],function(a){if(b[a])b[a][c]()})}}, | ||
R={pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color",dashstyle:"dashStyle"},pointArrayMap:["value"],axisTypes:["xAxis","yAxis","colorAxis"],optionalAxis:"colorAxis",trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:r,parallelArrays:["x","y","value"],colorKey:"value",translateColors:function(){var a=this,b=this.options.nullColor,c=this.colorAxis,d=this.colorKey;l(this.data,function(e){var f=e[d];if(f=e.options.color||(f===null?b:c&&f!==void 0?c.toColor(f, | ||
e):e.color||a.color))e.color=f})}};o(q.prototype,{renderMapNavigation:function(){var a=this,b=this.options.mapNavigation,c=b.buttons,d,e,f,g,i=function(b){this.handler.call(a,b);H(b)};if(m(b.enableButtons,b.enabled)&&!a.renderer.forExport)for(d in a.mapNavButtons=[],c)if(c.hasOwnProperty(d))f=p(b.buttonOptions,c[d]),e=f.theme,e.style=p(f.theme.style,f.style),g=e.states,e=a.renderer.button(f.text,0,0,i,e,g&&g.hover,g&&g.select,0,d==="zoomIn"?"topbutton":"bottombutton").attr({width:f.width,height:f.height, | ||
title:a.options.lang[d],zIndex:5}).add(),e.handler=f.onclick,e.align(o(f,{width:e.width,height:2*e.height}),null,f.alignTo),L(e.element,"dblclick",H),a.mapNavButtons.push(e)},fitToBox:function(a,b){l([["x","width"],["y","height"]],function(c){var d=c[0],c=c[1];a[d]+a[c]>b[d]+b[c]&&(a[c]>b[c]?(a[c]=b[c],a[d]=b[d]):a[d]=b[d]+b[c]-a[c]);a[c]>b[c]&&(a[c]=b[c]);a[d]<b[d]&&(a[d]=b[d])});return a},mapZoom:function(a,b,c,d,e){var f=this.xAxis[0],g=f.max-f.min,i=m(b,f.min+g/2),k=g*a,g=this.yAxis[0],h=g.max- | ||
g.min,z=m(c,g.min+h/2);h*=a;i=this.fitToBox({x:i-k*(d?(d-f.pos)/f.len:0.5),y:z-h*(e?(e-g.pos)/g.len:0.5),width:k,height:h},{x:f.dataMin,y:g.dataMin,width:f.dataMax-f.dataMin,height:g.dataMax-g.dataMin});k=i.x<=f.dataMin&&i.width>=f.dataMax-f.dataMin&&i.y<=g.dataMin&&i.height>=g.dataMax-g.dataMin;if(d)f.fixTo=[d-f.pos,b];if(e)g.fixTo=[e-g.pos,c];a!==void 0&&!k?(f.setExtremes(i.x,i.x+i.width,!1),g.setExtremes(i.y,i.y+i.height,!1)):(f.setExtremes(void 0,void 0,!1),g.setExtremes(void 0,void 0,!1));this.redraw()}}); | ||
u(q.prototype,"render",function(a){var b=this,c=b.options.mapNavigation;b.renderMapNavigation();a.call(b);(m(c.enableDoubleClickZoom,c.enabled)||c.enableDoubleClickZoomTo)&&L(b.container,"dblclick",function(a){b.pointer.onContainerDblClick(a)});m(c.enableMouseWheelZoom,c.enabled)&&L(b.container,P.onmousewheel===void 0?"DOMMouseScroll":"mousewheel",function(a){b.pointer.onContainerMouseWheel(a);H(a);return!1})});o(I.prototype,{onContainerDblClick:function(a){var b=this.chart,a=this.normalize(a);b.options.mapNavigation.enableDoubleClickZoomTo? | ||
b.pointer.inClass(a.target,"highcharts-tracker")&&b.hoverPoint&&b.hoverPoint.zoomTo():b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)&&b.mapZoom(0.5,b.xAxis[0].toValue(a.chartX),b.yAxis[0].toValue(a.chartY),a.chartX,a.chartY)},onContainerMouseWheel:function(a){var b=this.chart,c,a=this.normalize(a);c=a.detail||-(a.wheelDelta/120);b.isInsidePlot(a.chartX-b.plotLeft,a.chartY-b.plotTop)&&b.mapZoom(Math.pow(b.options.mapNavigation.mouseWheelSensitivity,c),b.xAxis[0].toValue(a.chartX),b.yAxis[0].toValue(a.chartY), | ||
a.chartX,a.chartY)}});u(I.prototype,"init",function(a,b,c){a.call(this,b,c);if(m(c.mapNavigation.enableTouchZoom,c.mapNavigation.enabled))this.pinchX=this.pinchHor=this.pinchY=this.pinchVert=this.hasZoom=!0});u(I.prototype,"pinchTranslate",function(a,b,c,d,e,f,g){a.call(this,b,c,d,e,f,g);this.chart.options.chart.type==="map"&&this.hasZoom&&(a=d.scaleX>d.scaleY,this.pinchTranslateDirection(!a,b,c,d,e,f,g,a?d.scaleX:d.scaleY))});var G=P.documentElement.style.vectorEffect!==void 0;v.map=p(v.scatter, | ||
{allAreas:!0,animation:!1,nullColor:"#F8F8F8",borderColor:"silver",borderWidth:1,marker:null,stickyTracking:!1,dataLabels:{formatter:function(){return this.point.value},inside:!0,verticalAlign:"middle",crop:!1,overflow:!1,padding:0},turboThreshold:0,tooltip:{followPointer:!0,pointFormat:"{point.name}: {point.value}<br/>"},states:{normal:{animation:!0},hover:{brightness:0.2,halo:null}}});var S=t(s,o({applyOptions:function(a,b){var c=s.prototype.applyOptions.call(this,a,b),d=this.series,e=d.joinBy; | ||
if(d.mapData)if(e=c[e[1]]!==void 0&&d.mapMap[c[e[1]]]){if(d.xyFromShape)c.x=e._midX,c.y=e._midY;o(c,e)}else c.value=c.value||null;return c},onMouseOver:function(a){clearTimeout(this.colorInterval);if(this.value!==null||this.series.options.nullInteraction)s.prototype.onMouseOver.call(this,a);else this.series.onMouseOut(a)},onMouseOut:function(){var a=this,b=+new Date,c=w(a.color),d=w(a.pointAttr.hover.fill),e=T(a.series.options.states.normal.animation).duration,f;if(e&&c.rgba.length===4&&d.rgba.length=== | ||
4&&a.state!=="select")f=a.pointAttr[""].fill,delete a.pointAttr[""].fill,clearTimeout(a.colorInterval),a.colorInterval=setInterval(function(){var g=(new Date-b)/e,f=a.graphic;g>1&&(g=1);f&&f.attr("fill",C.prototype.tweenColors.call(0,d,c,g));g>=1&&clearTimeout(a.colorInterval)},13);s.prototype.onMouseOut.call(a);if(f)a.pointAttr[""].fill=f},zoomTo:function(){var a=this.series;a.xAxis.setExtremes(this._minX,this._maxX,!1);a.yAxis.setExtremes(this._minY,this._maxY,!1);a.chart.redraw()}},D));j.map=t(j.scatter, | ||
p(R,{type:"map",pointClass:S,supportsDrilldown:!0,getExtremesFromAll:!0,useMapGeometry:!0,forceDL:!0,searchPoint:r,directTouch:!0,preserveAspectRatio:!0,getBox:function(a){var b=Number.MAX_VALUE,c=-b,d=b,e=-b,f=b,g=b,i=this.xAxis,k=this.yAxis,x;l(a||[],function(a){if(a.path){if(typeof a.path==="string")a.path=h.splitPath(a.path);var i=a.path||[],k=i.length,l=!1,j=-b,p=b,o=-b,n=b,q=a.properties;if(!a._foundBox){for(;k--;)F(i[k])&&(l?(j=Math.max(j,i[k]),p=Math.min(p,i[k])):(o=Math.max(o,i[k]),n=Math.min(n, | ||
i[k])),l=!l);a._midX=p+(j-p)*(a.middleX||q&&q["hc-middle-x"]||0.5);a._midY=n+(o-n)*(a.middleY||q&&q["hc-middle-y"]||0.5);a._maxX=j;a._minX=p;a._maxY=o;a._minY=n;a.labelrank=m(a.labelrank,(j-p)*(o-n));a._foundBox=!0}c=Math.max(c,a._maxX);d=Math.min(d,a._minX);e=Math.max(e,a._maxY);f=Math.min(f,a._minY);g=Math.min(a._maxX-a._minX,a._maxY-a._minY,g);x=!0}});if(x){this.minY=Math.min(f,m(this.minY,b));this.maxY=Math.max(e,m(this.maxY,-b));this.minX=Math.min(d,m(this.minX,b));this.maxX=Math.max(c,m(this.maxX, | ||
-b));if(i&&i.options.minRange===void 0)i.minRange=Math.min(5*g,(this.maxX-this.minX)/5,i.minRange||b);if(k&&k.options.minRange===void 0)k.minRange=Math.min(5*g,(this.maxY-this.minY)/5,k.minRange||b)}},getExtremes:function(){y.prototype.getExtremes.call(this,this.valueData);this.chart.hasRendered&&this.isDirtyData&&this.getBox(this.options.data);this.valueMin=this.dataMin;this.valueMax=this.dataMax;this.dataMin=this.minY;this.dataMax=this.maxY},translatePath:function(a){var b=!1,c=this.xAxis,d=this.yAxis, | ||
e=c.min,f=c.transA,c=c.minPixelPadding,g=d.min,i=d.transA,d=d.minPixelPadding,k,h=[];if(a)for(k=a.length;k--;)F(a[k])?(h[k]=b?(a[k]-e)*f+c:(a[k]-g)*i+d,b=!b):h[k]=a[k];return h},setData:function(a,b,c,d){var e=this.options,f=e.mapData,g=e.joinBy,i=g===null,k=[],m={},j,n,o;i&&(g="_i");g=this.joinBy=h.splat(g);g[1]||(g[1]=g[0]);a&&l(a,function(b,c){F(b)&&(a[c]={value:b});if(i)a[c]._i=c});this.getBox(a);if(f){if(f.type==="FeatureCollection"){if(f["hc-transform"])for(j in this.chart.mapTransforms=n=f["hc-transform"], | ||
n)if(n.hasOwnProperty(j)&&j.rotation)j.cosAngle=Math.cos(j.rotation),j.sinAngle=Math.sin(j.rotation);f=h.geojson(f,this.type,this)}this.mapData=f;for(o=0;o<f.length;o++)j=f[o],n=j.properties,j._i=o,g[0]&&n&&n[g[0]]&&(j[g[0]]=n[g[0]]),m[j[g[0]]]=j;this.mapMap=m;a&&g[1]&&l(a,function(a){m[a[g[1]]]&&k.push(m[a[g[1]]])});e.allAreas?(this.getBox(f),a=a||[],k="|"+V(k,function(a){return a[g[0]]}).join("|")+"|",l(f,function(b){if(!g[0]||k.indexOf("|"+b[g[0]]+"|")===-1)a.push(p(b,{value:null})),d=!1})):this.getBox(k)}y.prototype.setData.call(this, | ||
a,b,c,d)},drawGraph:r,drawDataLabels:r,doFullTranslate:function(){return this.isDirtyData||this.chart.isResizing||this.chart.renderer.isVML||!this.baseTrans},translate:function(){var a=this,b=a.xAxis,c=a.yAxis,d=a.doFullTranslate();a.generatePoints();l(a.data,function(e){e.plotX=b.toPixels(e._midX,!0);e.plotY=c.toPixels(e._midY,!0);if(d)e.shapeType="path",e.shapeArgs={d:a.translatePath(e.path)},G&&(e.shapeArgs["vector-effect"]="non-scaling-stroke")});a.translateColors()},drawPoints:function(){var a= | ||
this,b=a.xAxis,c=a.yAxis,d=a.group,e=a.chart,f=e.renderer,g,i=this.baseTrans;if(!a.transformGroup)a.transformGroup=f.g().attr({scaleX:1,scaleY:1}).add(d),a.transformGroup.survive=!0;a.doFullTranslate()?(e.hasRendered&&a.pointAttrToOptions.fill==="color"&&l(a.points,function(a){if(a.shapeArgs)a.shapeArgs.fill=a.pointAttr[m(a.state,"")].fill}),G||l(a.points,function(b){b=b.pointAttr[""];b["stroke-width"]===a.pointAttr[""]["stroke-width"]&&(b["stroke-width"]="inherit")}),a.group=a.transformGroup,j.column.prototype.drawPoints.apply(a), | ||
a.group=d,l(a.points,function(a){a.graphic&&(a.name&&a.graphic.addClass("highcharts-name-"+a.name.replace(" ","-").toLowerCase()),a.properties&&a.properties["hc-key"]&&a.graphic.addClass("highcharts-key-"+a.properties["hc-key"].toLowerCase()),G||(a.graphic["stroke-widthSetter"]=r))}),this.baseTrans={originX:b.min-b.minPixelPadding/b.transA,originY:c.min-c.minPixelPadding/c.transA+(c.reversed?0:c.len/c.transA),transAX:b.transA,transAY:c.transA},this.transformGroup.animate({translateX:0,translateY:0, | ||
scaleX:1,scaleY:1})):(g=b.transA/i.transAX,d=c.transA/i.transAY,b=b.toPixels(i.originX,!0),c=c.toPixels(i.originY,!0),g>0.99&&g<1.01&&d>0.99&&d<1.01&&(d=g=1,b=Math.round(b),c=Math.round(c)),this.transformGroup.animate({translateX:b,translateY:c,scaleX:g,scaleY:d}));G||a.group.element.setAttribute("stroke-width",a.options[a.pointAttrToOptions["stroke-width"]]/(g||1));this.drawMapDataLabels()},drawMapDataLabels:function(){y.prototype.drawDataLabels.call(this);this.dataLabelsGroup&&this.dataLabelsGroup.clip(this.chart.clipRect)}, | ||
render:function(){var a=this,b=y.prototype.render;a.chart.renderer.isVML&&a.data.length>3E3?setTimeout(function(){b.call(a)}):b.call(a)},animate:function(a){var b=this.options.animation,c=this.group,d=this.xAxis,e=this.yAxis,f=d.pos,g=e.pos;if(this.chart.renderer.isSVG)b===!0&&(b={duration:1E3}),a?c.attr({translateX:f+d.len/2,translateY:g+e.len/2,scaleX:0.001,scaleY:0.001}):(c.animate({translateX:f,translateY:g,scaleX:1,scaleY:1},b),this.animate=null)},animateDrilldown:function(a){var b=this.chart.plotBox, | ||
c=this.chart.drilldownLevels[this.chart.drilldownLevels.length-1],d=c.bBox,e=this.chart.options.drilldown.animation;if(!a)a=Math.min(d.width/b.width,d.height/b.height),c.shapeArgs={scaleX:a,scaleY:a,translateX:d.x,translateY:d.y},l(this.points,function(a){a.graphic&&a.graphic.attr(c.shapeArgs).animate({scaleX:1,scaleY:1,translateX:0,translateY:0},e)}),this.animate=null},drawLegendSymbol:J.drawRectangle,animateDrillupFrom:function(a){j.column.prototype.animateDrillupFrom.call(this,a)},animateDrillupTo:function(a){j.column.prototype.animateDrillupTo.call(this, | ||
a)}}));v.mapline=p(v.map,{lineWidth:1,fillColor:"none"});j.mapline=t(j.map,{type:"mapline",pointAttrToOptions:{stroke:"color","stroke-width":"lineWidth",fill:"fillColor",dashstyle:"dashStyle"},drawLegendSymbol:j.line.prototype.drawLegendSymbol});v.mappoint=p(v.scatter,{dataLabels:{enabled:!0,formatter:function(){return this.point.name},crop:!1,defer:!1,overflow:!1,style:{color:"#000000"}}});j.mappoint=t(j.scatter,{type:"mappoint",forceDL:!0,pointClass:t(s,{applyOptions:function(a,b){var c=a.lat!== | ||
void 0&&a.lon!==void 0?p(a,this.series.chart.fromLatLonToPoint(a)):a;return s.prototype.applyOptions.call(this,c,b)}})});if(j.bubble)v.mapbubble=p(v.bubble,{animationLimit:500,tooltip:{pointFormat:"{point.name}: {point.z}"}}),j.mapbubble=t(j.bubble,{pointClass:t(s,{applyOptions:function(a,b){var c;a&&a.lat!==void 0&&a.lon!==void 0?(c=s.prototype.applyOptions.call(this,a,b),c=o(c,this.series.chart.fromLatLonToPoint(c))):c=S.prototype.applyOptions.call(this,a,b);return c},ttBelow:!1}),xyFromShape:!0, | ||
type:"mapbubble",pointArrayMap:["z"],getMapData:j.map.prototype.getMapData,getBox:j.map.prototype.getBox,setData:j.map.prototype.setData});B.plotOptions.heatmap=p(B.plotOptions.scatter,{animation:!1,borderWidth:0,nullColor:"#F8F8F8",dataLabels:{formatter:function(){return this.point.value},inside:!0,verticalAlign:"middle",crop:!1,overflow:!1,padding:0},marker:null,pointRange:null,tooltip:{pointFormat:"{point.x}, {point.y}: {point.value}<br/>"},states:{normal:{animation:!0},hover:{halo:!1,brightness:0.2}}}); | ||
j.heatmap=t(j.scatter,p(R,{type:"heatmap",pointArrayMap:["y","value"],hasPointSpecificOptions:!0,pointClass:t(s,D),supportsDrilldown:!0,getExtremesFromAll:!0,directTouch:!0,init:function(){var a;j.scatter.prototype.init.apply(this,arguments);a=this.options;a.pointRange=m(a.pointRange,a.colsize||1);this.yAxis.axisPointRange=a.rowsize||1},translate:function(){var a=this.options,b=this.xAxis,c=this.yAxis,d=function(a,b,c){return Math.min(Math.max(b,a),c)};this.generatePoints();l(this.points,function(e){var f= | ||
(a.colsize||1)/2,g=(a.rowsize||1)/2,i=d(Math.round(b.len-b.translate(e.x-f,0,1,0,1)),-b.len,2*b.len),f=d(Math.round(b.len-b.translate(e.x+f,0,1,0,1)),-b.len,2*b.len),h=d(Math.round(c.translate(e.y-g,0,1,0,1)),-c.len,2*c.len),g=d(Math.round(c.translate(e.y+g,0,1,0,1)),-c.len,2*c.len);e.plotX=e.clientX=(i+f)/2;e.plotY=(h+g)/2;e.shapeType="rect";e.shapeArgs={x:Math.min(i,f),y:Math.min(h,g),width:Math.abs(f-i),height:Math.abs(g-h)}});this.translateColors();this.chart.hasRendered&&l(this.points,function(a){a.shapeArgs.fill= | ||
a.options.color||a.color})},drawPoints:j.column.prototype.drawPoints,animate:r,getBox:r,drawLegendSymbol:J.drawRectangle,alignDataLabel:j.column.prototype.alignDataLabel,getExtremes:function(){y.prototype.getExtremes.call(this,this.valueData);this.valueMin=this.dataMin;this.valueMax=this.dataMax;y.prototype.getExtremes.call(this)}}));q.prototype.transformFromLatLon=function(a,b){if(A.proj4===void 0)return E(21),{x:0,y:null};var c=A.proj4(b.crs,[a.lon,a.lat]),d=b.cosAngle||b.rotation&&Math.cos(b.rotation), | ||
e=b.sinAngle||b.rotation&&Math.sin(b.rotation),c=b.rotation?[c[0]*d+c[1]*e,-c[0]*e+c[1]*d]:c;return{x:((c[0]-(b.xoffset||0))*(b.scale||1)+(b.xpan||0))*(b.jsonres||1)+(b.jsonmarginX||0),y:(((b.yoffset||0)-c[1])*(b.scale||1)+(b.ypan||0))*(b.jsonres||1)-(b.jsonmarginY||0)}};q.prototype.transformToLatLon=function(a,b){if(A.proj4===void 0)E(21);else{var c={x:((a.x-(b.jsonmarginX||0))/(b.jsonres||1)-(b.xpan||0))/(b.scale||1)+(b.xoffset||0),y:((-a.y-(b.jsonmarginY||0))/(b.jsonres||1)+(b.ypan||0))/(b.scale|| | ||
1)+(b.yoffset||0)},d=b.cosAngle||b.rotation&&Math.cos(b.rotation),e=b.sinAngle||b.rotation&&Math.sin(b.rotation),c=A.proj4(b.crs,"WGS84",b.rotation?{x:c.x*d+c.y*-e,y:c.x*e+c.y*d}:c);return{lat:c.y,lon:c.x}}};q.prototype.fromPointToLatLon=function(a){var b=this.mapTransforms,c;if(b){for(c in b)if(b.hasOwnProperty(c)&&b[c].hitZone&&M({x:a.x,y:-a.y},b[c].hitZone.coordinates[0]))return this.transformToLatLon(a,b[c]);return this.transformToLatLon(a,b["default"])}else E(22)};q.prototype.fromLatLonToPoint= | ||
function(a){var b=this.mapTransforms,c,d;if(!b)return E(22),{x:0,y:null};for(c in b)if(b.hasOwnProperty(c)&&b[c].hitZone&&(d=this.transformFromLatLon(a,b[c]),M({x:d.x,y:-d.y},b[c].hitZone.coordinates[0])))return d;return this.transformFromLatLon(a,b["default"])};h.geojson=function(a,b,c){var d=[],e=[],f=function(a){var b,c=a.length;e.push("M");for(b=0;b<c;b++)b===1&&e.push("L"),e.push(a[b][0],-a[b][1])},b=b||"map";l(a.features,function(a){var c=a.geometry,h=c.type,c=c.coordinates,a=a.properties,j; | ||
e=[];b==="map"||b==="mapbubble"?(h==="Polygon"?(l(c,f),e.push("Z")):h==="MultiPolygon"&&(l(c,function(a){l(a,f)}),e.push("Z")),e.length&&(j={path:e})):b==="mapline"?(h==="LineString"?f(c):h==="MultiLineString"&&l(c,f),e.length&&(j={path:e})):b==="mappoint"&&h==="Point"&&(j={x:c[0],y:-c[1]});j&&d.push(o(j,{name:a.name||a.NAME,properties:a}))});if(c&&a.copyrightShort)c.chart.mapCredits=Q(c.chart.options.credits.mapText,{geojson:a}),c.chart.mapCreditsFull=Q(c.chart.options.credits.mapTextFull,{geojson:a}); | ||
return d};u(q.prototype,"showCredits",function(a,b){if(this.mapCredits)b.href=null;a.call(this,h.merge(b,{text:b.text+(this.mapCredits||"")}));this.credits&&this.mapCreditsFull&&this.credits.attr({title:this.mapCreditsFull})});o(B.lang,{zoomIn:"Zoom in",zoomOut:"Zoom out"});B.mapNavigation={buttonOptions:{alignTo:"plotBox",align:"left",verticalAlign:"top",x:0,width:18,height:18,style:{fontSize:"15px",fontWeight:"bold",textAlign:"center"},theme:{"stroke-width":1}},buttons:{zoomIn:{onclick:function(){this.mapZoom(0.5)}, | ||
text:"+",y:0},zoomOut:{onclick:function(){this.mapZoom(2)},text:"-",y:28}},mouseWheelSensitivity:1.1};h.splitPath=function(a){var b,a=a.replace(/([A-Za-z])/g," $1 "),a=a.replace(/^\s*/,"").replace(/\s*$/,""),a=a.split(/[ ,]+/);for(b=0;b<a.length;b++)/[a-zA-Z]/.test(a[b])||(a[b]=parseFloat(a[b]));return a};h.maps={};K.prototype.symbols.topbutton=function(a,b,c,d,e){return N(a-1,b-1,c,d,e.r,e.r,0,0)};K.prototype.symbols.bottombutton=function(a,b,c,d,e){return N(a-1,b-1,c,d,0,0,e.r,e.r)};U===O&&l(["topbutton", | ||
"bottombutton"],function(a){O.prototype.symbols[a]=K.prototype.symbols[a]});h.Map=h.mapChart=function(a,b,c){var d=typeof a==="string"||a.nodeName,e=arguments[d?1:0],f={endOnTick:!1,gridLineWidth:0,lineWidth:0,minPadding:0,maxPadding:0,startOnTick:!1,title:null,tickPositions:[]},g,i=h.getOptions().credits;g=e.series;e.series=null;e=p({chart:{panning:"xy",type:"map"},credits:{mapText:m(i.mapText,' \u00a9 <a href="{geojson.copyrightUrl}">{geojson.copyrightShort}</a>'),mapTextFull:m(i.mapTextFull,"{geojson.copyright}")}, | ||
xAxis:f,yAxis:p(f,{reversed:!0})},e,{chart:{inverted:!1,alignTicks:!1}});e.series=g;return d?new q(a,e,c):new q(e,b)}}); | ||
(function(w){"object"===typeof module&&module.exports?module.exports=w:w(Highcharts)})(function(w){(function(a){var h=a.Axis,l=a.each,e=a.pick;a=a.wrap;a(h.prototype,"getSeriesExtremes",function(a){var d=this.isXAxis,q,r,h=[],t;d&&l(this.series,function(a,b){a.useMapGeometry&&(h[b]=a.xData,a.xData=[])});a.call(this);d&&(q=e(this.dataMin,Number.MAX_VALUE),r=e(this.dataMax,-Number.MAX_VALUE),l(this.series,function(a,b){a.useMapGeometry&&(q=Math.min(q,e(a.minX,q)),r=Math.max(r,e(a.maxX,q)),a.xData=h[b], | ||
t=!0)}),t&&(this.dataMin=q,this.dataMax=r))});a(h.prototype,"setAxisTranslation",function(a){var d=this.chart,q=d.plotWidth/d.plotHeight,d=d.xAxis[0],e;a.call(this);"yAxis"===this.coll&&void 0!==d.transA&&l(this.series,function(a){a.preserveAspectRatio&&(e=!0)});if(e&&(this.transA=d.transA=Math.min(this.transA,d.transA),a=q/((d.max-d.min)/(this.max-this.min)),a=1>a?this:d,q=(a.max-a.min)*a.transA,a.pixelPadding=a.len-q,a.minPixelPadding=a.pixelPadding/2,q=a.fixTo)){q=q[1]-a.toValue(q[0],!0);q*=a.transA; | ||
if(Math.abs(q)>a.minPixelPadding||a.min===a.dataMin&&a.max===a.dataMax)q=0;a.minPixelPadding-=q}});a(h.prototype,"render",function(a){a.call(this);this.fixTo=null})})(w);(function(a){var h=a.Axis,l=a.Chart,e=a.color,f,d=a.each,q=a.extend,r=a.isNumber,v=a.Legend,t=a.LegendSymbolMixin,k=a.noop,b=a.merge,c=a.pick,g=a.wrap;f=a.ColorAxis=function(){this.init.apply(this,arguments)};q(f.prototype,h.prototype);q(f.prototype,{defaultColorAxisOptions:{lineWidth:0,minPadding:0,maxPadding:0,gridLineWidth:1,tickPixelInterval:72, | ||
startOnTick:!0,endOnTick:!0,offset:0,marker:{animation:{duration:50},width:.01,color:"#999999"},labels:{overflow:"justify"},minColor:"#e6ebf5",maxColor:"#003399",tickLength:5,showInLegend:!0},init:function(a,p){var c="vertical"!==a.options.legend.layout,n;this.coll="colorAxis";n=b(this.defaultColorAxisOptions,{side:c?2:1,reversed:!c},p,{opposite:!c,showEmpty:!1,title:null});h.prototype.init.call(this,a,n);p.dataClasses&&this.initDataClasses(p);this.initStops(p);this.horiz=c;this.zoomEnabled=!1;this.defaultLegendLength= | ||
200},tweenColors:function(a,b,c){var n;b.rgba.length&&a.rgba.length?(a=a.rgba,b=b.rgba,n=1!==b[3]||1!==a[3],a=(n?"rgba(":"rgb(")+Math.round(b[0]+(a[0]-b[0])*(1-c))+","+Math.round(b[1]+(a[1]-b[1])*(1-c))+","+Math.round(b[2]+(a[2]-b[2])*(1-c))+(n?","+(b[3]+(a[3]-b[3])*(1-c)):"")+")"):a=b.input||"none";return a},initDataClasses:function(a){var p=this,c=this.chart,n,m=0,k=c.options.chart.colorCount,x=this.options,g=a.dataClasses.length;this.dataClasses=n=[];this.legendItems=[];d(a.dataClasses,function(a, | ||
u){var d;a=b(a);n.push(a);a.color||("category"===x.dataClassColor?(d=c.options.colors,k=d.length,a.color=d[m],a.colorIndex=m,m++,m===k&&(m=0)):a.color=p.tweenColors(e(x.minColor),e(x.maxColor),2>g?.5:u/(g-1)))})},initStops:function(a){this.stops=a.stops||[[0,this.options.minColor],[1,this.options.maxColor]];d(this.stops,function(a){a.color=e(a[1])})},setOptions:function(a){h.prototype.setOptions.call(this,a);this.options.crosshair=this.options.marker},setAxisSize:function(){var a=this.legendSymbol, | ||
b=this.chart,c=b.options.legend||{},n,m;a?(this.left=c=a.attr("x"),this.top=n=a.attr("y"),this.width=m=a.attr("width"),this.height=a=a.attr("height"),this.right=b.chartWidth-c-m,this.bottom=b.chartHeight-n-a,this.len=this.horiz?m:a,this.pos=this.horiz?c:n):this.len=(this.horiz?c.symbolWidth:c.symbolHeight)||this.defaultLegendLength},toColor:function(a,b){var c,n=this.stops,m,k=this.dataClasses,d,g;if(k)for(g=k.length;g--;){if(d=k[g],m=d.from,n=d.to,(void 0===m||a>=m)&&(void 0===n||a<=n)){c=d.color; | ||
b&&(b.dataClass=g,b.colorIndex=d.colorIndex);break}}else{this.isLog&&(a=this.val2lin(a));c=1-(this.max-a)/(this.max-this.min||1);for(g=n.length;g--&&!(c>n[g][0]););m=n[g]||n[g+1];n=n[g+1]||m;c=1-(n[0]-c)/(n[0]-m[0]||1);c=this.tweenColors(m.color,n.color,c)}return c},getOffset:function(){var a=this.legendGroup,b=this.chart.axisOffset[this.side];a&&(this.axisParent=a,h.prototype.getOffset.call(this),this.added||(this.added=!0,this.labelLeft=0,this.labelRight=this.width),this.chart.axisOffset[this.side]= | ||
b)},setLegendColor:function(){var a,b=this.options,c=this.reversed;a=c?1:0;c=c?0:1;a=this.horiz?[a,0,c,0]:[0,c,0,a];this.legendColor={linearGradient:{x1:a[0],y1:a[1],x2:a[2],y2:a[3]},stops:b.stops||[[0,b.minColor],[1,b.maxColor]]}},drawLegendSymbol:function(a,b){var d=a.padding,k=a.options,m=this.horiz,g=c(k.symbolWidth,m?this.defaultLegendLength:12),x=c(k.symbolHeight,m?12:this.defaultLegendLength),t=c(k.labelPadding,m?16:30),k=c(k.itemDistance,10);this.setLegendColor();b.legendSymbol=this.chart.renderer.rect(0, | ||
a.baseline-11,g,x).attr({zIndex:1}).add(b.legendGroup);this.legendItemWidth=g+d+(m?k:t);this.legendItemHeight=x+d+(m?t:0)},setState:k,visible:!0,setVisible:k,getSeriesExtremes:function(){var a;this.series.length&&(a=this.series[0],this.dataMin=a.valueMin,this.dataMax=a.valueMax)},drawCrosshair:function(a,b){var c=b&&b.plotX,k=b&&b.plotY,m,d=this.pos,g=this.len;b&&(m=this.toPixels(b[b.series.colorKey]),m<d?m=d-2:m>d+g&&(m=d+g+2),b.plotX=m,b.plotY=this.len-m,h.prototype.drawCrosshair.call(this,a,b), | ||
b.plotX=c,b.plotY=k,this.cross&&(this.cross.addClass("highcharts-coloraxis-marker").add(this.legendGroup),this.cross.attr({fill:this.crosshair.color})))},getPlotLinePath:function(a,b,c,d,m){return r(m)?this.horiz?["M",m-4,this.top-6,"L",m+4,this.top-6,m,this.top,"Z"]:["M",this.left,m,"L",this.left-6,m+6,this.left-6,m-6,"Z"]:h.prototype.getPlotLinePath.call(this,a,b,c,d)},update:function(a,c){var k=this.chart,g=k.legend;d(this.series,function(a){a.isDirtyData=!0});a.dataClasses&&g.allItems&&(d(g.allItems, | ||
function(a){a.isDataClass&&a.legendGroup.destroy()}),k.isDirtyLegend=!0);k.options[this.coll]=b(this.userOptions,a);h.prototype.update.call(this,a,c);this.legendItem&&(this.setLegendColor(),g.colorizeItem(this,!0))},getDataClassLegendSymbols:function(){var b=this,c=this.chart,g=this.legendItems,n=c.options.legend,m=n.valueDecimals,f=n.valueSuffix||"",x;g.length||d(this.dataClasses,function(n,e){var h=!0,r=n.from,l=n.to;x="";void 0===r?x="< ":void 0===l&&(x="> ");void 0!==r&&(x+=a.numberFormat(r,m)+ | ||
f);void 0!==r&&void 0!==l&&(x+=" - ");void 0!==l&&(x+=a.numberFormat(l,m)+f);g.push(q({chart:c,name:x,options:{},drawLegendSymbol:t.drawRectangle,visible:!0,setState:k,isDataClass:!0,setVisible:function(){h=this.visible=!h;d(b.series,function(a){d(a.points,function(a){a.dataClass===e&&a.setVisible(h)})});c.legend.colorizeItem(this,h)}},n))});return g},name:""});d(["fill","stroke"],function(b){a.Fx.prototype[b+"Setter"]=function(){this.elem.attr(b,f.prototype.tweenColors(e(this.start),e(this.end), | ||
this.pos))}});g(l.prototype,"getAxes",function(a){var b=this.options.colorAxis;a.call(this);this.colorAxis=[];b&&new f(this,b)});g(v.prototype,"getAllItems",function(a){var b=[],c=this.chart.colorAxis[0];c&&c.options&&(c.options.showInLegend&&(c.options.dataClasses?b=b.concat(c.getDataClassLegendSymbols()):b.push(c)),d(c.series,function(a){a.options.showInLegend=!1}));return b.concat(a.call(this))});g(v.prototype,"colorizeItem",function(a,b,c){a.call(this,b,c);c&&b.legendColor&&b.legendSymbol.attr({fill:b.legendColor})})})(w); | ||
(function(a){var h=a.defined,l=a.each,e=a.noop,f=a.seriesTypes;a.colorPointMixin={setVisible:function(a){var f=this,e=a?"show":"hide";l(["graphic","dataLabel"],function(a){if(f[a])f[a][e]()})}};a.colorSeriesMixin={pointArrayMap:["value"],axisTypes:["xAxis","yAxis","colorAxis"],optionalAxis:"colorAxis",trackerGroups:["group","markerGroup","dataLabelsGroup"],getSymbol:e,parallelArrays:["x","y","value"],colorKey:"value",pointAttribs:f.column.prototype.pointAttribs,translateColors:function(){var a=this, | ||
f=this.options.nullColor,e=this.colorAxis,h=this.colorKey;l(this.data,function(t){var k=t[h];if(k=t.options.color||(null===k?f:e&&void 0!==k?e.toColor(k,t):t.color||a.color))t.color=k})},colorAttribs:function(a){var f={};h(a.color)&&(f[this.colorProp||"fill"]=a.color);return f}}})(w);(function(a){function h(a){a&&(a.preventDefault&&a.preventDefault(),a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)}var l=a.addEvent,e=a.Chart,f=a.doc,d=a.each,q=a.extend,r=a.merge,v=a.pick;a=a.wrap;q(e.prototype, | ||
{renderMapNavigation:function(){var a=this,k=this.options.mapNavigation,b=k.buttons,c,g,d,f,e,n=function(b){this.handler.call(a,b);h(b)};if(v(k.enableButtons,k.enabled)&&!a.renderer.forExport)for(c in a.mapNavButtons=[],b)b.hasOwnProperty(c)&&(d=r(k.buttonOptions,b[c]),g=d.theme,g.style=r(d.theme.style,d.style),e=(f=g.states)&&f.hover,f=f&&f.select,g=a.renderer.button(d.text,0,0,n,g,e,f,0,"zoomIn"===c?"topbutton":"bottombutton").addClass("highcharts-map-navigation").attr({width:d.width,height:d.height, | ||
title:a.options.lang[c],padding:d.padding,zIndex:5}).add(),g.handler=d.onclick,g.align(q(d,{width:g.width,height:2*g.height}),null,d.alignTo),l(g.element,"dblclick",h),a.mapNavButtons.push(g))},fitToBox:function(a,k){d([["x","width"],["y","height"]],function(b){var c=b[0];b=b[1];a[c]+a[b]>k[c]+k[b]&&(a[b]>k[b]?(a[b]=k[b],a[c]=k[c]):a[c]=k[c]+k[b]-a[b]);a[b]>k[b]&&(a[b]=k[b]);a[c]<k[c]&&(a[c]=k[c])});return a},mapZoom:function(a,d,b,c,g){var f=this.xAxis[0],p=f.max-f.min,e=v(d,f.min+p/2),n=p*a,p=this.yAxis[0], | ||
m=p.max-p.min,E=v(b,p.min+m/2),m=m*a,e=this.fitToBox({x:e-n*(c?(c-f.pos)/f.len:.5),y:E-m*(g?(g-p.pos)/p.len:.5),width:n,height:m},{x:f.dataMin,y:p.dataMin,width:f.dataMax-f.dataMin,height:p.dataMax-p.dataMin}),n=e.x<=f.dataMin&&e.width>=f.dataMax-f.dataMin&&e.y<=p.dataMin&&e.height>=p.dataMax-p.dataMin;c&&(f.fixTo=[c-f.pos,d]);g&&(p.fixTo=[g-p.pos,b]);void 0===a||n?(f.setExtremes(void 0,void 0,!1),p.setExtremes(void 0,void 0,!1)):(f.setExtremes(e.x,e.x+e.width,!1),p.setExtremes(e.y,e.y+e.height,!1)); | ||
this.redraw()}});a(e.prototype,"render",function(a){var d=this,b=d.options.mapNavigation;d.renderMapNavigation();a.call(d);(v(b.enableDoubleClickZoom,b.enabled)||b.enableDoubleClickZoomTo)&&l(d.container,"dblclick",function(a){d.pointer.onContainerDblClick(a)});v(b.enableMouseWheelZoom,b.enabled)&&l(d.container,void 0===f.onmousewheel?"DOMMouseScroll":"mousewheel",function(a){d.pointer.onContainerMouseWheel(a);h(a);return!1})})})(w);(function(a){var h=a.extend,l=a.pick,e=a.Pointer;a=a.wrap;h(e.prototype, | ||
{onContainerDblClick:function(a){var d=this.chart;a=this.normalize(a);d.options.mapNavigation.enableDoubleClickZoomTo?d.pointer.inClass(a.target,"highcharts-tracker")&&d.hoverPoint&&d.hoverPoint.zoomTo():d.isInsidePlot(a.chartX-d.plotLeft,a.chartY-d.plotTop)&&d.mapZoom(.5,d.xAxis[0].toValue(a.chartX),d.yAxis[0].toValue(a.chartY),a.chartX,a.chartY)},onContainerMouseWheel:function(a){var d=this.chart,e;a=this.normalize(a);e=a.detail||-(a.wheelDelta/120);d.isInsidePlot(a.chartX-d.plotLeft,a.chartY-d.plotTop)&& | ||
d.mapZoom(Math.pow(d.options.mapNavigation.mouseWheelSensitivity,e),d.xAxis[0].toValue(a.chartX),d.yAxis[0].toValue(a.chartY),a.chartX,a.chartY)}});a(e.prototype,"zoomOption",function(a){var d=this.chart.options.mapNavigation;a.apply(this,[].slice.call(arguments,1));l(d.enableTouchZoom,d.enabled)&&(this.pinchX=this.pinchHor=this.pinchY=this.pinchVert=this.hasZoom=!0)});a(e.prototype,"pinchTranslate",function(a,d,e,h,l,t,k){a.call(this,d,e,h,l,t,k);"map"===this.chart.options.chart.type&&this.hasZoom&& | ||
(a=h.scaleX>h.scaleY,this.pinchTranslateDirection(!a,d,e,h,l,t,k,a?h.scaleX:h.scaleY))})})(w);(function(a){var h=a.color,l=a.ColorAxis,e=a.colorPointMixin,f=a.each,d=a.extend,q=a.isNumber,r=a.map,v=a.merge,t=a.noop,k=a.pick,b=a.isArray,c=a.Point,g=a.Series,u=a.seriesType,p=a.seriesTypes,z=a.splat,n=void 0!==a.doc.documentElement.style.vectorEffect;u("map","scatter",{allAreas:!0,animation:!1,nullColor:"#f7f7f7",borderColor:"#cccccc",borderWidth:1,marker:null,stickyTracking:!1,joinBy:"hc-key",dataLabels:{formatter:function(){return this.point.value}, | ||
inside:!0,verticalAlign:"middle",crop:!1,overflow:!1,padding:0},turboThreshold:0,tooltip:{followPointer:!0,pointFormat:"{point.name}: {point.value}<br/>"},states:{normal:{animation:!0},hover:{brightness:.2,halo:null},select:{color:"#cccccc"}}},v(a.colorSeriesMixin,{type:"map",supportsDrilldown:!0,getExtremesFromAll:!0,useMapGeometry:!0,forceDL:!0,searchPoint:t,directTouch:!0,preserveAspectRatio:!0,pointArrayMap:["value"],getBox:function(b){var c=Number.MAX_VALUE,d=-c,g=c,e=-c,n=c,p=c,h=this.xAxis, | ||
u=this.yAxis,l;f(b||[],function(b){if(b.path){"string"===typeof b.path&&(b.path=a.splitPath(b.path));var m=b.path||[],f=m.length,h=!1,u=-c,A=c,t=-c,r=c,z=b.properties;if(!b._foundBox){for(;f--;)q(m[f])&&(h?(u=Math.max(u,m[f]),A=Math.min(A,m[f])):(t=Math.max(t,m[f]),r=Math.min(r,m[f])),h=!h);b._midX=A+(u-A)*(b.middleX||z&&z["hc-middle-x"]||.5);b._midY=r+(t-r)*(b.middleY||z&&z["hc-middle-y"]||.5);b._maxX=u;b._minX=A;b._maxY=t;b._minY=r;b.labelrank=k(b.labelrank,(u-A)*(t-r));b._foundBox=!0}d=Math.max(d, | ||
b._maxX);g=Math.min(g,b._minX);e=Math.max(e,b._maxY);n=Math.min(n,b._minY);p=Math.min(b._maxX-b._minX,b._maxY-b._minY,p);l=!0}});l&&(this.minY=Math.min(n,k(this.minY,c)),this.maxY=Math.max(e,k(this.maxY,-c)),this.minX=Math.min(g,k(this.minX,c)),this.maxX=Math.max(d,k(this.maxX,-c)),h&&void 0===h.options.minRange&&(h.minRange=Math.min(5*p,(this.maxX-this.minX)/5,h.minRange||c)),u&&void 0===u.options.minRange&&(u.minRange=Math.min(5*p,(this.maxY-this.minY)/5,u.minRange||c)))},getExtremes:function(){g.prototype.getExtremes.call(this, | ||
this.valueData);this.chart.hasRendered&&this.isDirtyData&&this.getBox(this.options.data);this.valueMin=this.dataMin;this.valueMax=this.dataMax;this.dataMin=this.minY;this.dataMax=this.maxY},translatePath:function(a){var b=!1,c=this.xAxis,d=this.yAxis,g=c.min,k=c.transA,c=c.minPixelPadding,e=d.min,n=d.transA,d=d.minPixelPadding,f,p=[];if(a)for(f=a.length;f--;)q(a[f])?(p[f]=b?(a[f]-g)*k+c:(a[f]-e)*n+d,b=!b):p[f]=a[f];return p},setData:function(c,d,k,e){var n=this.options,p=this.chart.options.chart, | ||
h=p&&p.map,u=n.mapData,l=n.joinBy,t=null===l,w=n.keys||this.pointArrayMap,B=[],C={},y,D=this.chart.mapTransforms;!u&&h&&(u="string"===typeof h?a.maps[h]:h);t&&(l="_i");l=this.joinBy=z(l);l[1]||(l[1]=l[0]);c&&f(c,function(a,d){var g=0;if(q(a))c[d]={value:a};else if(b(a)){c[d]={};!n.keys&&a.length>w.length&&"string"===typeof a[0]&&(c[d]["hc-key"]=a[0],++g);for(var k=0;k<w.length;++k,++g)w[k]&&(c[d][w[k]]=a[g])}t&&(c[d]._i=d)});this.getBox(c);if(this.chart.mapTransforms=D=p&&p.mapTransforms||u&&u["hc-transform"]|| | ||
D)for(y in D)D.hasOwnProperty(y)&&y.rotation&&(y.cosAngle=Math.cos(y.rotation),y.sinAngle=Math.sin(y.rotation));if(u){"FeatureCollection"===u.type&&(this.mapTitle=u.title,u=a.geojson(u,this.type,this));this.mapData=u;this.mapMap={};for(y=0;y<u.length;y++)p=u[y],h=p.properties,p._i=y,l[0]&&h&&h[l[0]]&&(p[l[0]]=h[l[0]]),C[p[l[0]]]=p;this.mapMap=C;c&&l[1]&&f(c,function(a){C[a[l[1]]]&&B.push(C[a[l[1]]])});n.allAreas?(this.getBox(u),c=c||[],l[1]&&f(c,function(a){B.push(a[l[1]])}),B="|"+r(B,function(a){return a&& | ||
a[l[0]]}).join("|")+"|",f(u,function(a){l[0]&&-1!==B.indexOf("|"+a[l[0]]+"|")||(c.push(v(a,{value:null})),e=!1)})):this.getBox(B)}g.prototype.setData.call(this,c,d,k,e)},drawGraph:t,drawDataLabels:t,doFullTranslate:function(){return this.isDirtyData||this.chart.isResizing||this.chart.renderer.isVML||!this.baseTrans},translate:function(){var a=this,b=a.xAxis,c=a.yAxis,d=a.doFullTranslate();a.generatePoints();f(a.data,function(g){g.plotX=b.toPixels(g._midX,!0);g.plotY=c.toPixels(g._midY,!0);d&&(g.shapeType= | ||
"path",g.shapeArgs={d:a.translatePath(g.path)})});a.translateColors()},pointAttribs:function(a,b){var c=p.column.prototype.pointAttribs.call(this,a,b);a.isFading&&delete c.fill;n?c["vector-effect"]="non-scaling-stroke":c["stroke-width"]="inherit";return c},drawPoints:function(){var a=this,b=a.xAxis,c=a.yAxis,d=a.group,g=a.chart,k=g.renderer,e,u=this.baseTrans;a.transformGroup||(a.transformGroup=k.g().attr({scaleX:1,scaleY:1}).add(d),a.transformGroup.survive=!0);a.doFullTranslate()?(g.hasRendered&& | ||
f(a.points,function(b){b.shapeArgs&&(b.shapeArgs.fill=a.pointAttribs(b,b.state).fill)}),a.group=a.transformGroup,p.column.prototype.drawPoints.apply(a),a.group=d,f(a.points,function(a){a.graphic&&(a.name&&a.graphic.addClass("highcharts-name-"+a.name.replace(" ","-").toLowerCase()),a.properties&&a.properties["hc-key"]&&a.graphic.addClass("highcharts-key-"+a.properties["hc-key"].toLowerCase()))}),this.baseTrans={originX:b.min-b.minPixelPadding/b.transA,originY:c.min-c.minPixelPadding/c.transA+(c.reversed? | ||
0:c.len/c.transA),transAX:b.transA,transAY:c.transA},this.transformGroup.animate({translateX:0,translateY:0,scaleX:1,scaleY:1})):(e=b.transA/u.transAX,d=c.transA/u.transAY,b=b.toPixels(u.originX,!0),c=c.toPixels(u.originY,!0),.99<e&&1.01>e&&.99<d&&1.01>d&&(d=e=1,b=Math.round(b),c=Math.round(c)),this.transformGroup.animate({translateX:b,translateY:c,scaleX:e,scaleY:d}));n||a.group.element.setAttribute("stroke-width",a.options[a.pointAttrToOptions&&a.pointAttrToOptions["stroke-width"]||"borderWidth"]/ | ||
(e||1));this.drawMapDataLabels()},drawMapDataLabels:function(){g.prototype.drawDataLabels.call(this);this.dataLabelsGroup&&this.dataLabelsGroup.clip(this.chart.clipRect)},render:function(){var a=this,b=g.prototype.render;a.chart.renderer.isVML&&3E3<a.data.length?setTimeout(function(){b.call(a)}):b.call(a)},animate:function(a){var b=this.options.animation,c=this.group,d=this.xAxis,g=this.yAxis,k=d.pos,e=g.pos;this.chart.renderer.isSVG&&(!0===b&&(b={duration:1E3}),a?c.attr({translateX:k+d.len/2,translateY:e+ | ||
g.len/2,scaleX:.001,scaleY:.001}):(c.animate({translateX:k,translateY:e,scaleX:1,scaleY:1},b),this.animate=null))},animateDrilldown:function(a){var b=this.chart.plotBox,c=this.chart.drilldownLevels[this.chart.drilldownLevels.length-1],d=c.bBox,g=this.chart.options.drilldown.animation;a||(a=Math.min(d.width/b.width,d.height/b.height),c.shapeArgs={scaleX:a,scaleY:a,translateX:d.x,translateY:d.y},f(this.points,function(a){a.graphic&&a.graphic.attr(c.shapeArgs).animate({scaleX:1,scaleY:1,translateX:0, | ||
translateY:0},g)}),this.animate=null)},drawLegendSymbol:a.LegendSymbolMixin.drawRectangle,animateDrillupFrom:function(a){p.column.prototype.animateDrillupFrom.call(this,a)},animateDrillupTo:function(a){p.column.prototype.animateDrillupTo.call(this,a)}}),d({applyOptions:function(a,b){var g=c.prototype.applyOptions.call(this,a,b),k=this.series,e=k.joinBy;k.mapData&&((e=void 0!==g[e[1]]&&k.mapMap[g[e[1]]])?(k.xyFromShape&&(g.x=e._midX,g.y=e._midY),d(g,e)):g.value=g.value||null);return g},onMouseOver:function(a){clearTimeout(this.colorInterval); | ||
if(null!==this.value)c.prototype.onMouseOver.call(this,a);else this.series.onMouseOut(a)},onMouseOut:function(){var a=this,b=+new Date,d=h(this.series.pointAttribs(a).fill),g=h(this.series.pointAttribs(a,"hover").fill),k=a.series.options.states.normal.animation,e=k&&(k.duration||500);e&&4===d.rgba.length&&4===g.rgba.length&&"select"!==a.state&&(clearTimeout(a.colorInterval),a.colorInterval=setInterval(function(){var c=(new Date-b)/e,k=a.graphic;1<c&&(c=1);k&&k.attr("fill",l.prototype.tweenColors.call(0, | ||
g,d,c));1<=c&&clearTimeout(a.colorInterval)},13));a.isFading=!0;c.prototype.onMouseOut.call(a);a.isFading=null},zoomTo:function(){var a=this.series;a.xAxis.setExtremes(this._minX,this._maxX,!1);a.yAxis.setExtremes(this._minY,this._maxY,!1);a.chart.redraw()}},e))})(w);(function(a){var h=a.seriesType,l=a.seriesTypes;h("mapline","map",{lineWidth:1,fillColor:"none"},{type:"mapline",colorProp:"stroke",pointAttrToOptions:{stroke:"color","stroke-width":"lineWidth"},pointAttribs:function(a,f){var d=l.map.prototype.pointAttribs.call(this, | ||
a,f);d.fill=this.options.fillColor;return d},drawLegendSymbol:l.line.prototype.drawLegendSymbol})})(w);(function(a){var h=a.merge,l=a.Point;a=a.seriesType;a("mappoint","scatter",{dataLabels:{enabled:!0,formatter:function(){return this.point.name},crop:!1,defer:!1,overflow:!1,style:{color:"#000000"}}},{type:"mappoint",forceDL:!0},{applyOptions:function(a,f){var d=void 0!==a.lat&&void 0!==a.lon?h(a,this.series.chart.fromLatLonToPoint(a)):a;return l.prototype.applyOptions.call(this,d,f)}})})(w);(function(a){var h= | ||
a.extend,l=a.Point,e=a.seriesType,f=a.seriesTypes;f.bubble&&e("mapbubble","bubble",{animationLimit:500,tooltip:{pointFormat:"{point.name}: {point.z}"}},{xyFromShape:!0,type:"mapbubble",pointArrayMap:["z"],getMapData:f.map.prototype.getMapData,getBox:f.map.prototype.getBox,setData:f.map.prototype.setData},{applyOptions:function(a,e){var r;a&&void 0!==a.lat&&void 0!==a.lon?(r=l.prototype.applyOptions.call(this,a,e),r=h(r,this.series.chart.fromLatLonToPoint(r))):r=f.map.prototype.pointClass.prototype.applyOptions.call(this, | ||
a,e);return r},ttBelow:!1})})(w);(function(a){var h=a.colorPointMixin,l=a.each,e=a.merge,f=a.noop,d=a.pick,q=a.Series,r=a.seriesType,v=a.seriesTypes;r("heatmap","scatter",{animation:!1,borderWidth:0,nullColor:"#f7f7f7",dataLabels:{formatter:function(){return this.point.value},inside:!0,verticalAlign:"middle",crop:!1,overflow:!1,padding:0},marker:null,pointRange:null,tooltip:{pointFormat:"{point.x}, {point.y}: {point.value}<br/>"},states:{normal:{animation:!0},hover:{halo:!1,brightness:.2}}},e(a.colorSeriesMixin, | ||
{pointArrayMap:["y","value"],hasPointSpecificOptions:!0,supportsDrilldown:!0,getExtremesFromAll:!0,directTouch:!0,init:function(){var a;v.scatter.prototype.init.apply(this,arguments);a=this.options;a.pointRange=d(a.pointRange,a.colsize||1);this.yAxis.axisPointRange=a.rowsize||1},translate:function(){var a=this.options,d=this.xAxis,b=this.yAxis,c=function(a,b,c){return Math.min(Math.max(b,a),c)};this.generatePoints();l(this.points,function(g){var e=(a.colsize||1)/2,f=(a.rowsize||1)/2,h=c(Math.round(d.len- | ||
d.translate(g.x-e,0,1,0,1)),-d.len,2*d.len),e=c(Math.round(d.len-d.translate(g.x+e,0,1,0,1)),-d.len,2*d.len),n=c(Math.round(b.translate(g.y-f,0,1,0,1)),-b.len,2*b.len),f=c(Math.round(b.translate(g.y+f,0,1,0,1)),-b.len,2*b.len);g.plotX=g.clientX=(h+e)/2;g.plotY=(n+f)/2;g.shapeType="rect";g.shapeArgs={x:Math.min(h,e),y:Math.min(n,f),width:Math.abs(e-h),height:Math.abs(f-n)}});this.translateColors()},drawPoints:function(){v.column.prototype.drawPoints.call(this);l(this.points,function(a){a.graphic.attr(this.colorAttribs(a, | ||
a.state))},this)},animate:f,getBox:f,drawLegendSymbol:a.LegendSymbolMixin.drawRectangle,alignDataLabel:v.column.prototype.alignDataLabel,getExtremes:function(){q.prototype.getExtremes.call(this,this.valueData);this.valueMin=this.dataMin;this.valueMax=this.dataMax;q.prototype.getExtremes.call(this)}}),h)})(w);(function(a){function h(a,b){var c,d,e,f,h=!1,n=a.x,m=a.y;c=0;for(d=b.length-1;c<b.length;d=c++)e=b[c][1]>m,f=b[d][1]>m,e!==f&&n<(b[d][0]-b[c][0])*(m-b[c][1])/(b[d][1]-b[c][1])+b[c][0]&&(h=!h); | ||
return h}var l=a.Chart,e=a.each,f=a.extend,d=a.error,q=a.format,r=a.merge,v=a.win,t=a.wrap;l.prototype.transformFromLatLon=function(a,b){if(void 0===v.proj4)return d(21),{x:0,y:null};var c=v.proj4(b.crs,[a.lon,a.lat]),g=b.cosAngle||b.rotation&&Math.cos(b.rotation),e=b.sinAngle||b.rotation&&Math.sin(b.rotation),c=b.rotation?[c[0]*g+c[1]*e,-c[0]*e+c[1]*g]:c;return{x:((c[0]-(b.xoffset||0))*(b.scale||1)+(b.xpan||0))*(b.jsonres||1)+(b.jsonmarginX||0),y:(((b.yoffset||0)-c[1])*(b.scale||1)+(b.ypan||0))* | ||
(b.jsonres||1)-(b.jsonmarginY||0)}};l.prototype.transformToLatLon=function(a,b){if(void 0===v.proj4)d(21);else{var c={x:((a.x-(b.jsonmarginX||0))/(b.jsonres||1)-(b.xpan||0))/(b.scale||1)+(b.xoffset||0),y:((-a.y-(b.jsonmarginY||0))/(b.jsonres||1)+(b.ypan||0))/(b.scale||1)+(b.yoffset||0)},g=b.cosAngle||b.rotation&&Math.cos(b.rotation),e=b.sinAngle||b.rotation&&Math.sin(b.rotation),c=v.proj4(b.crs,"WGS84",b.rotation?{x:c.x*g+c.y*-e,y:c.x*e+c.y*g}:c);return{lat:c.y,lon:c.x}}};l.prototype.fromPointToLatLon= | ||
function(a){var b=this.mapTransforms,c;if(b){for(c in b)if(b.hasOwnProperty(c)&&b[c].hitZone&&h({x:a.x,y:-a.y},b[c].hitZone.coordinates[0]))return this.transformToLatLon(a,b[c]);return this.transformToLatLon(a,b["default"])}d(22)};l.prototype.fromLatLonToPoint=function(a){var b=this.mapTransforms,c,g;if(!b)return d(22),{x:0,y:null};for(c in b)if(b.hasOwnProperty(c)&&b[c].hitZone&&(g=this.transformFromLatLon(a,b[c]),h({x:g.x,y:-g.y},b[c].hitZone.coordinates[0])))return g;return this.transformFromLatLon(a, | ||
b["default"])};a.geojson=function(a,b,c){var d=[],h=[],p=function(a){var b,c=a.length;h.push("M");for(b=0;b<c;b++)1===b&&h.push("L"),h.push(a[b][0],-a[b][1])};b=b||"map";e(a.features,function(a){var c=a.geometry,k=c.type,c=c.coordinates;a=a.properties;var l;h=[];"map"===b||"mapbubble"===b?("Polygon"===k?(e(c,p),h.push("Z")):"MultiPolygon"===k&&(e(c,function(a){e(a,p)}),h.push("Z")),h.length&&(l={path:h})):"mapline"===b?("LineString"===k?p(c):"MultiLineString"===k&&e(c,p),h.length&&(l={path:h})):"mappoint"=== | ||
b&&"Point"===k&&(l={x:c[0],y:-c[1]});l&&d.push(f(l,{name:a.name||a.NAME,properties:a}))});c&&a.copyrightShort&&(c.chart.mapCredits=q(c.chart.options.credits.mapText,{geojson:a}),c.chart.mapCreditsFull=q(c.chart.options.credits.mapTextFull,{geojson:a}));return d};t(l.prototype,"addCredits",function(a,b){b=r(!0,this.options.credits,b);this.mapCredits&&(b.href=null);a.call(this,b);this.credits&&this.mapCreditsFull&&this.credits.attr({title:this.mapCreditsFull})})})(w);(function(a){function h(a,c,d,e, | ||
f,h,k,l){return["M",a+f,c,"L",a+d-h,c,"C",a+d-h/2,c,a+d,c+h/2,a+d,c+h,"L",a+d,c+e-k,"C",a+d,c+e-k/2,a+d-k/2,c+e,a+d-k,c+e,"L",a+l,c+e,"C",a+l/2,c+e,a,c+e-l/2,a,c+e-l,"L",a,c+f,"C",a,c+f/2,a+f/2,c,a+f,c,"Z"]}var l=a.Chart,e=a.defaultOptions,f=a.each,d=a.extend,q=a.merge,r=a.pick,v=a.Renderer,t=a.SVGRenderer,k=a.VMLRenderer;d(e.lang,{zoomIn:"Zoom in",zoomOut:"Zoom out"});e.mapNavigation={buttonOptions:{alignTo:"plotBox",align:"left",verticalAlign:"top",x:0,width:18,height:18,padding:5,style:{fontSize:"15px", | ||
fontWeight:"bold"},theme:{"stroke-width":1,"text-align":"center"}},buttons:{zoomIn:{onclick:function(){this.mapZoom(.5)},text:"+",y:0},zoomOut:{onclick:function(){this.mapZoom(2)},text:"-",y:28}},mouseWheelSensitivity:1.1};a.splitPath=function(a){var c;a=a.replace(/([A-Za-z])/g," $1 ");a=a.replace(/^\s*/,"").replace(/\s*$/,"");a=a.split(/[ ,]+/);for(c=0;c<a.length;c++)/[a-zA-Z]/.test(a[c])||(a[c]=parseFloat(a[c]));return a};a.maps={};t.prototype.symbols.topbutton=function(a,c,d,e,f){return h(a-1, | ||
c-1,d,e,f.r,f.r,0,0)};t.prototype.symbols.bottombutton=function(a,c,d,e,f){return h(a-1,c-1,d,e,0,0,f.r,f.r)};v===k&&f(["topbutton","bottombutton"],function(a){k.prototype.symbols[a]=t.prototype.symbols[a]});a.Map=a.mapChart=function(b,c,d){var e="string"===typeof b||b.nodeName,f=arguments[e?1:0],h={endOnTick:!1,visible:!1,minPadding:0,maxPadding:0,startOnTick:!1},k,m=a.getOptions().credits;k=f.series;f.series=null;f=q({chart:{panning:"xy",type:"map"},credits:{mapText:r(m.mapText,' \u00a9 <a href="{geojson.copyrightUrl}">{geojson.copyrightShort}</a>'), | ||
mapTextFull:r(m.mapTextFull,"{geojson.copyright}")},xAxis:h,yAxis:q(h,{reversed:!0})},f,{chart:{inverted:!1,alignTicks:!1}});f.series=k;return e?new l(b,f,d):new l(f,c)}})(w)}); |
/* | ||
Highcharts JS v4.2.7 (2016-09-21) | ||
Highcharts JS v5.0.0 (2016-09-29) | ||
Plugin for displaying a message when there is no data visible in chart. | ||
@@ -10,4 +10,4 @@ | ||
*/ | ||
(function(a){typeof module==="object"&&module.exports?module.exports=a:a(Highcharts)})(function(a){function h(){return!!this.points.length}function d(){this.hasData()?this.hideNoData():this.showNoData()}var e=a.seriesTypes,c=a.Chart.prototype,f=a.getOptions(),g=a.extend,i=a.each;g(f.lang,{noData:"No data to display"});f.noData={position:{x:0,y:0,align:"center",verticalAlign:"middle"},attr:{},style:{fontWeight:"bold",fontSize:"12px",color:"#60606a"}};i(["pie","gauge","waterfall","bubble","treemap"], | ||
function(b){if(e[b])e[b].prototype.hasData=h});a.Series.prototype.hasData=function(){return this.visible&&this.dataMax!==void 0&&this.dataMin!==void 0};c.showNoData=function(b){var a=this.options,b=b||a.lang.noData,a=a.noData;if(!this.noDataLabel)this.noDataLabel=this.renderer.label(b,0,0,null,null,null,a.useHTML,null,"no-data").attr(a.attr).css(a.style).add(),this.noDataLabel.align(g(this.noDataLabel.getBBox(),a.position),!1,"plotBox")};c.hideNoData=function(){if(this.noDataLabel)this.noDataLabel= | ||
this.noDataLabel.destroy()};c.hasData=function(){for(var a=this.series,c=a.length;c--;)if(a[c].hasData()&&!a[c].options.isInternal)return!0;return!1};c.callbacks.push(function(b){a.addEvent(b,"load",d);a.addEvent(b,"redraw",d)})}); | ||
(function(d){"object"===typeof module&&module.exports?module.exports=d:d(Highcharts)})(function(d){(function(c){function d(){return!!this.points.length}function g(){this.hasData()?this.hideNoData():this.showNoData()}var h=c.seriesTypes,e=c.Chart.prototype,f=c.getOptions(),k=c.extend,l=c.each;k(f.lang,{noData:"No data to display"});f.noData={position:{x:0,y:0,align:"center",verticalAlign:"middle"}};f.noData.style={fontWeight:"bold",fontSize:"12px",color:"#666666"};l(["pie","gauge","waterfall","bubble", | ||
"treemap"],function(a){h[a]&&(h[a].prototype.hasData=d)});c.Series.prototype.hasData=function(){return this.visible&&void 0!==this.dataMax&&void 0!==this.dataMin};e.showNoData=function(a){var b=this.options;a=a||b.lang.noData;b=b.noData;this.noDataLabel||(this.noDataLabel=this.renderer.label(a,0,0,null,null,null,b.useHTML,null,"no-data"),this.noDataLabel.attr(b.attr).css(b.style),this.noDataLabel.add(),this.noDataLabel.align(k(this.noDataLabel.getBBox(),b.position),!1,"plotBox"))};e.hideNoData=function(){this.noDataLabel&& | ||
(this.noDataLabel=this.noDataLabel.destroy())};e.hasData=function(){for(var a=this.series,b=a.length;b--;)if(a[b].hasData()&&!a[b].options.isInternal)return!0;return!1};e.callbacks.push(function(a){c.addEvent(a,"load",g);c.addEvent(a,"redraw",g)})})(d)}); |
/** | ||
* @license Highcharts JS v4.2.7 (2016-09-21) | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* Plugin for displaying a message when there is no data visible in chart. | ||
@@ -10,135 +10,153 @@ * | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(H) { | ||
/** | ||
* Plugin for displaying a message when there is no data visible in chart. | ||
* | ||
* (c) 2010-2016 Highsoft AS | ||
* Author: Oystein Moseng | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
'use strict'; | ||
(function (factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function (H) { | ||
var seriesTypes = H.seriesTypes, | ||
chartPrototype = H.Chart.prototype, | ||
defaultOptions = H.getOptions(), | ||
extend = H.extend, | ||
each = H.each; | ||
var seriesTypes = H.seriesTypes, | ||
chartPrototype = H.Chart.prototype, | ||
defaultOptions = H.getOptions(), | ||
extend = H.extend, | ||
each = H.each; | ||
// Add language option | ||
extend(defaultOptions.lang, { | ||
noData: 'No data to display' | ||
}); | ||
// Add default display options for message | ||
defaultOptions.noData = { | ||
position: { | ||
x: 0, | ||
y: 0, | ||
align: 'center', | ||
verticalAlign: 'middle' | ||
}, | ||
attr: { | ||
}, | ||
style: { | ||
fontWeight: 'bold', | ||
fontSize: '12px', | ||
color: '#60606a' | ||
} | ||
// useHTML: false | ||
}; | ||
// Add language option | ||
extend(defaultOptions.lang, { | ||
noData: 'No data to display' | ||
}); | ||
/** | ||
* Define hasData functions for series. These return true if there are data points on this series within the plot area | ||
*/ | ||
function hasDataPie() { | ||
return !!this.points.length; /* != 0 */ | ||
} | ||
// Add default display options for message | ||
defaultOptions.noData = { | ||
position: { | ||
x: 0, | ||
y: 0, | ||
align: 'center', | ||
verticalAlign: 'middle' | ||
} | ||
// useHTML: false | ||
}; | ||
each(['pie', 'gauge', 'waterfall', 'bubble', 'treemap'], function (type) { | ||
if (seriesTypes[type]) { | ||
seriesTypes[type].prototype.hasData = hasDataPie; | ||
} | ||
}); | ||
H.Series.prototype.hasData = function () { | ||
return this.visible && this.dataMax !== undefined && this.dataMin !== undefined; // #3703 | ||
}; | ||
/** | ||
* Display a no-data message. | ||
* | ||
* @param {String} str An optional message to show in place of the default one | ||
*/ | ||
chartPrototype.showNoData = function (str) { | ||
var chart = this, | ||
options = chart.options, | ||
text = str || options.lang.noData, | ||
noDataOptions = options.noData; | ||
// Presentational | ||
defaultOptions.noData.style = { | ||
fontWeight: 'bold', | ||
fontSize: '12px', | ||
color: '#666666' | ||
}; | ||
if (!chart.noDataLabel) { | ||
chart.noDataLabel = chart.renderer | ||
.label( | ||
text, | ||
0, | ||
0, | ||
null, | ||
null, | ||
null, | ||
noDataOptions.useHTML, | ||
null, | ||
'no-data' | ||
) | ||
.attr(noDataOptions.attr) | ||
.css(noDataOptions.style) | ||
.add(); | ||
chart.noDataLabel.align(extend(chart.noDataLabel.getBBox(), noDataOptions.position), false, 'plotBox'); | ||
} | ||
}; | ||
/** | ||
* Hide no-data message | ||
*/ | ||
chartPrototype.hideNoData = function () { | ||
var chart = this; | ||
if (chart.noDataLabel) { | ||
chart.noDataLabel = chart.noDataLabel.destroy(); | ||
} | ||
}; | ||
/** | ||
* Define hasData functions for series. These return true if there are data points on this series within the plot area | ||
*/ | ||
function hasDataPie() { | ||
return !!this.points.length; /* != 0 */ | ||
} | ||
/** | ||
* Returns true if there are data points within the plot area now | ||
*/ | ||
chartPrototype.hasData = function () { | ||
var chart = this, | ||
series = chart.series, | ||
i = series.length; | ||
each(['pie', 'gauge', 'waterfall', 'bubble', 'treemap'], function(type) { | ||
if (seriesTypes[type]) { | ||
seriesTypes[type].prototype.hasData = hasDataPie; | ||
} | ||
}); | ||
while (i--) { | ||
if (series[i].hasData() && !series[i].options.isInternal) { | ||
return true; | ||
} | ||
} | ||
H.Series.prototype.hasData = function() { | ||
return this.visible && this.dataMax !== undefined && this.dataMin !== undefined; // #3703 | ||
}; | ||
return false; | ||
}; | ||
/** | ||
* Display a no-data message. | ||
* | ||
* @param {String} str An optional message to show in place of the default one | ||
*/ | ||
chartPrototype.showNoData = function(str) { | ||
var chart = this, | ||
options = chart.options, | ||
text = str || options.lang.noData, | ||
noDataOptions = options.noData; | ||
/** | ||
* Show no-data message if there is no data in sight. Otherwise, hide it. | ||
*/ | ||
function handleNoData() { | ||
var chart = this; | ||
if (chart.hasData()) { | ||
chart.hideNoData(); | ||
} else { | ||
chart.showNoData(); | ||
} | ||
} | ||
if (!chart.noDataLabel) { | ||
chart.noDataLabel = chart.renderer | ||
.label( | ||
text, | ||
0, | ||
0, | ||
null, | ||
null, | ||
null, | ||
noDataOptions.useHTML, | ||
null, | ||
'no-data' | ||
); | ||
/** | ||
* Add event listener to handle automatic display of no-data message | ||
*/ | ||
chartPrototype.callbacks.push(function (chart) { | ||
H.addEvent(chart, 'load', handleNoData); | ||
H.addEvent(chart, 'redraw', handleNoData); | ||
}); | ||
chart.noDataLabel | ||
.attr(noDataOptions.attr) | ||
.css(noDataOptions.style); | ||
chart.noDataLabel.add(); | ||
chart.noDataLabel.align(extend(chart.noDataLabel.getBBox(), noDataOptions.position), false, 'plotBox'); | ||
} | ||
}; | ||
/** | ||
* Hide no-data message | ||
*/ | ||
chartPrototype.hideNoData = function() { | ||
var chart = this; | ||
if (chart.noDataLabel) { | ||
chart.noDataLabel = chart.noDataLabel.destroy(); | ||
} | ||
}; | ||
/** | ||
* Returns true if there are data points within the plot area now | ||
*/ | ||
chartPrototype.hasData = function() { | ||
var chart = this, | ||
series = chart.series, | ||
i = series.length; | ||
while (i--) { | ||
if (series[i].hasData() && !series[i].options.isInternal) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
}; | ||
/** | ||
* Show no-data message if there is no data in sight. Otherwise, hide it. | ||
*/ | ||
function handleNoData() { | ||
var chart = this; | ||
if (chart.hasData()) { | ||
chart.hideNoData(); | ||
} else { | ||
chart.showNoData(); | ||
} | ||
} | ||
/** | ||
* Add event listener to handle automatic display of no-data message | ||
*/ | ||
chartPrototype.callbacks.push(function(chart) { | ||
H.addEvent(chart, 'load', handleNoData); | ||
H.addEvent(chart, 'redraw', handleNoData); | ||
}); | ||
}(Highcharts)); | ||
})); |
/* | ||
Highcharts JS v4.2.7 (2016-09-21) | ||
Highcharts JS v5.0.0 (2016-09-29) | ||
Client side exporting module | ||
@@ -9,9 +9,9 @@ | ||
*/ | ||
(function(a){typeof module==="object"&&module.exports?module.exports=a:a(Highcharts)})(function(a){function v(g,a){var c=m.getElementsByTagName("head")[0],b=m.createElement("script");b.type="text/javascript";b.src=g;b.onload=a;c.appendChild(b)}var j=a.win,k=j.navigator,m=j.document,r=j.URL||j.webkitURL||j,s=/Edge\/|Trident\/|MSIE /.test(k.userAgent),w=s?150:0;a.CanVGRenderer={};a.downloadURL=function(g,a){var c=m.createElement("a"),b;if(k.msSaveOrOpenBlob)k.msSaveOrOpenBlob(g,a);else if(c.download!== | ||
void 0)c.href=g,c.download=a,c.target="_blank",m.body.appendChild(c),c.click(),m.body.removeChild(c);else try{if(b=j.open(g,"chart"),b===void 0||b===null)throw"Failed to open window";}catch(i){j.location.href=g}};a.svgToDataUrl=function(a){var h=k.userAgent.indexOf("WebKit")>-1&&k.userAgent.indexOf("Chrome")<0;try{if(!h&&k.userAgent.toLowerCase().indexOf("firefox")<0)return r.createObjectURL(new j.Blob([a],{type:"image/svg+xml;charset-utf-16"}))}catch(c){}return"data:image/svg+xml;charset=UTF-8,"+ | ||
encodeURIComponent(a)};a.imageToDataUrl=function(a,h,c,b,i,d,l,f,n){var e=new j.Image,k,o=function(){setTimeout(function(){var d=m.createElement("canvas"),o=d.getContext&&d.getContext("2d"),f;try{if(o){d.height=e.height*b;d.width=e.width*b;o.drawImage(e,0,0,d.width,d.height);try{f=d.toDataURL(h),i(f,h,c,b)}catch(j){k(a,h,c,b)}}else l(a,h,c,b)}finally{n&&n(a,h,c,b)}},w)},q=function(){f(a,h,c,b);n&&n(a,h,c,b)};k=function(){e=new j.Image;k=d;e.crossOrigin="Anonymous";e.onload=o;e.onerror=q;e.src=a}; | ||
e.onload=o;e.onerror=q;e.src=a};a.downloadSVGLocal=function(g,h,c,b,i,d){var l,f,n=!0,e;if(c==="image/svg+xml")try{k.msSaveOrOpenBlob?(f=new MSBlobBuilder,f.append(g),l=f.getBlob("image/svg+xml")):l=a.svgToDataUrl(g),a.downloadURL(l,h),d&&d()}catch(p){i()}else l=a.svgToDataUrl(g),e=function(){try{r.revokeObjectURL(l)}catch(a){}},a.imageToDataUrl(l,c,{},b,function(b){try{a.downloadURL(b,h),d&&d()}catch(c){i()}},function(){var f=m.createElement("canvas"),l=f.getContext("2d"),t=g.match(/^<svg[^>]*width\s*=\s*\"?(\d+)\"?[^>]*>/)[1]* | ||
b,p=g.match(/^<svg[^>]*height\s*=\s*\"?(\d+)\"?[^>]*>/)[1]*b,u=function(){l.drawSvg(g,0,0,t,p);try{a.downloadURL(k.msSaveOrOpenBlob?f.msToBlob():f.toDataURL(c),h),d&&d()}catch(b){i()}finally{e()}};f.width=t;f.height=p;j.canvg?u():(n=!0,v(a.getOptions().global.canvasToolsURL,function(){u()}))},i,i,function(){n&&e()})};a.Chart.prototype.getSVGForLocalExport=function(g,h,c,b){var i=this,d,l=0,f,j,e,k,m=function(a,c,e){++l;e.imageElement.setAttributeNS("http://www.w3.org/1999/xlink","href",a);l===d.length&& | ||
b(i.sanitizeSVG(f.innerHTML))};a.wrap(a.Chart.prototype,"getChartHTML",function(a){f=this.container.cloneNode(!0);return a.apply(this,Array.prototype.slice.call(arguments,1))});i.getSVGForExport(g,h);d=f.getElementsByTagName("image");try{if(d.length)for(e=0,k=d.length;e<k;++e)j=d[e],a.imageToDataUrl(j.getAttributeNS("http://www.w3.org/1999/xlink","href"),"image/png",{imageElement:j},g.scale,m,c,c,c);else b(i.sanitizeSVG(f.innerHTML))}catch(q){c()}};a.Chart.prototype.exportChartLocal=function(g,h){var c= | ||
this,b=a.merge(c.options.exporting,g),i=b&&b.type||"image/png",d=function(){if(b.fallbackToExportServer===!1)if(b.error)b.error();else throw"Fallback to export server disabled";else c.exportChart(b)};s&&i!=="image/svg+xml"&&c.container.getElementsByTagName("image").length?d():c.getSVGForLocalExport(b,h,d,function(c){var f=(b.filename||"chart")+"."+(i==="image/svg+xml"?"svg":i.split("/")[1]);a.downloadSVGLocal(c,f,i,b.scale,d)})};a.getOptions().exporting.buttons.contextButton.menuItems=[{textKey:"printChart", | ||
onclick:function(){this.print()}},{separator:!0},{textKey:"downloadPNG",onclick:function(){this.exportChartLocal()}},{textKey:"downloadJPEG",onclick:function(){this.exportChartLocal({type:"image/jpeg"})}},{textKey:"downloadSVG",onclick:function(){this.exportChartLocal({type:"image/svg+xml"})}}]}); | ||
(function(r){"object"===typeof module&&module.exports?module.exports=r:r(Highcharts)})(function(r){(function(a){function r(e,a){var c=t.getElementsByTagName("head")[0],b=t.createElement("script");b.type="text/javascript";b.src=e;b.onload=a;c.appendChild(b)}var A=a.merge,m=a.win,q=m.navigator,t=m.document,v=m.URL||m.webkitURL||m,w=/Edge\/|Trident\/|MSIE /.test(q.userAgent),B=w?150:0;a.CanVGRenderer={};a.downloadURL=function(e,a){var c=t.createElement("a"),b;if(q.msSaveOrOpenBlob)q.msSaveOrOpenBlob(e, | ||
a);else if(void 0!==c.download)c.href=e,c.download=a,c.target="_blank",t.body.appendChild(c),c.click(),t.body.removeChild(c);else try{if(b=m.open(e,"chart"),void 0===b||null===b)throw"Failed to open window";}catch(h){m.location.href=e}};a.svgToDataUrl=function(e){var a=-1<q.userAgent.indexOf("WebKit")&&0>q.userAgent.indexOf("Chrome");try{if(!a&&0>q.userAgent.toLowerCase().indexOf("firefox"))return v.createObjectURL(new m.Blob([e],{type:"image/svg+xml;charset-utf-16"}))}catch(c){}return"data:image/svg+xml;charset=UTF-8,"+ | ||
encodeURIComponent(e)};a.imageToDataUrl=function(a,k,c,b,h,d,l,g,p){var f=new m.Image,n,u=function(){setTimeout(function(){var d=t.createElement("canvas"),u=d.getContext&&d.getContext("2d"),g;try{if(u){d.height=f.height*b;d.width=f.width*b;u.drawImage(f,0,0,d.width,d.height);try{g=d.toDataURL(k),h(g,k,c,b)}catch(m){n(a,k,c,b)}}else l(a,k,c,b)}finally{p&&p(a,k,c,b)}},B)},z=function(){g(a,k,c,b);p&&p(a,k,c,b)};n=function(){f=new m.Image;n=d;f.crossOrigin="Anonymous";f.onload=u;f.onerror=z;f.src=a}; | ||
f.onload=u;f.onerror=z;f.src=a};a.downloadSVGLocal=function(e,k,c,b,h,d){var l,g,p=!0,f,n=a.getOptions().exporting.libURL;if("image/svg+xml"===c)try{q.msSaveOrOpenBlob?(g=new MSBlobBuilder,g.append(e),l=g.getBlob("image/svg+xml")):l=a.svgToDataUrl(e),a.downloadURL(l,k),d&&d()}catch(u){h()}else l=a.svgToDataUrl(e),f=function(){try{v.revokeObjectURL(l)}catch(a){}},a.imageToDataUrl(l,c,{},b,function(b){try{a.downloadURL(b,k),d&&d()}catch(c){h()}},function(){var g=t.createElement("canvas"),l=g.getContext("2d"), | ||
x=e.match(/^<svg[^>]*width\s*=\s*\"?(\d+)\"?[^>]*>/)[1]*b,y=e.match(/^<svg[^>]*height\s*=\s*\"?(\d+)\"?[^>]*>/)[1]*b,v=function(){l.drawSvg(e,0,0,x,y);try{a.downloadURL(q.msSaveOrOpenBlob?g.msToBlob():g.toDataURL(c),k),d&&d()}catch(b){h()}finally{f()}};g.width=x;g.height=y;m.canvg?v():(p=!0,n="/"!==n.substr[-1]?n+"/":n,r(n+"rgbcolor.js",function(){r(n+"canvg.js",function(){v()})}))},h,h,function(){p&&f()})};a.Chart.prototype.getSVGForLocalExport=function(e,k,c,b){var h=this,d,l=0,g,p,f,n,m=function(a, | ||
c,e){++l;e.imageElement.setAttributeNS("http://www.w3.org/1999/xlink","href",a);l===d.length&&b(h.sanitizeSVG(g.innerHTML))};a.wrap(a.Chart.prototype,"getChartHTML",function(a){g=this.container.cloneNode(!0);return a.apply(this,Array.prototype.slice.call(arguments,1))});h.getSVGForExport(e,k);d=g.getElementsByTagName("image");try{if(d.length)for(f=0,n=d.length;f<n;++f)p=d[f],a.imageToDataUrl(p.getAttributeNS("http://www.w3.org/1999/xlink","href"),"image/png",{imageElement:p},e.scale,m,c,c,c);else b(h.sanitizeSVG(g.innerHTML))}catch(q){c()}}; | ||
a.Chart.prototype.exportChartLocal=function(e,k){var c=this,b=a.merge(c.options.exporting,e),h=b&&b.type||"image/png",d=function(){if(!1===b.fallbackToExportServer)if(b.error)b.error();else throw"Fallback to export server disabled";else c.exportChart(b)},l=function(c){var e=(b.filename||"chart")+"."+("image/svg+xml"===h?"svg":h.split("/")[1]);a.downloadSVGLocal(c,e,h,b.scale,d)};w&&"image/svg+xml"!==h&&c.container.getElementsByTagName("image").length?d():c.getSVGForLocalExport(b,k,d,l)};A(!0,a.getOptions().exporting, | ||
{libURL:"http://code.highcharts.com@product.cdnpath@/5.0.0/lib/",buttons:{contextButton:{menuItems:[{textKey:"printChart",onclick:function(){this.print()}},{separator:!0},{textKey:"downloadPNG",onclick:function(){this.exportChartLocal()}},{textKey:"downloadJPEG",onclick:function(){this.exportChartLocal({type:"image/jpeg"})}},{textKey:"downloadSVG",onclick:function(){this.exportChartLocal({type:"image/svg+xml"})}}]}}})})(r)}); |
/** | ||
* @license Highcharts JS v4.2.7 (2016-09-21) | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* Client side exporting module | ||
@@ -9,358 +9,417 @@ * | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(Highcharts) { | ||
/** | ||
* Client side exporting module | ||
* | ||
* (c) 2015 Torstein Honsi / Oystein Moseng | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
/*global MSBlobBuilder */ | ||
(function (factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function (Highcharts) { | ||
'use strict'; | ||
/*global MSBlobBuilder */ | ||
var win = Highcharts.win, | ||
nav = win.navigator, | ||
doc = win.document, | ||
domurl = win.URL || win.webkitURL || win, | ||
isMSBrowser = /Edge\/|Trident\/|MSIE /.test(nav.userAgent), | ||
loadEventDeferDelay = isMSBrowser ? 150 : 0; // Milliseconds to defer image load event handlers to offset IE bug | ||
var merge = Highcharts.merge, | ||
win = Highcharts.win, | ||
nav = win.navigator, | ||
doc = win.document, | ||
domurl = win.URL || win.webkitURL || win, | ||
isMSBrowser = /Edge\/|Trident\/|MSIE /.test(nav.userAgent), | ||
loadEventDeferDelay = isMSBrowser ? 150 : 0; // Milliseconds to defer image load event handlers to offset IE bug | ||
// Dummy object so we can reuse our canvas-tools.js without errors | ||
Highcharts.CanVGRenderer = {}; | ||
// Dummy object so we can reuse our canvas-tools.js without errors | ||
Highcharts.CanVGRenderer = {}; | ||
/** | ||
* Downloads a script and executes a callback when done. | ||
* @param {String} scriptLocation | ||
* @param {Function} callback | ||
*/ | ||
function getScript(scriptLocation, callback) { | ||
var head = doc.getElementsByTagName('head')[0], | ||
script = doc.createElement('script'); | ||
/** | ||
* Downloads a script and executes a callback when done. | ||
* @param {String} scriptLocation | ||
* @param {Function} callback | ||
*/ | ||
function getScript(scriptLocation, callback) { | ||
var head = doc.getElementsByTagName('head')[0], | ||
script = doc.createElement('script'); | ||
script.type = 'text/javascript'; | ||
script.src = scriptLocation; | ||
script.onload = callback; | ||
script.type = 'text/javascript'; | ||
script.src = scriptLocation; | ||
script.onload = callback; | ||
head.appendChild(script); | ||
} | ||
head.appendChild(script); | ||
} | ||
// Download contents by dataURL/blob | ||
Highcharts.downloadURL = function (dataURL, filename) { | ||
var a = doc.createElement('a'), | ||
windowRef; | ||
// Download contents by dataURL/blob | ||
Highcharts.downloadURL = function(dataURL, filename) { | ||
var a = doc.createElement('a'), | ||
windowRef; | ||
// IE specific blob implementation | ||
if (nav.msSaveOrOpenBlob) { | ||
nav.msSaveOrOpenBlob(dataURL, filename); | ||
return; | ||
} | ||
// IE specific blob implementation | ||
if (nav.msSaveOrOpenBlob) { | ||
nav.msSaveOrOpenBlob(dataURL, filename); | ||
return; | ||
} | ||
// Try HTML5 download attr if supported | ||
if (a.download !== undefined) { | ||
a.href = dataURL; | ||
a.download = filename; // HTML5 download attribute | ||
a.target = '_blank'; | ||
doc.body.appendChild(a); | ||
a.click(); | ||
doc.body.removeChild(a); | ||
} else { | ||
// No download attr, just opening data URI | ||
try { | ||
windowRef = win.open(dataURL, 'chart'); | ||
if (windowRef === undefined || windowRef === null) { | ||
throw 'Failed to open window'; | ||
} | ||
} catch (e) { | ||
// window.open failed, trying location.href | ||
win.location.href = dataURL; | ||
} | ||
} | ||
}; | ||
// Try HTML5 download attr if supported | ||
if (a.download !== undefined) { | ||
a.href = dataURL; | ||
a.download = filename; // HTML5 download attribute | ||
a.target = '_blank'; | ||
doc.body.appendChild(a); | ||
a.click(); | ||
doc.body.removeChild(a); | ||
} else { | ||
// No download attr, just opening data URI | ||
try { | ||
windowRef = win.open(dataURL, 'chart'); | ||
if (windowRef === undefined || windowRef === null) { | ||
throw 'Failed to open window'; | ||
} | ||
} catch (e) { | ||
// window.open failed, trying location.href | ||
win.location.href = dataURL; | ||
} | ||
} | ||
}; | ||
// Get blob URL from SVG code. Falls back to normal data URI. | ||
Highcharts.svgToDataUrl = function (svg) { | ||
var webKit = nav.userAgent.indexOf('WebKit') > -1 && nav.userAgent.indexOf('Chrome') < 0; // Webkit and not chrome | ||
try { | ||
// Safari requires data URI since it doesn't allow navigation to blob URLs | ||
// Firefox has an issue with Blobs and internal references, leading to gradients not working using Blobs (#4550) | ||
if (!webKit && nav.userAgent.toLowerCase().indexOf('firefox') < 0) { | ||
return domurl.createObjectURL(new win.Blob([svg], { type: 'image/svg+xml;charset-utf-16' })); | ||
} | ||
} catch (e) { | ||
// Ignore | ||
} | ||
return 'data:image/svg+xml;charset=UTF-8,' + encodeURIComponent(svg); | ||
}; | ||
// Get blob URL from SVG code. Falls back to normal data URI. | ||
Highcharts.svgToDataUrl = function(svg) { | ||
var webKit = nav.userAgent.indexOf('WebKit') > -1 && nav.userAgent.indexOf('Chrome') < 0; // Webkit and not chrome | ||
try { | ||
// Safari requires data URI since it doesn't allow navigation to blob URLs | ||
// Firefox has an issue with Blobs and internal references, leading to gradients not working using Blobs (#4550) | ||
if (!webKit && nav.userAgent.toLowerCase().indexOf('firefox') < 0) { | ||
return domurl.createObjectURL(new win.Blob([svg], { | ||
type: 'image/svg+xml;charset-utf-16' | ||
})); | ||
} | ||
} catch (e) { | ||
// Ignore | ||
} | ||
return 'data:image/svg+xml;charset=UTF-8,' + encodeURIComponent(svg); | ||
}; | ||
// Get data:URL from image URL | ||
// Pass in callbacks to handle results. finallyCallback is always called at the end of the process. Supplying this callback is optional. | ||
// All callbacks receive four arguments: imageURL, imageType, callbackArgs and scale. callbackArgs is used only by callbacks and can contain whatever. | ||
Highcharts.imageToDataUrl = function (imageURL, imageType, callbackArgs, scale, successCallback, taintedCallback, noCanvasSupportCallback, failedLoadCallback, finallyCallback) { | ||
var img = new win.Image(), | ||
taintedHandler, | ||
loadHandler = function () { | ||
setTimeout(function () { | ||
var canvas = doc.createElement('canvas'), | ||
ctx = canvas.getContext && canvas.getContext('2d'), | ||
dataURL; | ||
try { | ||
if (!ctx) { | ||
noCanvasSupportCallback(imageURL, imageType, callbackArgs, scale); | ||
} else { | ||
canvas.height = img.height * scale; | ||
canvas.width = img.width * scale; | ||
ctx.drawImage(img, 0, 0, canvas.width, canvas.height); | ||
// Get data:URL from image URL | ||
// Pass in callbacks to handle results. finallyCallback is always called at the end of the process. Supplying this callback is optional. | ||
// All callbacks receive four arguments: imageURL, imageType, callbackArgs and scale. callbackArgs is used only by callbacks and can contain whatever. | ||
Highcharts.imageToDataUrl = function(imageURL, imageType, callbackArgs, scale, successCallback, taintedCallback, noCanvasSupportCallback, failedLoadCallback, finallyCallback) { | ||
var img = new win.Image(), | ||
taintedHandler, | ||
loadHandler = function() { | ||
setTimeout(function() { | ||
var canvas = doc.createElement('canvas'), | ||
ctx = canvas.getContext && canvas.getContext('2d'), | ||
dataURL; | ||
try { | ||
if (!ctx) { | ||
noCanvasSupportCallback(imageURL, imageType, callbackArgs, scale); | ||
} else { | ||
canvas.height = img.height * scale; | ||
canvas.width = img.width * scale; | ||
ctx.drawImage(img, 0, 0, canvas.width, canvas.height); | ||
// Now we try to get the contents of the canvas. | ||
try { | ||
dataURL = canvas.toDataURL(imageType); | ||
successCallback(dataURL, imageType, callbackArgs, scale); | ||
} catch (e) { | ||
taintedHandler(imageURL, imageType, callbackArgs, scale); | ||
} | ||
} | ||
} finally { | ||
if (finallyCallback) { | ||
finallyCallback(imageURL, imageType, callbackArgs, scale); | ||
} | ||
} | ||
}, loadEventDeferDelay); // IE bug where image is not always ready despite calling load event. | ||
}, | ||
// Image load failed (e.g. invalid URL) | ||
errorHandler = function () { | ||
failedLoadCallback(imageURL, imageType, callbackArgs, scale); | ||
if (finallyCallback) { | ||
finallyCallback(imageURL, imageType, callbackArgs, scale); | ||
} | ||
}; | ||
// Now we try to get the contents of the canvas. | ||
try { | ||
dataURL = canvas.toDataURL(imageType); | ||
successCallback(dataURL, imageType, callbackArgs, scale); | ||
} catch (e) { | ||
taintedHandler(imageURL, imageType, callbackArgs, scale); | ||
} | ||
} | ||
} finally { | ||
if (finallyCallback) { | ||
finallyCallback(imageURL, imageType, callbackArgs, scale); | ||
} | ||
} | ||
}, loadEventDeferDelay); // IE bug where image is not always ready despite calling load event. | ||
}, | ||
// Image load failed (e.g. invalid URL) | ||
errorHandler = function() { | ||
failedLoadCallback(imageURL, imageType, callbackArgs, scale); | ||
if (finallyCallback) { | ||
finallyCallback(imageURL, imageType, callbackArgs, scale); | ||
} | ||
}; | ||
// This is called on load if the image drawing to canvas failed with a security error. | ||
// We retry the drawing with crossOrigin set to Anonymous. | ||
taintedHandler = function () { | ||
img = new win.Image(); | ||
taintedHandler = taintedCallback; | ||
img.crossOrigin = 'Anonymous'; // Must be set prior to loading image source | ||
img.onload = loadHandler; | ||
img.onerror = errorHandler; | ||
img.src = imageURL; | ||
}; | ||
// This is called on load if the image drawing to canvas failed with a security error. | ||
// We retry the drawing with crossOrigin set to Anonymous. | ||
taintedHandler = function() { | ||
img = new win.Image(); | ||
taintedHandler = taintedCallback; | ||
img.crossOrigin = 'Anonymous'; // Must be set prior to loading image source | ||
img.onload = loadHandler; | ||
img.onerror = errorHandler; | ||
img.src = imageURL; | ||
}; | ||
img.onload = loadHandler; | ||
img.onerror = errorHandler; | ||
img.src = imageURL; | ||
}; | ||
img.onload = loadHandler; | ||
img.onerror = errorHandler; | ||
img.src = imageURL; | ||
}; | ||
// Get data URL to an image of an SVG and call download on it | ||
Highcharts.downloadSVGLocal = function (svg, filename, imageType, scale, failCallback, successCallback) { | ||
var svgurl, | ||
blob, | ||
objectURLRevoke = true, | ||
finallyHandler; | ||
// Get data URL to an image of an SVG and call download on it | ||
Highcharts.downloadSVGLocal = function(svg, filename, imageType, scale, failCallback, successCallback) { | ||
var svgurl, | ||
blob, | ||
objectURLRevoke = true, | ||
finallyHandler, | ||
libURL = Highcharts.getOptions().exporting.libURL; | ||
// Initiate download depending on file type | ||
if (imageType === 'image/svg+xml') { | ||
// SVG download. In this case, we want to use Microsoft specific Blob if available | ||
try { | ||
if (nav.msSaveOrOpenBlob) { | ||
blob = new MSBlobBuilder(); | ||
blob.append(svg); | ||
svgurl = blob.getBlob('image/svg+xml'); | ||
} else { | ||
svgurl = Highcharts.svgToDataUrl(svg); | ||
} | ||
Highcharts.downloadURL(svgurl, filename); | ||
if (successCallback) { | ||
successCallback(); | ||
} | ||
} catch (e) { | ||
failCallback(); | ||
} | ||
} else { | ||
// PNG/JPEG download - create bitmap from SVG | ||
/* | ||
function svgToPdf(svgElement, margin) { | ||
var width = svgElement.width.baseVal.value + 2 * margin; | ||
var height = svgElement.height.baseVal.value + 2 * margin; | ||
var pdf = new win.jsPDF('l', 'pt', [width, height]); // eslint-disable-line new-cap | ||
win.svgElementToPdf(svgElement, pdf, { removeInvalid: true }); | ||
return pdf.output('datauristring'); | ||
} | ||
*/ | ||
svgurl = Highcharts.svgToDataUrl(svg); | ||
finallyHandler = function () { | ||
try { | ||
domurl.revokeObjectURL(svgurl); | ||
} catch (e) { | ||
// Ignore | ||
} | ||
}; | ||
// First, try to get PNG by rendering on canvas | ||
Highcharts.imageToDataUrl(svgurl, imageType, { /* args */ }, scale, function (imageURL) { | ||
// Success | ||
try { | ||
Highcharts.downloadURL(imageURL, filename); | ||
if (successCallback) { | ||
successCallback(); | ||
} | ||
} catch (e) { | ||
failCallback(); | ||
} | ||
}, function () { | ||
// Failed due to tainted canvas | ||
// Create new and untainted canvas | ||
var canvas = doc.createElement('canvas'), | ||
ctx = canvas.getContext('2d'), | ||
imageWidth = svg.match(/^<svg[^>]*width\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * scale, | ||
imageHeight = svg.match(/^<svg[^>]*height\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * scale, | ||
downloadWithCanVG = function () { | ||
ctx.drawSvg(svg, 0, 0, imageWidth, imageHeight); | ||
try { | ||
Highcharts.downloadURL(nav.msSaveOrOpenBlob ? canvas.msToBlob() : canvas.toDataURL(imageType), filename); | ||
if (successCallback) { | ||
successCallback(); | ||
} | ||
} catch (e) { | ||
failCallback(); | ||
} finally { | ||
finallyHandler(); | ||
} | ||
}; | ||
// Initiate download depending on file type | ||
if (imageType === 'image/svg+xml') { | ||
// SVG download. In this case, we want to use Microsoft specific Blob if available | ||
try { | ||
if (nav.msSaveOrOpenBlob) { | ||
blob = new MSBlobBuilder(); | ||
blob.append(svg); | ||
svgurl = blob.getBlob('image/svg+xml'); | ||
} else { | ||
svgurl = Highcharts.svgToDataUrl(svg); | ||
} | ||
Highcharts.downloadURL(svgurl, filename); | ||
if (successCallback) { | ||
successCallback(); | ||
} | ||
} catch (e) { | ||
failCallback(); | ||
} | ||
/*} else if (imageType === 'application/pdf') { | ||
doc.getElementsByTagName('svg')[0].id = 'svgElement'; | ||
// you should set the format dynamically, write [width, height] instead of 'a4' | ||
if (win.jsPDF && win.svgElementToPdf) { | ||
var dummyContainer = doc.createElement('div'); | ||
dummyContainer.innerHTML = svg; | ||
setTimeout(function () { | ||
var data = svgToPdf(dummyContainer.firstChild, 0); | ||
Highcharts.downloadURL(data, filename); | ||
if (successCallback) { | ||
successCallback(); | ||
} | ||
}, 100); | ||
}*/ | ||
} else { | ||
// PNG/JPEG download - create bitmap from SVG | ||
canvas.width = imageWidth; | ||
canvas.height = imageHeight; | ||
if (win.canvg) { | ||
// Use preloaded canvg | ||
downloadWithCanVG(); | ||
} else { | ||
// Must load canVG first | ||
objectURLRevoke = true; // Don't destroy the object URL yet since we are doing things asynchronously. A cleaner solution would be nice, but this will do for now. | ||
getScript(Highcharts.getOptions().global.canvasToolsURL, function () { | ||
downloadWithCanVG(); | ||
}); | ||
} | ||
}, | ||
// No canvas support | ||
failCallback, | ||
// Failed to load image | ||
failCallback, | ||
// Finally | ||
function () { | ||
if (objectURLRevoke) { | ||
finallyHandler(); | ||
} | ||
}); | ||
} | ||
}; | ||
svgurl = Highcharts.svgToDataUrl(svg); | ||
finallyHandler = function() { | ||
try { | ||
domurl.revokeObjectURL(svgurl); | ||
} catch (e) { | ||
// Ignore | ||
} | ||
}; | ||
// First, try to get PNG by rendering on canvas | ||
Highcharts.imageToDataUrl(svgurl, imageType, { /* args */ }, scale, function(imageURL) { | ||
// Success | ||
try { | ||
Highcharts.downloadURL(imageURL, filename); | ||
if (successCallback) { | ||
successCallback(); | ||
} | ||
} catch (e) { | ||
failCallback(); | ||
} | ||
}, function() { | ||
// Failed due to tainted canvas | ||
// Create new and untainted canvas | ||
var canvas = doc.createElement('canvas'), | ||
ctx = canvas.getContext('2d'), | ||
imageWidth = svg.match(/^<svg[^>]*width\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * scale, | ||
imageHeight = svg.match(/^<svg[^>]*height\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * scale, | ||
downloadWithCanVG = function() { | ||
ctx.drawSvg(svg, 0, 0, imageWidth, imageHeight); | ||
try { | ||
Highcharts.downloadURL(nav.msSaveOrOpenBlob ? canvas.msToBlob() : canvas.toDataURL(imageType), filename); | ||
if (successCallback) { | ||
successCallback(); | ||
} | ||
} catch (e) { | ||
failCallback(); | ||
} finally { | ||
finallyHandler(); | ||
} | ||
}; | ||
// Get SVG of chart prepared for client side export. This converts embedded images in the SVG to data URIs. | ||
// The options and chartOptions arguments are passed to the getSVGForExport function. | ||
Highcharts.Chart.prototype.getSVGForLocalExport = function (options, chartOptions, failCallback, successCallback) { | ||
var chart = this, | ||
images, | ||
imagesEmbedded = 0, | ||
chartCopyContainer, | ||
el, | ||
i, | ||
l, | ||
// Success handler, we converted image to base64! | ||
embeddedSuccess = function (imageURL, imageType, callbackArgs) { | ||
++imagesEmbedded; | ||
canvas.width = imageWidth; | ||
canvas.height = imageHeight; | ||
if (win.canvg) { | ||
// Use preloaded canvg | ||
downloadWithCanVG(); | ||
} else { | ||
// Must load canVG first | ||
objectURLRevoke = true; // Don't destroy the object URL yet since we are doing things asynchronously. A cleaner solution would be nice, but this will do for now. | ||
libURL = libURL.substr[-1] !== '/' ? libURL + '/' : libURL; // Allow libURL to end with or without fordward slash | ||
getScript(libURL + 'rgbcolor.js', function() { // Get RGBColor.js first | ||
getScript(libURL + 'canvg.js', function() { | ||
downloadWithCanVG(); | ||
}); | ||
}); | ||
} | ||
}, | ||
// No canvas support | ||
failCallback, | ||
// Failed to load image | ||
failCallback, | ||
// Finally | ||
function() { | ||
if (objectURLRevoke) { | ||
finallyHandler(); | ||
} | ||
}); | ||
} | ||
}; | ||
// Change image href in chart copy | ||
callbackArgs.imageElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', imageURL); | ||
// Get SVG of chart prepared for client side export. This converts embedded images in the SVG to data URIs. | ||
// The options and chartOptions arguments are passed to the getSVGForExport function. | ||
Highcharts.Chart.prototype.getSVGForLocalExport = function(options, chartOptions, failCallback, successCallback) { | ||
var chart = this, | ||
images, | ||
imagesEmbedded = 0, | ||
chartCopyContainer, | ||
el, | ||
i, | ||
l, | ||
// Success handler, we converted image to base64! | ||
embeddedSuccess = function(imageURL, imageType, callbackArgs) { | ||
++imagesEmbedded; | ||
// When done with last image we have our SVG | ||
if (imagesEmbedded === images.length) { | ||
successCallback(chart.sanitizeSVG(chartCopyContainer.innerHTML)); | ||
} | ||
}; | ||
// Change image href in chart copy | ||
callbackArgs.imageElement.setAttributeNS('http://www.w3.org/1999/xlink', 'href', imageURL); | ||
// Hook into getSVG to get a copy of the chart copy's container | ||
Highcharts.wrap(Highcharts.Chart.prototype, 'getChartHTML', function (proceed) { | ||
chartCopyContainer = this.container.cloneNode(true); | ||
return proceed.apply(this, Array.prototype.slice.call(arguments, 1)); | ||
}); | ||
// When done with last image we have our SVG | ||
if (imagesEmbedded === images.length) { | ||
successCallback(chart.sanitizeSVG(chartCopyContainer.innerHTML)); | ||
} | ||
}; | ||
// Trigger hook to get chart copy | ||
chart.getSVGForExport(options, chartOptions); | ||
images = chartCopyContainer.getElementsByTagName('image'); | ||
// Hook into getSVG to get a copy of the chart copy's container | ||
Highcharts.wrap(Highcharts.Chart.prototype, 'getChartHTML', function(proceed) { | ||
chartCopyContainer = this.container.cloneNode(true); | ||
return proceed.apply(this, Array.prototype.slice.call(arguments, 1)); | ||
}); | ||
try { | ||
// If there are no images to embed, the SVG is okay now. | ||
if (!images.length) { | ||
successCallback(chart.sanitizeSVG(chartCopyContainer.innerHTML)); // Use SVG of chart copy | ||
return; | ||
} | ||
// Trigger hook to get chart copy | ||
chart.getSVGForExport(options, chartOptions); | ||
images = chartCopyContainer.getElementsByTagName('image'); | ||
// Go through the images we want to embed | ||
for (i = 0, l = images.length; i < l; ++i) { | ||
el = images[i]; | ||
Highcharts.imageToDataUrl(el.getAttributeNS('http://www.w3.org/1999/xlink', 'href'), 'image/png', { imageElement: el }, options.scale, | ||
embeddedSuccess, | ||
// Tainted canvas | ||
failCallback, | ||
// No canvas support | ||
failCallback, | ||
// Failed to load source | ||
failCallback | ||
); | ||
} | ||
} catch (e) { | ||
failCallback(); | ||
} | ||
}; | ||
try { | ||
// If there are no images to embed, the SVG is okay now. | ||
if (!images.length) { | ||
successCallback(chart.sanitizeSVG(chartCopyContainer.innerHTML)); // Use SVG of chart copy | ||
return; | ||
} | ||
/** | ||
* Add a new method to the Chart object to perform a local download | ||
*/ | ||
Highcharts.Chart.prototype.exportChartLocal = function (exportingOptions, chartOptions) { | ||
var chart = this, | ||
options = Highcharts.merge(chart.options.exporting, exportingOptions), | ||
imageType = options && options.type || 'image/png', | ||
fallbackToExportServer = function () { | ||
if (options.fallbackToExportServer === false) { | ||
if (options.error) { | ||
options.error(); | ||
} else { | ||
throw 'Fallback to export server disabled'; | ||
} | ||
} else { | ||
chart.exportChart(options); | ||
} | ||
}, | ||
svgSuccess = function (svg) { | ||
var filename = (options.filename || 'chart') + '.' + (imageType === 'image/svg+xml' ? 'svg' : imageType.split('/')[1]); | ||
Highcharts.downloadSVGLocal(svg, filename, imageType, options.scale, fallbackToExportServer); | ||
}; | ||
// Go through the images we want to embed | ||
for (i = 0, l = images.length; i < l; ++i) { | ||
el = images[i]; | ||
Highcharts.imageToDataUrl(el.getAttributeNS('http://www.w3.org/1999/xlink', 'href'), 'image/png', { | ||
imageElement: el | ||
}, options.scale, | ||
embeddedSuccess, | ||
// Tainted canvas | ||
failCallback, | ||
// No canvas support | ||
failCallback, | ||
// Failed to load source | ||
failCallback | ||
); | ||
} | ||
} catch (e) { | ||
failCallback(); | ||
} | ||
}; | ||
// If we have embedded images and are exporting to JPEG/PNG, Microsoft browsers won't handle it, so fall back | ||
if (isMSBrowser && imageType !== 'image/svg+xml' && chart.container.getElementsByTagName('image').length) { | ||
fallbackToExportServer(); | ||
return; | ||
} | ||
/** | ||
* Add a new method to the Chart object to perform a local download | ||
*/ | ||
Highcharts.Chart.prototype.exportChartLocal = function(exportingOptions, chartOptions) { | ||
var chart = this, | ||
options = Highcharts.merge(chart.options.exporting, exportingOptions), | ||
imageType = options && options.type || 'image/png', | ||
fallbackToExportServer = function() { | ||
if (options.fallbackToExportServer === false) { | ||
if (options.error) { | ||
options.error(); | ||
} else { | ||
throw 'Fallback to export server disabled'; | ||
} | ||
} else { | ||
chart.exportChart(options); | ||
} | ||
}, | ||
svgSuccess = function(svg) { | ||
var filename = (options.filename || 'chart') + '.' + (imageType === 'image/svg+xml' ? 'svg' : imageType.split('/')[1]); | ||
Highcharts.downloadSVGLocal(svg, filename, imageType, options.scale, fallbackToExportServer); | ||
}; | ||
chart.getSVGForLocalExport(options, chartOptions, fallbackToExportServer, svgSuccess); | ||
}; | ||
// If we have embedded images and are exporting to JPEG/PNG, Microsoft browsers won't handle it, so fall back | ||
if (isMSBrowser && imageType !== 'image/svg+xml' && chart.container.getElementsByTagName('image').length) { | ||
fallbackToExportServer(); | ||
return; | ||
} | ||
// Extend the default options to use the local exporter logic | ||
Highcharts.getOptions().exporting.buttons.contextButton.menuItems = [{ | ||
textKey: 'printChart', | ||
onclick: function () { | ||
this.print(); | ||
} | ||
}, { | ||
separator: true | ||
}, { | ||
textKey: 'downloadPNG', | ||
onclick: function () { | ||
this.exportChartLocal(); | ||
} | ||
}, { | ||
textKey: 'downloadJPEG', | ||
onclick: function () { | ||
this.exportChartLocal({ | ||
type: 'image/jpeg' | ||
}); | ||
} | ||
}, { | ||
textKey: 'downloadSVG', | ||
onclick: function () { | ||
this.exportChartLocal({ | ||
type: 'image/svg+xml' | ||
}); | ||
} | ||
}]; | ||
chart.getSVGForLocalExport(options, chartOptions, fallbackToExportServer, svgSuccess); | ||
}; | ||
// Extend the default options to use the local exporter logic | ||
merge(true, Highcharts.getOptions().exporting, { | ||
libURL: 'http://code.highcharts.com@product.cdnpath@/5.0.0/lib/', | ||
buttons: { | ||
contextButton: { | ||
menuItems: [{ | ||
textKey: 'printChart', | ||
onclick: function() { | ||
this.print(); | ||
} | ||
}, { | ||
separator: true | ||
}, { | ||
textKey: 'downloadPNG', | ||
onclick: function() { | ||
this.exportChartLocal(); | ||
} | ||
}, { | ||
textKey: 'downloadJPEG', | ||
onclick: function() { | ||
this.exportChartLocal({ | ||
type: 'image/jpeg' | ||
}); | ||
} | ||
}, { | ||
textKey: 'downloadSVG', | ||
onclick: function() { | ||
this.exportChartLocal({ | ||
type: 'image/svg+xml' | ||
}); | ||
} | ||
} | ||
/*, { | ||
textKey: 'downloadPDF', | ||
onclick: function () { | ||
this.exportChartLocal({ | ||
type: 'application/pdf' | ||
}); | ||
} | ||
}*/ | ||
] | ||
} | ||
} | ||
}); | ||
}(Highcharts)); | ||
})); |
@@ -1,11 +0,18 @@ | ||
(function(l){typeof module==="object"&&module.exports?module.exports=l:l(Highcharts)})(function(l){function q(d,b,a,k,c,e){d=(e-b)*(a-d)-(k-b)*(c-d);return d>0?!0:d<0?!1:!0}function r(d,b,a,k,c,e,f,h){return q(d,b,c,e,f,h)!==q(a,k,c,e,f,h)&&q(d,b,a,k,c,e)!==q(d,b,a,k,f,h)}function u(d,b,a,k,c,e,f,h){return r(d,b,d+a,b,c,e,f,h)||r(d+a,b,d+a,b+k,c,e,f,h)||r(d,b+k,d+a,b+k,c,e,f,h)||r(d,b,d,b+k,c,e,f,h)}function v(d){var b=this;d.call(b);clearTimeout(b.seriesLabelTimer);b.seriesLabelTimer=setTimeout(function(){b.boxesToAvoid= | ||
[];s(b.series,function(a){var d=a.options.label;if(d.enabled&&a.visible&&(a.graph||a.area))a.interpolatedPoints=a.getPointsOnGraph(),s(d.boxesToAvoid||[],function(a){b.boxesToAvoid.push(a)})});s(b.series,function(a){function d(a,b,c){return a>l&&a<=l+p-c.width&&b>=i&&b<=i+n-c.height}var c,e,f,h=[],j,o,l=(c=b.inverted)?a.yAxis.pos:a.xAxis.pos,i=c?a.xAxis.pos:a.yAxis.pos,p=b.inverted?a.yAxis.len:a.xAxis.len,n=b.inverted?a.xAxis.len:a.yAxis.len,g=a.interpolatedPoints;if(a.visible&&g){if(!a.labelBySeries)a.labelBySeries= | ||
b.renderer.label(a.name,0,-9999,"connector").css(z({color:a.color},a.options.label.styles)).attr({padding:0,opacity:0,stroke:a.color,"stroke-width":1}).add(a.group).animate({opacity:1},{duration:200});c=a.labelBySeries.getBBox();c.width=Math.round(c.width);for(o=g.length-1;o>0;o-=1)e=g[o].chartX+m,f=g[o].chartY-c.height-m,d(e,f,c)&&(j=a.checkClearPoint(e,f,c)),j&&h.push(j),e=g[o].chartX+m,f=g[o].chartY+m,d(e,f,c)&&(j=a.checkClearPoint(e,f,c)),j&&h.push(j),e=g[o].chartX-c.width-m,f=g[o].chartY+m,d(e, | ||
f,c)&&(j=a.checkClearPoint(e,f,c)),j&&h.push(j),e=g[o].chartX-c.width-m,f=g[o].chartY-c.height-m,d(e,f,c)&&(j=a.checkClearPoint(e,f,c)),j&&h.push(j);if(!h.length)for(e=l+p-c.width;e>=l;e-=16)for(f=i;f<i+n-c.height;f+=16)(j=a.checkClearPoint(e,f,c,!0))&&h.push(j);if(h.length)h.sort(function(a,b){return b.weight-a.weight}),j=h[0],b.boxesToAvoid.push({left:j.x,right:j.x+c.width,top:j.y,bottom:j.y+c.height}),(Math.round(j.x)!==Math.round(a.labelBySeries.x)||Math.round(j.y)!==Math.round(a.labelBySeries.y))&& | ||
a.labelBySeries.attr({x:j.x-l,y:j.y-i,anchorX:j.connectorPoint&&j.connectorPoint.plotX,anchorY:j.connectorPoint&&j.connectorPoint.plotY,opacity:0}).animate({opacity:1});else if(a.labelBySeries)a.labelBySeries=a.labelBySeries.destroy()}})},350)}var m=3,w=l.wrap,s=l.each,z=l.extend,t=l.isNumber,x=l.Series,A=l.SVGRenderer,y=l.Chart;l.setOptions({plotOptions:{series:{label:{enabled:!0,connectorAllowed:!0,connectorNeighbourDistance:24,styles:{fontWeight:"bold"}}}}});A.prototype.symbols.connector=function(d, | ||
b,a,k,c){var e=c&&c.anchorX,c=c&&c.anchorY,f,h,j=a/2;t(e)&&t(c)&&(f=["M",e,c],h=b-c,h<0&&(h=-k-h),h<a&&(j=e<d+a/2?h:a-h),c>b+k?f.push("L",d+j,b+k):c<b?f.push("L",d+j,b):e<d?f.push("L",d,b+k/2):e>d+a&&f.push("L",d+a,b+k/2));return f||[]};x.prototype.getPointsOnGraph=function(){var d=this.points,b,a,k=[],c,e,f,h;e=this.graph||this.area;f=e.element;var j=(b=this.chart.inverted)?this.yAxis.pos:this.xAxis.pos,l=b?this.xAxis.pos:this.yAxis.pos;if(this.getPointSpline&&f.getPointAtLength){e.toD&&(a=e.attr("d"), | ||
e.attr({d:e.toD}));h=f.getTotalLength();for(c=0;c<h;c+=16)b=f.getPointAtLength(c),k.push({chartX:j+b.x,chartY:l+b.y,plotX:b.x,plotY:b.y});a&&e.attr({d:a});b=d[d.length-1];b.chartX=j+b.plotX;b.chartY=l+b.plotY;k.push(b)}else{h=d.length;for(c=0;c<h;c+=1){b=d[c];a=d[c-1];b.chartX=j+b.plotX;b.chartY=l+b.plotY;if(c>0&&(e=Math.abs(b.chartX-a.chartX),f=Math.abs(b.chartY-a.chartY),e=Math.max(e,f),e>16)){e=Math.ceil(e/16);for(f=1;f<e;f+=1)k.push({chartX:a.chartX+(b.chartX-a.chartX)*(f/e),chartY:a.chartY+(b.chartY- | ||
a.chartY)*(f/e),plotX:a.plotX+(b.plotX-a.plotX)*(f/e),plotY:a.plotY+(b.plotY-a.plotY)*(f/e)})}t(b.plotY)&&k.push(b)}}return k};x.prototype.checkClearPoint=function(d,b,a,k){function c(a,b){return!(b.left>a.right||b.right<a.left||b.top>a.bottom||b.bottom<a.top)}var e=Number.MAX_VALUE,f=Number.MAX_VALUE,h,j,l=this.options.label.connectorAllowed,m=this.chart,i,p,n,g;for(n=0;n<m.boxesToAvoid.length;n+=1)if(c(m.boxesToAvoid[n],{left:d,right:d+a.width,top:b,bottom:b+a.height}))return!1;for(n=0;n<m.series.length;n+= | ||
1)if(h=m.series[n],i=h.interpolatedPoints,h.visible&&i){for(g=1;g<i.length;g+=1){if(u(d,b,a.width,a.height,i[g-1].chartX,i[g-1].chartY,i[g].chartX,i[g].chartY))return!1;this===h&&!p&&k&&(p=u(d-16,b-16,a.width+32,a.height+32,i[g-1].chartX,i[g-1].chartY,i[g].chartX,i[g].chartY));this!==h&&(e=Math.min(e,Math.pow(d+a.width/2-i[g].chartX,2)+Math.pow(b+a.height/2-i[g].chartY,2),Math.pow(d-i[g].chartX,2)+Math.pow(b-i[g].chartY,2),Math.pow(d+a.width-i[g].chartX,2)+Math.pow(b-i[g].chartY,2),Math.pow(d+a.width- | ||
i[g].chartX,2)+Math.pow(b+a.height-i[g].chartY,2),Math.pow(d-i[g].chartX,2)+Math.pow(b+a.height-i[g].chartY,2)))}if(l&&this===h&&(k&&!p||e<Math.pow(this.options.label.connectorNeighbourDistance,2))){for(g=1;g<i.length;g+=1)h=Math.min(Math.pow(d+a.width/2-i[g].chartX,2)+Math.pow(b+a.height/2-i[g].chartY,2),Math.pow(d-i[g].chartX,2)+Math.pow(b-i[g].chartY,2),Math.pow(d+a.width-i[g].chartX,2)+Math.pow(b-i[g].chartY,2),Math.pow(d+a.width-i[g].chartX,2)+Math.pow(b+a.height-i[g].chartY,2),Math.pow(d-i[g].chartX, | ||
2)+Math.pow(b+a.height-i[g].chartY,2)),h<f&&(f=h,j=i[g]);p=!0}}return!k||p?{x:d,y:b,weight:e-(j?f:0),connectorPoint:j}:!1};w(y.prototype,"render",v);w(y.prototype,"redraw",v)}); | ||
/* | ||
Highcharts JS v5.0.0 (2016-09-29) | ||
(c) 2009-2016 Torstein Honsi | ||
License: www.highcharts.com/license | ||
*/ | ||
(function(t){"object"===typeof module&&module.exports?module.exports=t:t(Highcharts)})(function(t){(function(u){function t(d,b,a,m,c,e){d=(e-b)*(a-d)-(m-b)*(c-d);return 0<d?!0:0>d?!1:!0}function v(d,b,a,m,c,e,f,l){return t(d,b,c,e,f,l)!==t(a,m,c,e,f,l)&&t(d,b,a,m,c,e)!==t(d,b,a,m,f,l)}function y(d,b,a,m,c,e,f,l){return v(d,b,d+a,b,c,e,f,l)||v(d+a,b,d+a,b+m,c,e,f,l)||v(d,b+m,d+a,b+m,c,e,f,l)||v(d,b,d,b+m,c,e,f,l)}function z(d){var b=this;d.call(b);clearTimeout(b.seriesLabelTimer);b.seriesLabelTimer= | ||
setTimeout(function(){b.boxesToAvoid=[];w(b.series,function(a){var d=a.options.label;d.enabled&&a.visible&&(a.graph||a.area)&&(a.interpolatedPoints=a.getPointsOnGraph(),w(d.boxesToAvoid||[],function(a){b.boxesToAvoid.push(a)}))});w(b.series,function(a){function d(a,b,c){return a>p&&a<=p+r-c.width&&b>=g&&b<=g+h-c.height}var c,e,f,l=[],k,n,p=(c=b.inverted)?a.yAxis.pos:a.xAxis.pos,g=c?a.xAxis.pos:a.yAxis.pos,r=b.inverted?a.yAxis.len:a.xAxis.len,h=b.inverted?a.xAxis.len:a.yAxis.len,q=a.interpolatedPoints; | ||
if(a.visible&&q){a.labelBySeries||(a.labelBySeries=b.renderer.label(a.name,0,-9999,"connector").css(D({color:a.color},a.options.label.styles)).attr({padding:0,opacity:0,stroke:a.color,"stroke-width":1}).add(a.group).animate({opacity:1},{duration:200}));c=a.labelBySeries.getBBox();c.width=Math.round(c.width);for(n=q.length-1;0<n;--n)e=q[n].chartX+3,f=q[n].chartY-c.height-3,d(e,f,c)&&(k=a.checkClearPoint(e,f,c)),k&&l.push(k),e=q[n].chartX+3,f=q[n].chartY+3,d(e,f,c)&&(k=a.checkClearPoint(e,f,c)),k&& | ||
l.push(k),e=q[n].chartX-c.width-3,f=q[n].chartY+3,d(e,f,c)&&(k=a.checkClearPoint(e,f,c)),k&&l.push(k),e=q[n].chartX-c.width-3,f=q[n].chartY-c.height-3,d(e,f,c)&&(k=a.checkClearPoint(e,f,c)),k&&l.push(k);if(!l.length)for(e=p+r-c.width;e>=p;e-=16)for(f=g;f<g+h-c.height;f+=16)(k=a.checkClearPoint(e,f,c,!0))&&l.push(k);l.length?(l.sort(function(a,b){return b.weight-a.weight}),k=l[0],b.boxesToAvoid.push({left:k.x,right:k.x+c.width,top:k.y,bottom:k.y+c.height}),Math.round(k.x)===Math.round(a.labelBySeries.x)&& | ||
Math.round(k.y)===Math.round(a.labelBySeries.y)||a.labelBySeries.attr({x:k.x-p,y:k.y-g,anchorX:k.connectorPoint&&k.connectorPoint.plotX,anchorY:k.connectorPoint&&k.connectorPoint.plotY,opacity:0}).animate({opacity:1})):a.labelBySeries&&(a.labelBySeries=a.labelBySeries.destroy())}})},350)}var A=u.wrap,w=u.each,D=u.extend,x=u.isNumber,B=u.Series,E=u.SVGRenderer,C=u.Chart;u.setOptions({plotOptions:{series:{label:{enabled:!0,connectorAllowed:!0,connectorNeighbourDistance:24,styles:{fontWeight:"bold"}}}}}); | ||
E.prototype.symbols.connector=function(d,b,a,m,c){var e=c&&c.anchorX;c=c&&c.anchorY;var f,l,k=a/2;x(e)&&x(c)&&(f=["M",e,c],l=b-c,0>l&&(l=-m-l),l<a&&(k=e<d+a/2?l:a-l),c>b+m?f.push("L",d+k,b+m):c<b?f.push("L",d+k,b):e<d?f.push("L",d,b+m/2):e>d+a&&f.push("L",d+a,b+m/2));return f||[]};B.prototype.getPointsOnGraph=function(){var d=this.points,b,a,m=[],c,e,f,l;e=this.graph||this.area;f=e.element;var k=(b=this.chart.inverted)?this.yAxis.pos:this.xAxis.pos,n=b?this.xAxis.pos:this.yAxis.pos;if(this.getPointSpline&& | ||
f.getPointAtLength){e.toD&&(a=e.attr("d"),e.attr({d:e.toD}));l=f.getTotalLength();for(c=0;c<l;c+=16)b=f.getPointAtLength(c),m.push({chartX:k+b.x,chartY:n+b.y,plotX:b.x,plotY:b.y});a&&e.attr({d:a});b=d[d.length-1];b.chartX=k+b.plotX;b.chartY=n+b.plotY;m.push(b)}else for(l=d.length,c=0;c<l;c+=1){b=d[c];a=d[c-1];b.chartX=k+b.plotX;b.chartY=n+b.plotY;if(0<c&&(e=Math.abs(b.chartX-a.chartX),f=Math.abs(b.chartY-a.chartY),e=Math.max(e,f),16<e))for(e=Math.ceil(e/16),f=1;f<e;f+=1)m.push({chartX:a.chartX+f/ | ||
e*(b.chartX-a.chartX),chartY:a.chartY+f/e*(b.chartY-a.chartY),plotX:a.plotX+f/e*(b.plotX-a.plotX),plotY:a.plotY+f/e*(b.plotY-a.plotY)});x(b.plotY)&&m.push(b)}return m};B.prototype.checkClearPoint=function(d,b,a,m){var c=Number.MAX_VALUE,e=Number.MAX_VALUE,f,l,k=this.options.label.connectorAllowed,n=this.chart,p,g,r,h;for(r=0;r<n.boxesToAvoid.length;r+=1){g=n.boxesToAvoid[r];h=d+a.width;p=b;var q=b+a.height;if(!(d>g.right||h<g.left||p>g.bottom||q<g.top))return!1}for(r=0;r<n.series.length;r+=1)if(p= | ||
n.series[r],g=p.interpolatedPoints,p.visible&&g){for(h=1;h<g.length;h+=1){if(y(d,b,a.width,a.height,g[h-1].chartX,g[h-1].chartY,g[h].chartX,g[h].chartY))return!1;this===p&&!f&&m&&(f=y(d-16,b-16,a.width+32,a.height+32,g[h-1].chartX,g[h-1].chartY,g[h].chartX,g[h].chartY));this!==p&&(c=Math.min(c,Math.pow(d+a.width/2-g[h].chartX,2)+Math.pow(b+a.height/2-g[h].chartY,2),Math.pow(d-g[h].chartX,2)+Math.pow(b-g[h].chartY,2),Math.pow(d+a.width-g[h].chartX,2)+Math.pow(b-g[h].chartY,2),Math.pow(d+a.width-g[h].chartX, | ||
2)+Math.pow(b+a.height-g[h].chartY,2),Math.pow(d-g[h].chartX,2)+Math.pow(b+a.height-g[h].chartY,2)))}if(k&&this===p&&(m&&!f||c<Math.pow(this.options.label.connectorNeighbourDistance,2))){for(h=1;h<g.length;h+=1)f=Math.min(Math.pow(d+a.width/2-g[h].chartX,2)+Math.pow(b+a.height/2-g[h].chartY,2),Math.pow(d-g[h].chartX,2)+Math.pow(b-g[h].chartY,2),Math.pow(d+a.width-g[h].chartX,2)+Math.pow(b-g[h].chartY,2),Math.pow(d+a.width-g[h].chartX,2)+Math.pow(b+a.height-g[h].chartY,2),Math.pow(d-g[h].chartX,2)+ | ||
Math.pow(b+a.height-g[h].chartY,2)),f<e&&(e=f,l=g[h]);f=!0}}return!m||f?{x:d,y:b,weight:c-(l?e:0),connectorPoint:l}:!1};A(C.prototype,"render",z);A(C.prototype,"redraw",z)})(t)}); |
/** | ||
* EXPERIMENTAL Highcharts module to place labels next to a series in a natural position. | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* | ||
* TODO: | ||
* - add column support (box collision detection, boxesToAvoid logic) | ||
* - other series types, area etc. | ||
* - avoid data labels, when data labels above, show series label below. | ||
* - add more options (connector, format, formatter) | ||
* | ||
* http://jsfiddle.net/highcharts/L2u9rpwr/ | ||
* http://jsfiddle.net/highcharts/y5A37/ | ||
* http://jsfiddle.net/highcharts/264Nm/ | ||
* http://jsfiddle.net/highcharts/y5A37/ | ||
* (c) 2009-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
/* eslint indent: [2, 4] */ | ||
(function (factory) { | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
@@ -22,499 +14,532 @@ module.exports = factory; | ||
} | ||
}(function (H) { | ||
}(function(Highcharts) { | ||
(function(H) { | ||
/** | ||
* (c) 2009-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
/** | ||
* EXPERIMENTAL Highcharts module to place labels next to a series in a natural position. | ||
* | ||
* TODO: | ||
* - add column support (box collision detection, boxesToAvoid logic) | ||
* - other series types, area etc. | ||
* - avoid data labels, when data labels above, show series label below. | ||
* - add more options (connector, format, formatter) | ||
* | ||
* http://jsfiddle.net/highcharts/L2u9rpwr/ | ||
* http://jsfiddle.net/highcharts/y5A37/ | ||
* http://jsfiddle.net/highcharts/264Nm/ | ||
* http://jsfiddle.net/highcharts/y5A37/ | ||
*/ | ||
var labelDistance = 3, | ||
wrap = H.wrap, | ||
each = H.each, | ||
extend = H.extend, | ||
isNumber = H.isNumber, | ||
Series = H.Series, | ||
SVGRenderer = H.SVGRenderer, | ||
Chart = H.Chart; | ||
'use strict'; | ||
H.setOptions({ | ||
plotOptions: { | ||
series: { | ||
label: { | ||
enabled: true, | ||
// Allow labels to be placed distant to the graph if necessary, and | ||
// draw a connector line to the graph | ||
connectorAllowed: true, | ||
connectorNeighbourDistance: 24, // If the label is closer than this to a neighbour graph, draw a connector | ||
styles: { | ||
fontWeight: 'bold' | ||
var labelDistance = 3, | ||
wrap = H.wrap, | ||
each = H.each, | ||
extend = H.extend, | ||
isNumber = H.isNumber, | ||
Series = H.Series, | ||
SVGRenderer = H.SVGRenderer, | ||
Chart = H.Chart; | ||
H.setOptions({ | ||
plotOptions: { | ||
series: { | ||
label: { | ||
enabled: true, | ||
// Allow labels to be placed distant to the graph if necessary, and | ||
// draw a connector line to the graph | ||
connectorAllowed: true, | ||
connectorNeighbourDistance: 24, // If the label is closer than this to a neighbour graph, draw a connector | ||
styles: { | ||
fontWeight: 'bold' | ||
} | ||
// boxesToAvoid: [] | ||
} | ||
// boxesToAvoid: [] | ||
} | ||
} | ||
}); | ||
/** | ||
* Counter-clockwise, part of the fast line intersection logic | ||
*/ | ||
function ccw(x1, y1, x2, y2, x3, y3) { | ||
var cw = ((y3 - y1) * (x2 - x1)) - ((y2 - y1) * (x3 - x1)); | ||
return cw > 0 ? true : cw < 0 ? false : true; | ||
} | ||
}); | ||
/** | ||
* Counter-clockwise, part of the fast line intersection logic | ||
*/ | ||
function ccw(x1, y1, x2, y2, x3, y3) { | ||
var cw = ((y3 - y1) * (x2 - x1)) - ((y2 - y1) * (x3 - x1)); | ||
return cw > 0 ? true : cw < 0 ? false : true; | ||
} | ||
/** | ||
* Detect if two lines intersect | ||
*/ | ||
function intersectLine(x1, y1, x2, y2, x3, y3, x4, y4) { | ||
return ccw(x1, y1, x3, y3, x4, y4) !== ccw(x2, y2, x3, y3, x4, y4) && | ||
ccw(x1, y1, x2, y2, x3, y3) !== ccw(x1, y1, x2, y2, x4, y4); | ||
} | ||
/** | ||
* Detect if two lines intersect | ||
*/ | ||
function intersectLine(x1, y1, x2, y2, x3, y3, x4, y4) { | ||
return ccw(x1, y1, x3, y3, x4, y4) !== ccw(x2, y2, x3, y3, x4, y4) && | ||
ccw(x1, y1, x2, y2, x3, y3) !== ccw(x1, y1, x2, y2, x4, y4); | ||
} | ||
/** | ||
* Detect if a box intersects with a line | ||
*/ | ||
function boxIntersectLine(x, y, w, h, x1, y1, x2, y2) { | ||
return ( | ||
intersectLine(x, y, x + w, y, x1, y1, x2, y2) || // top of label | ||
intersectLine(x + w, y, x + w, y + h, x1, y1, x2, y2) || // right of label | ||
intersectLine(x, y + h, x + w, y + h, x1, y1, x2, y2) || // bottom of label | ||
intersectLine(x, y, x, y + h, x1, y1, x2, y2) // left of label | ||
); | ||
} | ||
/** | ||
* Detect if a box intersects with a line | ||
*/ | ||
function boxIntersectLine(x, y, w, h, x1, y1, x2, y2) { | ||
return ( | ||
intersectLine(x, y, x + w, y, x1, y1, x2, y2) || // top of label | ||
intersectLine(x + w, y, x + w, y + h, x1, y1, x2, y2) || // right of label | ||
intersectLine(x, y + h, x + w, y + h, x1, y1, x2, y2) || // bottom of label | ||
intersectLine(x, y, x, y + h, x1, y1, x2, y2) // left of label | ||
); | ||
} | ||
/** | ||
* General symbol definition for labels with connector | ||
*/ | ||
SVGRenderer.prototype.symbols.connector = function(x, y, w, h, options) { | ||
var anchorX = options && options.anchorX, | ||
anchorY = options && options.anchorY, | ||
path, | ||
yOffset, | ||
lateral = w / 2; | ||
/** | ||
* General symbol definition for labels with connector | ||
*/ | ||
SVGRenderer.prototype.symbols.connector = function (x, y, w, h, options) { | ||
var anchorX = options && options.anchorX, | ||
anchorY = options && options.anchorY, | ||
path, | ||
yOffset, | ||
lateral = w / 2; | ||
if (isNumber(anchorX) && isNumber(anchorY)) { | ||
if (isNumber(anchorX) && isNumber(anchorY)) { | ||
path = ['M', anchorX, anchorY]; | ||
path = ['M', anchorX, anchorY]; | ||
// Prefer 45 deg connectors | ||
yOffset = y - anchorY; | ||
if (yOffset < 0) { | ||
yOffset = -h - yOffset; | ||
} | ||
if (yOffset < w) { | ||
lateral = anchorX < x + (w / 2) ? yOffset : w - yOffset; | ||
} | ||
// Anchor below label | ||
if (anchorY > y + h) { | ||
path.push('L', x + lateral, y + h); | ||
// Prefer 45 deg connectors | ||
yOffset = y - anchorY; | ||
if (yOffset < 0) { | ||
yOffset = -h - yOffset; | ||
} | ||
if (yOffset < w) { | ||
lateral = anchorX < x + (w / 2) ? yOffset : w - yOffset; | ||
} | ||
// Anchor above label | ||
} else if (anchorY < y) { | ||
path.push('L', x + lateral, y); | ||
// Anchor below label | ||
if (anchorY > y + h) { | ||
path.push('L', x + lateral, y + h); | ||
// Anchor left of label | ||
} else if (anchorX < x) { | ||
path.push('L', x, y + h / 2); | ||
// Anchor right of label | ||
} else if (anchorX > x + w) { | ||
path.push('L', x + w, y + h / 2); | ||
} | ||
} | ||
return path || []; | ||
}; | ||
// Anchor above label | ||
} else if (anchorY < y) { | ||
path.push('L', x + lateral, y); | ||
/** | ||
* Points to avoid. In addition to actual data points, the label should avoid | ||
* interpolated positions. | ||
*/ | ||
Series.prototype.getPointsOnGraph = function () { | ||
var distance = 16, | ||
points = this.points, | ||
point, | ||
last, | ||
interpolated = [], | ||
i, | ||
deltaX, | ||
deltaY, | ||
delta, | ||
len, | ||
n, | ||
j, | ||
d, | ||
graph = this.graph || this.area, | ||
node = graph.element, | ||
inverted = this.chart.inverted, | ||
paneLeft = inverted ? this.yAxis.pos : this.xAxis.pos, | ||
paneTop = inverted ? this.xAxis.pos : this.yAxis.pos; | ||
// Anchor left of label | ||
} else if (anchorX < x) { | ||
path.push('L', x, y + h / 2); | ||
// For splines, get the point at length (possible caveat: peaks are not correctly detected) | ||
if (this.getPointSpline && node.getPointAtLength) { | ||
// If it is animating towards a path definition, use that briefly, and reset | ||
if (graph.toD) { | ||
d = graph.attr('d'); | ||
graph.attr({ d: graph.toD }); | ||
// Anchor right of label | ||
} else if (anchorX > x + w) { | ||
path.push('L', x + w, y + h / 2); | ||
} | ||
} | ||
len = node.getTotalLength(); | ||
for (i = 0; i < len; i += distance) { | ||
point = node.getPointAtLength(i); | ||
interpolated.push({ | ||
chartX: paneLeft + point.x, | ||
chartY: paneTop + point.y, | ||
plotX: point.x, | ||
plotY: point.y | ||
}); | ||
} | ||
if (d) { | ||
graph.attr({ d: d }); | ||
} | ||
// Last point | ||
point = points[points.length - 1]; | ||
point.chartX = paneLeft + point.plotX; | ||
point.chartY = paneTop + point.plotY; | ||
interpolated.push(point); | ||
return path || []; | ||
}; | ||
// Interpolate | ||
} else { | ||
len = points.length; | ||
for (i = 0; i < len; i += 1) { | ||
/** | ||
* Points to avoid. In addition to actual data points, the label should avoid | ||
* interpolated positions. | ||
*/ | ||
Series.prototype.getPointsOnGraph = function() { | ||
var distance = 16, | ||
points = this.points, | ||
point, | ||
last, | ||
interpolated = [], | ||
i, | ||
deltaX, | ||
deltaY, | ||
delta, | ||
len, | ||
n, | ||
j, | ||
d, | ||
graph = this.graph || this.area, | ||
node = graph.element, | ||
inverted = this.chart.inverted, | ||
paneLeft = inverted ? this.yAxis.pos : this.xAxis.pos, | ||
paneTop = inverted ? this.xAxis.pos : this.yAxis.pos; | ||
point = points[i]; | ||
last = points[i - 1]; | ||
// Absolute coordinates so we can compare different panes | ||
// For splines, get the point at length (possible caveat: peaks are not correctly detected) | ||
if (this.getPointSpline && node.getPointAtLength) { | ||
// If it is animating towards a path definition, use that briefly, and reset | ||
if (graph.toD) { | ||
d = graph.attr('d'); | ||
graph.attr({ | ||
d: graph.toD | ||
}); | ||
} | ||
len = node.getTotalLength(); | ||
for (i = 0; i < len; i += distance) { | ||
point = node.getPointAtLength(i); | ||
interpolated.push({ | ||
chartX: paneLeft + point.x, | ||
chartY: paneTop + point.y, | ||
plotX: point.x, | ||
plotY: point.y | ||
}); | ||
} | ||
if (d) { | ||
graph.attr({ | ||
d: d | ||
}); | ||
} | ||
// Last point | ||
point = points[points.length - 1]; | ||
point.chartX = paneLeft + point.plotX; | ||
point.chartY = paneTop + point.plotY; | ||
interpolated.push(point); | ||
// Add interpolated points | ||
if (i > 0) { | ||
deltaX = Math.abs(point.chartX - last.chartX); | ||
deltaY = Math.abs(point.chartY - last.chartY); | ||
delta = Math.max(deltaX, deltaY); | ||
if (delta > distance) { | ||
// Interpolate | ||
} else { | ||
len = points.length; | ||
for (i = 0; i < len; i += 1) { | ||
n = Math.ceil(delta / distance); | ||
point = points[i]; | ||
last = points[i - 1]; | ||
for (j = 1; j < n; j += 1) { | ||
interpolated.push({ | ||
chartX: last.chartX + (point.chartX - last.chartX) * (j / n), | ||
chartY: last.chartY + (point.chartY - last.chartY) * (j / n), | ||
plotX: last.plotX + (point.plotX - last.plotX) * (j / n), | ||
plotY: last.plotY + (point.plotY - last.plotY) * (j / n) | ||
}); | ||
// Absolute coordinates so we can compare different panes | ||
point.chartX = paneLeft + point.plotX; | ||
point.chartY = paneTop + point.plotY; | ||
// Add interpolated points | ||
if (i > 0) { | ||
deltaX = Math.abs(point.chartX - last.chartX); | ||
deltaY = Math.abs(point.chartY - last.chartY); | ||
delta = Math.max(deltaX, deltaY); | ||
if (delta > distance) { | ||
n = Math.ceil(delta / distance); | ||
for (j = 1; j < n; j += 1) { | ||
interpolated.push({ | ||
chartX: last.chartX + (point.chartX - last.chartX) * (j / n), | ||
chartY: last.chartY + (point.chartY - last.chartY) * (j / n), | ||
plotX: last.plotX + (point.plotX - last.plotX) * (j / n), | ||
plotY: last.plotY + (point.plotY - last.plotY) * (j / n) | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
// Add the real point in order to find positive and negative peaks | ||
if (isNumber(point.plotY)) { | ||
interpolated.push(point); | ||
// Add the real point in order to find positive and negative peaks | ||
if (isNumber(point.plotY)) { | ||
interpolated.push(point); | ||
} | ||
} | ||
} | ||
} | ||
return interpolated; | ||
}; | ||
return interpolated; | ||
}; | ||
/** | ||
* Check whether a proposed label position is clear of other elements | ||
*/ | ||
Series.prototype.checkClearPoint = function (x, y, bBox, checkDistance) { | ||
var distToOthersSquared = Number.MAX_VALUE, // distance to other graphs | ||
distToPointSquared = Number.MAX_VALUE, | ||
dist, | ||
connectorPoint, | ||
connectorEnabled = this.options.label.connectorAllowed, | ||
/** | ||
* Check whether a proposed label position is clear of other elements | ||
*/ | ||
Series.prototype.checkClearPoint = function(x, y, bBox, checkDistance) { | ||
var distToOthersSquared = Number.MAX_VALUE, // distance to other graphs | ||
distToPointSquared = Number.MAX_VALUE, | ||
dist, | ||
connectorPoint, | ||
connectorEnabled = this.options.label.connectorAllowed, | ||
chart = this.chart, | ||
series, | ||
points, | ||
leastDistance = 16, | ||
withinRange, | ||
i, | ||
j; | ||
chart = this.chart, | ||
series, | ||
points, | ||
leastDistance = 16, | ||
withinRange, | ||
i, | ||
j; | ||
function intersectRect(r1, r2) { | ||
return !(r2.left > r1.right || | ||
r2.right < r1.left || | ||
r2.top > r1.bottom || | ||
r2.bottom < r1.top); | ||
} | ||
function intersectRect(r1, r2) { | ||
return !(r2.left > r1.right || | ||
r2.right < r1.left || | ||
r2.top > r1.bottom || | ||
r2.bottom < r1.top); | ||
} | ||
/** | ||
* Get the weight in order to determine the ideal position. Larger distance to | ||
* other series gives more weight. Smaller distance to the actual point (connector points only) | ||
* gives more weight. | ||
*/ | ||
function getWeight(distToOthersSquared, distToPointSquared) { | ||
return distToOthersSquared - distToPointSquared; | ||
} | ||
/** | ||
* Get the weight in order to determine the ideal position. Larger distance to | ||
* other series gives more weight. Smaller distance to the actual point (connector points only) | ||
* gives more weight. | ||
*/ | ||
function getWeight(distToOthersSquared, distToPointSquared) { | ||
return distToOthersSquared - distToPointSquared; | ||
} | ||
// First check for collision with existing labels | ||
for (i = 0; i < chart.boxesToAvoid.length; i += 1) { | ||
if (intersectRect(chart.boxesToAvoid[i], { | ||
left: x, | ||
right: x + bBox.width, | ||
top: y, | ||
bottom: y + bBox.height | ||
})) { | ||
return false; | ||
// First check for collision with existing labels | ||
for (i = 0; i < chart.boxesToAvoid.length; i += 1) { | ||
if (intersectRect(chart.boxesToAvoid[i], { | ||
left: x, | ||
right: x + bBox.width, | ||
top: y, | ||
bottom: y + bBox.height | ||
})) { | ||
return false; | ||
} | ||
} | ||
} | ||
// For each position, check if the lines around the label intersect with any of the | ||
// graphs | ||
for (i = 0; i < chart.series.length; i += 1) { | ||
series = chart.series[i]; | ||
points = series.interpolatedPoints; | ||
if (series.visible && points) { | ||
for (j = 1; j < points.length; j += 1) { | ||
// If any of the box sides intersect with the line, return | ||
if (boxIntersectLine( | ||
x, | ||
y, | ||
bBox.width, | ||
bBox.height, | ||
points[j - 1].chartX, | ||
points[j - 1].chartY, | ||
points[j].chartX, | ||
points[j].chartY | ||
)) { | ||
return false; | ||
} | ||
// For each position, check if the lines around the label intersect with any of the | ||
// graphs | ||
for (i = 0; i < chart.series.length; i += 1) { | ||
series = chart.series[i]; | ||
points = series.interpolatedPoints; | ||
if (series.visible && points) { | ||
for (j = 1; j < points.length; j += 1) { | ||
// If any of the box sides intersect with the line, return | ||
if (boxIntersectLine( | ||
x, | ||
y, | ||
bBox.width, | ||
bBox.height, | ||
points[j - 1].chartX, | ||
points[j - 1].chartY, | ||
points[j].chartX, | ||
points[j].chartY | ||
)) { | ||
return false; | ||
} | ||
// But if it is too far away (a padded box doesn't intersect), also return | ||
if (this === series && !withinRange && checkDistance) { | ||
withinRange = boxIntersectLine( | ||
x - leastDistance, | ||
y - leastDistance, | ||
bBox.width + 2 * leastDistance, | ||
bBox.height + 2 * leastDistance, | ||
points[j - 1].chartX, | ||
points[j - 1].chartY, | ||
points[j].chartX, | ||
points[j].chartY | ||
); | ||
} | ||
// But if it is too far away (a padded box doesn't intersect), also return | ||
if (this === series && !withinRange && checkDistance) { | ||
withinRange = boxIntersectLine( | ||
x - leastDistance, | ||
y - leastDistance, | ||
bBox.width + 2 * leastDistance, | ||
bBox.height + 2 * leastDistance, | ||
points[j - 1].chartX, | ||
points[j - 1].chartY, | ||
points[j].chartX, | ||
points[j].chartY | ||
); | ||
} | ||
// Find the squared distance from the center of the label | ||
if (this !== series) { | ||
distToOthersSquared = Math.min( | ||
distToOthersSquared, | ||
Math.pow(x + bBox.width / 2 - points[j].chartX, 2) + Math.pow(y + bBox.height / 2 - points[j].chartY, 2), | ||
Math.pow(x - points[j].chartX, 2) + Math.pow(y - points[j].chartY, 2), | ||
Math.pow(x + bBox.width - points[j].chartX, 2) + Math.pow(y - points[j].chartY, 2), | ||
Math.pow(x + bBox.width - points[j].chartX, 2) + Math.pow(y + bBox.height - points[j].chartY, 2), | ||
Math.pow(x - points[j].chartX, 2) + Math.pow(y + bBox.height - points[j].chartY, 2) | ||
); | ||
// Find the squared distance from the center of the label | ||
if (this !== series) { | ||
distToOthersSquared = Math.min( | ||
distToOthersSquared, | ||
Math.pow(x + bBox.width / 2 - points[j].chartX, 2) + Math.pow(y + bBox.height / 2 - points[j].chartY, 2), | ||
Math.pow(x - points[j].chartX, 2) + Math.pow(y - points[j].chartY, 2), | ||
Math.pow(x + bBox.width - points[j].chartX, 2) + Math.pow(y - points[j].chartY, 2), | ||
Math.pow(x + bBox.width - points[j].chartX, 2) + Math.pow(y + bBox.height - points[j].chartY, 2), | ||
Math.pow(x - points[j].chartX, 2) + Math.pow(y + bBox.height - points[j].chartY, 2) | ||
); | ||
} | ||
} | ||
} | ||
// Do we need a connector? | ||
if (connectorEnabled && this === series && ((checkDistance && !withinRange) || | ||
distToOthersSquared < Math.pow(this.options.label.connectorNeighbourDistance, 2))) { | ||
for (j = 1; j < points.length; j += 1) { | ||
dist = Math.min( | ||
Math.pow(x + bBox.width / 2 - points[j].chartX, 2) + Math.pow(y + bBox.height / 2 - points[j].chartY, 2), | ||
Math.pow(x - points[j].chartX, 2) + Math.pow(y - points[j].chartY, 2), | ||
Math.pow(x + bBox.width - points[j].chartX, 2) + Math.pow(y - points[j].chartY, 2), | ||
Math.pow(x + bBox.width - points[j].chartX, 2) + Math.pow(y + bBox.height - points[j].chartY, 2), | ||
Math.pow(x - points[j].chartX, 2) + Math.pow(y + bBox.height - points[j].chartY, 2) | ||
); | ||
if (dist < distToPointSquared) { | ||
distToPointSquared = dist; | ||
connectorPoint = points[j]; | ||
// Do we need a connector? | ||
if (connectorEnabled && this === series && ((checkDistance && !withinRange) || | ||
distToOthersSquared < Math.pow(this.options.label.connectorNeighbourDistance, 2))) { | ||
for (j = 1; j < points.length; j += 1) { | ||
dist = Math.min( | ||
Math.pow(x + bBox.width / 2 - points[j].chartX, 2) + Math.pow(y + bBox.height / 2 - points[j].chartY, 2), | ||
Math.pow(x - points[j].chartX, 2) + Math.pow(y - points[j].chartY, 2), | ||
Math.pow(x + bBox.width - points[j].chartX, 2) + Math.pow(y - points[j].chartY, 2), | ||
Math.pow(x + bBox.width - points[j].chartX, 2) + Math.pow(y + bBox.height - points[j].chartY, 2), | ||
Math.pow(x - points[j].chartX, 2) + Math.pow(y + bBox.height - points[j].chartY, 2) | ||
); | ||
if (dist < distToPointSquared) { | ||
distToPointSquared = dist; | ||
connectorPoint = points[j]; | ||
} | ||
} | ||
withinRange = true; | ||
} | ||
withinRange = true; | ||
} | ||
} | ||
} | ||
return !checkDistance || withinRange ? { | ||
x: x, | ||
y: y, | ||
weight: getWeight(distToOthersSquared, connectorPoint ? distToPointSquared : 0), | ||
connectorPoint: connectorPoint | ||
} : false; | ||
return !checkDistance || withinRange ? { | ||
x: x, | ||
y: y, | ||
weight: getWeight(distToOthersSquared, connectorPoint ? distToPointSquared : 0), | ||
connectorPoint: connectorPoint | ||
} : false; | ||
}; | ||
}; | ||
/** | ||
* The main initiator method that runs on chart level after initiation and redraw. It runs in | ||
* a timeout to prevent locking, and loops over all series, taking all series and labels into | ||
* account when placing the labels. | ||
*/ | ||
function drawLabels(proceed) { | ||
/** | ||
* The main initiator method that runs on chart level after initiation and redraw. It runs in | ||
* a timeout to prevent locking, and loops over all series, taking all series and labels into | ||
* account when placing the labels. | ||
*/ | ||
function drawLabels(proceed) { | ||
var chart = this; | ||
var chart = this; | ||
proceed.call(chart); | ||
proceed.call(chart); | ||
clearTimeout(chart.seriesLabelTimer); | ||
clearTimeout(chart.seriesLabelTimer); | ||
chart.seriesLabelTimer = setTimeout(function () { | ||
chart.seriesLabelTimer = setTimeout(function() { | ||
chart.boxesToAvoid = []; | ||
chart.boxesToAvoid = []; | ||
// Build the interpolated points | ||
each(chart.series, function (series) { | ||
var options = series.options.label; | ||
if (options.enabled && series.visible && (series.graph || series.area)) { | ||
series.interpolatedPoints = series.getPointsOnGraph(); | ||
// Build the interpolated points | ||
each(chart.series, function(series) { | ||
var options = series.options.label; | ||
if (options.enabled && series.visible && (series.graph || series.area)) { | ||
series.interpolatedPoints = series.getPointsOnGraph(); | ||
each(options.boxesToAvoid || [], function (box) { | ||
chart.boxesToAvoid.push(box); | ||
}); | ||
} | ||
}); | ||
each(options.boxesToAvoid || [], function(box) { | ||
chart.boxesToAvoid.push(box); | ||
}); | ||
} | ||
}); | ||
each(chart.series, function (series) { | ||
var bBox, | ||
x, | ||
y, | ||
results = [], | ||
clearPoint, | ||
i, | ||
best, | ||
inverted = chart.inverted, | ||
paneLeft = inverted ? series.yAxis.pos : series.xAxis.pos, | ||
paneTop = inverted ? series.xAxis.pos : series.yAxis.pos, | ||
paneWidth = chart.inverted ? series.yAxis.len : series.xAxis.len, | ||
paneHeight = chart.inverted ? series.xAxis.len : series.yAxis.len, | ||
points = series.interpolatedPoints; | ||
each(chart.series, function(series) { | ||
var bBox, | ||
x, | ||
y, | ||
results = [], | ||
clearPoint, | ||
i, | ||
best, | ||
inverted = chart.inverted, | ||
paneLeft = inverted ? series.yAxis.pos : series.xAxis.pos, | ||
paneTop = inverted ? series.xAxis.pos : series.yAxis.pos, | ||
paneWidth = chart.inverted ? series.yAxis.len : series.xAxis.len, | ||
paneHeight = chart.inverted ? series.xAxis.len : series.yAxis.len, | ||
points = series.interpolatedPoints; | ||
function insidePane(x, y, bBox) { | ||
return x > paneLeft && x <= paneLeft + paneWidth - bBox.width && | ||
y >= paneTop && y <= paneTop + paneHeight - bBox.height; | ||
} | ||
function insidePane(x, y, bBox) { | ||
return x > paneLeft && x <= paneLeft + paneWidth - bBox.width && | ||
y >= paneTop && y <= paneTop + paneHeight - bBox.height; | ||
} | ||
if (series.visible && points) { | ||
if (series.visible && points) { | ||
if (!series.labelBySeries) { | ||
series.labelBySeries = chart.renderer.label(series.name, 0, -9999, 'connector') | ||
.css(extend({ | ||
color: series.color | ||
}, series.options.label.styles)) | ||
.attr({ | ||
padding: 0, | ||
opacity: 0, | ||
stroke: series.color, | ||
'stroke-width': 1 | ||
}) | ||
.add(series.group) | ||
.animate({ opacity: 1 }, { duration: 200 }); | ||
} | ||
if (!series.labelBySeries) { | ||
series.labelBySeries = chart.renderer.label(series.name, 0, -9999, 'connector') | ||
.css(extend({ | ||
color: series.color | ||
}, series.options.label.styles)) | ||
.attr({ | ||
padding: 0, | ||
opacity: 0, | ||
stroke: series.color, | ||
'stroke-width': 1 | ||
}) | ||
.add(series.group) | ||
.animate({ | ||
opacity: 1 | ||
}, { | ||
duration: 200 | ||
}); | ||
} | ||
bBox = series.labelBySeries.getBBox(); | ||
bBox.width = Math.round(bBox.width); | ||
bBox = series.labelBySeries.getBBox(); | ||
bBox.width = Math.round(bBox.width); | ||
// Ideal positions are centered above or below a point on right side of chart | ||
for (i = points.length - 1; i > 0; i -= 1) { | ||
// Ideal positions are centered above or below a point on right side of chart | ||
for (i = points.length - 1; i > 0; i -= 1) { | ||
// Right - up | ||
x = points[i].chartX + labelDistance; | ||
y = points[i].chartY - bBox.height - labelDistance; | ||
if (insidePane(x, y, bBox)) { | ||
best = series.checkClearPoint( | ||
x, | ||
y, | ||
bBox | ||
); | ||
} | ||
if (best) { | ||
results.push(best); | ||
} | ||
// Right - up | ||
x = points[i].chartX + labelDistance; | ||
y = points[i].chartY - bBox.height - labelDistance; | ||
if (insidePane(x, y, bBox)) { | ||
best = series.checkClearPoint( | ||
x, | ||
y, | ||
bBox | ||
); | ||
} | ||
if (best) { | ||
results.push(best); | ||
} | ||
// Right - down | ||
x = points[i].chartX + labelDistance; | ||
y = points[i].chartY + labelDistance; | ||
if (insidePane(x, y, bBox)) { | ||
best = series.checkClearPoint( | ||
x, | ||
y, | ||
bBox | ||
); | ||
} | ||
if (best) { | ||
results.push(best); | ||
} | ||
// Right - down | ||
x = points[i].chartX + labelDistance; | ||
y = points[i].chartY + labelDistance; | ||
if (insidePane(x, y, bBox)) { | ||
best = series.checkClearPoint( | ||
x, | ||
y, | ||
bBox | ||
); | ||
} | ||
if (best) { | ||
results.push(best); | ||
} | ||
// Left - down | ||
x = points[i].chartX - bBox.width - labelDistance; | ||
y = points[i].chartY + labelDistance; | ||
if (insidePane(x, y, bBox)) { | ||
best = series.checkClearPoint( | ||
x, | ||
y, | ||
bBox | ||
); | ||
} | ||
if (best) { | ||
results.push(best); | ||
} | ||
// Left - down | ||
x = points[i].chartX - bBox.width - labelDistance; | ||
y = points[i].chartY + labelDistance; | ||
if (insidePane(x, y, bBox)) { | ||
best = series.checkClearPoint( | ||
x, | ||
y, | ||
bBox | ||
); | ||
} | ||
if (best) { | ||
results.push(best); | ||
} | ||
// Left - up | ||
x = points[i].chartX - bBox.width - labelDistance; | ||
y = points[i].chartY - bBox.height - labelDistance; | ||
if (insidePane(x, y, bBox)) { | ||
best = series.checkClearPoint( | ||
x, | ||
y, | ||
bBox | ||
); | ||
// Left - up | ||
x = points[i].chartX - bBox.width - labelDistance; | ||
y = points[i].chartY - bBox.height - labelDistance; | ||
if (insidePane(x, y, bBox)) { | ||
best = series.checkClearPoint( | ||
x, | ||
y, | ||
bBox | ||
); | ||
} | ||
if (best) { | ||
results.push(best); | ||
} | ||
} | ||
if (best) { | ||
results.push(best); | ||
} | ||
} | ||
// Brute force, try all positions on the chart in a 16x16 grid | ||
if (!results.length) { | ||
for (x = paneLeft + paneWidth - bBox.width; x >= paneLeft; x -= 16) { | ||
for (y = paneTop; y < paneTop + paneHeight - bBox.height; y += 16) { | ||
clearPoint = series.checkClearPoint(x, y, bBox, true); | ||
if (clearPoint) { | ||
results.push(clearPoint); | ||
// Brute force, try all positions on the chart in a 16x16 grid | ||
if (!results.length) { | ||
for (x = paneLeft + paneWidth - bBox.width; x >= paneLeft; x -= 16) { | ||
for (y = paneTop; y < paneTop + paneHeight - bBox.height; y += 16) { | ||
clearPoint = series.checkClearPoint(x, y, bBox, true); | ||
if (clearPoint) { | ||
results.push(clearPoint); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
if (results.length) { | ||
if (results.length) { | ||
results.sort(function (a, b) { | ||
return b.weight - a.weight; | ||
}); | ||
best = results[0]; | ||
results.sort(function(a, b) { | ||
return b.weight - a.weight; | ||
}); | ||
chart.boxesToAvoid.push({ | ||
left: best.x, | ||
right: best.x + bBox.width, | ||
top: best.y, | ||
bottom: best.y + bBox.height | ||
}); | ||
best = results[0]; | ||
// Move it if needed | ||
if (Math.round(best.x) !== Math.round(series.labelBySeries.x) || Math.round(best.y) !== Math.round(series.labelBySeries.y)) { | ||
series.labelBySeries | ||
.attr({ | ||
x: best.x - paneLeft, | ||
y: best.y - paneTop, | ||
anchorX: best.connectorPoint && best.connectorPoint.plotX, | ||
anchorY: best.connectorPoint && best.connectorPoint.plotY, | ||
opacity: 0 | ||
}) | ||
.animate({ opacity: 1 }); | ||
chart.boxesToAvoid.push({ | ||
left: best.x, | ||
right: best.x + bBox.width, | ||
top: best.y, | ||
bottom: best.y + bBox.height | ||
}); | ||
// Move it if needed | ||
if (Math.round(best.x) !== Math.round(series.labelBySeries.x) || Math.round(best.y) !== Math.round(series.labelBySeries.y)) { | ||
series.labelBySeries | ||
.attr({ | ||
x: best.x - paneLeft, | ||
y: best.y - paneTop, | ||
anchorX: best.connectorPoint && best.connectorPoint.plotX, | ||
anchorY: best.connectorPoint && best.connectorPoint.plotY, | ||
opacity: 0 | ||
}) | ||
.animate({ | ||
opacity: 1 | ||
}); | ||
} | ||
} else if (series.labelBySeries) { | ||
series.labelBySeries = series.labelBySeries.destroy(); | ||
} | ||
} else if (series.labelBySeries) { | ||
series.labelBySeries = series.labelBySeries.destroy(); | ||
} | ||
} | ||
}); | ||
}, 350); | ||
}); | ||
}, 350); | ||
} | ||
wrap(Chart.prototype, 'render', drawLabels); | ||
wrap(Chart.prototype, 'redraw', drawLabels); | ||
} | ||
wrap(Chart.prototype, 'render', drawLabels); | ||
wrap(Chart.prototype, 'redraw', drawLabels); | ||
}(Highcharts)); | ||
})); |
/* | ||
Highcharts JS v4.2.7 (2016-09-21) | ||
Highcharts JS v5.0.0 (2016-09-29) | ||
Solid angular gauge module | ||
@@ -9,7 +9,7 @@ | ||
*/ | ||
(function(a){typeof module==="object"&&module.exports?module.exports=a:a(Highcharts)})(function(a){var q=a.getOptions().plotOptions,r=a.pInt,s=a.pick,k=a.each,t=a.isNumber,l;q.solidgauge=a.merge(q.gauge,{colorByPoint:!0});l={initDataClasses:function(b){var e=this,i=this.chart,c,g=0,d=this.options;this.dataClasses=c=[];k(b.dataClasses,function(f,h){var p,f=a.merge(f);c.push(f);if(!f.color)d.dataClassColor==="category"?(p=i.options.colors,f.color=p[g++],g===p.length&&(g=0)):f.color=e.tweenColors(a.Color(d.minColor), | ||
a.Color(d.maxColor),h/(b.dataClasses.length-1))})},initStops:function(b){this.stops=b.stops||[[0,this.options.minColor],[1,this.options.maxColor]];k(this.stops,function(b){b.color=a.Color(b[1])})},toColor:function(b,e){var a,c=this.stops,g,d=this.dataClasses,f,h;if(d)for(h=d.length;h--;){if(f=d[h],g=f.from,c=f.to,(g===void 0||b>=g)&&(c===void 0||b<=c)){a=f.color;if(e)e.dataClass=h;break}}else{this.isLog&&(b=this.val2lin(b));a=1-(this.max-b)/(this.max-this.min);for(h=c.length;h--;)if(a>c[h][0])break; | ||
g=c[h]||c[h+1];c=c[h+1]||g;a=1-(c[0]-a)/(c[0]-g[0]||1);a=this.tweenColors(g.color,c.color,a)}return a},tweenColors:function(b,a,i){var c;!a.rgba.length||!b.rgba.length?b=a.input||"none":(b=b.rgba,a=a.rgba,c=a[3]!==1||b[3]!==1,b=(c?"rgba(":"rgb(")+Math.round(a[0]+(b[0]-a[0])*(1-i))+","+Math.round(a[1]+(b[1]-a[1])*(1-i))+","+Math.round(a[2]+(b[2]-a[2])*(1-i))+(c?","+(a[3]+(b[3]-a[3])*(1-i)):"")+")");return b}};k(["fill","stroke"],function(b){a.Fx.prototype[b+"Setter"]=function(){this.elem.attr(b,l.tweenColors(a.Color(this.start), | ||
a.Color(this.end),this.pos))}});a.seriesTypes.solidgauge=a.extendClass(a.seriesTypes.gauge,{type:"solidgauge",pointAttrToOptions:{},bindAxes:function(){var b;a.seriesTypes.gauge.prototype.bindAxes.call(this);b=this.yAxis;a.extend(b,l);b.options.dataClasses&&b.initDataClasses(b.options);b.initStops(b.options)},drawPoints:function(){var b=this,e=b.yAxis,i=e.center,c=b.options,g=b.chart.renderer,d=c.overshoot,f=t(d)?d/180*Math.PI:0;a.each(b.points,function(a){var d=a.graphic,j=e.startAngleRad+e.translate(a.y, | ||
null,null,null,!0),k=r(s(a.options.radius,c.radius,100))*i[2]/200,m=r(s(a.options.innerRadius,c.innerRadius,60))*i[2]/200,n=e.toColor(a.y,a),o=Math.min(e.startAngleRad,e.endAngleRad),l=Math.max(e.startAngleRad,e.endAngleRad);n==="none"&&(n=a.color||b.color||"none");if(n!=="none")a.color=n;j=Math.max(o-f,Math.min(l+f,j));c.wrap===!1&&(j=Math.max(o,Math.min(l,j)));o=Math.min(j,e.startAngleRad);j=Math.max(j,e.startAngleRad);j-o>2*Math.PI&&(j=o+2*Math.PI);a.shapeArgs=m={x:i[0],y:i[1],r:k,innerR:m,start:o, | ||
end:j,fill:n};a.startR=k;if(d){if(a=m.d,d.animate(m),a)m.d=a}else d={stroke:c.borderColor||"none","stroke-width":c.borderWidth||0,fill:n,"sweep-flag":0},c.linecap!=="square"&&(d["stroke-linecap"]=d["stroke-linejoin"]="round"),a.graphic=g.arc(m).attr(d).add(b.group)})},animate:function(b){if(!b)this.startAngleRad=this.yAxis.startAngleRad,a.seriesTypes.pie.prototype.animate.call(this,b)}})}); | ||
(function(f){"object"===typeof module&&module.exports?module.exports=f:f(Highcharts)})(function(f){(function(b){var f=b.pInt,u=b.pick,m=b.each,v=b.isNumber,n;n={initDataClasses:function(a){var c=this,h=this.chart,e,t=0,l=this.options;this.dataClasses=e=[];m(a.dataClasses,function(g,d){var f;g=b.merge(g);e.push(g);g.color||("category"===l.dataClassColor?(f=h.options.colors,g.color=f[t++],t===f.length&&(t=0)):g.color=c.tweenColors(b.color(l.minColor),b.color(l.maxColor),d/(a.dataClasses.length-1)))})}, | ||
initStops:function(a){this.stops=a.stops||[[0,this.options.minColor],[1,this.options.maxColor]];m(this.stops,function(a){a.color=b.color(a[1])})},toColor:function(a,c){var h,e=this.stops,b,f=this.dataClasses,g,d;if(f)for(d=f.length;d--;){if(g=f[d],b=g.from,e=g.to,(void 0===b||a>=b)&&(void 0===e||a<=e)){h=g.color;c&&(c.dataClass=d);break}}else{this.isLog&&(a=this.val2lin(a));h=1-(this.max-a)/(this.max-this.min);for(d=e.length;d--&&!(h>e[d][0]););b=e[d]||e[d+1];e=e[d+1]||b;h=1-(e[0]-h)/(e[0]-b[0]|| | ||
1);h=this.tweenColors(b.color,e.color,h)}return h},tweenColors:function(a,c,b){var e;c.rgba.length&&a.rgba.length?(a=a.rgba,c=c.rgba,e=1!==c[3]||1!==a[3],a=(e?"rgba(":"rgb(")+Math.round(c[0]+(a[0]-c[0])*(1-b))+","+Math.round(c[1]+(a[1]-c[1])*(1-b))+","+Math.round(c[2]+(a[2]-c[2])*(1-b))+(e?","+(c[3]+(a[3]-c[3])*(1-b)):"")+")"):a=c.input||"none";return a}};m(["fill","stroke"],function(a){b.Fx.prototype[a+"Setter"]=function(){this.elem.attr(a,n.tweenColors(b.color(this.start),b.color(this.end),this.pos))}}); | ||
b.seriesType("solidgauge","gauge",{colorByPoint:!0},{bindAxes:function(){var a;b.seriesTypes.gauge.prototype.bindAxes.call(this);a=this.yAxis;b.extend(a,n);a.options.dataClasses&&a.initDataClasses(a.options);a.initStops(a.options)},drawPoints:function(){var a=this,c=a.yAxis,b=c.center,e=a.options,t=a.chart.renderer,l=e.overshoot,g=v(l)?l/180*Math.PI:0;m(a.points,function(d){var l=d.graphic,k=c.startAngleRad+c.translate(d.y,null,null,null,!0),m=f(u(d.options.radius,e.radius,100))*b[2]/200,p=f(u(d.options.innerRadius, | ||
e.innerRadius,60))*b[2]/200,q=c.toColor(d.y,d),r=Math.min(c.startAngleRad,c.endAngleRad),n=Math.max(c.startAngleRad,c.endAngleRad);"none"===q&&(q=d.color||a.color||"none");"none"!==q&&(d.color=q);k=Math.max(r-g,Math.min(n+g,k));!1===e.wrap&&(k=Math.max(r,Math.min(n,k)));r=Math.min(k,c.startAngleRad);k=Math.max(k,c.startAngleRad);k-r>2*Math.PI&&(k=r+2*Math.PI);d.shapeArgs=p={x:b[0],y:b[1],r:m,innerR:p,start:r,end:k,fill:q};d.startR=m;l?(d=p.d,l.animate(p),d&&(p.d=d)):(d.graphic=t.arc(p).addClass("highcharts-point").attr({fill:q, | ||
"sweep-flag":0}).add(a.group),"square"!==e.linecap&&d.graphic.attr({"stroke-linecap":"round","stroke-linejoin":"round"}),d.graphic.attr({stroke:e.borderColor||"none","stroke-width":e.borderWidth||0}))})},animate:function(a){a||(this.startAngleRad=this.yAxis.startAngleRad,b.seriesTypes.pie.prototype.animate.call(this,a))}})})(f)}); |
/** | ||
* @license Highcharts JS v4.2.7 (2016-09-21) | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* Solid angular gauge module | ||
@@ -9,272 +9,280 @@ * | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(H) { | ||
/** | ||
* Solid angular gauge module | ||
* | ||
* (c) 2010-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
(function (factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function (H) { | ||
'use strict'; | ||
'use strict'; | ||
var pInt = H.pInt, | ||
pick = H.pick, | ||
each = H.each, | ||
isNumber = H.isNumber, | ||
colorAxisMethods; | ||
var defaultPlotOptions = H.getOptions().plotOptions, | ||
pInt = H.pInt, | ||
pick = H.pick, | ||
each = H.each, | ||
isNumber = H.isNumber, | ||
colorAxisMethods, | ||
UNDEFINED; | ||
// These methods are defined in the ColorAxis object, and copied here. | ||
// If we implement an AMD system we should make ColorAxis a dependency. | ||
colorAxisMethods = { | ||
// The default options | ||
defaultPlotOptions.solidgauge = H.merge(defaultPlotOptions.gauge, { | ||
colorByPoint: true | ||
}); | ||
initDataClasses: function(userOptions) { | ||
var axis = this, | ||
chart = this.chart, | ||
dataClasses, | ||
colorCounter = 0, | ||
options = this.options; | ||
this.dataClasses = dataClasses = []; | ||
// These methods are defined in the ColorAxis object, and copied here. | ||
// If we implement an AMD system we should make ColorAxis a dependency. | ||
colorAxisMethods = { | ||
each(userOptions.dataClasses, function(dataClass, i) { | ||
var colors; | ||
dataClass = H.merge(dataClass); | ||
dataClasses.push(dataClass); | ||
if (!dataClass.color) { | ||
if (options.dataClassColor === 'category') { | ||
colors = chart.options.colors; | ||
dataClass.color = colors[colorCounter++]; | ||
// loop back to zero | ||
if (colorCounter === colors.length) { | ||
colorCounter = 0; | ||
} | ||
} else { | ||
dataClass.color = axis.tweenColors(H.color(options.minColor), H.color(options.maxColor), i / (userOptions.dataClasses.length - 1)); | ||
} | ||
} | ||
}); | ||
}, | ||
initDataClasses: function (userOptions) { | ||
var axis = this, | ||
chart = this.chart, | ||
dataClasses, | ||
colorCounter = 0, | ||
options = this.options; | ||
this.dataClasses = dataClasses = []; | ||
initStops: function(userOptions) { | ||
this.stops = userOptions.stops || [ | ||
[0, this.options.minColor], | ||
[1, this.options.maxColor] | ||
]; | ||
each(this.stops, function(stop) { | ||
stop.color = H.color(stop[1]); | ||
}); | ||
}, | ||
/** | ||
* Translate from a value to a color | ||
*/ | ||
toColor: function(value, point) { | ||
var pos, | ||
stops = this.stops, | ||
from, | ||
to, | ||
color, | ||
dataClasses = this.dataClasses, | ||
dataClass, | ||
i; | ||
each(userOptions.dataClasses, function (dataClass, i) { | ||
var colors; | ||
if (dataClasses) { | ||
i = dataClasses.length; | ||
while (i--) { | ||
dataClass = dataClasses[i]; | ||
from = dataClass.from; | ||
to = dataClass.to; | ||
if ((from === undefined || value >= from) && (to === undefined || value <= to)) { | ||
color = dataClass.color; | ||
if (point) { | ||
point.dataClass = i; | ||
} | ||
break; | ||
} | ||
} | ||
dataClass = H.merge(dataClass); | ||
dataClasses.push(dataClass); | ||
if (!dataClass.color) { | ||
if (options.dataClassColor === 'category') { | ||
colors = chart.options.colors; | ||
dataClass.color = colors[colorCounter++]; | ||
// loop back to zero | ||
if (colorCounter === colors.length) { | ||
colorCounter = 0; | ||
} | ||
} else { | ||
dataClass.color = axis.tweenColors(H.Color(options.minColor), H.Color(options.maxColor), i / (userOptions.dataClasses.length - 1)); | ||
} | ||
} | ||
}); | ||
}, | ||
} else { | ||
initStops: function (userOptions) { | ||
this.stops = userOptions.stops || [ | ||
[0, this.options.minColor], | ||
[1, this.options.maxColor] | ||
]; | ||
each(this.stops, function (stop) { | ||
stop.color = H.Color(stop[1]); | ||
}); | ||
}, | ||
/** | ||
* Translate from a value to a color | ||
*/ | ||
toColor: function (value, point) { | ||
var pos, | ||
stops = this.stops, | ||
from, | ||
to, | ||
color, | ||
dataClasses = this.dataClasses, | ||
dataClass, | ||
i; | ||
if (this.isLog) { | ||
value = this.val2lin(value); | ||
} | ||
pos = 1 - ((this.max - value) / (this.max - this.min)); | ||
i = stops.length; | ||
while (i--) { | ||
if (pos > stops[i][0]) { | ||
break; | ||
} | ||
} | ||
from = stops[i] || stops[i + 1]; | ||
to = stops[i + 1] || from; | ||
if (dataClasses) { | ||
i = dataClasses.length; | ||
while (i--) { | ||
dataClass = dataClasses[i]; | ||
from = dataClass.from; | ||
to = dataClass.to; | ||
if ((from === UNDEFINED || value >= from) && (to === UNDEFINED || value <= to)) { | ||
color = dataClass.color; | ||
if (point) { | ||
point.dataClass = i; | ||
} | ||
break; | ||
} | ||
} | ||
// The position within the gradient | ||
pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1); | ||
} else { | ||
color = this.tweenColors( | ||
from.color, | ||
to.color, | ||
pos | ||
); | ||
} | ||
return color; | ||
}, | ||
/* | ||
* Return an intermediate color between two colors, according to pos where 0 | ||
* is the from color and 1 is the to color. | ||
*/ | ||
tweenColors: function(from, to, pos) { | ||
// Check for has alpha, because rgba colors perform worse due to lack of | ||
// support in WebKit. | ||
var hasAlpha, | ||
ret; | ||
if (this.isLog) { | ||
value = this.val2lin(value); | ||
} | ||
pos = 1 - ((this.max - value) / (this.max - this.min)); | ||
i = stops.length; | ||
while (i--) { | ||
if (pos > stops[i][0]) { | ||
break; | ||
} | ||
} | ||
from = stops[i] || stops[i + 1]; | ||
to = stops[i + 1] || from; | ||
// Unsupported color, return to-color (#3920) | ||
if (!to.rgba.length || !from.rgba.length) { | ||
ret = to.input || 'none'; | ||
// The position within the gradient | ||
pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1); | ||
color = this.tweenColors( | ||
from.color, | ||
to.color, | ||
pos | ||
); | ||
} | ||
return color; | ||
}, | ||
/* | ||
* Return an intermediate color between two colors, according to pos where 0 | ||
* is the from color and 1 is the to color. | ||
*/ | ||
tweenColors: function (from, to, pos) { | ||
// Check for has alpha, because rgba colors perform worse due to lack of | ||
// support in WebKit. | ||
var hasAlpha, | ||
ret; | ||
// Interpolate | ||
} else { | ||
from = from.rgba; | ||
to = to.rgba; | ||
hasAlpha = (to[3] !== 1 || from[3] !== 1); | ||
ret = (hasAlpha ? 'rgba(' : 'rgb(') + | ||
Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' + | ||
Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' + | ||
Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) + | ||
(hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')'; | ||
} | ||
return ret; | ||
} | ||
}; | ||
// Unsupported color, return to-color (#3920) | ||
if (!to.rgba.length || !from.rgba.length) { | ||
ret = to.input || 'none'; | ||
/** | ||
* Handle animation of the color attributes directly | ||
*/ | ||
each(['fill', 'stroke'], function(prop) { | ||
H.Fx.prototype[prop + 'Setter'] = function() { | ||
this.elem.attr(prop, colorAxisMethods.tweenColors(H.color(this.start), H.color(this.end), this.pos)); | ||
}; | ||
}); | ||
// Interpolate | ||
} else { | ||
from = from.rgba; | ||
to = to.rgba; | ||
hasAlpha = (to[3] !== 1 || from[3] !== 1); | ||
ret = (hasAlpha ? 'rgba(' : 'rgb(') + | ||
Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' + | ||
Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' + | ||
Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) + | ||
(hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')'; | ||
} | ||
return ret; | ||
} | ||
}; | ||
// The solidgauge series type | ||
H.seriesType('solidgauge', 'gauge', { | ||
colorByPoint: true | ||
/** | ||
* Handle animation of the color attributes directly | ||
*/ | ||
each(['fill', 'stroke'], function (prop) { | ||
H.Fx.prototype[prop + 'Setter'] = function () { | ||
this.elem.attr(prop, colorAxisMethods.tweenColors(H.Color(this.start), H.Color(this.end), this.pos)); | ||
}; | ||
}); | ||
}, { | ||
bindAxes: function() { | ||
var axis; | ||
H.seriesTypes.gauge.prototype.bindAxes.call(this); | ||
// The series prototype | ||
H.seriesTypes.solidgauge = H.extendClass(H.seriesTypes.gauge, { | ||
type: 'solidgauge', | ||
pointAttrToOptions: {}, // #4301, don't inherit line marker's attribs | ||
bindAxes: function () { | ||
var axis; | ||
H.seriesTypes.gauge.prototype.bindAxes.call(this); | ||
axis = this.yAxis; | ||
H.extend(axis, colorAxisMethods); | ||
axis = this.yAxis; | ||
H.extend(axis, colorAxisMethods); | ||
// Prepare data classes | ||
if (axis.options.dataClasses) { | ||
axis.initDataClasses(axis.options); | ||
} | ||
axis.initStops(axis.options); | ||
}, | ||
// Prepare data classes | ||
if (axis.options.dataClasses) { | ||
axis.initDataClasses(axis.options); | ||
} | ||
axis.initStops(axis.options); | ||
}, | ||
/** | ||
* Draw the points where each point is one needle | ||
*/ | ||
drawPoints: function() { | ||
var series = this, | ||
yAxis = series.yAxis, | ||
center = yAxis.center, | ||
options = series.options, | ||
renderer = series.chart.renderer, | ||
overshoot = options.overshoot, | ||
overshootVal = isNumber(overshoot) ? overshoot / 180 * Math.PI : 0; | ||
/** | ||
* Draw the points where each point is one needle | ||
*/ | ||
drawPoints: function () { | ||
var series = this, | ||
yAxis = series.yAxis, | ||
center = yAxis.center, | ||
options = series.options, | ||
renderer = series.chart.renderer, | ||
overshoot = options.overshoot, | ||
overshootVal = isNumber(overshoot) ? overshoot / 180 * Math.PI : 0; | ||
each(series.points, function(point) { | ||
var graphic = point.graphic, | ||
rotation = yAxis.startAngleRad + yAxis.translate(point.y, null, null, null, true), | ||
radius = (pInt(pick(point.options.radius, options.radius, 100)) * center[2]) / 200, | ||
innerRadius = (pInt(pick(point.options.innerRadius, options.innerRadius, 60)) * center[2]) / 200, | ||
shapeArgs, | ||
d, | ||
toColor = yAxis.toColor(point.y, point), | ||
axisMinAngle = Math.min(yAxis.startAngleRad, yAxis.endAngleRad), | ||
axisMaxAngle = Math.max(yAxis.startAngleRad, yAxis.endAngleRad), | ||
minAngle, | ||
maxAngle; | ||
H.each(series.points, function (point) { | ||
var graphic = point.graphic, | ||
rotation = yAxis.startAngleRad + yAxis.translate(point.y, null, null, null, true), | ||
radius = (pInt(pick(point.options.radius, options.radius, 100)) * center[2]) / 200, | ||
innerRadius = (pInt(pick(point.options.innerRadius, options.innerRadius, 60)) * center[2]) / 200, | ||
shapeArgs, | ||
d, | ||
toColor = yAxis.toColor(point.y, point), | ||
axisMinAngle = Math.min(yAxis.startAngleRad, yAxis.endAngleRad), | ||
axisMaxAngle = Math.max(yAxis.startAngleRad, yAxis.endAngleRad), | ||
minAngle, | ||
maxAngle, | ||
attribs; | ||
if (toColor === 'none') { // #3708 | ||
toColor = point.color || series.color || 'none'; | ||
} | ||
if (toColor !== 'none') { | ||
point.color = toColor; | ||
} | ||
if (toColor === 'none') { // #3708 | ||
toColor = point.color || series.color || 'none'; | ||
} | ||
if (toColor !== 'none') { | ||
point.color = toColor; | ||
} | ||
// Handle overshoot and clipping to axis max/min | ||
rotation = Math.max(axisMinAngle - overshootVal, Math.min(axisMaxAngle + overshootVal, rotation)); | ||
// Handle overshoot and clipping to axis max/min | ||
rotation = Math.max(axisMinAngle - overshootVal, Math.min(axisMaxAngle + overshootVal, rotation)); | ||
// Handle the wrap option | ||
if (options.wrap === false) { | ||
rotation = Math.max(axisMinAngle, Math.min(axisMaxAngle, rotation)); | ||
} | ||
// Handle the wrap option | ||
if (options.wrap === false) { | ||
rotation = Math.max(axisMinAngle, Math.min(axisMaxAngle, rotation)); | ||
} | ||
minAngle = Math.min(rotation, yAxis.startAngleRad); | ||
maxAngle = Math.max(rotation, yAxis.startAngleRad); | ||
minAngle = Math.min(rotation, yAxis.startAngleRad); | ||
maxAngle = Math.max(rotation, yAxis.startAngleRad); | ||
if (maxAngle - minAngle > 2 * Math.PI) { | ||
maxAngle = minAngle + 2 * Math.PI; | ||
} | ||
if (maxAngle - minAngle > 2 * Math.PI) { | ||
maxAngle = minAngle + 2 * Math.PI; | ||
} | ||
point.shapeArgs = shapeArgs = { | ||
x: center[0], | ||
y: center[1], | ||
r: radius, | ||
innerR: innerRadius, | ||
start: minAngle, | ||
end: maxAngle, | ||
fill: toColor | ||
}; | ||
point.startR = radius; // For PieSeries.animate | ||
point.shapeArgs = shapeArgs = { | ||
x: center[0], | ||
y: center[1], | ||
r: radius, | ||
innerR: innerRadius, | ||
start: minAngle, | ||
end: maxAngle, | ||
fill: toColor | ||
}; | ||
point.startR = radius; // For PieSeries.animate | ||
if (graphic) { | ||
d = shapeArgs.d; | ||
graphic.animate(shapeArgs); | ||
if (d) { | ||
shapeArgs.d = d; // animate alters it | ||
} | ||
} else { | ||
point.graphic = renderer.arc(shapeArgs) | ||
.addClass('highcharts-point') | ||
.attr({ | ||
fill: toColor, | ||
'sweep-flag': 0 | ||
}) | ||
.add(series.group); | ||
if (graphic) { | ||
d = shapeArgs.d; | ||
graphic.animate(shapeArgs); | ||
if (d) { | ||
shapeArgs.d = d; // animate alters it | ||
} | ||
} else { | ||
attribs = { | ||
stroke: options.borderColor || 'none', | ||
'stroke-width': options.borderWidth || 0, | ||
fill: toColor, | ||
'sweep-flag': 0 | ||
}; | ||
if (options.linecap !== 'square') { | ||
attribs['stroke-linecap'] = attribs['stroke-linejoin'] = 'round'; | ||
} | ||
point.graphic = renderer.arc(shapeArgs) | ||
.attr(attribs) | ||
.add(series.group); | ||
} | ||
}); | ||
}, | ||
/** | ||
* Extend the pie slice animation by animating from start angle and up | ||
*/ | ||
animate: function (init) { | ||
if (options.linecap !== 'square') { | ||
point.graphic.attr({ | ||
'stroke-linecap': 'round', | ||
'stroke-linejoin': 'round' | ||
}); | ||
} | ||
point.graphic.attr({ | ||
stroke: options.borderColor || 'none', | ||
'stroke-width': options.borderWidth || 0 | ||
}); | ||
if (!init) { | ||
this.startAngleRad = this.yAxis.startAngleRad; | ||
H.seriesTypes.pie.prototype.animate.call(this, init); | ||
} | ||
} | ||
}); | ||
} | ||
}); | ||
}, | ||
/** | ||
* Extend the pie slice animation by animating from start angle and up | ||
*/ | ||
animate: function(init) { | ||
if (!init) { | ||
this.startAngleRad = this.yAxis.startAngleRad; | ||
H.seriesTypes.pie.prototype.animate.call(this, init); | ||
} | ||
} | ||
}); | ||
}(Highcharts)); | ||
})); |
/* | ||
Highcharts JS v4.2.7 (2016-09-21) | ||
Highcharts JS v5.0.0 (2016-09-29) | ||
@@ -9,23 +9,24 @@ (c) 2014 Highsoft AS | ||
*/ | ||
(function(f){typeof module==="object"&&module.exports?module.exports=f:f(Highcharts)})(function(f){var i=f.seriesTypes,B=f.map,m=f.merge,t=f.extend,u=f.extendClass,v=f.getOptions().plotOptions,w=function(){},k=f.each,r=f.grep,j=f.pick,n=f.Series,C=f.stableSort,x=f.Color,D=function(a,b,c){var d,c=c||this;for(d in a)a.hasOwnProperty(d)&&b.call(c,a[d],d,a)},y=function(a,b,c,d){d=d||this;a=a||[];k(a,function(e,h){c=b.call(d,c,e,h,a)});return c},q=function(a,b,c){c=c||this;a=b.call(c,a);a!==!1&&q(a,b, | ||
c)};v.treemap=m(v.scatter,{showInLegend:!1,marker:!1,borderColor:"#E0E0E0",borderWidth:1,dataLabels:{enabled:!0,defer:!1,verticalAlign:"middle",formatter:function(){return this.point.name||this.point.id},inside:!0},tooltip:{headerFormat:"",pointFormat:"<b>{point.name}</b>: {point.value}</b><br/>"},layoutAlgorithm:"sliceAndDice",layoutStartingDirection:"vertical",alternateStartingDirection:!1,levelIsConstant:!0,opacity:0.15,states:{hover:{borderColor:"#A0A0A0",brightness:i.heatmap?0:0.1,opacity:0.75, | ||
shadow:!1}},drillUpButton:{position:{align:"right",x:-10,y:10}}});i.treemap=u(i.scatter,m({pointAttrToOptions:{},pointArrayMap:["value"],axisTypes:i.heatmap?["xAxis","yAxis","colorAxis"]:["xAxis","yAxis"],optionalAxis:"colorAxis",getSymbol:w,parallelArrays:["x","y","value","colorValue"],colorKey:"colorValue",translateColors:i.heatmap&&i.heatmap.prototype.translateColors},{type:"treemap",trackerGroups:["group","dataLabelsGroup"],pointClass:u(f.Point,{setVisible:i.pie.prototype.pointClass.prototype.setVisible}), | ||
getListOfParents:function(a,b){var c=y(a,function(a,c,b){c=j(c.parent,"");a[c]===void 0&&(a[c]=[]);a[c].push(b);return a},{});D(c,function(a,c,h){c!==""&&f.inArray(c,b)===-1&&(k(a,function(a){h[""].push(a)}),delete h[c])});return c},getTree:function(){var a,b=this;a=B(this.data,function(a){return a.id});a=b.getListOfParents(this.data,a);b.nodeMap=[];a=b.buildNode("",-1,0,a,null);q(this.nodeMap[this.rootNode],function(a){var d=!1,e=a.parent;a.visible=!0;if(e||e==="")d=b.nodeMap[e];return d});q(this.nodeMap[this.rootNode].children, | ||
function(a){var b=!1;k(a,function(a){a.visible=!0;a.children.length&&(b=(b||[]).concat(a.children))});return b});this.setTreeValues(a);return a},init:function(a,b){n.prototype.init.call(this,a,b);this.options.allowDrillToNode&&this.drillTo()},buildNode:function(a,b,c,d,e){var h=this,g=[],z=h.points[b],A;k(d[a]||[],function(b){A=h.buildNode(h.points[b].id,b,c+1,d,a);g.push(A)});b={id:a,i:b,children:g,level:c,parent:e,visible:!1};h.nodeMap[b.id]=b;if(z)z.node=b;return b},setTreeValues:function(a){var b= | ||
this,c=b.options,d=0,e=[],h,g=b.points[a.i];k(a.children,function(a){a=b.setTreeValues(a);e.push(a);a.ignore?q(a.children,function(a){var c=!1;k(a,function(a){t(a,{ignore:!0,isLeaf:!1,visible:!1});a.children.length&&(c=(c||[]).concat(a.children))});return c}):d+=a.val});C(e,function(a,c){return a.sortIndex-c.sortIndex});h=j(g&&g.options.value,d);if(g)g.value=h;t(a,{children:e,childrenTotal:d,ignore:!(j(g&&g.visible,!0)&&h>0),isLeaf:a.visible&&!d,levelDynamic:c.levelIsConstant?a.level:a.level-b.nodeMap[b.rootNode].level, | ||
name:j(g&&g.name,""),sortIndex:j(g&&g.sortIndex,-h),val:h});return a},calculateChildrenAreas:function(a,b){var c=this,d=c.options,e=this.levelMap[a.levelDynamic+1],h=j(c[e&&e.layoutAlgorithm]&&e.layoutAlgorithm,d.layoutAlgorithm),g=d.alternateStartingDirection,f=[],d=r(a.children,function(a){return!a.ignore});if(e&&e.layoutStartingDirection)b.direction=e.layoutStartingDirection==="vertical"?0:1;f=c[h](b,d);k(d,function(a,d){var e=f[d];a.values=m(e,{val:a.childrenTotal,direction:g?1-b.direction:b.direction}); | ||
a.pointValues=m(e,{x:e.x/c.axisRatio,width:e.width/c.axisRatio});a.children.length&&c.calculateChildrenAreas(a,a.values)})},setPointValues:function(){var a=this.xAxis,b=this.yAxis;k(this.points,function(c){var d=c.node,e=d.pointValues,h,g;e&&d.visible?(d=Math.round(a.translate(e.x,0,0,0,1)),h=Math.round(a.translate(e.x+e.width,0,0,0,1)),g=Math.round(b.translate(e.y,0,0,0,1)),e=Math.round(b.translate(e.y+e.height,0,0,0,1)),c.shapeType="rect",c.shapeArgs={x:Math.min(d,h),y:Math.min(g,e),width:Math.abs(h- | ||
d),height:Math.abs(e-g)},c.plotX=c.shapeArgs.x+c.shapeArgs.width/2,c.plotY=c.shapeArgs.y+c.shapeArgs.height/2):(delete c.plotX,delete c.plotY)})},setColorRecursive:function(a,b){var c=this,d,e;if(a){d=c.points[a.i];e=c.levelMap[a.levelDynamic];b=j(d&&d.options.color,e&&e.color,b);if(d)d.color=b;a.children.length&&k(a.children,function(a){c.setColorRecursive(a,b)})}},algorithmGroup:function(a,b,c,d){this.height=a;this.width=b;this.plot=d;this.startDirection=this.direction=c;this.lH=this.nH=this.lW= | ||
this.nW=this.total=0;this.elArr=[];this.lP={total:0,lH:0,nH:0,lW:0,nW:0,nR:0,lR:0,aspectRatio:function(a,c){return Math.max(a/c,c/a)}};this.addElement=function(a){this.lP.total=this.elArr[this.elArr.length-1];this.total+=a;this.direction===0?(this.lW=this.nW,this.lP.lH=this.lP.total/this.lW,this.lP.lR=this.lP.aspectRatio(this.lW,this.lP.lH),this.nW=this.total/this.height,this.lP.nH=this.lP.total/this.nW,this.lP.nR=this.lP.aspectRatio(this.nW,this.lP.nH)):(this.lH=this.nH,this.lP.lW=this.lP.total/ | ||
this.lH,this.lP.lR=this.lP.aspectRatio(this.lP.lW,this.lH),this.nH=this.total/this.width,this.lP.nW=this.lP.total/this.nH,this.lP.nR=this.lP.aspectRatio(this.lP.nW,this.nH));this.elArr.push(a)};this.reset=function(){this.lW=this.nW=0;this.elArr=[];this.total=0}},algorithmCalcPoints:function(a,b,c,d){var e,h,g,f,j=c.lW,s=c.lH,l=c.plot,i,o=0,p=c.elArr.length-1;b?(j=c.nW,s=c.nH):i=c.elArr[c.elArr.length-1];k(c.elArr,function(a){if(b||o<p)c.direction===0?(e=l.x,h=l.y,g=j,f=a/g):(e=l.x,h=l.y,f=s,g=a/f), | ||
d.push({x:e,y:h,width:g,height:f}),c.direction===0?l.y+=f:l.x+=g;o+=1});c.reset();c.direction===0?c.width-=j:c.height-=s;l.y=l.parent.y+(l.parent.height-c.height);l.x=l.parent.x+(l.parent.width-c.width);if(a)c.direction=1-c.direction;b||c.addElement(i)},algorithmLowAspectRatio:function(a,b,c){var d=[],e=this,h,g={x:b.x,y:b.y,parent:b},f=0,j=c.length-1,i=new this.algorithmGroup(b.height,b.width,b.direction,g);k(c,function(c){h=b.width*b.height*(c.val/b.val);i.addElement(h);i.lP.nR>i.lP.lR&&e.algorithmCalcPoints(a, | ||
!1,i,d,g);f===j&&e.algorithmCalcPoints(a,!0,i,d,g);f+=1});return d},algorithmFill:function(a,b,c){var d=[],e,f=b.direction,g=b.x,i=b.y,j=b.width,m=b.height,l,n,o,p;k(c,function(c){e=b.width*b.height*(c.val/b.val);l=g;n=i;f===0?(p=m,o=e/p,j-=o,g+=o):(o=j,p=e/o,m-=p,i+=p);d.push({x:l,y:n,width:o,height:p});a&&(f=1-f)});return d},strip:function(a,b){return this.algorithmLowAspectRatio(!1,a,b)},squarified:function(a,b){return this.algorithmLowAspectRatio(!0,a,b)},sliceAndDice:function(a,b){return this.algorithmFill(!0, | ||
a,b)},stripes:function(a,b){return this.algorithmFill(!1,a,b)},translate:function(){var a,b;n.prototype.translate.call(this);this.rootNode=j(this.options.rootId,"");this.levelMap=y(this.options.levels,function(a,b){a[b.level]=b;return a},{});b=this.tree=this.getTree();this.axisRatio=this.xAxis.len/this.yAxis.len;this.nodeMap[""].pointValues=a={x:0,y:0,width:100,height:100};this.nodeMap[""].values=a=m(a,{width:a.width*this.axisRatio,direction:this.options.layoutStartingDirection==="vertical"?0:1,val:b.val}); | ||
this.calculateChildrenAreas(b,a);this.colorAxis?this.translateColors():this.options.colorByPoint||this.setColorRecursive(this.tree,void 0);if(this.options.allowDrillToNode)b=this.nodeMap[this.rootNode].pointValues,this.xAxis.setExtremes(b.x,b.x+b.width,!1),this.yAxis.setExtremes(b.y,b.y+b.height,!1),this.xAxis.setScale(),this.yAxis.setScale();this.setPointValues()},drawDataLabels:function(){var a=this,b=r(a.points,function(a){return a.node.visible}),c,d;k(b,function(b){d=a.levelMap[b.node.levelDynamic]; | ||
c={style:{}};if(!b.node.isLeaf)c.enabled=!1;if(d&&d.dataLabels)c=m(c,d.dataLabels),a._hasPointLabels=!0;if(b.shapeArgs)c.style.width=b.shapeArgs.width,b.dataLabel&&b.dataLabel.css({width:b.shapeArgs.width+"px"});b.dlOptions=m(c,b.options.dataLabels)});n.prototype.drawDataLabels.call(this)},alignDataLabel:i.column.prototype.alignDataLabel,pointAttribs:function(a,b){var c=this.levelMap[a.node.levelDynamic]||{},d=this.options,e=b&&d.states[b]||{},c={stroke:a.borderColor||c.borderColor||e.borderColor|| | ||
d.borderColor,"stroke-width":j(a.borderWidth,c.borderWidth,e.borderWidth,d.borderWidth),dashstyle:a.borderDashStyle||c.borderDashStyle||e.borderDashStyle||d.borderDashStyle,fill:a.color||this.color,zIndex:b==="hover"?1:0};if(a.node.level<=this.nodeMap[this.rootNode].level)c.fill="none",c["stroke-width"]=0;else if(a.node.isLeaf){if(b)c.fill=x(c.fill).brighten(e.brightness).get()}else j(d.interactByLeaf,!d.allowDrillToNode)?c.fill="none":(d=j(e.opacity,d.opacity),c.fill=x(c.fill).setOpacity(d).get()); | ||
return c},drawPoints:function(){var a=this,b=r(a.points,function(a){return a.node.visible});k(b,function(c){var b="levelGroup-"+c.node.levelDynamic;a[b]||(a[b]=a.chart.renderer.g(b).attr({zIndex:1E3-c.node.levelDynamic}).add(a.group));c.group=a[b];b=a.pointAttribs(c);c.pointAttr={"":b,hover:a.pointAttribs(c,"hover"),select:{}};c.shapeArgs&&(b=parseInt(b["stroke-width"],10)%2/2,c.shapeArgs.x-=b,c.shapeArgs.y-=b)});i.column.prototype.drawPoints.call(this);a.options.allowDrillToNode&&k(b,function(b){var d; | ||
if(b.graphic)d=b.drillId=a.options.interactByLeaf?a.drillToByLeaf(b):a.drillToByGroup(b),b.graphic.css({cursor:d?"pointer":"default"})})},drillTo:function(){var a=this;f.addEvent(a,"click",function(b){var b=b.point,c=b.drillId,d;c&&(d=a.nodeMap[a.rootNode].name||a.rootNode,b.setState(""),a.drillToNode(c),a.showDrillUpButton(d))})},drillToByGroup:function(a){var b=!1;if(a.node.level-this.nodeMap[this.rootNode].level===1&&!a.node.isLeaf)b=a.id;return b},drillToByLeaf:function(a){var b=!1;if(a.node.parent!== | ||
this.rootNode&&a.node.isLeaf)for(a=a.node;!b;)if(a=this.nodeMap[a.parent],a.parent===this.rootNode)b=a.id;return b},drillUp:function(){var a=null;this.rootNode&&(a=this.nodeMap[this.rootNode],a=a.parent!==null?this.nodeMap[a.parent]:this.nodeMap[""]);if(a!==null)this.drillToNode(a.id),a.id===""?this.drillUpButton=this.drillUpButton.destroy():(a=this.nodeMap[a.parent],this.showDrillUpButton(a.name||a.id))},drillToNode:function(a){this.options.rootId=a;this.isDirty=!0;this.chart.redraw()},showDrillUpButton:function(a){var b= | ||
this,a=a||"< Back",c=b.options.drillUpButton,d,e;if(c.text)a=c.text;this.drillUpButton?this.drillUpButton.attr({text:a}).align():(e=(d=c.theme)&&d.states,this.drillUpButton=this.chart.renderer.button(a,null,null,function(){b.drillUp()},d,e&&e.hover,e&&e.select).attr({align:c.position.align,zIndex:9}).add().align(c.position,!1,c.relativeTo||"plotBox"))},buildKDTree:w,drawLegendSymbol:f.LegendSymbolMixin.drawRectangle,getExtremes:function(){n.prototype.getExtremes.call(this,this.colorValueData);this.valueMin= | ||
this.dataMin;this.valueMax=this.dataMax;n.prototype.getExtremes.call(this)},getExtremesFromAll:!0,bindAxes:function(){var a={endOnTick:!1,gridLineWidth:0,lineWidth:0,min:0,dataMin:0,minPadding:0,max:100,dataMax:100,maxPadding:0,startOnTick:!1,title:null,tickPositions:[]};n.prototype.bindAxes.call(this);f.extend(this.yAxis.options,a);f.extend(this.xAxis.options,a)}}))}); | ||
(function(t){"object"===typeof module&&module.exports?module.exports=t:t(Highcharts)})(function(t){(function(g){var t=g.seriesType,n=g.seriesTypes,E=g.map,v=g.merge,y=g.extend,z=g.noop,m=g.each,x=g.grep,k=g.pick,u=g.Series,F=g.stableSort,A=g.Color,G=function(a,b,c){var d;c=c||this;for(d in a)a.hasOwnProperty(d)&&b.call(c,a[d],d,a)},B=function(a,b,c,d){d=d||this;a=a||[];m(a,function(e,f){c=b.call(d,c,e,f,a)});return c},w=function(a,b,c){c=c||this;a=b.call(c,a);!1!==a&&w(a,b,c)};t("treemap","scatter", | ||
{showInLegend:!1,marker:!1,dataLabels:{enabled:!0,defer:!1,verticalAlign:"middle",formatter:function(){return this.point.name||this.point.id},inside:!0},tooltip:{headerFormat:"",pointFormat:"<b>{point.name}</b>: {point.value}</b><br/>"},layoutAlgorithm:"sliceAndDice",layoutStartingDirection:"vertical",alternateStartingDirection:!1,levelIsConstant:!0,drillUpButton:{position:{align:"right",x:-10,y:10}},borderColor:"#e6e6e6",borderWidth:1,opacity:.15,states:{hover:{borderColor:"#999999",brightness:n.heatmap? | ||
0:.1,opacity:.75,shadow:!1}}},{pointArrayMap:["value"],axisTypes:n.heatmap?["xAxis","yAxis","colorAxis"]:["xAxis","yAxis"],optionalAxis:"colorAxis",getSymbol:z,parallelArrays:["x","y","value","colorValue"],colorKey:"colorValue",translateColors:n.heatmap&&n.heatmap.prototype.translateColors,trackerGroups:["group","dataLabelsGroup"],getListOfParents:function(a,b){var c=B(a,function(a,c,b){c=k(c.parent,"");void 0===a[c]&&(a[c]=[]);a[c].push(b);return a},{});G(c,function(a,c,f){""!==c&&-1===g.inArray(c, | ||
b)&&(m(a,function(a){f[""].push(a)}),delete f[c])});return c},getTree:function(){var a,b=this;a=E(this.data,function(a){return a.id});a=b.getListOfParents(this.data,a);b.nodeMap=[];a=b.buildNode("",-1,0,a,null);w(this.nodeMap[this.rootNode],function(a){var d=!1,e=a.parent;a.visible=!0;if(e||""===e)d=b.nodeMap[e];return d});w(this.nodeMap[this.rootNode].children,function(a){var b=!1;m(a,function(a){a.visible=!0;a.children.length&&(b=(b||[]).concat(a.children))});return b});this.setTreeValues(a);return a}, | ||
init:function(a,b){u.prototype.init.call(this,a,b);this.options.allowDrillToNode&&this.drillTo()},buildNode:function(a,b,c,d,e){var f=this,h=[],C=f.points[b],D;m(d[a]||[],function(b){D=f.buildNode(f.points[b].id,b,c+1,d,a);h.push(D)});b={id:a,i:b,children:h,level:c,parent:e,visible:!1};f.nodeMap[b.id]=b;C&&(C.node=b);return b},setTreeValues:function(a){var b=this,c=b.options,d=0,e=[],f,h=b.points[a.i];m(a.children,function(a){a=b.setTreeValues(a);e.push(a);a.ignore?w(a.children,function(a){var c= | ||
!1;m(a,function(a){y(a,{ignore:!0,isLeaf:!1,visible:!1});a.children.length&&(c=(c||[]).concat(a.children))});return c}):d+=a.val});F(e,function(a,c){return a.sortIndex-c.sortIndex});f=k(h&&h.options.value,d);h&&(h.value=f);y(a,{children:e,childrenTotal:d,ignore:!(k(h&&h.visible,!0)&&0<f),isLeaf:a.visible&&!d,levelDynamic:c.levelIsConstant?a.level:a.level-b.nodeMap[b.rootNode].level,name:k(h&&h.name,""),sortIndex:k(h&&h.sortIndex,-f),val:f});return a},calculateChildrenAreas:function(a,b){var c=this, | ||
d=c.options,e=this.levelMap[a.levelDynamic+1],f=k(c[e&&e.layoutAlgorithm]&&e.layoutAlgorithm,d.layoutAlgorithm),h=d.alternateStartingDirection,g=[],d=x(a.children,function(a){return!a.ignore});e&&e.layoutStartingDirection&&(b.direction="vertical"===e.layoutStartingDirection?0:1);g=c[f](b,d);m(d,function(a,e){var d=g[e];a.values=v(d,{val:a.childrenTotal,direction:h?1-b.direction:b.direction});a.pointValues=v(d,{x:d.x/c.axisRatio,width:d.width/c.axisRatio});a.children.length&&c.calculateChildrenAreas(a, | ||
a.values)})},setPointValues:function(){var a=this.xAxis,b=this.yAxis;m(this.points,function(c){var d=c.node,e=d.pointValues,f,h;e&&d.visible?(d=Math.round(a.translate(e.x,0,0,0,1))-.5,f=Math.round(a.translate(e.x+e.width,0,0,0,1))-.5,h=Math.round(b.translate(e.y,0,0,0,1))-.5,e=Math.round(b.translate(e.y+e.height,0,0,0,1))-.5,c.shapeType="rect",c.shapeArgs={x:Math.min(d,f),y:Math.min(h,e),width:Math.abs(f-d),height:Math.abs(e-h)},c.plotX=c.shapeArgs.x+c.shapeArgs.width/2,c.plotY=c.shapeArgs.y+c.shapeArgs.height/ | ||
2):(delete c.plotX,delete c.plotY)})},setColorRecursive:function(a,b,c){var d=this,e,f;a&&(e=d.points[a.i],f=d.levelMap[a.levelDynamic],b=k(e&&e.options.color,f&&f.color,b),c=k(e&&e.options.colorIndex,f&&f.colorIndex,c),e&&(e.color=b,e.colorIndex=c),a.children.length&&m(a.children,function(a){d.setColorRecursive(a,b,c)}))},algorithmGroup:function(a,b,c,d){this.height=a;this.width=b;this.plot=d;this.startDirection=this.direction=c;this.lH=this.nH=this.lW=this.nW=this.total=0;this.elArr=[];this.lP= | ||
{total:0,lH:0,nH:0,lW:0,nW:0,nR:0,lR:0,aspectRatio:function(a,c){return Math.max(a/c,c/a)}};this.addElement=function(a){this.lP.total=this.elArr[this.elArr.length-1];this.total+=a;0===this.direction?(this.lW=this.nW,this.lP.lH=this.lP.total/this.lW,this.lP.lR=this.lP.aspectRatio(this.lW,this.lP.lH),this.nW=this.total/this.height,this.lP.nH=this.lP.total/this.nW,this.lP.nR=this.lP.aspectRatio(this.nW,this.lP.nH)):(this.lH=this.nH,this.lP.lW=this.lP.total/this.lH,this.lP.lR=this.lP.aspectRatio(this.lP.lW, | ||
this.lH),this.nH=this.total/this.width,this.lP.nW=this.lP.total/this.nH,this.lP.nR=this.lP.aspectRatio(this.lP.nW,this.nH));this.elArr.push(a)};this.reset=function(){this.lW=this.nW=0;this.elArr=[];this.total=0}},algorithmCalcPoints:function(a,b,c,d){var e,f,h,g,k=c.lW,p=c.lH,l=c.plot,n,q=0,r=c.elArr.length-1;b?(k=c.nW,p=c.nH):n=c.elArr[c.elArr.length-1];m(c.elArr,function(a){if(b||q<r)0===c.direction?(e=l.x,f=l.y,h=k,g=a/h):(e=l.x,f=l.y,g=p,h=a/g),d.push({x:e,y:f,width:h,height:g}),0===c.direction? | ||
l.y+=g:l.x+=h;q+=1});c.reset();0===c.direction?c.width-=k:c.height-=p;l.y=l.parent.y+(l.parent.height-c.height);l.x=l.parent.x+(l.parent.width-c.width);a&&(c.direction=1-c.direction);b||c.addElement(n)},algorithmLowAspectRatio:function(a,b,c){var d=[],e=this,f,h={x:b.x,y:b.y,parent:b},g=0,k=c.length-1,p=new this.algorithmGroup(b.height,b.width,b.direction,h);m(c,function(c){f=c.val/b.val*b.height*b.width;p.addElement(f);p.lP.nR>p.lP.lR&&e.algorithmCalcPoints(a,!1,p,d,h);g===k&&e.algorithmCalcPoints(a, | ||
!0,p,d,h);g+=1});return d},algorithmFill:function(a,b,c){var d=[],e,f=b.direction,h=b.x,g=b.y,k=b.width,p=b.height,l,n,q,r;m(c,function(c){e=c.val/b.val*b.height*b.width;l=h;n=g;0===f?(r=p,q=e/r,k-=q,h+=q):(q=k,r=e/q,p-=r,g+=r);d.push({x:l,y:n,width:q,height:r});a&&(f=1-f)});return d},strip:function(a,b){return this.algorithmLowAspectRatio(!1,a,b)},squarified:function(a,b){return this.algorithmLowAspectRatio(!0,a,b)},sliceAndDice:function(a,b){return this.algorithmFill(!0,a,b)},stripes:function(a, | ||
b){return this.algorithmFill(!1,a,b)},translate:function(){var a,b;u.prototype.translate.call(this);this.rootNode=k(this.options.rootId,"");this.levelMap=B(this.options.levels,function(a,b){a[b.level]=b;return a},{});b=this.tree=this.getTree();this.axisRatio=this.xAxis.len/this.yAxis.len;this.nodeMap[""].pointValues=a={x:0,y:0,width:100,height:100};this.nodeMap[""].values=a=v(a,{width:a.width*this.axisRatio,direction:"vertical"===this.options.layoutStartingDirection?0:1,val:b.val});this.calculateChildrenAreas(b, | ||
a);this.colorAxis?this.translateColors():this.options.colorByPoint||this.setColorRecursive(this.tree);this.options.allowDrillToNode&&(b=this.nodeMap[this.rootNode].pointValues,this.xAxis.setExtremes(b.x,b.x+b.width,!1),this.yAxis.setExtremes(b.y,b.y+b.height,!1),this.xAxis.setScale(),this.yAxis.setScale());this.setPointValues()},drawDataLabels:function(){var a=this,b=x(a.points,function(a){return a.node.visible}),c,d;m(b,function(b){d=a.levelMap[b.node.levelDynamic];c={style:{}};b.node.isLeaf||(c.enabled= | ||
!1);d&&d.dataLabels&&(c=v(c,d.dataLabels),a._hasPointLabels=!0);b.shapeArgs&&(c.style.width=b.shapeArgs.width,b.dataLabel&&b.dataLabel.css({width:b.shapeArgs.width+"px"}));b.dlOptions=v(c,b.options.dataLabels)});u.prototype.drawDataLabels.call(this)},alignDataLabel:function(a){n.column.prototype.alignDataLabel.apply(this,arguments);a.dataLabel&&a.dataLabel.attr({zIndex:a.node.zIndex+1})},pointAttribs:function(a,b){var c=this.levelMap[a.node.levelDynamic]||{},d=this.options,e=b&&d.states[b]||{},f= | ||
a.getClassName(),c={stroke:a.borderColor||c.borderColor||e.borderColor||d.borderColor,"stroke-width":k(a.borderWidth,c.borderWidth,e.borderWidth,d.borderWidth),dashstyle:a.borderDashStyle||c.borderDashStyle||e.borderDashStyle||d.borderDashStyle,fill:a.color||this.color};-1!==f.indexOf("highcharts-above-level")?(c.fill="none",c["stroke-width"]=0):-1!==f.indexOf("highcharts-internal-node-interactive")?(d=k(e.opacity,d.opacity),c.fill=A(c.fill).setOpacity(d).get(),c.cursor="pointer"):-1!==f.indexOf("highcharts-internal-node")? | ||
c.fill="none":b&&(c.fill=A(c.fill).brighten(e.brightness).get());return c},drawPoints:function(){var a=this,b=x(a.points,function(a){return a.node.visible});m(b,function(c){var b="levelGroup-"+c.node.levelDynamic;a[b]||(a[b]=a.chart.renderer.g(b).attr({zIndex:1E3-c.node.levelDynamic}).add(a.group));c.group=a[b]});n.column.prototype.drawPoints.call(this);a.options.allowDrillToNode&&m(b,function(b){b.graphic&&(b.drillId=a.options.interactByLeaf?a.drillToByLeaf(b):a.drillToByGroup(b))})},drillTo:function(){var a= | ||
this;g.addEvent(a,"click",function(b){b=b.point;var c=b.drillId,d;c&&(d=a.nodeMap[a.rootNode].name||a.rootNode,b.setState(""),a.drillToNode(c),a.showDrillUpButton(d))})},drillToByGroup:function(a){var b=!1;1!==a.node.level-this.nodeMap[this.rootNode].level||a.node.isLeaf||(b=a.id);return b},drillToByLeaf:function(a){var b=!1;if(a.node.parent!==this.rootNode&&a.node.isLeaf)for(a=a.node;!b;)a=this.nodeMap[a.parent],a.parent===this.rootNode&&(b=a.id);return b},drillUp:function(){var a=null;this.rootNode&& | ||
(a=this.nodeMap[this.rootNode],a=null!==a.parent?this.nodeMap[a.parent]:this.nodeMap[""]);null!==a&&(this.drillToNode(a.id),""===a.id?this.drillUpButton=this.drillUpButton.destroy():(a=this.nodeMap[a.parent],this.showDrillUpButton(a.name||a.id)))},drillToNode:function(a){this.options.rootId=a;this.isDirty=!0;this.chart.redraw()},showDrillUpButton:function(a){var b=this;a=a||"< Back";var c=b.options.drillUpButton,d,e;c.text&&(a=c.text);this.drillUpButton?this.drillUpButton.attr({text:a}).align():(e= | ||
(d=c.theme)&&d.states,this.drillUpButton=this.chart.renderer.button(a,null,null,function(){b.drillUp()},d,e&&e.hover,e&&e.select).attr({align:c.position.align,zIndex:7}).add().align(c.position,!1,c.relativeTo||"plotBox"))},buildKDTree:z,drawLegendSymbol:g.LegendSymbolMixin.drawRectangle,getExtremes:function(){u.prototype.getExtremes.call(this,this.colorValueData);this.valueMin=this.dataMin;this.valueMax=this.dataMax;u.prototype.getExtremes.call(this)},getExtremesFromAll:!0,bindAxes:function(){var a= | ||
{endOnTick:!1,gridLineWidth:0,lineWidth:0,min:0,dataMin:0,minPadding:0,max:100,dataMax:100,maxPadding:0,startOnTick:!1,title:null,tickPositions:[]};u.prototype.bindAxes.call(this);g.extend(this.yAxis.options,a);g.extend(this.xAxis.options,a)}},{getClassName:function(){var a=g.Point.prototype.getClassName.call(this),b=this.series,c=b.options;this.node.level<=b.nodeMap[b.rootNode].level?a+=" highcharts-above-level":this.node.isLeaf||k(c.interactByLeaf,!c.allowDrillToNode)?this.node.isLeaf||(a+=" highcharts-internal-node"): | ||
a+=" highcharts-internal-node-interactive";return a},setState:function(a){g.Point.prototype.setState.call(this,a);this.graphic.attr({zIndex:"hover"===a?1:0})},setVisible:n.pie.prototype.pointClass.prototype.setVisible})})(t)}); |
/** | ||
* @license Highcharts JS v4.2.7 (2016-09-21) | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* | ||
@@ -9,888 +9,923 @@ * (c) 2014 Highsoft AS | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(H) { | ||
/** | ||
* (c) 2014 Highsoft AS | ||
* Authors: Jon Arild Nygard / Oystein Moseng | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
'use strict'; | ||
var seriesType = H.seriesType, | ||
seriesTypes = H.seriesTypes, | ||
map = H.map, | ||
merge = H.merge, | ||
extend = H.extend, | ||
noop = H.noop, | ||
each = H.each, | ||
grep = H.grep, | ||
pick = H.pick, | ||
Series = H.Series, | ||
stableSort = H.stableSort, | ||
color = H.Color, | ||
eachObject = function(list, func, context) { | ||
var key; | ||
context = context || this; | ||
for (key in list) { | ||
if (list.hasOwnProperty(key)) { | ||
func.call(context, list[key], key, list); | ||
} | ||
} | ||
}, | ||
reduce = function(arr, func, previous, context) { | ||
context = context || this; | ||
arr = arr || []; // @note should each be able to handle empty values automatically? | ||
each(arr, function(current, i) { | ||
previous = func.call(context, previous, current, i, arr); | ||
}); | ||
return previous; | ||
}, | ||
// @todo find correct name for this function. | ||
// @todo Similar to reduce, this function is likely redundant | ||
recursive = function(item, func, context) { | ||
var next; | ||
context = context || this; | ||
next = func.call(context, item); | ||
if (next !== false) { | ||
recursive(next, func, context); | ||
} | ||
}; | ||
(function (factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function (H) { | ||
var seriesTypes = H.seriesTypes, | ||
map = H.map, | ||
merge = H.merge, | ||
extend = H.extend, | ||
extendClass = H.extendClass, | ||
defaultOptions = H.getOptions(), | ||
plotOptions = defaultOptions.plotOptions, | ||
noop = function () { | ||
}, | ||
each = H.each, | ||
grep = H.grep, | ||
pick = H.pick, | ||
Series = H.Series, | ||
stableSort = H.stableSort, | ||
Color = H.Color, | ||
eachObject = function (list, func, context) { | ||
var key; | ||
context = context || this; | ||
for (key in list) { | ||
if (list.hasOwnProperty(key)) { | ||
func.call(context, list[key], key, list); | ||
} | ||
} | ||
}, | ||
reduce = function (arr, func, previous, context) { | ||
context = context || this; | ||
arr = arr || []; // @note should each be able to handle empty values automatically? | ||
each(arr, function (current, i) { | ||
previous = func.call(context, previous, current, i, arr); | ||
}); | ||
return previous; | ||
}, | ||
// @todo find correct name for this function. | ||
// @todo Similar to reduce, this function is likely redundant | ||
recursive = function (item, func, context) { | ||
var next; | ||
context = context || this; | ||
next = func.call(context, item); | ||
if (next !== false) { | ||
recursive(next, func, context); | ||
} | ||
}; | ||
// The Treemap series type | ||
seriesType('treemap', 'scatter', { | ||
showInLegend: false, | ||
marker: false, | ||
dataLabels: { | ||
enabled: true, | ||
defer: false, | ||
verticalAlign: 'middle', | ||
formatter: function() { // #2945 | ||
return this.point.name || this.point.id; | ||
}, | ||
inside: true | ||
}, | ||
tooltip: { | ||
headerFormat: '', | ||
pointFormat: '<b>{point.name}</b>: {point.value}</b><br/>' | ||
}, | ||
layoutAlgorithm: 'sliceAndDice', | ||
layoutStartingDirection: 'vertical', | ||
alternateStartingDirection: false, | ||
levelIsConstant: true, | ||
drillUpButton: { | ||
position: { | ||
align: 'right', | ||
x: -10, | ||
y: 10 | ||
} | ||
}, | ||
// Define default options | ||
plotOptions.treemap = merge(plotOptions.scatter, { | ||
showInLegend: false, | ||
marker: false, | ||
borderColor: '#E0E0E0', | ||
borderWidth: 1, | ||
dataLabels: { | ||
enabled: true, | ||
defer: false, | ||
verticalAlign: 'middle', | ||
formatter: function () { // #2945 | ||
return this.point.name || this.point.id; | ||
}, | ||
inside: true | ||
}, | ||
tooltip: { | ||
headerFormat: '', | ||
pointFormat: '<b>{point.name}</b>: {point.value}</b><br/>' | ||
}, | ||
layoutAlgorithm: 'sliceAndDice', | ||
layoutStartingDirection: 'vertical', | ||
alternateStartingDirection: false, | ||
levelIsConstant: true, | ||
opacity: 0.15, | ||
states: { | ||
hover: { | ||
borderColor: '#A0A0A0', | ||
brightness: seriesTypes.heatmap ? 0 : 0.1, | ||
opacity: 0.75, | ||
shadow: false | ||
} | ||
}, | ||
drillUpButton: { | ||
position: { | ||
align: 'right', | ||
x: -10, | ||
y: 10 | ||
} | ||
} | ||
}); | ||
// Stolen from heatmap | ||
var colorSeriesMixin = { | ||
// mapping between SVG attributes and the corresponding options | ||
pointAttrToOptions: {}, | ||
pointArrayMap: ['value'], | ||
axisTypes: seriesTypes.heatmap ? ['xAxis', 'yAxis', 'colorAxis'] : ['xAxis', 'yAxis'], | ||
optionalAxis: 'colorAxis', | ||
getSymbol: noop, | ||
parallelArrays: ['x', 'y', 'value', 'colorValue'], | ||
colorKey: 'colorValue', // Point color option key | ||
translateColors: seriesTypes.heatmap && seriesTypes.heatmap.prototype.translateColors | ||
}; | ||
// Presentational options | ||
borderColor: '#e6e6e6', | ||
borderWidth: 1, | ||
opacity: 0.15, | ||
states: { | ||
hover: { | ||
borderColor: '#999999', | ||
brightness: seriesTypes.heatmap ? 0 : 0.1, | ||
opacity: 0.75, | ||
shadow: false | ||
} | ||
} | ||
// The Treemap series type | ||
seriesTypes.treemap = extendClass(seriesTypes.scatter, merge(colorSeriesMixin, { | ||
type: 'treemap', | ||
trackerGroups: ['group', 'dataLabelsGroup'], | ||
pointClass: extendClass(H.Point, { | ||
setVisible: seriesTypes.pie.prototype.pointClass.prototype.setVisible | ||
}), | ||
/** | ||
* Creates an object map from parent id to childrens index. | ||
* @param {Array} data List of points set in options. | ||
* @param {string} data[].parent Parent id of point. | ||
* @param {Array} ids List of all point ids. | ||
* @return {Object} Map from parent id to children index in data. | ||
*/ | ||
getListOfParents: function (data, ids) { | ||
var listOfParents = reduce(data, function (prev, curr, i) { | ||
var parent = pick(curr.parent, ''); | ||
if (prev[parent] === undefined) { | ||
prev[parent] = []; | ||
} | ||
prev[parent].push(i); | ||
return prev; | ||
}, {}); | ||
// If parent does not exist, hoist parent to root of tree. | ||
eachObject(listOfParents, function (children, parent, list) { | ||
if ((parent !== '') && (H.inArray(parent, ids) === -1)) { | ||
each(children, function (child) { | ||
list[''].push(child); | ||
}); | ||
delete list[parent]; | ||
} | ||
}); | ||
return listOfParents; | ||
}, | ||
/** | ||
* Creates a tree structured object from the series points | ||
*/ | ||
getTree: function () { | ||
var tree, | ||
series = this, | ||
allIds = map(this.data, function (d) { | ||
return d.id; | ||
}), | ||
parentList = series.getListOfParents(this.data, allIds); | ||
// Prototype members | ||
}, { | ||
pointArrayMap: ['value'], | ||
axisTypes: seriesTypes.heatmap ? ['xAxis', 'yAxis', 'colorAxis'] : ['xAxis', 'yAxis'], | ||
optionalAxis: 'colorAxis', | ||
getSymbol: noop, | ||
parallelArrays: ['x', 'y', 'value', 'colorValue'], | ||
colorKey: 'colorValue', // Point color option key | ||
translateColors: seriesTypes.heatmap && seriesTypes.heatmap.prototype.translateColors, | ||
trackerGroups: ['group', 'dataLabelsGroup'], | ||
/** | ||
* Creates an object map from parent id to childrens index. | ||
* @param {Array} data List of points set in options. | ||
* @param {string} data[].parent Parent id of point. | ||
* @param {Array} ids List of all point ids. | ||
* @return {Object} Map from parent id to children index in data. | ||
*/ | ||
getListOfParents: function(data, ids) { | ||
var listOfParents = reduce(data, function(prev, curr, i) { | ||
var parent = pick(curr.parent, ''); | ||
if (prev[parent] === undefined) { | ||
prev[parent] = []; | ||
} | ||
prev[parent].push(i); | ||
return prev; | ||
}, {}); | ||
series.nodeMap = []; | ||
tree = series.buildNode('', -1, 0, parentList, null); | ||
// Parents of the root node is by default visible | ||
recursive(this.nodeMap[this.rootNode], function (node) { | ||
var next = false, | ||
p = node.parent; | ||
node.visible = true; | ||
if (p || p === '') { | ||
next = series.nodeMap[p]; | ||
} | ||
return next; | ||
}); | ||
// Children of the root node is by default visible | ||
recursive(this.nodeMap[this.rootNode].children, function (children) { | ||
var next = false; | ||
each(children, function (child) { | ||
child.visible = true; | ||
if (child.children.length) { | ||
next = (next || []).concat(child.children); | ||
} | ||
}); | ||
return next; | ||
}); | ||
this.setTreeValues(tree); | ||
return tree; | ||
}, | ||
init: function (chart, options) { | ||
var series = this; | ||
Series.prototype.init.call(series, chart, options); | ||
if (series.options.allowDrillToNode) { | ||
series.drillTo(); | ||
} | ||
}, | ||
buildNode: function (id, i, level, list, parent) { | ||
var series = this, | ||
children = [], | ||
point = series.points[i], | ||
node, | ||
child; | ||
// If parent does not exist, hoist parent to root of tree. | ||
eachObject(listOfParents, function(children, parent, list) { | ||
if ((parent !== '') && (H.inArray(parent, ids) === -1)) { | ||
each(children, function(child) { | ||
list[''].push(child); | ||
}); | ||
delete list[parent]; | ||
} | ||
}); | ||
return listOfParents; | ||
}, | ||
/** | ||
* Creates a tree structured object from the series points | ||
*/ | ||
getTree: function() { | ||
var tree, | ||
series = this, | ||
allIds = map(this.data, function(d) { | ||
return d.id; | ||
}), | ||
parentList = series.getListOfParents(this.data, allIds); | ||
// Actions | ||
each((list[id] || []), function (i) { | ||
child = series.buildNode(series.points[i].id, i, (level + 1), list, id); | ||
children.push(child); | ||
}); | ||
node = { | ||
id: id, | ||
i: i, | ||
children: children, | ||
level: level, | ||
parent: parent, | ||
visible: false // @todo move this to better location | ||
}; | ||
series.nodeMap[node.id] = node; | ||
if (point) { | ||
point.node = node; | ||
} | ||
return node; | ||
}, | ||
setTreeValues: function (tree) { | ||
var series = this, | ||
options = series.options, | ||
childrenTotal = 0, | ||
children = [], | ||
val, | ||
point = series.points[tree.i]; | ||
series.nodeMap = []; | ||
tree = series.buildNode('', -1, 0, parentList, null); | ||
// Parents of the root node is by default visible | ||
recursive(this.nodeMap[this.rootNode], function(node) { | ||
var next = false, | ||
p = node.parent; | ||
node.visible = true; | ||
if (p || p === '') { | ||
next = series.nodeMap[p]; | ||
} | ||
return next; | ||
}); | ||
// Children of the root node is by default visible | ||
recursive(this.nodeMap[this.rootNode].children, function(children) { | ||
var next = false; | ||
each(children, function(child) { | ||
child.visible = true; | ||
if (child.children.length) { | ||
next = (next || []).concat(child.children); | ||
} | ||
}); | ||
return next; | ||
}); | ||
this.setTreeValues(tree); | ||
return tree; | ||
}, | ||
init: function(chart, options) { | ||
var series = this; | ||
Series.prototype.init.call(series, chart, options); | ||
if (series.options.allowDrillToNode) { | ||
series.drillTo(); | ||
} | ||
}, | ||
buildNode: function(id, i, level, list, parent) { | ||
var series = this, | ||
children = [], | ||
point = series.points[i], | ||
node, | ||
child; | ||
// First give the children some values | ||
each(tree.children, function (child) { | ||
child = series.setTreeValues(child); | ||
children.push(child); | ||
// Actions | ||
each((list[id] || []), function(i) { | ||
child = series.buildNode(series.points[i].id, i, (level + 1), list, id); | ||
children.push(child); | ||
}); | ||
node = { | ||
id: id, | ||
i: i, | ||
children: children, | ||
level: level, | ||
parent: parent, | ||
visible: false // @todo move this to better location | ||
}; | ||
series.nodeMap[node.id] = node; | ||
if (point) { | ||
point.node = node; | ||
} | ||
return node; | ||
}, | ||
setTreeValues: function(tree) { | ||
var series = this, | ||
options = series.options, | ||
childrenTotal = 0, | ||
children = [], | ||
val, | ||
point = series.points[tree.i]; | ||
if (!child.ignore) { | ||
childrenTotal += child.val; | ||
} else { | ||
// @todo Add predicate to avoid looping already ignored children | ||
recursive(child.children, function (children) { | ||
var next = false; | ||
each(children, function (node) { | ||
extend(node, { | ||
ignore: true, | ||
isLeaf: false, | ||
visible: false | ||
}); | ||
if (node.children.length) { | ||
next = (next || []).concat(node.children); | ||
} | ||
}); | ||
return next; | ||
}); | ||
} | ||
}); | ||
// Sort the children | ||
stableSort(children, function (a, b) { | ||
return a.sortIndex - b.sortIndex; | ||
}); | ||
// Set the values | ||
val = pick(point && point.options.value, childrenTotal); | ||
if (point) { | ||
point.value = val; | ||
} | ||
extend(tree, { | ||
children: children, | ||
childrenTotal: childrenTotal, | ||
// Ignore this node if point is not visible | ||
ignore: !(pick(point && point.visible, true) && (val > 0)), | ||
isLeaf: tree.visible && !childrenTotal, | ||
levelDynamic: (options.levelIsConstant ? tree.level : (tree.level - series.nodeMap[series.rootNode].level)), | ||
name: pick(point && point.name, ''), | ||
sortIndex: pick(point && point.sortIndex, -val), | ||
val: val | ||
}); | ||
return tree; | ||
}, | ||
/** | ||
* Recursive function which calculates the area for all children of a node. | ||
* @param {Object} node The node which is parent to the children. | ||
* @param {Object} area The rectangular area of the parent. | ||
*/ | ||
calculateChildrenAreas: function (parent, area) { | ||
var series = this, | ||
options = series.options, | ||
level = this.levelMap[parent.levelDynamic + 1], | ||
algorithm = pick((series[level && level.layoutAlgorithm] && level.layoutAlgorithm), options.layoutAlgorithm), | ||
alternate = options.alternateStartingDirection, | ||
childrenValues = [], | ||
children; | ||
// First give the children some values | ||
each(tree.children, function(child) { | ||
child = series.setTreeValues(child); | ||
children.push(child); | ||
// Collect all children which should be included | ||
children = grep(parent.children, function (n) { | ||
return !n.ignore; | ||
}); | ||
if (!child.ignore) { | ||
childrenTotal += child.val; | ||
} else { | ||
// @todo Add predicate to avoid looping already ignored children | ||
recursive(child.children, function(children) { | ||
var next = false; | ||
each(children, function(node) { | ||
extend(node, { | ||
ignore: true, | ||
isLeaf: false, | ||
visible: false | ||
}); | ||
if (node.children.length) { | ||
next = (next || []).concat(node.children); | ||
} | ||
}); | ||
return next; | ||
}); | ||
} | ||
}); | ||
// Sort the children | ||
stableSort(children, function(a, b) { | ||
return a.sortIndex - b.sortIndex; | ||
}); | ||
// Set the values | ||
val = pick(point && point.options.value, childrenTotal); | ||
if (point) { | ||
point.value = val; | ||
} | ||
extend(tree, { | ||
children: children, | ||
childrenTotal: childrenTotal, | ||
// Ignore this node if point is not visible | ||
ignore: !(pick(point && point.visible, true) && (val > 0)), | ||
isLeaf: tree.visible && !childrenTotal, | ||
levelDynamic: (options.levelIsConstant ? tree.level : (tree.level - series.nodeMap[series.rootNode].level)), | ||
name: pick(point && point.name, ''), | ||
sortIndex: pick(point && point.sortIndex, -val), | ||
val: val | ||
}); | ||
return tree; | ||
}, | ||
/** | ||
* Recursive function which calculates the area for all children of a node. | ||
* @param {Object} node The node which is parent to the children. | ||
* @param {Object} area The rectangular area of the parent. | ||
*/ | ||
calculateChildrenAreas: function(parent, area) { | ||
var series = this, | ||
options = series.options, | ||
level = this.levelMap[parent.levelDynamic + 1], | ||
algorithm = pick((series[level && level.layoutAlgorithm] && level.layoutAlgorithm), options.layoutAlgorithm), | ||
alternate = options.alternateStartingDirection, | ||
childrenValues = [], | ||
children; | ||
if (level && level.layoutStartingDirection) { | ||
area.direction = level.layoutStartingDirection === 'vertical' ? 0 : 1; | ||
} | ||
childrenValues = series[algorithm](area, children); | ||
each(children, function (child, index) { | ||
var values = childrenValues[index]; | ||
child.values = merge(values, { | ||
val: child.childrenTotal, | ||
direction: (alternate ? 1 - area.direction : area.direction) | ||
}); | ||
child.pointValues = merge(values, { | ||
x: (values.x / series.axisRatio), | ||
width: (values.width / series.axisRatio) | ||
}); | ||
// If node has children, then call method recursively | ||
if (child.children.length) { | ||
series.calculateChildrenAreas(child, child.values); | ||
} | ||
}); | ||
}, | ||
setPointValues: function () { | ||
var series = this, | ||
xAxis = series.xAxis, | ||
yAxis = series.yAxis; | ||
each(series.points, function (point) { | ||
var node = point.node, | ||
values = node.pointValues, | ||
x1, | ||
x2, | ||
y1, | ||
y2; | ||
// Points which is ignored, have no values. | ||
if (values && node.visible) { | ||
x1 = Math.round(xAxis.translate(values.x, 0, 0, 0, 1)); | ||
x2 = Math.round(xAxis.translate(values.x + values.width, 0, 0, 0, 1)); | ||
y1 = Math.round(yAxis.translate(values.y, 0, 0, 0, 1)); | ||
y2 = Math.round(yAxis.translate(values.y + values.height, 0, 0, 0, 1)); | ||
// Set point values | ||
point.shapeType = 'rect'; | ||
point.shapeArgs = { | ||
x: Math.min(x1, x2), | ||
y: Math.min(y1, y2), | ||
width: Math.abs(x2 - x1), | ||
height: Math.abs(y2 - y1) | ||
}; | ||
point.plotX = point.shapeArgs.x + (point.shapeArgs.width / 2); | ||
point.plotY = point.shapeArgs.y + (point.shapeArgs.height / 2); | ||
} else { | ||
// Reset visibility | ||
delete point.plotX; | ||
delete point.plotY; | ||
} | ||
}); | ||
}, | ||
setColorRecursive: function (node, color) { | ||
var series = this, | ||
point, | ||
level; | ||
if (node) { | ||
point = series.points[node.i]; | ||
level = series.levelMap[node.levelDynamic]; | ||
// Select either point color, level color or inherited color. | ||
color = pick(point && point.options.color, level && level.color, color); | ||
if (point) { | ||
point.color = color; | ||
} | ||
// Do it all again with the children | ||
if (node.children.length) { | ||
each(node.children, function (child) { | ||
series.setColorRecursive(child, color); | ||
}); | ||
} | ||
} | ||
}, | ||
algorithmGroup: function (h, w, d, p) { | ||
this.height = h; | ||
this.width = w; | ||
this.plot = p; | ||
this.direction = d; | ||
this.startDirection = d; | ||
this.total = 0; | ||
this.nW = 0; | ||
this.lW = 0; | ||
this.nH = 0; | ||
this.lH = 0; | ||
this.elArr = []; | ||
this.lP = { | ||
total: 0, | ||
lH: 0, | ||
nH: 0, | ||
lW: 0, | ||
nW: 0, | ||
nR: 0, | ||
lR: 0, | ||
aspectRatio: function (w, h) { | ||
return Math.max((w / h), (h / w)); | ||
} | ||
}; | ||
this.addElement = function (el) { | ||
this.lP.total = this.elArr[this.elArr.length - 1]; | ||
this.total = this.total + el; | ||
if (this.direction === 0) { | ||
// Calculate last point old aspect ratio | ||
this.lW = this.nW; | ||
this.lP.lH = this.lP.total / this.lW; | ||
this.lP.lR = this.lP.aspectRatio(this.lW, this.lP.lH); | ||
// Calculate last point new aspect ratio | ||
this.nW = this.total / this.height; | ||
this.lP.nH = this.lP.total / this.nW; | ||
this.lP.nR = this.lP.aspectRatio(this.nW, this.lP.nH); | ||
} else { | ||
// Calculate last point old aspect ratio | ||
this.lH = this.nH; | ||
this.lP.lW = this.lP.total / this.lH; | ||
this.lP.lR = this.lP.aspectRatio(this.lP.lW, this.lH); | ||
// Calculate last point new aspect ratio | ||
this.nH = this.total / this.width; | ||
this.lP.nW = this.lP.total / this.nH; | ||
this.lP.nR = this.lP.aspectRatio(this.lP.nW, this.nH); | ||
} | ||
this.elArr.push(el); | ||
}; | ||
this.reset = function () { | ||
this.nW = 0; | ||
this.lW = 0; | ||
this.elArr = []; | ||
this.total = 0; | ||
}; | ||
}, | ||
algorithmCalcPoints: function (directionChange, last, group, childrenArea) { | ||
var pX, | ||
pY, | ||
pW, | ||
pH, | ||
gW = group.lW, | ||
gH = group.lH, | ||
plot = group.plot, | ||
keep, | ||
i = 0, | ||
end = group.elArr.length - 1; | ||
if (last) { | ||
gW = group.nW; | ||
gH = group.nH; | ||
} else { | ||
keep = group.elArr[group.elArr.length - 1]; | ||
} | ||
each(group.elArr, function (p) { | ||
if (last || (i < end)) { | ||
if (group.direction === 0) { | ||
pX = plot.x; | ||
pY = plot.y; | ||
pW = gW; | ||
pH = p / pW; | ||
} else { | ||
pX = plot.x; | ||
pY = plot.y; | ||
pH = gH; | ||
pW = p / pH; | ||
} | ||
childrenArea.push({ | ||
x: pX, | ||
y: pY, | ||
width: pW, | ||
height: pH | ||
}); | ||
if (group.direction === 0) { | ||
plot.y = plot.y + pH; | ||
} else { | ||
plot.x = plot.x + pW; | ||
} | ||
} | ||
i = i + 1; | ||
}); | ||
// Reset variables | ||
group.reset(); | ||
if (group.direction === 0) { | ||
group.width = group.width - gW; | ||
} else { | ||
group.height = group.height - gH; | ||
} | ||
plot.y = plot.parent.y + (plot.parent.height - group.height); | ||
plot.x = plot.parent.x + (plot.parent.width - group.width); | ||
if (directionChange) { | ||
group.direction = 1 - group.direction; | ||
} | ||
// If not last, then add uncalculated element | ||
if (!last) { | ||
group.addElement(keep); | ||
} | ||
}, | ||
algorithmLowAspectRatio: function (directionChange, parent, children) { | ||
var childrenArea = [], | ||
series = this, | ||
pTot, | ||
plot = { | ||
x: parent.x, | ||
y: parent.y, | ||
parent: parent | ||
}, | ||
direction = parent.direction, | ||
i = 0, | ||
end = children.length - 1, | ||
group = new this.algorithmGroup(parent.height, parent.width, direction, plot); | ||
// Loop through and calculate all areas | ||
each(children, function (child) { | ||
pTot = (parent.width * parent.height) * (child.val / parent.val); | ||
group.addElement(pTot); | ||
if (group.lP.nR > group.lP.lR) { | ||
series.algorithmCalcPoints(directionChange, false, group, childrenArea, plot); | ||
} | ||
// If last child, then calculate all remaining areas | ||
if (i === end) { | ||
series.algorithmCalcPoints(directionChange, true, group, childrenArea, plot); | ||
} | ||
i = i + 1; | ||
}); | ||
return childrenArea; | ||
}, | ||
algorithmFill: function (directionChange, parent, children) { | ||
var childrenArea = [], | ||
pTot, | ||
direction = parent.direction, | ||
x = parent.x, | ||
y = parent.y, | ||
width = parent.width, | ||
height = parent.height, | ||
pX, | ||
pY, | ||
pW, | ||
pH; | ||
each(children, function (child) { | ||
pTot = (parent.width * parent.height) * (child.val / parent.val); | ||
pX = x; | ||
pY = y; | ||
if (direction === 0) { | ||
pH = height; | ||
pW = pTot / pH; | ||
width = width - pW; | ||
x = x + pW; | ||
} else { | ||
pW = width; | ||
pH = pTot / pW; | ||
height = height - pH; | ||
y = y + pH; | ||
} | ||
childrenArea.push({ | ||
x: pX, | ||
y: pY, | ||
width: pW, | ||
height: pH | ||
}); | ||
if (directionChange) { | ||
direction = 1 - direction; | ||
} | ||
}); | ||
return childrenArea; | ||
}, | ||
strip: function (parent, children) { | ||
return this.algorithmLowAspectRatio(false, parent, children); | ||
}, | ||
squarified: function (parent, children) { | ||
return this.algorithmLowAspectRatio(true, parent, children); | ||
}, | ||
sliceAndDice: function (parent, children) { | ||
return this.algorithmFill(true, parent, children); | ||
}, | ||
stripes: function (parent, children) { | ||
return this.algorithmFill(false, parent, children); | ||
}, | ||
translate: function () { | ||
var pointValues, | ||
seriesArea, | ||
tree, | ||
val; | ||
// Collect all children which should be included | ||
children = grep(parent.children, function(n) { | ||
return !n.ignore; | ||
}); | ||
// Call prototype function | ||
Series.prototype.translate.call(this); | ||
if (level && level.layoutStartingDirection) { | ||
area.direction = level.layoutStartingDirection === 'vertical' ? 0 : 1; | ||
} | ||
childrenValues = series[algorithm](area, children); | ||
each(children, function(child, index) { | ||
var values = childrenValues[index]; | ||
child.values = merge(values, { | ||
val: child.childrenTotal, | ||
direction: (alternate ? 1 - area.direction : area.direction) | ||
}); | ||
child.pointValues = merge(values, { | ||
x: (values.x / series.axisRatio), | ||
width: (values.width / series.axisRatio) | ||
}); | ||
// If node has children, then call method recursively | ||
if (child.children.length) { | ||
series.calculateChildrenAreas(child, child.values); | ||
} | ||
}); | ||
}, | ||
setPointValues: function() { | ||
var series = this, | ||
xAxis = series.xAxis, | ||
yAxis = series.yAxis; | ||
each(series.points, function(point) { | ||
var node = point.node, | ||
values = node.pointValues, | ||
x1, | ||
x2, | ||
y1, | ||
y2, | ||
crispCorr = 0.5; // Assume 1px borderWidth for simplicity | ||
// Assign variables | ||
this.rootNode = pick(this.options.rootId, ''); | ||
// Create a object map from level to options | ||
this.levelMap = reduce(this.options.levels, function (arr, item) { | ||
arr[item.level] = item; | ||
return arr; | ||
}, {}); | ||
tree = this.tree = this.getTree(); // @todo Only if series.isDirtyData is true | ||
// Points which is ignored, have no values. | ||
if (values && node.visible) { | ||
x1 = Math.round(xAxis.translate(values.x, 0, 0, 0, 1)) - crispCorr; | ||
x2 = Math.round(xAxis.translate(values.x + values.width, 0, 0, 0, 1)) - crispCorr; | ||
y1 = Math.round(yAxis.translate(values.y, 0, 0, 0, 1)) - crispCorr; | ||
y2 = Math.round(yAxis.translate(values.y + values.height, 0, 0, 0, 1)) - crispCorr; | ||
// Set point values | ||
point.shapeType = 'rect'; | ||
point.shapeArgs = { | ||
x: Math.min(x1, x2), | ||
y: Math.min(y1, y2), | ||
width: Math.abs(x2 - x1), | ||
height: Math.abs(y2 - y1) | ||
}; | ||
point.plotX = point.shapeArgs.x + (point.shapeArgs.width / 2); | ||
point.plotY = point.shapeArgs.y + (point.shapeArgs.height / 2); | ||
} else { | ||
// Reset visibility | ||
delete point.plotX; | ||
delete point.plotY; | ||
} | ||
}); | ||
}, | ||
setColorRecursive: function(node, color, colorIndex) { | ||
var series = this, | ||
point, | ||
level; | ||
if (node) { | ||
point = series.points[node.i]; | ||
level = series.levelMap[node.levelDynamic]; | ||
// Select either point color, level color or inherited color. | ||
color = pick(point && point.options.color, level && level.color, color); | ||
colorIndex = pick(point && point.options.colorIndex, level && level.colorIndex, colorIndex); | ||
if (point) { | ||
point.color = color; | ||
point.colorIndex = colorIndex; | ||
} | ||
// Calculate plotting values. | ||
this.axisRatio = (this.xAxis.len / this.yAxis.len); | ||
this.nodeMap[''].pointValues = pointValues = { x: 0, y: 0, width: 100, height: 100 }; | ||
this.nodeMap[''].values = seriesArea = merge(pointValues, { | ||
width: (pointValues.width * this.axisRatio), | ||
direction: (this.options.layoutStartingDirection === 'vertical' ? 0 : 1), | ||
val: tree.val | ||
}); | ||
this.calculateChildrenAreas(tree, seriesArea); | ||
// Do it all again with the children | ||
if (node.children.length) { | ||
each(node.children, function(child) { | ||
series.setColorRecursive(child, color, colorIndex); | ||
}); | ||
} | ||
} | ||
}, | ||
algorithmGroup: function(h, w, d, p) { | ||
this.height = h; | ||
this.width = w; | ||
this.plot = p; | ||
this.direction = d; | ||
this.startDirection = d; | ||
this.total = 0; | ||
this.nW = 0; | ||
this.lW = 0; | ||
this.nH = 0; | ||
this.lH = 0; | ||
this.elArr = []; | ||
this.lP = { | ||
total: 0, | ||
lH: 0, | ||
nH: 0, | ||
lW: 0, | ||
nW: 0, | ||
nR: 0, | ||
lR: 0, | ||
aspectRatio: function(w, h) { | ||
return Math.max((w / h), (h / w)); | ||
} | ||
}; | ||
this.addElement = function(el) { | ||
this.lP.total = this.elArr[this.elArr.length - 1]; | ||
this.total = this.total + el; | ||
if (this.direction === 0) { | ||
// Calculate last point old aspect ratio | ||
this.lW = this.nW; | ||
this.lP.lH = this.lP.total / this.lW; | ||
this.lP.lR = this.lP.aspectRatio(this.lW, this.lP.lH); | ||
// Calculate last point new aspect ratio | ||
this.nW = this.total / this.height; | ||
this.lP.nH = this.lP.total / this.nW; | ||
this.lP.nR = this.lP.aspectRatio(this.nW, this.lP.nH); | ||
} else { | ||
// Calculate last point old aspect ratio | ||
this.lH = this.nH; | ||
this.lP.lW = this.lP.total / this.lH; | ||
this.lP.lR = this.lP.aspectRatio(this.lP.lW, this.lH); | ||
// Calculate last point new aspect ratio | ||
this.nH = this.total / this.width; | ||
this.lP.nW = this.lP.total / this.nH; | ||
this.lP.nR = this.lP.aspectRatio(this.lP.nW, this.nH); | ||
} | ||
this.elArr.push(el); | ||
}; | ||
this.reset = function() { | ||
this.nW = 0; | ||
this.lW = 0; | ||
this.elArr = []; | ||
this.total = 0; | ||
}; | ||
}, | ||
algorithmCalcPoints: function(directionChange, last, group, childrenArea) { | ||
var pX, | ||
pY, | ||
pW, | ||
pH, | ||
gW = group.lW, | ||
gH = group.lH, | ||
plot = group.plot, | ||
keep, | ||
i = 0, | ||
end = group.elArr.length - 1; | ||
if (last) { | ||
gW = group.nW; | ||
gH = group.nH; | ||
} else { | ||
keep = group.elArr[group.elArr.length - 1]; | ||
} | ||
each(group.elArr, function(p) { | ||
if (last || (i < end)) { | ||
if (group.direction === 0) { | ||
pX = plot.x; | ||
pY = plot.y; | ||
pW = gW; | ||
pH = p / pW; | ||
} else { | ||
pX = plot.x; | ||
pY = plot.y; | ||
pH = gH; | ||
pW = p / pH; | ||
} | ||
childrenArea.push({ | ||
x: pX, | ||
y: pY, | ||
width: pW, | ||
height: pH | ||
}); | ||
if (group.direction === 0) { | ||
plot.y = plot.y + pH; | ||
} else { | ||
plot.x = plot.x + pW; | ||
} | ||
} | ||
i = i + 1; | ||
}); | ||
// Reset variables | ||
group.reset(); | ||
if (group.direction === 0) { | ||
group.width = group.width - gW; | ||
} else { | ||
group.height = group.height - gH; | ||
} | ||
plot.y = plot.parent.y + (plot.parent.height - group.height); | ||
plot.x = plot.parent.x + (plot.parent.width - group.width); | ||
if (directionChange) { | ||
group.direction = 1 - group.direction; | ||
} | ||
// If not last, then add uncalculated element | ||
if (!last) { | ||
group.addElement(keep); | ||
} | ||
}, | ||
algorithmLowAspectRatio: function(directionChange, parent, children) { | ||
var childrenArea = [], | ||
series = this, | ||
pTot, | ||
plot = { | ||
x: parent.x, | ||
y: parent.y, | ||
parent: parent | ||
}, | ||
direction = parent.direction, | ||
i = 0, | ||
end = children.length - 1, | ||
group = new this.algorithmGroup(parent.height, parent.width, direction, plot); // eslint-disable-line new-cap | ||
// Loop through and calculate all areas | ||
each(children, function(child) { | ||
pTot = (parent.width * parent.height) * (child.val / parent.val); | ||
group.addElement(pTot); | ||
if (group.lP.nR > group.lP.lR) { | ||
series.algorithmCalcPoints(directionChange, false, group, childrenArea, plot); | ||
} | ||
// If last child, then calculate all remaining areas | ||
if (i === end) { | ||
series.algorithmCalcPoints(directionChange, true, group, childrenArea, plot); | ||
} | ||
i = i + 1; | ||
}); | ||
return childrenArea; | ||
}, | ||
algorithmFill: function(directionChange, parent, children) { | ||
var childrenArea = [], | ||
pTot, | ||
direction = parent.direction, | ||
x = parent.x, | ||
y = parent.y, | ||
width = parent.width, | ||
height = parent.height, | ||
pX, | ||
pY, | ||
pW, | ||
pH; | ||
each(children, function(child) { | ||
pTot = (parent.width * parent.height) * (child.val / parent.val); | ||
pX = x; | ||
pY = y; | ||
if (direction === 0) { | ||
pH = height; | ||
pW = pTot / pH; | ||
width = width - pW; | ||
x = x + pW; | ||
} else { | ||
pW = width; | ||
pH = pTot / pW; | ||
height = height - pH; | ||
y = y + pH; | ||
} | ||
childrenArea.push({ | ||
x: pX, | ||
y: pY, | ||
width: pW, | ||
height: pH | ||
}); | ||
if (directionChange) { | ||
direction = 1 - direction; | ||
} | ||
}); | ||
return childrenArea; | ||
}, | ||
strip: function(parent, children) { | ||
return this.algorithmLowAspectRatio(false, parent, children); | ||
}, | ||
squarified: function(parent, children) { | ||
return this.algorithmLowAspectRatio(true, parent, children); | ||
}, | ||
sliceAndDice: function(parent, children) { | ||
return this.algorithmFill(true, parent, children); | ||
}, | ||
stripes: function(parent, children) { | ||
return this.algorithmFill(false, parent, children); | ||
}, | ||
translate: function() { | ||
var pointValues, | ||
seriesArea, | ||
tree, | ||
val; | ||
// Logic for point colors | ||
if (this.colorAxis) { | ||
this.translateColors(); | ||
} else if (!this.options.colorByPoint) { | ||
this.setColorRecursive(this.tree, undefined); | ||
} | ||
// Call prototype function | ||
Series.prototype.translate.call(this); | ||
// Update axis extremes according to the root node. | ||
if (this.options.allowDrillToNode) { | ||
val = this.nodeMap[this.rootNode].pointValues; | ||
this.xAxis.setExtremes(val.x, val.x + val.width, false); | ||
this.yAxis.setExtremes(val.y, val.y + val.height, false); | ||
this.xAxis.setScale(); | ||
this.yAxis.setScale(); | ||
} | ||
// Assign variables | ||
this.rootNode = pick(this.options.rootId, ''); | ||
// Create a object map from level to options | ||
this.levelMap = reduce(this.options.levels, function(arr, item) { | ||
arr[item.level] = item; | ||
return arr; | ||
}, {}); | ||
tree = this.tree = this.getTree(); // @todo Only if series.isDirtyData is true | ||
// Assign values to points. | ||
this.setPointValues(); | ||
}, | ||
/** | ||
* Extend drawDataLabels with logic to handle custom options related to the treemap series: | ||
* - Points which is not a leaf node, has dataLabels disabled by default. | ||
* - Options set on series.levels is merged in. | ||
* - Width of the dataLabel is set to match the width of the point shape. | ||
*/ | ||
drawDataLabels: function () { | ||
var series = this, | ||
points = grep(series.points, function (n) { | ||
return n.node.visible; | ||
}), | ||
options, | ||
level; | ||
each(points, function (point) { | ||
level = series.levelMap[point.node.levelDynamic]; | ||
// Set options to new object to avoid problems with scope | ||
options = { style: {} }; | ||
// Calculate plotting values. | ||
this.axisRatio = (this.xAxis.len / this.yAxis.len); | ||
this.nodeMap[''].pointValues = pointValues = { | ||
x: 0, | ||
y: 0, | ||
width: 100, | ||
height: 100 | ||
}; | ||
this.nodeMap[''].values = seriesArea = merge(pointValues, { | ||
width: (pointValues.width * this.axisRatio), | ||
direction: (this.options.layoutStartingDirection === 'vertical' ? 0 : 1), | ||
val: tree.val | ||
}); | ||
this.calculateChildrenAreas(tree, seriesArea); | ||
// If not a leaf, then label should be disabled as default | ||
if (!point.node.isLeaf) { | ||
options.enabled = false; | ||
} | ||
// Logic for point colors | ||
if (this.colorAxis) { | ||
this.translateColors(); | ||
} else if (!this.options.colorByPoint) { | ||
this.setColorRecursive(this.tree); | ||
} | ||
// If options for level exists, include them as well | ||
if (level && level.dataLabels) { | ||
options = merge(options, level.dataLabels); | ||
series._hasPointLabels = true; | ||
} | ||
// Update axis extremes according to the root node. | ||
if (this.options.allowDrillToNode) { | ||
val = this.nodeMap[this.rootNode].pointValues; | ||
this.xAxis.setExtremes(val.x, val.x + val.width, false); | ||
this.yAxis.setExtremes(val.y, val.y + val.height, false); | ||
this.xAxis.setScale(); | ||
this.yAxis.setScale(); | ||
} | ||
// Set dataLabel width to the width of the point shape. | ||
if (point.shapeArgs) { | ||
options.style.width = point.shapeArgs.width; | ||
if (point.dataLabel) { | ||
point.dataLabel.css({ width: point.shapeArgs.width + 'px' }); | ||
} | ||
} | ||
// Assign values to points. | ||
this.setPointValues(); | ||
}, | ||
/** | ||
* Extend drawDataLabels with logic to handle custom options related to the treemap series: | ||
* - Points which is not a leaf node, has dataLabels disabled by default. | ||
* - Options set on series.levels is merged in. | ||
* - Width of the dataLabel is set to match the width of the point shape. | ||
*/ | ||
drawDataLabels: function() { | ||
var series = this, | ||
points = grep(series.points, function(n) { | ||
return n.node.visible; | ||
}), | ||
options, | ||
level; | ||
each(points, function(point) { | ||
level = series.levelMap[point.node.levelDynamic]; | ||
// Set options to new object to avoid problems with scope | ||
options = { | ||
style: {} | ||
}; | ||
// Merge custom options with point options | ||
point.dlOptions = merge(options, point.options.dataLabels); | ||
}); | ||
Series.prototype.drawDataLabels.call(this); | ||
}, | ||
alignDataLabel: seriesTypes.column.prototype.alignDataLabel, | ||
// If not a leaf, then label should be disabled as default | ||
if (!point.node.isLeaf) { | ||
options.enabled = false; | ||
} | ||
/** | ||
* Get presentational attributes | ||
*/ | ||
pointAttribs: function (point, state) { | ||
var level = this.levelMap[point.node.levelDynamic] || {}, | ||
options = this.options, | ||
attr, | ||
stateOptions = (state && options.states[state]) || {}, | ||
opacity; | ||
// If options for level exists, include them as well | ||
if (level && level.dataLabels) { | ||
options = merge(options, level.dataLabels); | ||
series._hasPointLabels = true; | ||
} | ||
// Set attributes by precedence. Point trumps level trumps series. Stroke width uses pick | ||
// because it can be 0. | ||
attr = { | ||
'stroke': point.borderColor || level.borderColor || stateOptions.borderColor || options.borderColor, | ||
'stroke-width': pick(point.borderWidth, level.borderWidth, stateOptions.borderWidth, options.borderWidth), | ||
'dashstyle': point.borderDashStyle || level.borderDashStyle || stateOptions.borderDashStyle || options.borderDashStyle, | ||
'fill': point.color || this.color, | ||
'zIndex': state === 'hover' ? 1 : 0 | ||
}; | ||
// Set dataLabel width to the width of the point shape. | ||
if (point.shapeArgs) { | ||
options.style.width = point.shapeArgs.width; | ||
if (point.dataLabel) { | ||
point.dataLabel.css({ | ||
width: point.shapeArgs.width + 'px' | ||
}); | ||
} | ||
} | ||
if (point.node.level <= this.nodeMap[this.rootNode].level) { | ||
// Hide levels above the current view | ||
attr.fill = 'none'; | ||
attr['stroke-width'] = 0; | ||
} else if (!point.node.isLeaf) { | ||
// If not a leaf, either set opacity or remove fill | ||
if (pick(options.interactByLeaf, !options.allowDrillToNode)) { | ||
attr.fill = 'none'; | ||
} else { | ||
opacity = pick(stateOptions.opacity, options.opacity); | ||
attr.fill = Color(attr.fill).setOpacity(opacity).get(); | ||
} | ||
} else if (state) { | ||
// Brighten and hoist the hover nodes | ||
attr.fill = Color(attr.fill).brighten(stateOptions.brightness).get(); | ||
} | ||
return attr; | ||
}, | ||
// Merge custom options with point options | ||
point.dlOptions = merge(options, point.options.dataLabels); | ||
}); | ||
Series.prototype.drawDataLabels.call(this); | ||
}, | ||
/** | ||
* Extending ColumnSeries drawPoints | ||
*/ | ||
drawPoints: function () { | ||
var series = this, | ||
points = grep(series.points, function (n) { | ||
return n.node.visible; | ||
}); | ||
/** | ||
* Over the alignment method by setting z index | ||
*/ | ||
alignDataLabel: function(point) { | ||
seriesTypes.column.prototype.alignDataLabel.apply(this, arguments); | ||
if (point.dataLabel) { | ||
point.dataLabel.attr({ | ||
zIndex: point.node.zIndex + 1 | ||
}); | ||
} | ||
}, | ||
each(points, function (point) { | ||
var groupKey = 'levelGroup-' + point.node.levelDynamic, | ||
pointAttribs, | ||
crispCorr; | ||
if (!series[groupKey]) { | ||
series[groupKey] = series.chart.renderer.g(groupKey) | ||
.attr({ | ||
zIndex: 1000 - point.node.levelDynamic // @todo Set the zIndex based upon the number of levels, instead of using 1000 | ||
}) | ||
.add(series.group); | ||
} | ||
point.group = series[groupKey]; | ||
// Preliminary code in prepraration for HC5 that uses pointAttribs for all series | ||
pointAttribs = series.pointAttribs(point); | ||
point.pointAttr = { | ||
'': pointAttribs, | ||
'hover': series.pointAttribs(point, 'hover'), | ||
'select': {} | ||
}; | ||
// Crisp correction | ||
if (point.shapeArgs) { | ||
crispCorr = parseInt(pointAttribs['stroke-width'], 10) % 2 / 2; | ||
point.shapeArgs.x -= crispCorr; | ||
point.shapeArgs.y -= crispCorr; | ||
} | ||
}); | ||
// Call standard drawPoints | ||
seriesTypes.column.prototype.drawPoints.call(this); | ||
/** | ||
* Get presentational attributes | ||
*/ | ||
pointAttribs: function(point, state) { | ||
var level = this.levelMap[point.node.levelDynamic] || {}, | ||
options = this.options, | ||
attr, | ||
stateOptions = (state && options.states[state]) || {}, | ||
className = point.getClassName(), | ||
opacity; | ||
// If drillToNode is allowed, set a point cursor on clickables & add drillId to point | ||
if (series.options.allowDrillToNode) { | ||
each(points, function (point) { | ||
var cursor, | ||
drillId; | ||
if (point.graphic) { | ||
drillId = point.drillId = series.options.interactByLeaf ? series.drillToByLeaf(point) : series.drillToByGroup(point); | ||
cursor = drillId ? 'pointer' : 'default'; | ||
point.graphic.css({ cursor: cursor }); | ||
} | ||
}); | ||
} | ||
}, | ||
/** | ||
* Add drilling on the suitable points | ||
*/ | ||
drillTo: function () { | ||
var series = this; | ||
H.addEvent(series, 'click', function (event) { | ||
var point = event.point, | ||
drillId = point.drillId, | ||
drillName; | ||
// If a drill id is returned, add click event and cursor. | ||
if (drillId) { | ||
drillName = series.nodeMap[series.rootNode].name || series.rootNode; | ||
point.setState(''); // Remove hover | ||
series.drillToNode(drillId); | ||
series.showDrillUpButton(drillName); | ||
} | ||
}); | ||
}, | ||
/** | ||
* Finds the drill id for a parent node. | ||
* Returns false if point should not have a click event | ||
* @param {Object} point | ||
* @return {string || boolean} Drill to id or false when point should not have a click event | ||
*/ | ||
drillToByGroup: function (point) { | ||
var series = this, | ||
drillId = false; | ||
if ((point.node.level - series.nodeMap[series.rootNode].level) === 1 && !point.node.isLeaf) { | ||
drillId = point.id; | ||
} | ||
return drillId; | ||
}, | ||
/** | ||
* Finds the drill id for a leaf node. | ||
* Returns false if point should not have a click event | ||
* @param {Object} point | ||
* @return {string || boolean} Drill to id or false when point should not have a click event | ||
*/ | ||
drillToByLeaf: function (point) { | ||
var series = this, | ||
drillId = false, | ||
nodeParent; | ||
if ((point.node.parent !== series.rootNode) && (point.node.isLeaf)) { | ||
nodeParent = point.node; | ||
while (!drillId) { | ||
nodeParent = series.nodeMap[nodeParent.parent]; | ||
if (nodeParent.parent === series.rootNode) { | ||
drillId = nodeParent.id; | ||
} | ||
} | ||
} | ||
return drillId; | ||
}, | ||
drillUp: function () { | ||
var drillPoint = null, | ||
node, | ||
parent; | ||
if (this.rootNode) { | ||
node = this.nodeMap[this.rootNode]; | ||
if (node.parent !== null) { | ||
drillPoint = this.nodeMap[node.parent]; | ||
} else { | ||
drillPoint = this.nodeMap['']; | ||
} | ||
} | ||
// Set attributes by precedence. Point trumps level trumps series. Stroke width uses pick | ||
// because it can be 0. | ||
attr = { | ||
'stroke': point.borderColor || level.borderColor || stateOptions.borderColor || options.borderColor, | ||
'stroke-width': pick(point.borderWidth, level.borderWidth, stateOptions.borderWidth, options.borderWidth), | ||
'dashstyle': point.borderDashStyle || level.borderDashStyle || stateOptions.borderDashStyle || options.borderDashStyle, | ||
'fill': point.color || this.color | ||
}; | ||
if (drillPoint !== null) { | ||
this.drillToNode(drillPoint.id); | ||
if (drillPoint.id === '') { | ||
this.drillUpButton = this.drillUpButton.destroy(); | ||
} else { | ||
parent = this.nodeMap[drillPoint.parent]; | ||
this.showDrillUpButton((parent.name || parent.id)); | ||
} | ||
} | ||
}, | ||
drillToNode: function (id) { | ||
this.options.rootId = id; | ||
this.isDirty = true; // Force redraw | ||
this.chart.redraw(); | ||
}, | ||
showDrillUpButton: function (name) { | ||
var series = this, | ||
backText = (name || '< Back'), | ||
buttonOptions = series.options.drillUpButton, | ||
attr, | ||
states; | ||
// Hide levels above the current view | ||
if (className.indexOf('highcharts-above-level') !== -1) { | ||
attr.fill = 'none'; | ||
attr['stroke-width'] = 0; | ||
if (buttonOptions.text) { | ||
backText = buttonOptions.text; | ||
} | ||
if (!this.drillUpButton) { | ||
attr = buttonOptions.theme; | ||
states = attr && attr.states; | ||
this.drillUpButton = this.chart.renderer.button( | ||
backText, | ||
null, | ||
null, | ||
function () { | ||
series.drillUp(); | ||
}, | ||
attr, | ||
states && states.hover, | ||
states && states.select | ||
) | ||
.attr({ | ||
align: buttonOptions.position.align, | ||
zIndex: 9 | ||
}) | ||
.add() | ||
.align(buttonOptions.position, false, buttonOptions.relativeTo || 'plotBox'); | ||
} else { | ||
this.drillUpButton.attr({ | ||
text: backText | ||
}) | ||
.align(); | ||
} | ||
}, | ||
buildKDTree: noop, | ||
drawLegendSymbol: H.LegendSymbolMixin.drawRectangle, | ||
getExtremes: function () { | ||
// Get the extremes from the value data | ||
Series.prototype.getExtremes.call(this, this.colorValueData); | ||
this.valueMin = this.dataMin; | ||
this.valueMax = this.dataMax; | ||
// Nodes with children that accept interaction | ||
} else if (className.indexOf('highcharts-internal-node-interactive') !== -1) { | ||
opacity = pick(stateOptions.opacity, options.opacity); | ||
attr.fill = color(attr.fill).setOpacity(opacity).get(); | ||
attr.cursor = 'pointer'; | ||
// Hide nodes that have children | ||
} else if (className.indexOf('highcharts-internal-node') !== -1) { | ||
attr.fill = 'none'; | ||
// Get the extremes from the y data | ||
Series.prototype.getExtremes.call(this); | ||
}, | ||
getExtremesFromAll: true, | ||
bindAxes: function () { | ||
var treeAxis = { | ||
endOnTick: false, | ||
gridLineWidth: 0, | ||
lineWidth: 0, | ||
min: 0, | ||
dataMin: 0, | ||
minPadding: 0, | ||
max: 100, | ||
dataMax: 100, | ||
maxPadding: 0, | ||
startOnTick: false, | ||
title: null, | ||
tickPositions: [] | ||
}; | ||
Series.prototype.bindAxes.call(this); | ||
H.extend(this.yAxis.options, treeAxis); | ||
H.extend(this.xAxis.options, treeAxis); | ||
} | ||
})); | ||
} else if (state) { | ||
// Brighten and hoist the hover nodes | ||
attr.fill = color(attr.fill).brighten(stateOptions.brightness).get(); | ||
} | ||
return attr; | ||
}, | ||
/** | ||
* Extending ColumnSeries drawPoints | ||
*/ | ||
drawPoints: function() { | ||
var series = this, | ||
points = grep(series.points, function(n) { | ||
return n.node.visible; | ||
}); | ||
each(points, function(point) { | ||
var groupKey = 'levelGroup-' + point.node.levelDynamic; | ||
if (!series[groupKey]) { | ||
series[groupKey] = series.chart.renderer.g(groupKey) | ||
.attr({ | ||
zIndex: 1000 - point.node.levelDynamic // @todo Set the zIndex based upon the number of levels, instead of using 1000 | ||
}) | ||
.add(series.group); | ||
} | ||
point.group = series[groupKey]; | ||
}); | ||
// Call standard drawPoints | ||
seriesTypes.column.prototype.drawPoints.call(this); | ||
// If drillToNode is allowed, set a point cursor on clickables & add drillId to point | ||
if (series.options.allowDrillToNode) { | ||
each(points, function(point) { | ||
if (point.graphic) { | ||
point.drillId = series.options.interactByLeaf ? series.drillToByLeaf(point) : series.drillToByGroup(point); | ||
} | ||
}); | ||
} | ||
}, | ||
/** | ||
* Add drilling on the suitable points | ||
*/ | ||
drillTo: function() { | ||
var series = this; | ||
H.addEvent(series, 'click', function(event) { | ||
var point = event.point, | ||
drillId = point.drillId, | ||
drillName; | ||
// If a drill id is returned, add click event and cursor. | ||
if (drillId) { | ||
drillName = series.nodeMap[series.rootNode].name || series.rootNode; | ||
point.setState(''); // Remove hover | ||
series.drillToNode(drillId); | ||
series.showDrillUpButton(drillName); | ||
} | ||
}); | ||
}, | ||
/** | ||
* Finds the drill id for a parent node. | ||
* Returns false if point should not have a click event | ||
* @param {Object} point | ||
* @return {string || boolean} Drill to id or false when point should not have a click event | ||
*/ | ||
drillToByGroup: function(point) { | ||
var series = this, | ||
drillId = false; | ||
if ((point.node.level - series.nodeMap[series.rootNode].level) === 1 && !point.node.isLeaf) { | ||
drillId = point.id; | ||
} | ||
return drillId; | ||
}, | ||
/** | ||
* Finds the drill id for a leaf node. | ||
* Returns false if point should not have a click event | ||
* @param {Object} point | ||
* @return {string || boolean} Drill to id or false when point should not have a click event | ||
*/ | ||
drillToByLeaf: function(point) { | ||
var series = this, | ||
drillId = false, | ||
nodeParent; | ||
if ((point.node.parent !== series.rootNode) && (point.node.isLeaf)) { | ||
nodeParent = point.node; | ||
while (!drillId) { | ||
nodeParent = series.nodeMap[nodeParent.parent]; | ||
if (nodeParent.parent === series.rootNode) { | ||
drillId = nodeParent.id; | ||
} | ||
} | ||
} | ||
return drillId; | ||
}, | ||
drillUp: function() { | ||
var drillPoint = null, | ||
node, | ||
parent; | ||
if (this.rootNode) { | ||
node = this.nodeMap[this.rootNode]; | ||
if (node.parent !== null) { | ||
drillPoint = this.nodeMap[node.parent]; | ||
} else { | ||
drillPoint = this.nodeMap['']; | ||
} | ||
} | ||
if (drillPoint !== null) { | ||
this.drillToNode(drillPoint.id); | ||
if (drillPoint.id === '') { | ||
this.drillUpButton = this.drillUpButton.destroy(); | ||
} else { | ||
parent = this.nodeMap[drillPoint.parent]; | ||
this.showDrillUpButton((parent.name || parent.id)); | ||
} | ||
} | ||
}, | ||
drillToNode: function(id) { | ||
this.options.rootId = id; | ||
this.isDirty = true; // Force redraw | ||
this.chart.redraw(); | ||
}, | ||
showDrillUpButton: function(name) { | ||
var series = this, | ||
backText = (name || '< Back'), | ||
buttonOptions = series.options.drillUpButton, | ||
attr, | ||
states; | ||
if (buttonOptions.text) { | ||
backText = buttonOptions.text; | ||
} | ||
if (!this.drillUpButton) { | ||
attr = buttonOptions.theme; | ||
states = attr && attr.states; | ||
this.drillUpButton = this.chart.renderer.button( | ||
backText, | ||
null, | ||
null, | ||
function() { | ||
series.drillUp(); | ||
}, | ||
attr, | ||
states && states.hover, | ||
states && states.select | ||
) | ||
.attr({ | ||
align: buttonOptions.position.align, | ||
zIndex: 7 | ||
}) | ||
.add() | ||
.align(buttonOptions.position, false, buttonOptions.relativeTo || 'plotBox'); | ||
} else { | ||
this.drillUpButton.attr({ | ||
text: backText | ||
}) | ||
.align(); | ||
} | ||
}, | ||
buildKDTree: noop, | ||
drawLegendSymbol: H.LegendSymbolMixin.drawRectangle, | ||
getExtremes: function() { | ||
// Get the extremes from the value data | ||
Series.prototype.getExtremes.call(this, this.colorValueData); | ||
this.valueMin = this.dataMin; | ||
this.valueMax = this.dataMax; | ||
// Get the extremes from the y data | ||
Series.prototype.getExtremes.call(this); | ||
}, | ||
getExtremesFromAll: true, | ||
bindAxes: function() { | ||
var treeAxis = { | ||
endOnTick: false, | ||
gridLineWidth: 0, | ||
lineWidth: 0, | ||
min: 0, | ||
dataMin: 0, | ||
minPadding: 0, | ||
max: 100, | ||
dataMax: 100, | ||
maxPadding: 0, | ||
startOnTick: false, | ||
title: null, | ||
tickPositions: [] | ||
}; | ||
Series.prototype.bindAxes.call(this); | ||
H.extend(this.yAxis.options, treeAxis); | ||
H.extend(this.xAxis.options, treeAxis); | ||
} | ||
// Point class | ||
}, { | ||
getClassName: function() { | ||
var className = H.Point.prototype.getClassName.call(this), | ||
series = this.series, | ||
options = series.options; | ||
// Above the current level | ||
if (this.node.level <= series.nodeMap[series.rootNode].level) { | ||
className += ' highcharts-above-level'; | ||
} else if (!this.node.isLeaf && !pick(options.interactByLeaf, !options.allowDrillToNode)) { | ||
className += ' highcharts-internal-node-interactive'; | ||
} else if (!this.node.isLeaf) { | ||
className += ' highcharts-internal-node'; | ||
} | ||
return className; | ||
}, | ||
setState: function(state) { | ||
H.Point.prototype.setState.call(this, state); | ||
this.graphic.attr({ | ||
zIndex: state === 'hover' ? 1 : 0 | ||
}); | ||
}, | ||
setVisible: seriesTypes.pie.prototype.pointClass.prototype.setVisible | ||
}); | ||
}(Highcharts)); | ||
})); |
@@ -5,3 +5,3 @@ { | ||
"homepage": "http://www.highcharts.com", | ||
"version": "v4.2.7", | ||
"version": "v5.0.0", | ||
"author": "Highsoft AS <support@highcharts.com> (http://www.highcharts.com/about)", | ||
@@ -8,0 +8,0 @@ "main": "highcharts.js", |
/** | ||
* Dark blue theme for Highcharts JS | ||
* @author Torstein Honsi | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* | ||
* (c) 2009-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(Highcharts) { | ||
/** | ||
* (c) 2010-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
* | ||
* Dark blue theme for Highcharts JS | ||
* @author Torstein Honsi | ||
*/ | ||
'use strict'; | ||
Highcharts.theme = { | ||
colors: ['#DDDF0D', '#55BF3B', '#DF5353', '#7798BF', '#aaeeee', '#ff0066', '#eeaaee', | ||
'#55BF3B', '#DF5353', '#7798BF', '#aaeeee' | ||
], | ||
chart: { | ||
backgroundColor: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 1, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0, 'rgb(48, 48, 96)'], | ||
[1, 'rgb(0, 0, 0)'] | ||
] | ||
}, | ||
borderColor: '#000000', | ||
borderWidth: 2, | ||
className: 'dark-container', | ||
plotBackgroundColor: 'rgba(255, 255, 255, .1)', | ||
plotBorderColor: '#CCCCCC', | ||
plotBorderWidth: 1 | ||
}, | ||
title: { | ||
style: { | ||
color: '#C0C0C0', | ||
font: 'bold 16px "Trebuchet MS", Verdana, sans-serif' | ||
} | ||
}, | ||
subtitle: { | ||
style: { | ||
color: '#666666', | ||
font: 'bold 12px "Trebuchet MS", Verdana, sans-serif' | ||
} | ||
}, | ||
xAxis: { | ||
gridLineColor: '#333333', | ||
gridLineWidth: 1, | ||
labels: { | ||
style: { | ||
color: '#A0A0A0' | ||
} | ||
}, | ||
lineColor: '#A0A0A0', | ||
tickColor: '#A0A0A0', | ||
title: { | ||
style: { | ||
color: '#CCC', | ||
fontWeight: 'bold', | ||
fontSize: '12px', | ||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' | ||
Highcharts.theme = { | ||
colors: ["#DDDF0D", "#55BF3B", "#DF5353", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", | ||
"#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], | ||
chart: { | ||
backgroundColor: { | ||
linearGradient: { x1: 0, y1: 0, x2: 1, y2: 1 }, | ||
stops: [ | ||
[0, 'rgb(48, 48, 96)'], | ||
[1, 'rgb(0, 0, 0)'] | ||
] | ||
}, | ||
borderColor: '#000000', | ||
borderWidth: 2, | ||
className: 'dark-container', | ||
plotBackgroundColor: 'rgba(255, 255, 255, .1)', | ||
plotBorderColor: '#CCCCCC', | ||
plotBorderWidth: 1 | ||
}, | ||
title: { | ||
style: { | ||
color: '#C0C0C0', | ||
font: 'bold 16px "Trebuchet MS", Verdana, sans-serif' | ||
} | ||
}, | ||
subtitle: { | ||
style: { | ||
color: '#666666', | ||
font: 'bold 12px "Trebuchet MS", Verdana, sans-serif' | ||
} | ||
}, | ||
xAxis: { | ||
gridLineColor: '#333333', | ||
gridLineWidth: 1, | ||
labels: { | ||
style: { | ||
color: '#A0A0A0' | ||
} | ||
}, | ||
lineColor: '#A0A0A0', | ||
tickColor: '#A0A0A0', | ||
title: { | ||
style: { | ||
color: '#CCC', | ||
fontWeight: 'bold', | ||
fontSize: '12px', | ||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
gridLineColor: '#333333', | ||
labels: { | ||
style: { | ||
color: '#A0A0A0' | ||
} | ||
}, | ||
lineColor: '#A0A0A0', | ||
minorTickInterval: null, | ||
tickColor: '#A0A0A0', | ||
tickWidth: 1, | ||
title: { | ||
style: { | ||
color: '#CCC', | ||
fontWeight: 'bold', | ||
fontSize: '12px', | ||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' | ||
} | ||
} | ||
}, | ||
tooltip: { | ||
backgroundColor: 'rgba(0, 0, 0, 0.75)', | ||
style: { | ||
color: '#F0F0F0' | ||
} | ||
}, | ||
toolbar: { | ||
itemStyle: { | ||
color: 'silver' | ||
} | ||
}, | ||
plotOptions: { | ||
line: { | ||
dataLabels: { | ||
color: '#CCC' | ||
}, | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
spline: { | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
scatter: { | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
candlestick: { | ||
lineColor: 'white' | ||
} | ||
}, | ||
legend: { | ||
itemStyle: { | ||
font: '9pt Trebuchet MS, Verdana, sans-serif', | ||
color: '#A0A0A0' | ||
}, | ||
itemHoverStyle: { | ||
color: '#FFF' | ||
}, | ||
itemHiddenStyle: { | ||
color: '#444' | ||
} | ||
}, | ||
credits: { | ||
style: { | ||
color: '#666' | ||
} | ||
}, | ||
labels: { | ||
style: { | ||
color: '#CCC' | ||
} | ||
}, | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
gridLineColor: '#333333', | ||
labels: { | ||
style: { | ||
color: '#A0A0A0' | ||
} | ||
}, | ||
lineColor: '#A0A0A0', | ||
minorTickInterval: null, | ||
tickColor: '#A0A0A0', | ||
tickWidth: 1, | ||
title: { | ||
style: { | ||
color: '#CCC', | ||
fontWeight: 'bold', | ||
fontSize: '12px', | ||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' | ||
} | ||
} | ||
}, | ||
tooltip: { | ||
backgroundColor: 'rgba(0, 0, 0, 0.75)', | ||
style: { | ||
color: '#F0F0F0' | ||
} | ||
}, | ||
toolbar: { | ||
itemStyle: { | ||
color: 'silver' | ||
} | ||
}, | ||
plotOptions: { | ||
line: { | ||
dataLabels: { | ||
color: '#CCC' | ||
}, | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
spline: { | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
scatter: { | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
candlestick: { | ||
lineColor: 'white' | ||
} | ||
}, | ||
legend: { | ||
itemStyle: { | ||
font: '9pt Trebuchet MS, Verdana, sans-serif', | ||
color: '#A0A0A0' | ||
}, | ||
itemHoverStyle: { | ||
color: '#FFF' | ||
}, | ||
itemHiddenStyle: { | ||
color: '#444' | ||
} | ||
}, | ||
credits: { | ||
style: { | ||
color: '#666' | ||
} | ||
}, | ||
labels: { | ||
style: { | ||
color: '#CCC' | ||
} | ||
}, | ||
navigation: { | ||
buttonOptions: { | ||
symbolStroke: '#DDDDDD', | ||
hoverSymbolStroke: '#FFFFFF', | ||
theme: { | ||
fill: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#606060'], | ||
[0.6, '#333333'] | ||
] | ||
}, | ||
stroke: '#000000' | ||
} | ||
} | ||
}, | ||
navigation: { | ||
buttonOptions: { | ||
symbolStroke: '#DDDDDD', | ||
hoverSymbolStroke: '#FFFFFF', | ||
theme: { | ||
fill: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#606060'], | ||
[0.6, '#333333'] | ||
] | ||
}, | ||
stroke: '#000000' | ||
} | ||
} | ||
}, | ||
// scroll charts | ||
rangeSelector: { | ||
buttonTheme: { | ||
fill: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: '#CCC', | ||
fontWeight: 'bold' | ||
}, | ||
states: { | ||
hover: { | ||
fill: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#BBB'], | ||
[0.6, '#888'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: 'white' | ||
} | ||
}, | ||
select: { | ||
fill: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.1, '#000'], | ||
[0.3, '#333'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: 'yellow' | ||
} | ||
} | ||
} | ||
}, | ||
inputStyle: { | ||
backgroundColor: '#333', | ||
color: 'silver' | ||
}, | ||
labelStyle: { | ||
color: 'silver' | ||
} | ||
}, | ||
// scroll charts | ||
rangeSelector: { | ||
buttonTheme: { | ||
fill: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: '#CCC', | ||
fontWeight: 'bold' | ||
}, | ||
states: { | ||
hover: { | ||
fill: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#BBB'], | ||
[0.6, '#888'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: 'white' | ||
} | ||
}, | ||
select: { | ||
fill: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.1, '#000'], | ||
[0.3, '#333'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: 'yellow' | ||
} | ||
} | ||
} | ||
}, | ||
inputStyle: { | ||
backgroundColor: '#333', | ||
color: 'silver' | ||
}, | ||
labelStyle: { | ||
color: 'silver' | ||
} | ||
}, | ||
navigator: { | ||
handles: { | ||
backgroundColor: '#666', | ||
borderColor: '#AAA' | ||
}, | ||
outlineColor: '#CCC', | ||
maskFill: 'rgba(16, 16, 16, 0.5)', | ||
series: { | ||
color: '#7798BF', | ||
lineColor: '#A6C7ED' | ||
} | ||
}, | ||
navigator: { | ||
handles: { | ||
backgroundColor: '#666', | ||
borderColor: '#AAA' | ||
}, | ||
outlineColor: '#CCC', | ||
maskFill: 'rgba(16, 16, 16, 0.5)', | ||
series: { | ||
color: '#7798BF', | ||
lineColor: '#A6C7ED' | ||
} | ||
}, | ||
scrollbar: { | ||
barBackgroundColor: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
barBorderColor: '#CCC', | ||
buttonArrowColor: '#CCC', | ||
buttonBackgroundColor: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
buttonBorderColor: '#CCC', | ||
rifleColor: '#FFF', | ||
trackBackgroundColor: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0, '#000'], | ||
[1, '#333'] | ||
] | ||
}, | ||
trackBorderColor: '#666' | ||
}, | ||
scrollbar: { | ||
barBackgroundColor: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
barBorderColor: '#CCC', | ||
buttonArrowColor: '#CCC', | ||
buttonBackgroundColor: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
buttonBorderColor: '#CCC', | ||
rifleColor: '#FFF', | ||
trackBackgroundColor: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0, '#000'], | ||
[1, '#333'] | ||
] | ||
}, | ||
trackBorderColor: '#666' | ||
}, | ||
// special colors for some of the | ||
legendBackgroundColor: 'rgba(0, 0, 0, 0.5)', | ||
background2: 'rgb(35, 35, 70)', | ||
dataLabelsColor: '#444', | ||
textColor: '#C0C0C0', | ||
maskColor: 'rgba(255,255,255,0.3)' | ||
}; | ||
// special colors for some of the | ||
legendBackgroundColor: 'rgba(0, 0, 0, 0.5)', | ||
background2: 'rgb(35, 35, 70)', | ||
dataLabelsColor: '#444', | ||
textColor: '#C0C0C0', | ||
maskColor: 'rgba(255,255,255,0.3)' | ||
}; | ||
// Apply the theme | ||
Highcharts.setOptions(Highcharts.theme); | ||
// Apply the theme | ||
var highchartsOptions = Highcharts.setOptions(Highcharts.theme); | ||
}(Highcharts)); | ||
})); |
/** | ||
* Dark blue theme for Highcharts JS | ||
* @author Torstein Honsi | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* | ||
* (c) 2009-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(Highcharts) { | ||
/** | ||
* (c) 2010-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
* | ||
* Dark blue theme for Highcharts JS | ||
* @author Torstein Honsi | ||
*/ | ||
Highcharts.theme = { | ||
colors: ["#DDDF0D", "#55BF3B", "#DF5353", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", | ||
"#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], | ||
chart: { | ||
backgroundColor: { | ||
linearGradient: [0, 0, 250, 500], | ||
stops: [ | ||
[0, 'rgb(48, 96, 48)'], | ||
[1, 'rgb(0, 0, 0)'] | ||
] | ||
}, | ||
borderColor: '#000000', | ||
borderWidth: 2, | ||
className: 'dark-container', | ||
plotBackgroundColor: 'rgba(255, 255, 255, .1)', | ||
plotBorderColor: '#CCCCCC', | ||
plotBorderWidth: 1 | ||
}, | ||
title: { | ||
style: { | ||
color: '#C0C0C0', | ||
font: 'bold 16px "Trebuchet MS", Verdana, sans-serif' | ||
} | ||
}, | ||
subtitle: { | ||
style: { | ||
color: '#666666', | ||
font: 'bold 12px "Trebuchet MS", Verdana, sans-serif' | ||
} | ||
}, | ||
xAxis: { | ||
gridLineColor: '#333333', | ||
gridLineWidth: 1, | ||
labels: { | ||
style: { | ||
color: '#A0A0A0' | ||
} | ||
}, | ||
lineColor: '#A0A0A0', | ||
tickColor: '#A0A0A0', | ||
title: { | ||
style: { | ||
color: '#CCC', | ||
fontWeight: 'bold', | ||
fontSize: '12px', | ||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' | ||
'use strict'; | ||
Highcharts.theme = { | ||
colors: ['#DDDF0D', '#55BF3B', '#DF5353', '#7798BF', '#aaeeee', '#ff0066', '#eeaaee', | ||
'#55BF3B', '#DF5353', '#7798BF', '#aaeeee' | ||
], | ||
chart: { | ||
backgroundColor: { | ||
linearGradient: [0, 0, 250, 500], | ||
stops: [ | ||
[0, 'rgb(48, 96, 48)'], | ||
[1, 'rgb(0, 0, 0)'] | ||
] | ||
}, | ||
borderColor: '#000000', | ||
borderWidth: 2, | ||
className: 'dark-container', | ||
plotBackgroundColor: 'rgba(255, 255, 255, .1)', | ||
plotBorderColor: '#CCCCCC', | ||
plotBorderWidth: 1 | ||
}, | ||
title: { | ||
style: { | ||
color: '#C0C0C0', | ||
font: 'bold 16px "Trebuchet MS", Verdana, sans-serif' | ||
} | ||
}, | ||
subtitle: { | ||
style: { | ||
color: '#666666', | ||
font: 'bold 12px "Trebuchet MS", Verdana, sans-serif' | ||
} | ||
}, | ||
xAxis: { | ||
gridLineColor: '#333333', | ||
gridLineWidth: 1, | ||
labels: { | ||
style: { | ||
color: '#A0A0A0' | ||
} | ||
}, | ||
lineColor: '#A0A0A0', | ||
tickColor: '#A0A0A0', | ||
title: { | ||
style: { | ||
color: '#CCC', | ||
fontWeight: 'bold', | ||
fontSize: '12px', | ||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
gridLineColor: '#333333', | ||
labels: { | ||
style: { | ||
color: '#A0A0A0' | ||
} | ||
}, | ||
lineColor: '#A0A0A0', | ||
minorTickInterval: null, | ||
tickColor: '#A0A0A0', | ||
tickWidth: 1, | ||
title: { | ||
style: { | ||
color: '#CCC', | ||
fontWeight: 'bold', | ||
fontSize: '12px', | ||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' | ||
} | ||
} | ||
}, | ||
tooltip: { | ||
backgroundColor: 'rgba(0, 0, 0, 0.75)', | ||
style: { | ||
color: '#F0F0F0' | ||
} | ||
}, | ||
toolbar: { | ||
itemStyle: { | ||
color: 'silver' | ||
} | ||
}, | ||
plotOptions: { | ||
line: { | ||
dataLabels: { | ||
color: '#CCC' | ||
}, | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
spline: { | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
scatter: { | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
candlestick: { | ||
lineColor: 'white' | ||
} | ||
}, | ||
legend: { | ||
itemStyle: { | ||
font: '9pt Trebuchet MS, Verdana, sans-serif', | ||
color: '#A0A0A0' | ||
}, | ||
itemHoverStyle: { | ||
color: '#FFF' | ||
}, | ||
itemHiddenStyle: { | ||
color: '#444' | ||
} | ||
}, | ||
credits: { | ||
style: { | ||
color: '#666' | ||
} | ||
}, | ||
labels: { | ||
style: { | ||
color: '#CCC' | ||
} | ||
}, | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
gridLineColor: '#333333', | ||
labels: { | ||
style: { | ||
color: '#A0A0A0' | ||
} | ||
}, | ||
lineColor: '#A0A0A0', | ||
minorTickInterval: null, | ||
tickColor: '#A0A0A0', | ||
tickWidth: 1, | ||
title: { | ||
style: { | ||
color: '#CCC', | ||
fontWeight: 'bold', | ||
fontSize: '12px', | ||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' | ||
} | ||
} | ||
}, | ||
tooltip: { | ||
backgroundColor: 'rgba(0, 0, 0, 0.75)', | ||
style: { | ||
color: '#F0F0F0' | ||
} | ||
}, | ||
toolbar: { | ||
itemStyle: { | ||
color: 'silver' | ||
} | ||
}, | ||
plotOptions: { | ||
line: { | ||
dataLabels: { | ||
color: '#CCC' | ||
}, | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
spline: { | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
scatter: { | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
candlestick: { | ||
lineColor: 'white' | ||
} | ||
}, | ||
legend: { | ||
itemStyle: { | ||
font: '9pt Trebuchet MS, Verdana, sans-serif', | ||
color: '#A0A0A0' | ||
}, | ||
itemHoverStyle: { | ||
color: '#FFF' | ||
}, | ||
itemHiddenStyle: { | ||
color: '#444' | ||
} | ||
}, | ||
credits: { | ||
style: { | ||
color: '#666' | ||
} | ||
}, | ||
labels: { | ||
style: { | ||
color: '#CCC' | ||
} | ||
}, | ||
navigation: { | ||
buttonOptions: { | ||
symbolStroke: '#DDDDDD', | ||
hoverSymbolStroke: '#FFFFFF', | ||
theme: { | ||
fill: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#606060'], | ||
[0.6, '#333333'] | ||
] | ||
}, | ||
stroke: '#000000' | ||
} | ||
} | ||
}, | ||
navigation: { | ||
buttonOptions: { | ||
symbolStroke: '#DDDDDD', | ||
hoverSymbolStroke: '#FFFFFF', | ||
theme: { | ||
fill: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#606060'], | ||
[0.6, '#333333'] | ||
] | ||
}, | ||
stroke: '#000000' | ||
} | ||
} | ||
}, | ||
// scroll charts | ||
rangeSelector: { | ||
buttonTheme: { | ||
fill: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: '#CCC', | ||
fontWeight: 'bold' | ||
}, | ||
states: { | ||
hover: { | ||
fill: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#BBB'], | ||
[0.6, '#888'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: 'white' | ||
} | ||
}, | ||
select: { | ||
fill: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.1, '#000'], | ||
[0.3, '#333'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: 'yellow' | ||
} | ||
} | ||
} | ||
}, | ||
inputStyle: { | ||
backgroundColor: '#333', | ||
color: 'silver' | ||
}, | ||
labelStyle: { | ||
color: 'silver' | ||
} | ||
}, | ||
// scroll charts | ||
rangeSelector: { | ||
buttonTheme: { | ||
fill: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: '#CCC', | ||
fontWeight: 'bold' | ||
}, | ||
states: { | ||
hover: { | ||
fill: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#BBB'], | ||
[0.6, '#888'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: 'white' | ||
} | ||
}, | ||
select: { | ||
fill: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.1, '#000'], | ||
[0.3, '#333'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: 'yellow' | ||
} | ||
} | ||
} | ||
}, | ||
inputStyle: { | ||
backgroundColor: '#333', | ||
color: 'silver' | ||
}, | ||
labelStyle: { | ||
color: 'silver' | ||
} | ||
}, | ||
navigator: { | ||
handles: { | ||
backgroundColor: '#666', | ||
borderColor: '#AAA' | ||
}, | ||
outlineColor: '#CCC', | ||
maskFill: 'rgba(16, 16, 16, 0.5)', | ||
series: { | ||
color: '#7798BF', | ||
lineColor: '#A6C7ED' | ||
} | ||
}, | ||
navigator: { | ||
handles: { | ||
backgroundColor: '#666', | ||
borderColor: '#AAA' | ||
}, | ||
outlineColor: '#CCC', | ||
maskFill: 'rgba(16, 16, 16, 0.5)', | ||
series: { | ||
color: '#7798BF', | ||
lineColor: '#A6C7ED' | ||
} | ||
}, | ||
scrollbar: { | ||
barBackgroundColor: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
barBorderColor: '#CCC', | ||
buttonArrowColor: '#CCC', | ||
buttonBackgroundColor: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
buttonBorderColor: '#CCC', | ||
rifleColor: '#FFF', | ||
trackBackgroundColor: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0, '#000'], | ||
[1, '#333'] | ||
] | ||
}, | ||
trackBorderColor: '#666' | ||
}, | ||
scrollbar: { | ||
barBackgroundColor: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
barBorderColor: '#CCC', | ||
buttonArrowColor: '#CCC', | ||
buttonBackgroundColor: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
buttonBorderColor: '#CCC', | ||
rifleColor: '#FFF', | ||
trackBackgroundColor: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0, '#000'], | ||
[1, '#333'] | ||
] | ||
}, | ||
trackBorderColor: '#666' | ||
}, | ||
// special colors for some of the | ||
legendBackgroundColor: 'rgba(0, 0, 0, 0.5)', | ||
background2: 'rgb(35, 35, 70)', | ||
dataLabelsColor: '#444', | ||
textColor: '#C0C0C0', | ||
maskColor: 'rgba(255,255,255,0.3)' | ||
}; | ||
// special colors for some of the | ||
legendBackgroundColor: 'rgba(0, 0, 0, 0.5)', | ||
background2: 'rgb(35, 35, 70)', | ||
dataLabelsColor: '#444', | ||
textColor: '#C0C0C0', | ||
maskColor: 'rgba(255,255,255,0.3)' | ||
}; | ||
// Apply the theme | ||
var highchartsOptions = Highcharts.setOptions(Highcharts.theme); | ||
// Apply the theme | ||
Highcharts.setOptions(Highcharts.theme); | ||
}(Highcharts)); | ||
})); |
/** | ||
* Dark theme for Highcharts JS | ||
* @author Torstein Honsi | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* | ||
* (c) 2009-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(Highcharts) { | ||
/** | ||
* (c) 2010-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
* | ||
* Dark theme for Highcharts JS | ||
* @author Torstein Honsi | ||
*/ | ||
// Load the fonts | ||
Highcharts.createElement('link', { | ||
href: 'https://fonts.googleapis.com/css?family=Unica+One', | ||
rel: 'stylesheet', | ||
type: 'text/css' | ||
}, null, document.getElementsByTagName('head')[0]); | ||
'use strict'; | ||
/* global document */ | ||
// Load the fonts | ||
Highcharts.createElement('link', { | ||
href: 'https://fonts.googleapis.com/css?family=Unica+One', | ||
rel: 'stylesheet', | ||
type: 'text/css' | ||
}, null, document.getElementsByTagName('head')[0]); | ||
Highcharts.theme = { | ||
colors: ["#2b908f", "#90ee7e", "#f45b5b", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", | ||
"#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], | ||
chart: { | ||
backgroundColor: { | ||
linearGradient: { x1: 0, y1: 0, x2: 1, y2: 1 }, | ||
stops: [ | ||
[0, '#2a2a2b'], | ||
[1, '#3e3e40'] | ||
] | ||
}, | ||
style: { | ||
fontFamily: "'Unica One', sans-serif" | ||
}, | ||
plotBorderColor: '#606063' | ||
}, | ||
title: { | ||
style: { | ||
color: '#E0E0E3', | ||
textTransform: 'uppercase', | ||
fontSize: '20px' | ||
} | ||
}, | ||
subtitle: { | ||
style: { | ||
color: '#E0E0E3', | ||
textTransform: 'uppercase' | ||
} | ||
}, | ||
xAxis: { | ||
gridLineColor: '#707073', | ||
labels: { | ||
style: { | ||
color: '#E0E0E3' | ||
} | ||
}, | ||
lineColor: '#707073', | ||
minorGridLineColor: '#505053', | ||
tickColor: '#707073', | ||
title: { | ||
style: { | ||
color: '#A0A0A3' | ||
Highcharts.theme = { | ||
colors: ['#2b908f', '#90ee7e', '#f45b5b', '#7798BF', '#aaeeee', '#ff0066', '#eeaaee', | ||
'#55BF3B', '#DF5353', '#7798BF', '#aaeeee' | ||
], | ||
chart: { | ||
backgroundColor: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 1, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0, '#2a2a2b'], | ||
[1, '#3e3e40'] | ||
] | ||
}, | ||
style: { | ||
fontFamily: '\'Unica One\', sans-serif' | ||
}, | ||
plotBorderColor: '#606063' | ||
}, | ||
title: { | ||
style: { | ||
color: '#E0E0E3', | ||
textTransform: 'uppercase', | ||
fontSize: '20px' | ||
} | ||
}, | ||
subtitle: { | ||
style: { | ||
color: '#E0E0E3', | ||
textTransform: 'uppercase' | ||
} | ||
}, | ||
xAxis: { | ||
gridLineColor: '#707073', | ||
labels: { | ||
style: { | ||
color: '#E0E0E3' | ||
} | ||
}, | ||
lineColor: '#707073', | ||
minorGridLineColor: '#505053', | ||
tickColor: '#707073', | ||
title: { | ||
style: { | ||
color: '#A0A0A3' | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
gridLineColor: '#707073', | ||
labels: { | ||
style: { | ||
color: '#E0E0E3' | ||
} | ||
}, | ||
lineColor: '#707073', | ||
minorGridLineColor: '#505053', | ||
tickColor: '#707073', | ||
tickWidth: 1, | ||
title: { | ||
style: { | ||
color: '#A0A0A3' | ||
} | ||
} | ||
}, | ||
tooltip: { | ||
backgroundColor: 'rgba(0, 0, 0, 0.85)', | ||
style: { | ||
color: '#F0F0F0' | ||
} | ||
}, | ||
plotOptions: { | ||
series: { | ||
dataLabels: { | ||
color: '#B0B0B3' | ||
}, | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
boxplot: { | ||
fillColor: '#505053' | ||
}, | ||
candlestick: { | ||
lineColor: 'white' | ||
}, | ||
errorbar: { | ||
color: 'white' | ||
} | ||
}, | ||
legend: { | ||
itemStyle: { | ||
color: '#E0E0E3' | ||
}, | ||
itemHoverStyle: { | ||
color: '#FFF' | ||
}, | ||
itemHiddenStyle: { | ||
color: '#606063' | ||
} | ||
}, | ||
credits: { | ||
style: { | ||
color: '#666' | ||
} | ||
}, | ||
labels: { | ||
style: { | ||
color: '#707073' | ||
} | ||
}, | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
gridLineColor: '#707073', | ||
labels: { | ||
style: { | ||
color: '#E0E0E3' | ||
} | ||
}, | ||
lineColor: '#707073', | ||
minorGridLineColor: '#505053', | ||
tickColor: '#707073', | ||
tickWidth: 1, | ||
title: { | ||
style: { | ||
color: '#A0A0A3' | ||
} | ||
} | ||
}, | ||
tooltip: { | ||
backgroundColor: 'rgba(0, 0, 0, 0.85)', | ||
style: { | ||
color: '#F0F0F0' | ||
} | ||
}, | ||
plotOptions: { | ||
series: { | ||
dataLabels: { | ||
color: '#B0B0B3' | ||
}, | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
boxplot: { | ||
fillColor: '#505053' | ||
}, | ||
candlestick: { | ||
lineColor: 'white' | ||
}, | ||
errorbar: { | ||
color: 'white' | ||
} | ||
}, | ||
legend: { | ||
itemStyle: { | ||
color: '#E0E0E3' | ||
}, | ||
itemHoverStyle: { | ||
color: '#FFF' | ||
}, | ||
itemHiddenStyle: { | ||
color: '#606063' | ||
} | ||
}, | ||
credits: { | ||
style: { | ||
color: '#666' | ||
} | ||
}, | ||
labels: { | ||
style: { | ||
color: '#707073' | ||
} | ||
}, | ||
drilldown: { | ||
activeAxisLabelStyle: { | ||
color: '#F0F0F3' | ||
}, | ||
activeDataLabelStyle: { | ||
color: '#F0F0F3' | ||
} | ||
}, | ||
drilldown: { | ||
activeAxisLabelStyle: { | ||
color: '#F0F0F3' | ||
}, | ||
activeDataLabelStyle: { | ||
color: '#F0F0F3' | ||
} | ||
}, | ||
navigation: { | ||
buttonOptions: { | ||
symbolStroke: '#DDDDDD', | ||
theme: { | ||
fill: '#505053' | ||
} | ||
} | ||
}, | ||
navigation: { | ||
buttonOptions: { | ||
symbolStroke: '#DDDDDD', | ||
theme: { | ||
fill: '#505053' | ||
} | ||
} | ||
}, | ||
// scroll charts | ||
rangeSelector: { | ||
buttonTheme: { | ||
fill: '#505053', | ||
stroke: '#000000', | ||
style: { | ||
color: '#CCC' | ||
}, | ||
states: { | ||
hover: { | ||
fill: '#707073', | ||
stroke: '#000000', | ||
style: { | ||
color: 'white' | ||
} | ||
}, | ||
select: { | ||
fill: '#000003', | ||
stroke: '#000000', | ||
style: { | ||
color: 'white' | ||
} | ||
} | ||
} | ||
}, | ||
inputBoxBorderColor: '#505053', | ||
inputStyle: { | ||
backgroundColor: '#333', | ||
color: 'silver' | ||
}, | ||
labelStyle: { | ||
color: 'silver' | ||
} | ||
}, | ||
// scroll charts | ||
rangeSelector: { | ||
buttonTheme: { | ||
fill: '#505053', | ||
stroke: '#000000', | ||
style: { | ||
color: '#CCC' | ||
}, | ||
states: { | ||
hover: { | ||
fill: '#707073', | ||
stroke: '#000000', | ||
style: { | ||
color: 'white' | ||
} | ||
}, | ||
select: { | ||
fill: '#000003', | ||
stroke: '#000000', | ||
style: { | ||
color: 'white' | ||
} | ||
} | ||
} | ||
}, | ||
inputBoxBorderColor: '#505053', | ||
inputStyle: { | ||
backgroundColor: '#333', | ||
color: 'silver' | ||
}, | ||
labelStyle: { | ||
color: 'silver' | ||
} | ||
}, | ||
navigator: { | ||
handles: { | ||
backgroundColor: '#666', | ||
borderColor: '#AAA' | ||
}, | ||
outlineColor: '#CCC', | ||
maskFill: 'rgba(255,255,255,0.1)', | ||
series: { | ||
color: '#7798BF', | ||
lineColor: '#A6C7ED' | ||
}, | ||
xAxis: { | ||
gridLineColor: '#505053' | ||
} | ||
}, | ||
navigator: { | ||
handles: { | ||
backgroundColor: '#666', | ||
borderColor: '#AAA' | ||
}, | ||
outlineColor: '#CCC', | ||
maskFill: 'rgba(255,255,255,0.1)', | ||
series: { | ||
color: '#7798BF', | ||
lineColor: '#A6C7ED' | ||
}, | ||
xAxis: { | ||
gridLineColor: '#505053' | ||
} | ||
}, | ||
scrollbar: { | ||
barBackgroundColor: '#808083', | ||
barBorderColor: '#808083', | ||
buttonArrowColor: '#CCC', | ||
buttonBackgroundColor: '#606063', | ||
buttonBorderColor: '#606063', | ||
rifleColor: '#FFF', | ||
trackBackgroundColor: '#404043', | ||
trackBorderColor: '#404043' | ||
}, | ||
scrollbar: { | ||
barBackgroundColor: '#808083', | ||
barBorderColor: '#808083', | ||
buttonArrowColor: '#CCC', | ||
buttonBackgroundColor: '#606063', | ||
buttonBorderColor: '#606063', | ||
rifleColor: '#FFF', | ||
trackBackgroundColor: '#404043', | ||
trackBorderColor: '#404043' | ||
}, | ||
// special colors for some of the | ||
legendBackgroundColor: 'rgba(0, 0, 0, 0.5)', | ||
background2: '#505053', | ||
dataLabelsColor: '#B0B0B3', | ||
textColor: '#C0C0C0', | ||
contrastTextColor: '#F0F0F3', | ||
maskColor: 'rgba(255,255,255,0.3)' | ||
}; | ||
// special colors for some of the | ||
legendBackgroundColor: 'rgba(0, 0, 0, 0.5)', | ||
background2: '#505053', | ||
dataLabelsColor: '#B0B0B3', | ||
textColor: '#C0C0C0', | ||
contrastTextColor: '#F0F0F3', | ||
maskColor: 'rgba(255,255,255,0.3)' | ||
}; | ||
// Apply the theme | ||
Highcharts.setOptions(Highcharts.theme); | ||
// Apply the theme | ||
Highcharts.setOptions(Highcharts.theme); | ||
}(Highcharts)); | ||
})); |
/** | ||
* Gray theme for Highcharts JS | ||
* @author Torstein Honsi | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* | ||
* (c) 2009-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(Highcharts) { | ||
/** | ||
* (c) 2010-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
* | ||
* Gray theme for Highcharts JS | ||
* @author Torstein Honsi | ||
*/ | ||
Highcharts.theme = { | ||
colors: ["#DDDF0D", "#7798BF", "#55BF3B", "#DF5353", "#aaeeee", "#ff0066", "#eeaaee", | ||
"#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], | ||
chart: { | ||
backgroundColor: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0, 'rgb(96, 96, 96)'], | ||
[1, 'rgb(16, 16, 16)'] | ||
] | ||
}, | ||
borderWidth: 0, | ||
borderRadius: 0, | ||
plotBackgroundColor: null, | ||
plotShadow: false, | ||
plotBorderWidth: 0 | ||
}, | ||
title: { | ||
style: { | ||
color: '#FFF', | ||
font: '16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
}, | ||
subtitle: { | ||
style: { | ||
color: '#DDD', | ||
font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
}, | ||
xAxis: { | ||
gridLineWidth: 0, | ||
lineColor: '#999', | ||
tickColor: '#999', | ||
labels: { | ||
style: { | ||
color: '#999', | ||
fontWeight: 'bold' | ||
} | ||
}, | ||
title: { | ||
style: { | ||
color: '#AAA', | ||
font: 'bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
alternateGridColor: null, | ||
minorTickInterval: null, | ||
gridLineColor: 'rgba(255, 255, 255, .1)', | ||
minorGridLineColor: 'rgba(255,255,255,0.07)', | ||
lineWidth: 0, | ||
tickWidth: 0, | ||
labels: { | ||
style: { | ||
color: '#999', | ||
fontWeight: 'bold' | ||
} | ||
}, | ||
title: { | ||
style: { | ||
color: '#AAA', | ||
font: 'bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
} | ||
}, | ||
legend: { | ||
itemStyle: { | ||
color: '#CCC' | ||
}, | ||
itemHoverStyle: { | ||
color: '#FFF' | ||
}, | ||
itemHiddenStyle: { | ||
color: '#333' | ||
} | ||
}, | ||
labels: { | ||
style: { | ||
color: '#CCC' | ||
} | ||
}, | ||
tooltip: { | ||
backgroundColor: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0, 'rgba(96, 96, 96, .8)'], | ||
[1, 'rgba(16, 16, 16, .8)'] | ||
] | ||
}, | ||
borderWidth: 0, | ||
style: { | ||
color: '#FFF' | ||
} | ||
}, | ||
'use strict'; | ||
Highcharts.theme = { | ||
colors: ['#DDDF0D', '#7798BF', '#55BF3B', '#DF5353', '#aaeeee', '#ff0066', '#eeaaee', | ||
'#55BF3B', '#DF5353', '#7798BF', '#aaeeee' | ||
], | ||
chart: { | ||
backgroundColor: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0, 'rgb(96, 96, 96)'], | ||
[1, 'rgb(16, 16, 16)'] | ||
] | ||
}, | ||
borderWidth: 0, | ||
borderRadius: 0, | ||
plotBackgroundColor: null, | ||
plotShadow: false, | ||
plotBorderWidth: 0 | ||
}, | ||
title: { | ||
style: { | ||
color: '#FFF', | ||
font: '16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
}, | ||
subtitle: { | ||
style: { | ||
color: '#DDD', | ||
font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
}, | ||
xAxis: { | ||
gridLineWidth: 0, | ||
lineColor: '#999', | ||
tickColor: '#999', | ||
labels: { | ||
style: { | ||
color: '#999', | ||
fontWeight: 'bold' | ||
} | ||
}, | ||
title: { | ||
style: { | ||
color: '#AAA', | ||
font: 'bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
alternateGridColor: null, | ||
minorTickInterval: null, | ||
gridLineColor: 'rgba(255, 255, 255, .1)', | ||
minorGridLineColor: 'rgba(255,255,255,0.07)', | ||
lineWidth: 0, | ||
tickWidth: 0, | ||
labels: { | ||
style: { | ||
color: '#999', | ||
fontWeight: 'bold' | ||
} | ||
}, | ||
title: { | ||
style: { | ||
color: '#AAA', | ||
font: 'bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
} | ||
}, | ||
legend: { | ||
itemStyle: { | ||
color: '#CCC' | ||
}, | ||
itemHoverStyle: { | ||
color: '#FFF' | ||
}, | ||
itemHiddenStyle: { | ||
color: '#333' | ||
} | ||
}, | ||
labels: { | ||
style: { | ||
color: '#CCC' | ||
} | ||
}, | ||
tooltip: { | ||
backgroundColor: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0, 'rgba(96, 96, 96, .8)'], | ||
[1, 'rgba(16, 16, 16, .8)'] | ||
] | ||
}, | ||
borderWidth: 0, | ||
style: { | ||
color: '#FFF' | ||
} | ||
}, | ||
plotOptions: { | ||
series: { | ||
nullColor: '#444444' | ||
}, | ||
line: { | ||
dataLabels: { | ||
color: '#CCC' | ||
}, | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
spline: { | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
scatter: { | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
candlestick: { | ||
lineColor: 'white' | ||
} | ||
}, | ||
plotOptions: { | ||
series: { | ||
nullColor: '#444444' | ||
}, | ||
line: { | ||
dataLabels: { | ||
color: '#CCC' | ||
}, | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
spline: { | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
scatter: { | ||
marker: { | ||
lineColor: '#333' | ||
} | ||
}, | ||
candlestick: { | ||
lineColor: 'white' | ||
} | ||
}, | ||
toolbar: { | ||
itemStyle: { | ||
color: '#CCC' | ||
} | ||
}, | ||
toolbar: { | ||
itemStyle: { | ||
color: '#CCC' | ||
} | ||
}, | ||
navigation: { | ||
buttonOptions: { | ||
symbolStroke: '#DDDDDD', | ||
hoverSymbolStroke: '#FFFFFF', | ||
theme: { | ||
fill: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#606060'], | ||
[0.6, '#333333'] | ||
] | ||
}, | ||
stroke: '#000000' | ||
} | ||
} | ||
}, | ||
navigation: { | ||
buttonOptions: { | ||
symbolStroke: '#DDDDDD', | ||
hoverSymbolStroke: '#FFFFFF', | ||
theme: { | ||
fill: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#606060'], | ||
[0.6, '#333333'] | ||
] | ||
}, | ||
stroke: '#000000' | ||
} | ||
} | ||
}, | ||
// scroll charts | ||
rangeSelector: { | ||
buttonTheme: { | ||
fill: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: '#CCC', | ||
fontWeight: 'bold' | ||
}, | ||
states: { | ||
hover: { | ||
fill: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#BBB'], | ||
[0.6, '#888'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: 'white' | ||
} | ||
}, | ||
select: { | ||
fill: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.1, '#000'], | ||
[0.3, '#333'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: 'yellow' | ||
} | ||
} | ||
} | ||
}, | ||
inputStyle: { | ||
backgroundColor: '#333', | ||
color: 'silver' | ||
}, | ||
labelStyle: { | ||
color: 'silver' | ||
} | ||
}, | ||
// scroll charts | ||
rangeSelector: { | ||
buttonTheme: { | ||
fill: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: '#CCC', | ||
fontWeight: 'bold' | ||
}, | ||
states: { | ||
hover: { | ||
fill: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#BBB'], | ||
[0.6, '#888'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: 'white' | ||
} | ||
}, | ||
select: { | ||
fill: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.1, '#000'], | ||
[0.3, '#333'] | ||
] | ||
}, | ||
stroke: '#000000', | ||
style: { | ||
color: 'yellow' | ||
} | ||
} | ||
} | ||
}, | ||
inputStyle: { | ||
backgroundColor: '#333', | ||
color: 'silver' | ||
}, | ||
labelStyle: { | ||
color: 'silver' | ||
} | ||
}, | ||
navigator: { | ||
handles: { | ||
backgroundColor: '#666', | ||
borderColor: '#AAA' | ||
}, | ||
outlineColor: '#CCC', | ||
maskFill: 'rgba(16, 16, 16, 0.5)', | ||
series: { | ||
color: '#7798BF', | ||
lineColor: '#A6C7ED' | ||
} | ||
}, | ||
navigator: { | ||
handles: { | ||
backgroundColor: '#666', | ||
borderColor: '#AAA' | ||
}, | ||
outlineColor: '#CCC', | ||
maskFill: 'rgba(16, 16, 16, 0.5)', | ||
series: { | ||
color: '#7798BF', | ||
lineColor: '#A6C7ED' | ||
} | ||
}, | ||
scrollbar: { | ||
barBackgroundColor: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
barBorderColor: '#CCC', | ||
buttonArrowColor: '#CCC', | ||
buttonBackgroundColor: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
buttonBorderColor: '#CCC', | ||
rifleColor: '#FFF', | ||
trackBackgroundColor: { | ||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, | ||
stops: [ | ||
[0, '#000'], | ||
[1, '#333'] | ||
] | ||
}, | ||
trackBorderColor: '#666' | ||
}, | ||
scrollbar: { | ||
barBackgroundColor: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
barBorderColor: '#CCC', | ||
buttonArrowColor: '#CCC', | ||
buttonBackgroundColor: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0.4, '#888'], | ||
[0.6, '#555'] | ||
] | ||
}, | ||
buttonBorderColor: '#CCC', | ||
rifleColor: '#FFF', | ||
trackBackgroundColor: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 0, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0, '#000'], | ||
[1, '#333'] | ||
] | ||
}, | ||
trackBorderColor: '#666' | ||
}, | ||
// special colors for some of the demo examples | ||
legendBackgroundColor: 'rgba(48, 48, 48, 0.8)', | ||
background2: 'rgb(70, 70, 70)', | ||
dataLabelsColor: '#444', | ||
textColor: '#E0E0E0', | ||
maskColor: 'rgba(255,255,255,0.3)' | ||
}; | ||
// special colors for some of the demo examples | ||
legendBackgroundColor: 'rgba(48, 48, 48, 0.8)', | ||
background2: 'rgb(70, 70, 70)', | ||
dataLabelsColor: '#444', | ||
textColor: '#E0E0E0', | ||
maskColor: 'rgba(255,255,255,0.3)' | ||
}; | ||
// Apply the theme | ||
var highchartsOptions = Highcharts.setOptions(Highcharts.theme); | ||
// Apply the theme | ||
Highcharts.setOptions(Highcharts.theme); | ||
}(Highcharts)); | ||
})); |
/** | ||
* Grid-light theme for Highcharts JS | ||
* @author Torstein Honsi | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* | ||
* (c) 2009-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(Highcharts) { | ||
/** | ||
* (c) 2010-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
* | ||
* Grid-light theme for Highcharts JS | ||
* @author Torstein Honsi | ||
*/ | ||
// Load the fonts | ||
Highcharts.createElement('link', { | ||
href: 'https://fonts.googleapis.com/css?family=Dosis:400,600', | ||
rel: 'stylesheet', | ||
type: 'text/css' | ||
}, null, document.getElementsByTagName('head')[0]); | ||
'use strict'; | ||
/* global document */ | ||
// Load the fonts | ||
Highcharts.createElement('link', { | ||
href: 'https://fonts.googleapis.com/css?family=Dosis:400,600', | ||
rel: 'stylesheet', | ||
type: 'text/css' | ||
}, null, document.getElementsByTagName('head')[0]); | ||
Highcharts.theme = { | ||
colors: ["#7cb5ec", "#f7a35c", "#90ee7e", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", | ||
"#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], | ||
chart: { | ||
backgroundColor: null, | ||
style: { | ||
fontFamily: "Dosis, sans-serif" | ||
} | ||
}, | ||
title: { | ||
style: { | ||
fontSize: '16px', | ||
fontWeight: 'bold', | ||
textTransform: 'uppercase' | ||
} | ||
}, | ||
tooltip: { | ||
borderWidth: 0, | ||
backgroundColor: 'rgba(219,219,216,0.8)', | ||
shadow: false | ||
}, | ||
legend: { | ||
itemStyle: { | ||
fontWeight: 'bold', | ||
fontSize: '13px' | ||
} | ||
}, | ||
xAxis: { | ||
gridLineWidth: 1, | ||
labels: { | ||
style: { | ||
fontSize: '12px' | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
minorTickInterval: 'auto', | ||
title: { | ||
style: { | ||
textTransform: 'uppercase' | ||
} | ||
}, | ||
labels: { | ||
style: { | ||
fontSize: '12px' | ||
} | ||
} | ||
}, | ||
plotOptions: { | ||
candlestick: { | ||
lineColor: '#404048' | ||
} | ||
}, | ||
Highcharts.theme = { | ||
colors: ['#7cb5ec', '#f7a35c', '#90ee7e', '#7798BF', '#aaeeee', '#ff0066', '#eeaaee', | ||
'#55BF3B', '#DF5353', '#7798BF', '#aaeeee' | ||
], | ||
chart: { | ||
backgroundColor: null, | ||
style: { | ||
fontFamily: 'Dosis, sans-serif' | ||
} | ||
}, | ||
title: { | ||
style: { | ||
fontSize: '16px', | ||
fontWeight: 'bold', | ||
textTransform: 'uppercase' | ||
} | ||
}, | ||
tooltip: { | ||
borderWidth: 0, | ||
backgroundColor: 'rgba(219,219,216,0.8)', | ||
shadow: false | ||
}, | ||
legend: { | ||
itemStyle: { | ||
fontWeight: 'bold', | ||
fontSize: '13px' | ||
} | ||
}, | ||
xAxis: { | ||
gridLineWidth: 1, | ||
labels: { | ||
style: { | ||
fontSize: '12px' | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
minorTickInterval: 'auto', | ||
title: { | ||
style: { | ||
textTransform: 'uppercase' | ||
} | ||
}, | ||
labels: { | ||
style: { | ||
fontSize: '12px' | ||
} | ||
} | ||
}, | ||
plotOptions: { | ||
candlestick: { | ||
lineColor: '#404048' | ||
} | ||
}, | ||
// General | ||
background2: '#F0F0EA' | ||
// General | ||
background2: '#F0F0EA' | ||
}; | ||
}; | ||
// Apply the theme | ||
Highcharts.setOptions(Highcharts.theme); | ||
// Apply the theme | ||
Highcharts.setOptions(Highcharts.theme); | ||
}(Highcharts)); | ||
})); |
/** | ||
* Grid theme for Highcharts JS | ||
* @author Torstein Honsi | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* | ||
* (c) 2009-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(Highcharts) { | ||
/** | ||
* (c) 2010-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
* | ||
* Grid theme for Highcharts JS | ||
* @author Torstein Honsi | ||
*/ | ||
Highcharts.theme = { | ||
colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'], | ||
chart: { | ||
backgroundColor: { | ||
linearGradient: { x1: 0, y1: 0, x2: 1, y2: 1 }, | ||
stops: [ | ||
[0, 'rgb(255, 255, 255)'], | ||
[1, 'rgb(240, 240, 255)'] | ||
] | ||
}, | ||
borderWidth: 2, | ||
plotBackgroundColor: 'rgba(255, 255, 255, .9)', | ||
plotShadow: true, | ||
plotBorderWidth: 1 | ||
}, | ||
title: { | ||
style: { | ||
color: '#000', | ||
font: 'bold 16px "Trebuchet MS", Verdana, sans-serif' | ||
} | ||
}, | ||
subtitle: { | ||
style: { | ||
color: '#666666', | ||
font: 'bold 12px "Trebuchet MS", Verdana, sans-serif' | ||
} | ||
}, | ||
xAxis: { | ||
gridLineWidth: 1, | ||
lineColor: '#000', | ||
tickColor: '#000', | ||
labels: { | ||
style: { | ||
color: '#000', | ||
font: '11px Trebuchet MS, Verdana, sans-serif' | ||
} | ||
}, | ||
title: { | ||
style: { | ||
color: '#333', | ||
fontWeight: 'bold', | ||
fontSize: '12px', | ||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' | ||
'use strict'; | ||
Highcharts.theme = { | ||
colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4'], | ||
chart: { | ||
backgroundColor: { | ||
linearGradient: { | ||
x1: 0, | ||
y1: 0, | ||
x2: 1, | ||
y2: 1 | ||
}, | ||
stops: [ | ||
[0, 'rgb(255, 255, 255)'], | ||
[1, 'rgb(240, 240, 255)'] | ||
] | ||
}, | ||
borderWidth: 2, | ||
plotBackgroundColor: 'rgba(255, 255, 255, .9)', | ||
plotShadow: true, | ||
plotBorderWidth: 1 | ||
}, | ||
title: { | ||
style: { | ||
color: '#000', | ||
font: 'bold 16px "Trebuchet MS", Verdana, sans-serif' | ||
} | ||
}, | ||
subtitle: { | ||
style: { | ||
color: '#666666', | ||
font: 'bold 12px "Trebuchet MS", Verdana, sans-serif' | ||
} | ||
}, | ||
xAxis: { | ||
gridLineWidth: 1, | ||
lineColor: '#000', | ||
tickColor: '#000', | ||
labels: { | ||
style: { | ||
color: '#000', | ||
font: '11px Trebuchet MS, Verdana, sans-serif' | ||
} | ||
}, | ||
title: { | ||
style: { | ||
color: '#333', | ||
fontWeight: 'bold', | ||
fontSize: '12px', | ||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
minorTickInterval: 'auto', | ||
lineColor: '#000', | ||
lineWidth: 1, | ||
tickWidth: 1, | ||
tickColor: '#000', | ||
labels: { | ||
style: { | ||
color: '#000', | ||
font: '11px Trebuchet MS, Verdana, sans-serif' | ||
} | ||
}, | ||
title: { | ||
style: { | ||
color: '#333', | ||
fontWeight: 'bold', | ||
fontSize: '12px', | ||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' | ||
} | ||
} | ||
}, | ||
legend: { | ||
itemStyle: { | ||
font: '9pt Trebuchet MS, Verdana, sans-serif', | ||
color: 'black' | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
minorTickInterval: 'auto', | ||
lineColor: '#000', | ||
lineWidth: 1, | ||
tickWidth: 1, | ||
tickColor: '#000', | ||
labels: { | ||
style: { | ||
color: '#000', | ||
font: '11px Trebuchet MS, Verdana, sans-serif' | ||
} | ||
}, | ||
title: { | ||
style: { | ||
color: '#333', | ||
fontWeight: 'bold', | ||
fontSize: '12px', | ||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' | ||
} | ||
} | ||
}, | ||
legend: { | ||
itemStyle: { | ||
font: '9pt Trebuchet MS, Verdana, sans-serif', | ||
color: 'black' | ||
}, | ||
itemHoverStyle: { | ||
color: '#039' | ||
}, | ||
itemHiddenStyle: { | ||
color: 'gray' | ||
} | ||
}, | ||
labels: { | ||
style: { | ||
color: '#99b' | ||
} | ||
}, | ||
}, | ||
itemHoverStyle: { | ||
color: '#039' | ||
}, | ||
itemHiddenStyle: { | ||
color: 'gray' | ||
} | ||
}, | ||
labels: { | ||
style: { | ||
color: '#99b' | ||
} | ||
}, | ||
navigation: { | ||
buttonOptions: { | ||
theme: { | ||
stroke: '#CCCCCC' | ||
} | ||
} | ||
} | ||
}; | ||
navigation: { | ||
buttonOptions: { | ||
theme: { | ||
stroke: '#CCCCCC' | ||
} | ||
} | ||
} | ||
}; | ||
// Apply the theme | ||
var highchartsOptions = Highcharts.setOptions(Highcharts.theme); | ||
// Apply the theme | ||
Highcharts.setOptions(Highcharts.theme); | ||
}(Highcharts)); | ||
})); |
/** | ||
* Sand-Signika theme for Highcharts JS | ||
* @author Torstein Honsi | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* | ||
* (c) 2009-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(Highcharts) { | ||
/** | ||
* (c) 2010-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
* | ||
* Sand-Signika theme for Highcharts JS | ||
* @author Torstein Honsi | ||
*/ | ||
// Load the fonts | ||
Highcharts.createElement('link', { | ||
href: 'https://fonts.googleapis.com/css?family=Signika:400,700', | ||
rel: 'stylesheet', | ||
type: 'text/css' | ||
}, null, document.getElementsByTagName('head')[0]); | ||
'use strict'; | ||
/* global document */ | ||
// Load the fonts | ||
Highcharts.createElement('link', { | ||
href: 'https://fonts.googleapis.com/css?family=Signika:400,700', | ||
rel: 'stylesheet', | ||
type: 'text/css' | ||
}, null, document.getElementsByTagName('head')[0]); | ||
// Add the background image to the container | ||
Highcharts.wrap(Highcharts.Chart.prototype, 'getContainer', function (proceed) { | ||
proceed.call(this); | ||
this.container.style.background = 'url(http://www.highcharts.com/samples/graphics/sand.png)'; | ||
}); | ||
// Add the background image to the container | ||
Highcharts.wrap(Highcharts.Chart.prototype, 'getContainer', function(proceed) { | ||
proceed.call(this); | ||
this.container.style.background = 'url(http://www.highcharts.com/samples/graphics/sand.png)'; | ||
}); | ||
Highcharts.theme = { | ||
colors: ["#f45b5b", "#8085e9", "#8d4654", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", | ||
"#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], | ||
chart: { | ||
backgroundColor: null, | ||
style: { | ||
fontFamily: "Signika, serif" | ||
} | ||
}, | ||
title: { | ||
style: { | ||
color: 'black', | ||
fontSize: '16px', | ||
fontWeight: 'bold' | ||
} | ||
}, | ||
subtitle: { | ||
style: { | ||
color: 'black' | ||
} | ||
}, | ||
tooltip: { | ||
borderWidth: 0 | ||
}, | ||
legend: { | ||
itemStyle: { | ||
fontWeight: 'bold', | ||
fontSize: '13px' | ||
} | ||
}, | ||
xAxis: { | ||
labels: { | ||
style: { | ||
color: '#6e6e70' | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
labels: { | ||
style: { | ||
color: '#6e6e70' | ||
} | ||
} | ||
}, | ||
plotOptions: { | ||
series: { | ||
shadow: true | ||
}, | ||
candlestick: { | ||
lineColor: '#404048' | ||
}, | ||
map: { | ||
shadow: false | ||
} | ||
}, | ||
Highcharts.theme = { | ||
colors: ['#f45b5b', '#8085e9', '#8d4654', '#7798BF', '#aaeeee', '#ff0066', '#eeaaee', | ||
'#55BF3B', '#DF5353', '#7798BF', '#aaeeee' | ||
], | ||
chart: { | ||
backgroundColor: null, | ||
style: { | ||
fontFamily: 'Signika, serif' | ||
} | ||
}, | ||
title: { | ||
style: { | ||
color: 'black', | ||
fontSize: '16px', | ||
fontWeight: 'bold' | ||
} | ||
}, | ||
subtitle: { | ||
style: { | ||
color: 'black' | ||
} | ||
}, | ||
tooltip: { | ||
borderWidth: 0 | ||
}, | ||
legend: { | ||
itemStyle: { | ||
fontWeight: 'bold', | ||
fontSize: '13px' | ||
} | ||
}, | ||
xAxis: { | ||
labels: { | ||
style: { | ||
color: '#6e6e70' | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
labels: { | ||
style: { | ||
color: '#6e6e70' | ||
} | ||
} | ||
}, | ||
plotOptions: { | ||
series: { | ||
shadow: true | ||
}, | ||
candlestick: { | ||
lineColor: '#404048' | ||
}, | ||
map: { | ||
shadow: false | ||
} | ||
}, | ||
// Highstock specific | ||
navigator: { | ||
xAxis: { | ||
gridLineColor: '#D0D0D8' | ||
} | ||
}, | ||
rangeSelector: { | ||
buttonTheme: { | ||
fill: 'white', | ||
stroke: '#C0C0C8', | ||
'stroke-width': 1, | ||
states: { | ||
select: { | ||
fill: '#D0D0D8' | ||
} | ||
} | ||
} | ||
}, | ||
scrollbar: { | ||
trackBorderColor: '#C0C0C8' | ||
}, | ||
// Highstock specific | ||
navigator: { | ||
xAxis: { | ||
gridLineColor: '#D0D0D8' | ||
} | ||
}, | ||
rangeSelector: { | ||
buttonTheme: { | ||
fill: 'white', | ||
stroke: '#C0C0C8', | ||
'stroke-width': 1, | ||
states: { | ||
select: { | ||
fill: '#D0D0D8' | ||
} | ||
} | ||
} | ||
}, | ||
scrollbar: { | ||
trackBorderColor: '#C0C0C8' | ||
}, | ||
// General | ||
background2: '#E0E0E8' | ||
// General | ||
background2: '#E0E0E8' | ||
}; | ||
}; | ||
// Apply the theme | ||
Highcharts.setOptions(Highcharts.theme); | ||
// Apply the theme | ||
Highcharts.setOptions(Highcharts.theme); | ||
}(Highcharts)); | ||
})); |
/** | ||
* Skies theme for Highcharts JS | ||
* @author Torstein Honsi | ||
* @license Highcharts JS v5.0.0 (2016-09-29) | ||
* | ||
* (c) 2009-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
*/ | ||
(function(factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory; | ||
} else { | ||
factory(Highcharts); | ||
} | ||
}(function(Highcharts) { | ||
(function(Highcharts) { | ||
/** | ||
* (c) 2010-2016 Torstein Honsi | ||
* | ||
* License: www.highcharts.com/license | ||
* | ||
* Skies theme for Highcharts JS | ||
* @author Torstein Honsi | ||
*/ | ||
Highcharts.theme = { | ||
colors: ["#514F78", "#42A07B", "#9B5E4A", "#72727F", "#1F949A", "#82914E", "#86777F", "#42A07B"], | ||
chart: { | ||
className: 'skies', | ||
borderWidth: 0, | ||
plotShadow: true, | ||
plotBackgroundImage: 'http://www.highcharts.com/demo/gfx/skies.jpg', | ||
plotBackgroundColor: { | ||
linearGradient: [0, 0, 250, 500], | ||
stops: [ | ||
[0, 'rgba(255, 255, 255, 1)'], | ||
[1, 'rgba(255, 255, 255, 0)'] | ||
] | ||
}, | ||
plotBorderWidth: 1 | ||
}, | ||
title: { | ||
style: { | ||
color: '#3E576F', | ||
font: '16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
}, | ||
subtitle: { | ||
style: { | ||
color: '#6D869F', | ||
font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
}, | ||
xAxis: { | ||
gridLineWidth: 0, | ||
lineColor: '#C0D0E0', | ||
tickColor: '#C0D0E0', | ||
labels: { | ||
style: { | ||
color: '#666', | ||
fontWeight: 'bold' | ||
} | ||
}, | ||
title: { | ||
style: { | ||
color: '#666', | ||
font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
alternateGridColor: 'rgba(255, 255, 255, .5)', | ||
lineColor: '#C0D0E0', | ||
tickColor: '#C0D0E0', | ||
tickWidth: 1, | ||
labels: { | ||
style: { | ||
color: '#666', | ||
fontWeight: 'bold' | ||
} | ||
}, | ||
title: { | ||
style: { | ||
color: '#666', | ||
font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
} | ||
}, | ||
legend: { | ||
itemStyle: { | ||
font: '9pt Trebuchet MS, Verdana, sans-serif', | ||
color: '#3E576F' | ||
}, | ||
itemHoverStyle: { | ||
color: 'black' | ||
}, | ||
itemHiddenStyle: { | ||
color: 'silver' | ||
} | ||
}, | ||
labels: { | ||
style: { | ||
color: '#3E576F' | ||
} | ||
} | ||
}; | ||
'use strict'; | ||
Highcharts.theme = { | ||
colors: ['#514F78', '#42A07B', '#9B5E4A', '#72727F', '#1F949A', '#82914E', '#86777F', '#42A07B'], | ||
chart: { | ||
className: 'skies', | ||
borderWidth: 0, | ||
plotShadow: true, | ||
plotBackgroundImage: 'http://www.highcharts.com/demo/gfx/skies.jpg', | ||
plotBackgroundColor: { | ||
linearGradient: [0, 0, 250, 500], | ||
stops: [ | ||
[0, 'rgba(255, 255, 255, 1)'], | ||
[1, 'rgba(255, 255, 255, 0)'] | ||
] | ||
}, | ||
plotBorderWidth: 1 | ||
}, | ||
title: { | ||
style: { | ||
color: '#3E576F', | ||
font: '16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
}, | ||
subtitle: { | ||
style: { | ||
color: '#6D869F', | ||
font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
}, | ||
xAxis: { | ||
gridLineWidth: 0, | ||
lineColor: '#C0D0E0', | ||
tickColor: '#C0D0E0', | ||
labels: { | ||
style: { | ||
color: '#666', | ||
fontWeight: 'bold' | ||
} | ||
}, | ||
title: { | ||
style: { | ||
color: '#666', | ||
font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
} | ||
}, | ||
yAxis: { | ||
alternateGridColor: 'rgba(255, 255, 255, .5)', | ||
lineColor: '#C0D0E0', | ||
tickColor: '#C0D0E0', | ||
tickWidth: 1, | ||
labels: { | ||
style: { | ||
color: '#666', | ||
fontWeight: 'bold' | ||
} | ||
}, | ||
title: { | ||
style: { | ||
color: '#666', | ||
font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif' | ||
} | ||
} | ||
}, | ||
legend: { | ||
itemStyle: { | ||
font: '9pt Trebuchet MS, Verdana, sans-serif', | ||
color: '#3E576F' | ||
}, | ||
itemHoverStyle: { | ||
color: 'black' | ||
}, | ||
itemHiddenStyle: { | ||
color: 'silver' | ||
} | ||
}, | ||
labels: { | ||
style: { | ||
color: '#3E576F' | ||
} | ||
} | ||
}; | ||
// Apply the theme | ||
var highchartsOptions = Highcharts.setOptions(Highcharts.theme); | ||
// Apply the theme | ||
Highcharts.setOptions(Highcharts.theme); | ||
}(Highcharts)); | ||
})); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
6348267
107
118776
1