10 lines
42 KiB
JavaScript
10 lines
42 KiB
JavaScript
|
!/**
|
||
|
* Highcharts JS v11.4.1 (2024-04-04)
|
||
|
*
|
||
|
* Boost module
|
||
|
*
|
||
|
* (c) 2010-2024 Highsoft AS
|
||
|
* Author: Torstein Honsi
|
||
|
*
|
||
|
* License: www.highcharts.com/license
|
||
|
*/function(t){"object"==typeof module&&module.exports?(t.default=t,module.exports=t):"function"==typeof define&&define.amd?define("highcharts/modules/boost-canvas",["highcharts"],function(e){return t(e),t.Highcharts=e,t}):t("undefined"!=typeof Highcharts?Highcharts:void 0)}(function(t){"use strict";var e=t?t._modules:{};function i(t,e,i,s){t.hasOwnProperty(e)||(t[e]=s.apply(null,i),"function"==typeof CustomEvent&&window.dispatchEvent(new CustomEvent("HighchartsModuleLoaded",{detail:{path:e,module:t[e]}})))}i(e,"Extensions/Boost/Boostables.js",[],function(){return["area","areaspline","arearange","column","columnrange","bar","line","scatter","heatmap","bubble","treemap"]}),i(e,"Extensions/Boost/BoostableMap.js",[e["Extensions/Boost/Boostables.js"]],function(t){let e={};return t.forEach(t=>{e[t]=!0}),e}),i(e,"Extensions/Boost/BoostChart.js",[e["Extensions/Boost/BoostableMap.js"],e["Core/Globals.js"],e["Core/Utilities.js"]],function(t,e,i){let{composed:s}=e,{addEvent:o,pick:r,pushUnique:n}=i;function a(e){let i=e.series,s=e.boost=e.boost||{},o=e.options.boost||{},n=r(o.seriesThreshold,50);if(i.length>=n)return!0;if(1===i.length)return!1;let a=o.allowForce;if(void 0===a){for(let t of(a=!0,e.xAxis))if(r(t.min,-1/0)>r(t.dataMin,-1/0)||r(t.max,1/0)<r(t.dataMax,1/0)){a=!1;break}}if(void 0!==s.forceChartBoost){if(a)return s.forceChartBoost;s.forceChartBoost=void 0}let l=0,h=0,d;for(let e of i)0!==(d=e.options).boostThreshold&&!1!==e.visible&&"heatmap"!==e.type&&(t[e.type]&&++l,function(...t){let e=-Number.MAX_VALUE;return t.forEach(function(t){if(null!=t&&void 0!==t.length&&t.length>0)return e=t.length,!0}),e}(e.processedXData,d.data,e.points)>=(d.boostThreshold||Number.MAX_VALUE)&&++h);return s.forceChartBoost=a&&(l===i.length&&h===l||h>5),s.forceChartBoost}function l(t){function e(){t.boost&&t.boost.wgl&&a(t)&&t.boost.wgl.render(t)}o(t,"predraw",function(){t.boost=t.boost||{},t.boost.forceChartBoost=void 0,t.boosted=!1,t.axes.some(t=>t.isPanning)||t.boost.clear?.(),t.boost.canvas&&t.boost.wgl&&a(t)&&t.boost.wgl.allocateBuffer(t),t.boost.markerGroup&&t.xAxis&&t.xAxis.length>0&&t.yAxis&&t.yAxis.length>0&&t.boost.markerGroup.translate(t.xAxis[0].pos,t.yAxis[0].pos)}),o(t,"load",e,{order:-1}),o(t,"redraw",e);let i=-1,s=-1;o(t.pointer,"afterGetHoverData",()=>{let e=t.hoverSeries;if(t.boost=t.boost||{},t.boost.markerGroup&&e){let o=t.inverted?e.yAxis:e.xAxis,r=t.inverted?e.xAxis:e.yAxis;(o&&o.pos!==i||r&&r.pos!==s)&&(t.boost.markerGroup.translate(o.pos,r.pos),i=o.pos,s=r.pos)}})}return{compose:function(t,e){return e&&n(s,"Boost.Chart")&&t.prototype.callbacks.push(l),t},getBoostClipRect:function(t,e){let i={x:t.plotLeft,y:t.plotTop,width:t.plotWidth,height:t.navigator?t.navigator.top+t.navigator.height-t.plotTop:t.plotHeight};if(e.getClipBox){let{xAxis:s,yAxis:o}=e;if(i=e.getClipBox(),t.inverted){let t=i.width;i.width=i.height,i.height=t,i.x=o.pos,i.y=s.pos}else i.x=s.pos,i.y=o.pos}if(e===t){let e=t.inverted?t.xAxis:t.yAxis;e.length<=1&&(i.y=Math.min(e[0].pos,i.y),i.height=e[0].pos-t.plotTop+e[0].len)}return i},isChartSeriesBoosting:a}}),i(e,"Extensions/Boost/WGLDrawMode.js",[],function(){return{area:"LINES",arearange:"LINES",areaspline:"LINES",column:"LINES",columnrange:"LINES",bar:"LINES",line:"LINE_STRIP",scatter:"POINTS",heatmap:"TRIANGLES",treemap:"TRIANGLES",bubble:"POINTS"}}),i(e,"Extensions/Boost/WGLShader.js",[e["Core/Utilities.js"]],function(t){let{clamp:e,error:i,pick:s}=t;return class{constructor(t){if(this.errors=[],this.uLocations={},this.gl=t,t&&!this.createShader())return}bind(){this.gl&&this.shaderProgram&&this.gl.useProgram(this.shaderProgram)}createShader(){let t=this.stringToProgram("#version 100\n#define LN10 2.302585092994046\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 xAxisTrans;\nuniform float xAxisMin;\nuniform float xAxisMinPad;\nuniform float xAxisPointRange;\n
|