UNPKG

highcharts

Version:
65 lines (62 loc) 30.2 kB
/* Highcharts JS v7.1.0 (2019-04-01) Boost module (c) 2010-2019 Highsoft AS Author: Torstein Honsi License: www.highcharts.com/license */ (function(e){"object"===typeof module&&module.exports?(e["default"]=e,module.exports=e):"function"===typeof define&&define.amd?define("highcharts/modules/boost",["highcharts"],function(m){e(m);e.Highcharts=m;return e}):e("undefined"!==typeof Highcharts?Highcharts:void 0)})(function(e){function m(f,e,d,L){f.hasOwnProperty(e)||(f[e]=L.apply(null,d))}e=e?e._modules:{};m(e,"modules/boost/boostables.js",[],function(){return"area arearange column columnrange bar line scatter heatmap bubble treemap".split(" ")}); m(e,"modules/boost/boostable-map.js",[e["modules/boost/boostables.js"]],function(f){var e={};f.forEach(function(d){e[d]=1});return e});m(e,"modules/boost/wgl-shader.js",[e["parts/Globals.js"]],function(f){var e=f.pick;return function(d){function r(){k.length&&f.error("[highcharts boost] shader error - "+k.join("\n"))}function g(b,a){var c=d.createShader("vertex"===a?d.VERTEX_SHADER:d.FRAGMENT_SHADER);d.shaderSource(c,b);d.compileShader(c);return d.getShaderParameter(c,d.COMPILE_STATUS)?c:(k.push("when compiling "+ a+" shader:\n"+d.getShaderInfoLog(c)),!1)}function B(){function b(b){return d.getUniformLocation(a,b)}var f=g("#version 100\nprecision highp float;\nattribute vec4 aVertexPosition;\nattribute vec4 aColor;\nvarying highp vec2 position;\nvarying highp vec4 vColor;\nuniform mat4 uPMatrix;\nuniform float pSize;\nuniform float translatedThreshold;\nuniform bool hasThreshold;\nuniform bool skipTranslation;\nuniform float plotHeight;\nuniform float xAxisTrans;\nuniform float xAxisMin;\nuniform float xAxisMinPad;\nuniform float xAxisPointRange;\nuniform float xAxisLen;\nuniform bool xAxisPostTranslate;\nuniform float xAxisOrdinalSlope;\nuniform float xAxisOrdinalOffset;\nuniform float xAxisPos;\nuniform bool xAxisCVSCoord;\nuniform float yAxisTrans;\nuniform float yAxisMin;\nuniform float yAxisMinPad;\nuniform float yAxisPointRange;\nuniform float yAxisLen;\nuniform bool yAxisPostTranslate;\nuniform float yAxisOrdinalSlope;\nuniform float yAxisOrdinalOffset;\nuniform float yAxisPos;\nuniform bool yAxisCVSCoord;\nuniform bool isBubble;\nuniform bool bubbleSizeByArea;\nuniform float bubbleZMin;\nuniform float bubbleZMax;\nuniform float bubbleZThreshold;\nuniform float bubbleMinSize;\nuniform float bubbleMaxSize;\nuniform bool bubbleSizeAbs;\nuniform bool isInverted;\nfloat bubbleRadius(){\nfloat value \x3d aVertexPosition.w;\nfloat zMax \x3d bubbleZMax;\nfloat zMin \x3d bubbleZMin;\nfloat radius \x3d 0.0;\nfloat pos \x3d 0.0;\nfloat zRange \x3d zMax - zMin;\nif (bubbleSizeAbs){\nvalue \x3d value - bubbleZThreshold;\nzMax \x3d max(zMax - bubbleZThreshold, zMin - bubbleZThreshold);\nzMin \x3d 0.0;\n}\nif (value \x3c zMin){\nradius \x3d bubbleZMin / 2.0 - 1.0;\n} else {\npos \x3d zRange \x3e 0.0 ? (value - zMin) / zRange : 0.5;\nif (bubbleSizeByArea \x26\x26 pos \x3e 0.0){\npos \x3d sqrt(pos);\n}\nradius \x3d ceil(bubbleMinSize + pos * (bubbleMaxSize - bubbleMinSize)) / 2.0;\n}\nreturn radius * 2.0;\n}\nfloat translate(float val,\nfloat pointPlacement,\nfloat localA,\nfloat localMin,\nfloat minPixelPadding,\nfloat pointRange,\nfloat len,\nbool cvsCoord\n){\nfloat sign \x3d 1.0;\nfloat cvsOffset \x3d 0.0;\nif (cvsCoord) {\nsign *\x3d -1.0;\ncvsOffset \x3d len;\n}\nreturn sign * (val - localMin) * localA + cvsOffset + \n(sign * minPixelPadding);\n}\nfloat xToPixels(float value){\nif (skipTranslation){\nreturn value;// + xAxisPos;\n}\nreturn translate(value, 0.0, xAxisTrans, xAxisMin, xAxisMinPad, xAxisPointRange, xAxisLen, xAxisCVSCoord);// + xAxisPos;\n}\nfloat yToPixels(float value, float checkTreshold){\nfloat v;\nif (skipTranslation){\nv \x3d value;// + yAxisPos;\n} else {\nv \x3d translate(value, 0.0, yAxisTrans, yAxisMin, yAxisMinPad, yAxisPointRange, yAxisLen, yAxisCVSCoord);// + yAxisPos;\nif (v \x3e plotHeight) {\nv \x3d plotHeight;\n}\n}\nif (checkTreshold \x3e 0.0 \x26\x26 hasThreshold) {\nv \x3d min(v, translatedThreshold);\n}\nreturn v;\n}\nvoid main(void) {\nif (isBubble){\ngl_PointSize \x3d bubbleRadius();\n} else {\ngl_PointSize \x3d pSize;\n}\nvColor \x3d aColor;\nif (isInverted) {\ngl_Position \x3d uPMatrix * vec4(xToPixels(aVertexPosition.y) + yAxisPos, yToPixels(aVertexPosition.x, aVertexPosition.z) + xAxisPos, 0.0, 1.0);\n} else {\ngl_Position \x3d uPMatrix * vec4(xToPixels(aVertexPosition.x) + xAxisPos, yToPixels(aVertexPosition.y, aVertexPosition.z) + yAxisPos, 0.0, 1.0);\n}\n}", "vertex"),e=g("precision highp float;\nuniform vec4 fillColor;\nvarying highp vec2 position;\nvarying highp vec4 vColor;\nuniform sampler2D uSampler;\nuniform bool isCircle;\nuniform bool hasColor;\nvoid main(void) {\nvec4 col \x3d fillColor;\nvec4 tcol;\nif (hasColor) {\ncol \x3d vColor;\n}\nif (isCircle) {\ntcol \x3d texture2D(uSampler, gl_PointCoord.st);\ncol *\x3d tcol;\nif (tcol.r \x3c 0.0) {\ndiscard;\n} else {\ngl_FragColor \x3d col;\n}\n} else {\ngl_FragColor \x3d col;\n}\n}","fragment"); if(!f||!e)return a=!1,r(),!1;a=d.createProgram();d.attachShader(a,f);d.attachShader(a,e);d.linkProgram(a);if(!d.getProgramParameter(a,d.LINK_STATUS))return k.push(d.getProgramInfoLog(a)),r(),a=!1;d.useProgram(a);d.bindAttribLocation(a,0,"aVertexPosition");p=b("uPMatrix");D=b("pSize");x=b("fillColor");u=b("isBubble");c=b("bubbleSizeAbs");q=b("bubbleSizeByArea");H=b("uSampler");C=b("skipTranslation");h=b("isCircle");O=b("isInverted");P=b("plotHeight");return!0}function n(b,c){d&&a&&(b=l[b]=l[b]||d.getUniformLocation(a, b),d.uniform1f(b,c))}var l={},a,p,D,x,u,c,q,C,h,O,P,k=[],H;return d&&!B()?!1:{psUniform:function(){return D},pUniform:function(){return p},fillColorUniform:function(){return x},setPlotHeight:function(b){d&&a&&d.uniform1f(P,b)},setBubbleUniforms:function(b,k,f){var C=b.options,g=Number.MAX_VALUE,l=-Number.MAX_VALUE;d&&a&&"bubble"===b.type&&(g=e(C.zMin,Math.min(g,Math.max(k,!1===C.displayNegative?C.zThreshold:-Number.MAX_VALUE))),l=e(C.zMax,Math.max(l,f)),d.uniform1i(u,1),d.uniform1i(h,1),d.uniform1i(q, "width"!==b.options.sizeBy),d.uniform1i(c,b.options.sizeByAbsoluteValue),n("bubbleZMin",g),n("bubbleZMax",l),n("bubbleZThreshold",b.options.zThreshold),n("bubbleMinSize",b.minPxSize),n("bubbleMaxSize",b.maxPxSize))},bind:function(){d&&a&&d.useProgram(a)},program:function(){return a},create:B,setUniform:n,setPMatrix:function(b){d&&a&&d.uniformMatrix4fv(p,!1,b)},setColor:function(b){d&&a&&d.uniform4f(x,b[0]/255,b[1]/255,b[2]/255,b[3])},setPointSize:function(b){d&&a&&d.uniform1f(D,b)},setSkipTranslation:function(b){d&& a&&d.uniform1i(C,!0===b?1:0)},setTexture:function(b){d&&a&&d.uniform1i(H,b)},setDrawAsCircle:function(b){d&&a&&d.uniform1i(h,b?1:0)},reset:function(){d&&a&&(d.uniform1i(u,0),d.uniform1i(h,0))},setInverted:function(b){d&&a&&d.uniform1i(O,b)},destroy:function(){d&&a&&(d.deleteProgram(a),a=!1)}}}});m(e,"modules/boost/wgl-vbuffer.js",[],function(){return function(f,e,d){function r(){g&&(f.deleteBuffer(g),B=g=!1);a=0;n=d||2;p=[]}var g=!1,B=!1,n=d||2,l=!1,a=0,p;return{destroy:r,bind:function(){if(!g)return!1; f.vertexAttribPointer(B,n,f.FLOAT,!1,0,0)},data:p,build:function(a,d,u){var c;p=a||[];if(!(p&&0!==p.length||l))return r(),!1;n=u||n;g&&f.deleteBuffer(g);l||(c=new Float32Array(p));g=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,g);f.bufferData(f.ARRAY_BUFFER,l||c,f.STATIC_DRAW);B=f.getAttribLocation(e.program(),d);f.enableVertexAttribArray(B);return!0},render:function(a,d,u){var c=l?l.length:p.length;if(!g||!c)return!1;if(!a||a>c||0>a)a=0;if(!d||d>c)d=c;f.drawArrays(f[(u||"points").toUpperCase()], a/n,(d-a)/n);return!0},allocate:function(d){a=-1;l=new Float32Array(4*d)},push:function(d,f,u,c){l&&(l[++a]=d,l[++a]=f,l[++a]=u,l[++a]=c)}}}});m(e,"modules/boost/wgl-renderer.js",[e["modules/boost/wgl-shader.js"],e["modules/boost/wgl-vbuffer.js"],e["parts/Globals.js"]],function(f,e,d){var r=d.win.document,g=d.merge,B=d.objEach,n=d.isNumber,l=d.Color,a=d.pick;return function(p){function D(b){var a,c;return b.isSeriesBoosting?(a=!!b.options.stacking,c=b.xData||b.options.xData||b.processedXData,a=(a? b.data:c||b.options.data).length,"treemap"===b.type?a*=12:"heatmap"===b.type?a*=6:ha[b.type]&&(a*=2),a):0}function x(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)}function u(b,a){function c(b){b&&(a.colorData.push(b[0]),a.colorData.push(b[1]),a.colorData.push(b[2]),a.colorData.push(b[3]))}function h(b,a,h,d,q){c(q);t.usePreallocated?H.push(b,a,h?1:0,d||1):(K.push(b),K.push(a),K.push(h?1:0),K.push(d||1))}function q(){a.segments.length&&(a.segments[a.segments.length-1].to=K.length)}function f(){a.segments.length&& a.segments[a.segments.length-1].from===K.length||(q(),a.segments.push({from:K.length}))}function k(b,a,d,q,f){c(f);h(b+d,a);c(f);h(b,a);c(f);h(b,a+q);c(f);h(b,a+q);c(f);h(b+d,a+q);c(f);h(b+d,a)}function e(b,c){t.useGPUTranslations||(a.skipTranslation=!0,b.x=B.toPixels(b.x,!0),b.y=W.toPixels(b.y,!0));c?K=[b.x,b.y,0,2].concat(K):h(b.x,b.y,0,2)}var u=b.pointArrayMap&&"low,high"===b.pointArrayMap.join(","),v=b.chart,J=b.options,C=!!J.stacking,g=J.data,l=b.xAxis.getExtremes(),n=l.min,l=l.max,r=b.yAxis.getExtremes(), p=r.min,r=r.max,N=b.xData||J.xData||b.processedXData,P=b.yData||J.yData||b.processedYData,m=b.zData||J.zData||b.processedZData,W=b.yAxis,B=b.xAxis,O=b.chart.plotWidth,L=!N||0===N.length,D=J.connectNulls,w=b.points||!1,x=!1,I=!1,A,z,E,g=C?b.data:N||g,N={x:Number.MAX_VALUE,y:0},M={x:-Number.MAX_VALUE,y:0},R=0,Q=!1,y,Z,F=-1,T=!1,U=!1,V,oa="undefined"===typeof v.index,ea=!1,fa=!1,sa=ha[b.type],ga=!1,ma=!0,na=!0,ta=J.threshold;if(!(J.boostData&&0<J.boostData.length)){v.inverted&&(O=b.chart.plotHeight); b.closestPointRangePx=Number.MAX_VALUE;f();if(w&&0<w.length)a.skipTranslation=!0,a.drawMode="triangles",w[0].node&&w[0].node.levelDynamic&&w.sort(function(b,a){if(b.node){if(b.node.levelDynamic>a.node.levelDynamic)return 1;if(b.node.levelDynamic<a.node.levelDynamic)return-1}return 0}),w.forEach(function(a){var c=a.plotY,h;"undefined"===typeof c||isNaN(c)||null===a.y||(c=a.shapeArgs,h=v.styledMode?a.series.colorAttribs(a):h=a.series.pointAttribs(a),a=h["stroke-width"]||0,z=d.color(h.fill).rgba,z[0]/= 255,z[1]/=255,z[2]/=255,"treemap"===b.type&&(a=a||1,E=d.color(h.stroke).rgba,E[0]/=255,E[1]/=255,E[2]/=255,k(c.x,c.y,c.width,c.height,E),a/=2),"heatmap"===b.type&&v.inverted&&(c.x=B.len-c.x,c.y=W.len-c.y,c.width=-c.width,c.height=-c.height),k(c.x+a,c.y+a,c.width-2*a,c.height-2*a,z))});else{for(;F<g.length-1;){A=g[++F];if(oa)break;L?(w=A[0],y=A[1],g[F+1]&&(U=g[F+1][0]),g[F-1]&&(T=g[F-1][0]),3<=A.length&&(Z=A[2],A[2]>a.zMax&&(a.zMax=A[2]),A[2]<a.zMin&&(a.zMin=A[2]))):(w=A,y=P[F],g[F+1]&&(U=g[F+1]), g[F-1]&&(T=g[F-1]),m&&m.length&&(Z=m[F],m[F]>a.zMax&&(a.zMax=m[F]),m[F]<a.zMin&&(a.zMin=m[F])));if(D||null!==w&&null!==y){if(U&&U>=n&&U<=l&&(ea=!0),T&&T>=n&&T<=l&&(fa=!0),u?(L&&(y=A.slice(1,3)),V=y[0],y=y[1]):C&&(w=A.x,y=A.stackY,V=y-A.y),null!==p&&"undefined"!==typeof p&&null!==r&&"undefined"!==typeof r&&(ma=y>=p&&y<=r),w>l&&M.x<l&&(M.x=w,M.y=y),w<n&&N.x>n&&(N.x=w,N.y=y),null!==y||!D)if(null!==y&&(ma||ea||fa)){if((U>=n||w>=n)&&(T<=l||w<=l)&&(ga=!0),ga||ea||fa){if(!t.useGPUTranslations&&(a.skipTranslation= !0,w=B.toPixels(w,!0),y=W.toPixels(y,!0),w>O&&"points"===a.drawMode))continue;if(sa){A=V;if(!1===V||"undefined"===typeof V)A=0>y?y:0;u||C||(A=Math.max(ta,p));t.useGPUTranslations||(A=W.toPixels(A,!0));h(w,A,0,0,!1)}a.hasMarkers&&ga&&!1!==x&&(b.closestPointRangePx=Math.min(b.closestPointRangePx,Math.abs(w-x)));!t.useGPUTranslations&&!t.usePreallocated&&x&&1>Math.abs(w-x)&&I&&1>Math.abs(y-I)?t.debug.showSkipSummary&&++R:(J.step&&!na&&h(w,I,0,2,!1),h(w,y,0,"bubble"===b.type?Z||1:2,!1),x=w,I=y,Q=!0,na= !1)}}else f()}else f()}t.debug.showSkipSummary&&console.log("skipped points:",R);Q||!1===D||"line_strip"!==b.drawMode||(N.x<Number.MAX_VALUE&&e(N,!0),M.x>-Number.MAX_VALUE&&e(M))}q()}}function c(){z=[];R.data=K=[];L=[];H&&H.destroy()}function q(b){k&&(k.setUniform("xAxisTrans",b.transA),k.setUniform("xAxisMin",b.min),k.setUniform("xAxisMinPad",b.minPixelPadding),k.setUniform("xAxisPointRange",b.pointRange),k.setUniform("xAxisLen",b.len),k.setUniform("xAxisPos",b.pos),k.setUniform("xAxisCVSCoord", !b.horiz))}function C(b){k&&(k.setUniform("yAxisTrans",b.transA),k.setUniform("yAxisMin",b.min),k.setUniform("yAxisMinPad",b.minPixelPadding),k.setUniform("yAxisPointRange",b.pointRange),k.setUniform("yAxisLen",b.len),k.setUniform("yAxisPos",b.pos),k.setUniform("yAxisCVSCoord",!b.horiz))}function h(b,a){k.setUniform("hasThreshold",b);k.setUniform("translatedThreshold",a)}function O(f){if(f)m=f.chartWidth||800,I=f.chartHeight||400;else return!1;if(!(b&&m&&I&&k))return!1;t.debug.timeRendering&&console.time("gl rendering"); b.canvas.width=m;b.canvas.height=I;k.bind();b.viewport(0,0,m,I);k.setPMatrix([2/m,0,0,0,0,-(2/I),0,0,0,0,-2,0,-1,1,-1,1]);k.setPlotHeight(f.plotHeight);1<t.lineWidth&&!d.isMS&&b.lineWidth(t.lineWidth);H.build(R.data,"aVertexPosition",4);H.bind();k.setInverted(f.inverted);z.forEach(function(c,u){var g=c.series.options,v=g.marker,G;G="undefined"!==typeof g.lineWidth?g.lineWidth:1;var r=g.threshold,p=n(r),m=c.series.yAxis.getThreshold(r),r=a(g.marker?g.marker.enabled:null,c.series.xAxis.isRadial?!0: null,c.series.closestPointRangePx>2*((g.marker?g.marker.radius:10)||10)),v=E[v&&v.symbol||c.series.symbol]||E.circle;if(!(0===c.segments.length||c.segmentslength&&c.segments[0].from===c.segments[0].to)){v.isReady&&(b.bindTexture(b.TEXTURE_2D,v.handle),k.setTexture(v.handle));f.styledMode?v=c.series.markerGroup&&c.series.markerGroup.getStyle("fill"):(v=c.series.pointAttribs&&c.series.pointAttribs().fill||c.series.color,g.colorByPoint&&(v=c.series.chart.options.colors[u]));c.series.fillOpacity&&g.fillOpacity&& (v=(new l(v)).setOpacity(a(g.fillOpacity,1)).get());v=d.color(v).rgba;t.useAlpha||(v[3]=1);"lines"===c.drawMode&&t.useAlpha&&1>v[3]&&(v[3]/=10);"add"===g.boostBlending?(b.blendFunc(b.SRC_ALPHA,b.ONE),b.blendEquation(b.FUNC_ADD)):"mult"===g.boostBlending||"multiply"===g.boostBlending?b.blendFunc(b.DST_COLOR,b.ZERO):"darken"===g.boostBlending?(b.blendFunc(b.ONE,b.ONE),b.blendEquation(b.FUNC_MIN)):b.blendFuncSeparate(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA,b.ONE,b.ONE_MINUS_SRC_ALPHA);k.reset();0<c.colorData.length&& (k.setUniform("hasColor",1),u=e(b,k),u.build(c.colorData,"aColor",4),u.bind());k.setColor(v);q(c.series.xAxis);C(c.series.yAxis);h(p,m);"points"===c.drawMode&&(g.marker&&g.marker.radius?k.setPointSize(2*g.marker.radius):k.setPointSize(1));k.setSkipTranslation(c.skipTranslation);"bubble"===c.series.type&&k.setBubbleUniforms(c.series,c.zMin,c.zMax);k.setDrawAsCircle(Q[c.series.type]||!1);if(0<G||"line_strip"!==c.drawMode)for(G=0;G<c.segments.length;G++)H.render(c.segments[G].from,c.segments[G].to,c.drawMode); if(c.hasMarkers&&r)for(g.marker&&g.marker.radius?k.setPointSize(2*g.marker.radius):k.setPointSize(10),k.setDrawAsCircle(!0),G=0;G<c.segments.length;G++)H.render(c.segments[G].from,c.segments[G].to,"POINTS")}});t.debug.timeRendering&&console.timeEnd("gl rendering");p&&p();c()}function P(b){x();if(b.renderer.forExport)return O(b);M?O(b):setTimeout(function(){P(b)},1)}var k=!1,H=!1,b=!1,m=0,I=0,K=!1,L=!1,R={},M=!1,z=[],E={},ha={column:!0,columnrange:!0,bar:!0,area:!0,arearange:!0},Q={scatter:!0,bubble:!0}, t={pointSize:1,lineWidth:1,fillColor:"#AA00AA",useAlpha:!0,usePreallocated:!1,useGPUTranslations:!1,debug:{timeRendering:!1,timeSeriesProcessing:!1,timeSetup:!1,timeBufferCopy:!1,timeKDTree:!1,showSkipSummary:!1}};return R={allocateBufferForSingleSeries:function(b){var a=0;t.usePreallocated&&(b.isSeriesBoosting&&(a=D(b)),H.allocate(a))},pushSeries:function(b){0<z.length&&z[z.length-1].hasMarkers&&(z[z.length-1].markerTo=L.length);t.debug.timeSeriesProcessing&&console.time("building "+b.type+" series"); z.push({segments:[],markerFrom:L.length,colorData:[],series:b,zMin:Number.MAX_VALUE,zMax:-Number.MAX_VALUE,hasMarkers:b.options.marker?!1!==b.options.marker.enabled:!1,showMarkers:!0,drawMode:{area:"lines",arearange:"lines",areaspline:"line_strip",column:"lines",columnrange:"lines",bar:"lines",line:"line_strip",scatter:"points",heatmap:"triangles",treemap:"triangles",bubble:"points"}[b.type]||"line_strip"});u(b,z[z.length-1]);t.debug.timeSeriesProcessing&&console.timeEnd("building "+b.type+" series")}, setSize:function(b,a){m===b&&I===a||!k||(m=b,I=a,k.bind(),k.setPMatrix([2/m,0,0,0,0,-(2/I),0,0,0,0,-2,0,-1,1,-1,1]))},inited:function(){return M},setThreshold:h,init:function(a,h){function d(a,c){var d={isReady:!1,texture:r.createElement("canvas"),handle:b.createTexture()},h=d.texture.getContext("2d");E[a]=d;d.texture.width=512;d.texture.height=512;h.mozImageSmoothingEnabled=!1;h.webkitImageSmoothingEnabled=!1;h.msImageSmoothingEnabled=!1;h.imageSmoothingEnabled=!1;h.strokeStyle="rgba(255, 255, 255, 0)"; h.fillStyle="#FFF";c(h);try{b.activeTexture(b.TEXTURE0),b.bindTexture(b.TEXTURE_2D,d.handle),b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,d.texture),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR),b.bindTexture(b.TEXTURE_2D,null),d.isReady=!0}catch(X){}}var g=0,q=["webgl","experimental-webgl", "moz-webgl","webkit-3d"];M=!1;if(!a)return!1;for(t.debug.timeSetup&&console.time("gl setup");g<q.length&&!(b=a.getContext(q[g],{}));g++);if(b)h||c();else return!1;b.enable(b.BLEND);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.disable(b.DEPTH_TEST);b.depthFunc(b.LESS);k=f(b);if(!k)return!1;H=e(b,k);d("circle",function(b){b.beginPath();b.arc(256,256,256,0,2*Math.PI);b.stroke();b.fill()});d("square",function(b){b.fillRect(0,0,512,512)});d("diamond",function(b){b.beginPath();b.moveTo(256,0);b.lineTo(512, 256);b.lineTo(256,512);b.lineTo(0,256);b.lineTo(256,0);b.fill()});d("triangle",function(b){b.beginPath();b.moveTo(0,512);b.lineTo(256,0);b.lineTo(512,512);b.lineTo(0,512);b.fill()});d("triangle-down",function(b){b.beginPath();b.moveTo(0,0);b.lineTo(256,512);b.lineTo(512,0);b.lineTo(0,0);b.fill()});M=!0;t.debug.timeSetup&&console.timeEnd("gl setup");return!0},render:P,settings:t,valid:function(){return!1!==b},clear:x,flush:c,setXAxis:q,setYAxis:C,data:K,gl:function(){return b},allocateBuffer:function(b){var a= 0;t.usePreallocated&&(b.series.forEach(function(b){b.isSeriesBoosting&&(a+=D(b))}),H.allocate(a))},destroy:function(){c();H.destroy();k.destroy();b&&(B(E,function(a){E[a].handle&&b.deleteTexture(E[a].handle)}),b.canvas.width=1,b.canvas.height=1)},setOptions:function(b){g(!0,t,b)}}}});m(e,"modules/boost/boost-attach.js",[e["parts/Globals.js"],e["modules/boost/wgl-renderer.js"]],function(f,e){var d=f.win.document,r=d.createElement("canvas");return function(g,m){var n=g.chartWidth,l=g.chartHeight,a= g,p=g.seriesGroup||m.group,B=d.implementation.hasFeature("www.http://w3.org/TR/SVG11/feature#Extensibility","1.1"),a=g.isChartSeriesBoosting()?g:m,B=!1;a.renderTarget||(a.canvas=r,g.renderer.forExport||!B?(a.renderTarget=g.renderer.image("",0,0,n,l).addClass("highcharts-boost-canvas").add(p),a.boostClear=function(){a.renderTarget.attr({href:""})},a.boostCopy=function(){a.boostResizeTarget();a.renderTarget.attr({href:a.canvas.toDataURL("image/png")})}):(a.renderTargetFo=g.renderer.createElement("foreignObject").add(p), a.renderTarget=d.createElement("canvas"),a.renderTargetCtx=a.renderTarget.getContext("2d"),a.renderTargetFo.element.appendChild(a.renderTarget),a.boostClear=function(){a.renderTarget.width=a.canvas.width;a.renderTarget.height=a.canvas.height},a.boostCopy=function(){a.renderTarget.width=a.canvas.width;a.renderTarget.height=a.canvas.height;a.renderTargetCtx.drawImage(a.canvas,0,0)}),a.boostResizeTarget=function(){n=g.chartWidth;l=g.chartHeight;(a.renderTargetFo||a.renderTarget).attr({x:0,y:0,width:n, height:l}).css({pointerEvents:"none",mixedBlendMode:"normal",opacity:1});a instanceof f.Chart&&a.markerGroup.translate(g.plotLeft,g.plotTop)},a.boostClipRect=g.renderer.clipRect(),(a.renderTargetFo||a.renderTarget).clip(a.boostClipRect),a instanceof f.Chart&&(a.markerGroup=a.renderer.g().add(p),a.markerGroup.translate(m.xAxis.pos,m.yAxis.pos)));a.canvas.width=n;a.canvas.height=l;a.boostClipRect.attr(g.getBoostClipRect(a));a.boostResizeTarget();a.boostClear();a.ogl||(a.ogl=e(function(){a.ogl.settings.debug.timeBufferCopy&& console.time("buffer copy");a.boostCopy();a.ogl.settings.debug.timeBufferCopy&&console.timeEnd("buffer copy")}),a.ogl.init(a.canvas)||f.error("[highcharts boost] - unable to init WebGL renderer"),a.ogl.setOptions(g.options.boost||{}),a instanceof f.Chart&&a.ogl.allocateBuffer(g));a.ogl.setSize(n,l);return a.ogl}});m(e,"modules/boost/boost-utils.js",[e["parts/Globals.js"],e["modules/boost/boostable-map.js"],e["modules/boost/boost-attach.js"]],function(f,e,d){function m(){var a=Array.prototype.slice.call(arguments), c=-Number.MAX_VALUE;a.forEach(function(a){if("undefined"!==typeof a&&null!==a&&"undefined"!==typeof a.length&&0<a.length)return c=a.length,!0});return c}function g(a,c,d){a&&c.renderTarget&&c.canvas&&!(d||c.chart).isChartSeriesBoosting()&&a.render(d||c.chart)}function r(a,c){a&&c.renderTarget&&c.canvas&&!c.chart.isChartSeriesBoosting()&&a.allocateBufferForSingleSeries(c)}function n(d,c,g,f,h,e){h=h||0;f=f||3E3;for(var q=h+f,k=!0;k&&h<q&&h<d.length;)k=c(d[h],h),++h;k&&(h<d.length?e?n(d,c,g,f,h,e): a.requestAnimationFrame?a.requestAnimationFrame(function(){n(d,c,g,f,h)}):setTimeout(function(){n(d,c,g,f,h)}):g&&g())}function l(){var d=0,c,g=["webgl","experimental-webgl","moz-webgl","webkit-3d"],f=!1;if("undefined"!==typeof a.WebGLRenderingContext)for(c=p.createElement("canvas");d<g.length;d++)try{if(f=c.getContext(g[d]),"undefined"!==typeof f&&null!==f)return!0}catch(h){}return!1}var a=f.win,p=a.document,D=f.pick,x={patientMax:m,boostEnabled:function(a){return D(a&&a.options&&a.options.boost&& a.options.boost.enabled,!0)},shouldForceChartSeriesBoosting:function(a){var c=0,d=0,f=D(a.options.boost&&a.options.boost.allowForce,!0),h;if("undefined"!==typeof a.boostForceChartBoost)return a.boostForceChartBoost;if(1<a.series.length)for(var g=0;g<a.series.length;g++)h=a.series[g],0!==h.options.boostThreshold&&!1!==h.visible&&"heatmap"!==h.type&&(e[h.type]&&++d,m(h.processedXData,h.options.data,h.points)>=(h.options.boostThreshold||Number.MAX_VALUE)&&++c);a.boostForceChartBoost=f&&(d===a.series.length&& 0<c||5<c);return a.boostForceChartBoost},renderIfNotSeriesBoosting:g,allocateIfNotSeriesBoosting:r,eachAsync:n,hasWebGLSupport:l,pointDrawHandler:function(a){var c=!0;this.chart.options&&this.chart.options.boost&&(c="undefined"===typeof this.chart.options.boost.enabled?!0:this.chart.options.boost.enabled);if(!c||!this.isSeriesBoosting)return a.call(this);this.chart.isBoosting=!0;if(a=d(this.chart,this))r(a,this),a.pushSeries(this);g(a,this)}};f.hasWebGLSupport=l;return x});m(e,"modules/boost/boost-init.js", [e["parts/Globals.js"],e["modules/boost/boost-utils.js"],e["modules/boost/boost-attach.js"]],function(f,e,d){var m=f.addEvent,g=f.fireEvent,r=f.extend,n=f.Series,l=f.seriesTypes,a=f.wrap,p=function(){},D=e.eachAsync,x=e.pointDrawHandler,u=e.allocateIfNotSeriesBoosting,c=e.renderIfNotSeriesBoosting,q=e.shouldForceChartSeriesBoosting,C;return function(){f.extend(n.prototype,{renderCanvas:function(){function a(a,c){var d,h,f=!1,g="undefined"===typeof b.index,e=!0;if(!g&&(ka?(d=a[0],h=a[1]):(d=a,h=r[c]), ia?(ka&&(h=a.slice(1,3)),f=h[0],h=h[1]):G&&(d=a.x,h=a.stackY,f=h-a.y),qa||(e=h>=E&&h<=L),null!==h&&d>=B&&d<=z&&e))if(a=l.toPixels(d,!0),v){if(void 0===S||a===t){ia||(f=h);if(void 0===Y||h>ba)ba=h,Y=c;if(void 0===S||f<X)X=f,S=c}a!==t&&(void 0!==S&&(h=n.toPixels(ba,!0),aa=n.toPixels(X,!0),da(a,h,Y),aa!==h&&da(a,aa,S)),S=Y=void 0,t=a)}else h=Math.ceil(n.toPixels(h,!0)),da(a,h,c);return!g}function f(){g(e,"renderedCanvas");delete e.buildKDTree;e.buildKDTree();ca.debug.timeKDTree&&console.timeEnd("kd tree building")} var e=this,k=e.options||{},q=!1,b=e.chart,l=this.xAxis,n=this.yAxis,m=k.xData||e.processedXData,r=k.yData||e.processedYData,x=k.data,q=l.getExtremes(),B=q.min,z=q.max,q=n.getExtremes(),E=q.min,L=q.max,Q={},t,v=!!e.sampling,J,pa=!1!==k.enableMouseTracking,aa=n.getThreshold(k.threshold),ia=e.pointArrayMap&&"low,high"===e.pointArrayMap.join(","),G=!!k.stacking,ja=e.cropStart||0,qa=e.requireSorting,ka=!m,X,ba,S,Y,ca,ra="x"===k.findNearestPointBy,la=this.xData||this.options.xData||this.processedXData|| !1,da=function(a,c,d){a=Math.ceil(a);C=ra?a:a+","+c;pa&&!Q[C]&&(Q[C]=!0,b.inverted&&(a=l.len-a,c=n.len-c),J.push({x:la?la[ja+d]:!1,clientX:a,plotX:a,plotY:c,i:ja+d}))},q=d(b,e);b.isBoosting=!0;ca=q.settings;if(this.visible){if(this.points||this.graph)this.animate=null,this.destroyGraphics();b.isChartSeriesBoosting()?(this.markerGroup=b.markerGroup,this.renderTarget&&(this.renderTarget=this.renderTarget.destroy())):this.markerGroup=e.plotGroup("markerGroup","markers",!0,1,b.seriesGroup);J=this.points= [];e.buildKDTree=p;q&&(u(q,this),q.pushSeries(e),c(q,this,b));b.renderer.forExport||(ca.debug.timeKDTree&&console.time("kd tree building"),D(G?e.data:m||x,a,f))}}});["heatmap","treemap"].forEach(function(c){l[c]&&a(l[c].prototype,"drawPoints",x)});l.bubble&&(delete l.bubble.prototype.buildKDTree,a(l.bubble.prototype,"markerAttribs",function(a){return this.isSeriesBoosting?!1:a.apply(this,[].slice.call(arguments,1))}));l.scatter.prototype.fill=!0;r(l.area.prototype,{fill:!0,fillOpacity:!0,sampling:!0}); r(l.column.prototype,{fill:!0,sampling:!0});f.Chart.prototype.callbacks.push(function(a){m(a,"predraw",function(){a.boostForceChartBoost=void 0;a.boostForceChartBoost=q(a);a.isBoosting=!1;!a.isChartSeriesBoosting()&&a.didBoost&&(a.didBoost=!1);a.boostClear&&a.boostClear();a.canvas&&a.ogl&&a.isChartSeriesBoosting()&&(a.didBoost=!0,a.ogl.allocateBuffer(a));a.markerGroup&&a.xAxis&&0<a.xAxis.length&&a.yAxis&&0<a.yAxis.length&&a.markerGroup.translate(a.xAxis[0].pos,a.yAxis[0].pos)});m(a,"render",function(){a.ogl&& a.isChartSeriesBoosting()&&a.ogl.render(a)})})}});m(e,"modules/boost/boost-overrides.js",[e["parts/Globals.js"],e["modules/boost/boost-utils.js"],e["modules/boost/boostables.js"],e["modules/boost/boostable-map.js"]],function(f,e,d,m){var g=e.boostEnabled,r=e.shouldForceChartSeriesBoosting;e=f.Chart;var n=f.Series,l=f.seriesTypes,a=f.addEvent,p=f.isNumber,D=f.pick,x=f.wrap,u=f.getOptions().plotOptions;e.prototype.isChartSeriesBoosting=function(){return D(this.options.boost&&this.options.boost.seriesThreshold, 50)<=this.series.length||r(this)};e.prototype.getBoostClipRect=function(a){var c={x:this.plotLeft,y:this.plotTop,width:this.plotWidth,height:this.plotHeight};a===this&&this.yAxis.forEach(function(a){c.y=Math.min(a.pos,c.y);c.height=Math.max(a.pos-this.plotTop+a.len,c.height)},this);return c};n.prototype.getPoint=function(a){var c=a,d=this.xData||this.options.xData||this.processedXData||!1;!a||a instanceof this.pointClass||(c=(new this.pointClass).init(this,this.options.data[a.i],d?d[a.i]:void 0), c.category=c.x,c.dist=a.dist,c.distX=a.distX,c.plotX=a.plotX,c.plotY=a.plotY,c.index=a.i);return c};x(n.prototype,"searchPoint",function(a){return this.getPoint(a.apply(this,[].slice.call(arguments,1)))});a(n,"destroy",function(){var a=this,d=a.chart;d.markerGroup===a.markerGroup&&(a.markerGroup=null);d.hoverPoints&&(d.hoverPoints=d.hoverPoints.filter(function(c){return c.series===a}));d.hoverPoint&&d.hoverPoint.series===a&&(d.hoverPoint=null)});x(n.prototype,"getExtremes",function(a){if(!this.isSeriesBoosting|| !this.hasExtremes||!this.hasExtremes())return a.apply(this,Array.prototype.slice.call(arguments,1))});["translate","generatePoints","drawTracker","drawPoints","render"].forEach(function(a){function c(c){var d=this.options.stacking&&("translate"===a||"generatePoints"===a);if(!this.isSeriesBoosting||d||!g(this.chart)||"heatmap"===this.type||"treemap"===this.type||!m[this.type]||0===this.options.boostThreshold)c.call(this);else if(this[a+"Canvas"])this[a+"Canvas"]()}x(n.prototype,a,c);"translate"=== a&&"column bar arearange columnrange heatmap treemap".split(" ").forEach(function(d){l[d]&&x(l[d].prototype,a,c)})});x(n.prototype,"processData",function(a){function c(a){return d.chart.isChartSeriesBoosting()||(a?a.length:0)>=(d.options.boostThreshold||Number.MAX_VALUE)}var d=this,e=this.options.data;g(this.chart)&&m[this.type]?(c(e)&&"heatmap"!==this.type&&"treemap"!==this.type&&!this.options.stacking&&this.hasExtremes&&this.hasExtremes(!0)||(a.apply(this,Array.prototype.slice.call(arguments,1)), e=this.processedXData),(this.isSeriesBoosting=c(e))?this.enterBoost():this.exitBoost&&this.exitBoost()):a.apply(this,Array.prototype.slice.call(arguments,1))});a(n,"hide",function(){this.canvas&&this.renderTarget&&(this.ogl&&this.ogl.clear(),this.boostClear())});n.prototype.enterBoost=function(){this.alteredByBoost=[];["allowDG","directTouch","stickyTracking"].forEach(function(a){this.alteredByBoost.push({prop:a,val:this[a],own:this.hasOwnProperty(a)})},this);this.directTouch=this.allowDG=!1;this.stickyTracking= !0;this.animate=null;this.labelBySeries&&(this.labelBySeries=this.labelBySeries.destroy())};n.prototype.exitBoost=function(){(this.alteredByBoost||[]).forEach(function(a){a.own?this[a.prop]=a.val:delete this[a.prop]},this);this.boostClear&&this.boostClear()};n.prototype.hasExtremes=function(a){var c=this.options,d=this.xAxis&&this.xAxis.options,e=this.yAxis&&this.yAxis.options;return c.data.length>(c.boostThreshold||Number.MAX_VALUE)&&p(e.min)&&p(e.max)&&(!a||p(d.min)&&p(d.max))};n.prototype.destroyGraphics= function(){var a=this,d=this.points,e,f;if(d)for(f=0;f<d.length;f+=1)(e=d[f])&&e.destroyElements&&e.destroyElements();["graph","area","tracker"].forEach(function(c){a[c]&&(a[c]=a[c].destroy())})};d.forEach(function(a){u[a]&&(u[a].boostThreshold=5E3,u[a].boostData=[],l[a].prototype.fillOpacity=!0)})});m(e,"modules/boost/boost.js",[e["parts/Globals.js"],e["modules/boost/boost-utils.js"],e["modules/boost/boost-init.js"]],function(e,m,d){m=m.hasWebGLSupport;m()?d():"undefined"!==typeof e.initCanvasBoost? e.initCanvasBoost():e.error(26)});m(e,"masters/modules/boost.src.js",[],function(){})}); //# sourceMappingURL=boost.js.map