All Downloads are FREE. Search and download functionalities are using the official Maven repository.

console.highstock.code.modules.boost.js Maven / Gradle / Ivy

The newest version!
/*
 Highcharts JS v5.0.12 (2017-05-24)
 Boost module

 (c) 2010-2017 Highsoft AS
 Author: Torstein Honsi

 License: www.highcharts.com/license
*/
(function(x){"object"===typeof module&&module.exports?module.exports=x:x(Highcharts)})(function(x){(function(h){function x(){var a=Array.prototype.slice.call(arguments),c=-Number.MAX_VALUE;C(a,function(a){if("undefined"!==typeof a&&"undefined"!==typeof a.length&&0=(d.options.boostThreshold||Number.MAX_VALUE)&&c++;return 5<
c||a.series.length>=G(a.options.boost&&a.options.boost.seriesThreshold,50)}function A(a){return z(a.chart)||x(a.processedXData,a.options.data,a.points)>=(a.options.boostThreshold||Number.MAX_VALUE)}function fa(a){function c(b,c){c=a.createShader("vertex"===c?a.VERTEX_SHADER:a.FRAGMENT_SHADER);a.shaderSource(c,b);a.compileShader(c);return a.getShaderParameter(c,a.COMPILE_STATUS)?c:!1}function d(){function d(b){return a.getUniformLocation(l,b)}var f=c("#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 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;\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=c("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;\nif (hasColor) {\ncol \x3d vColor;\n}\nif (isCircle) {\ngl_FragColor \x3d col * texture2D(uSampler, gl_PointCoord.st);\n} else {\ngl_FragColor \x3d col;\n}\n}","fragment");if(!f||!e)return l=!1;l=a.createProgram();a.attachShader(l,f);a.attachShader(l,e);a.linkProgram(l);
a.useProgram(l);a.bindAttribLocation(l,0,"aVertexPosition");h=d("uPMatrix");n=d("pSize");J=d("fillColor");H=d("isBubble");k=d("bubbleSizeAbs");t=d("bubbleSizeByArea");B=d("uSampler");b=d("skipTranslation");q=d("isCircle");g=d("isInverted");return!0}function f(b,c){b=e[b]=e[b]||a.getUniformLocation(l,b);a.uniform1f(b,c)}var e={},l,h,n,J,H,k,t,b,q,g,B;a&&d();return{psUniform:function(){return n},pUniform:function(){return h},fillColorUniform:function(){return J},setBubbleUniforms:function(b,c,d){var e=
b.options,l=Number.MAX_VALUE,h=-Number.MAX_VALUE;"bubble"===b.type&&(l=G(e.zMin,Math.min(l,Math.max(c,!1===e.displayNegative?e.zThreshold:-Number.MAX_VALUE))),h=G(e.zMax,Math.max(h,d)),a.uniform1i(H,1),a.uniform1i(q,1),a.uniform1i(t,"width"!==b.options.sizeBy),a.uniform1i(k,b.options.sizeByAbsoluteValue),f("bubbleZMin",l),f("bubbleZMax",h),f("bubbleZThreshold",b.options.zThreshold),f("bubbleMinSize",b.minPxSize),f("bubbleMaxSize",b.maxPxSize))},bind:function(){a.useProgram(l)},program:function(){return l},
create:d,setUniform:f,setPMatrix:function(b){a.uniformMatrix4fv(h,!1,b)},setColor:function(b){a.uniform4f(J,b[0]/255,b[1]/255,b[2]/255,b[3])},setPointSize:function(b){a.uniform1f(n,b)},setSkipTranslation:function(c){a.uniform1i(b,!0===c?1:0)},setTexture:function(){a.uniform1i(B,0)},setDrawAsCircle:function(b){a.uniform1i(q,b?1:0)},reset:function(){a.uniform1i(H,0);a.uniform1i(q,0)},setInverted:function(b){a.uniform1i(g,b)},destroy:function(){a&&l&&a.deleteProgram(l)}}}function X(a,c,d){var f=!1,e=
!1,l=d||2,h=!1,n=0,g;return{destroy:function(){f&&a.deleteBuffer(f)},bind:function(){if(!f)return!1;a.vertexAttribPointer(e,l,a.FLOAT,!1,0,0)},data:g,build:function(d,k,t){g=d||[];if(!(g&&0!==g.length||h))return f=!1;l=t||l;f&&a.deleteBuffer(f);f=a.createBuffer();a.bindBuffer(a.ARRAY_BUFFER,f);a.bufferData(a.ARRAY_BUFFER,h||new Float32Array(g),a.STATIC_DRAW);e=a.getAttribLocation(c.program(),k);a.enableVertexAttribArray(e);return!0},render:function(c,d,e){var b=h?h.length:g.length;if(!f||!b)return!1;
if(!c||c>b||0>c)c=0;if(!d||d>b)d=b;a.drawArrays(a[(e||"points").toUpperCase()],c/l,(d-c)/l);return!0},allocate:function(a){n=-1;h=new Float32Array(4*a)},push:function(a,c,d,b){h&&(h[++n]=a,h[++n]=c,h[++n]=d,h[++n]=b)}}}function ga(a){function c(a){var b,c;return A(a)?(b=!!a.options.stacking,c=a.xData||a.options.xData||a.processedXData,b=(b?a.data:c||a.options.data).length,"treemap"===a.type?b*=12:"heatmap"===a.type?b*=6:N[a.type]&&(b*=2),b):0}function d(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)}
function f(a,b){function c(a){a&&(b.colorData.push(a[0]),b.colorData.push(a[1]),b.colorData.push(a[2]),b.colorData.push(a[3]))}function d(a,b,d,e,f){c(f);r.usePreallocated?t.push(a,b,d?1:0,e||1):(B.push(a),B.push(b),B.push(d?1:0),B.push(e||1))}function e(a,b,e,f,v){c(v);d(a+e,b);c(v);d(a,b);c(v);d(a,b+f);c(v);d(a,b+f);c(v);d(a+e,b+f);c(v);d(a+e,b)}function f(a){r.useGPUTranslations||(b.skipTranslation=!0,a.x=A.toPixels(a.x,!0),a.y=F.toPixels(a.y,!0));d(a.x,a.y,0,2)}var v=a.pointArrayMap&&"low,high"===
a.pointArrayMap.join(","),k=a.chart,m=a.options,l=!!m.stacking,g=m.data,n=a.xAxis.getExtremes(),q=n.min,u=n.max,n=a.yAxis.getExtremes(),w=n.min,z=n.max,n=a.xData||m.xData||a.processedXData,x=a.yData||m.yData||a.processedYData,p=a.zData||m.zData||a.processedZData,F=a.yAxis,A=a.xAxis,E=!n||0===n.length,y=a.points||!1,J=!1,H,K,L,I=l?a.data:n||g,D={x:Number.MIN_VALUE,y:0},R={x:Number.MIN_VALUE,y:0};m.boostData&&0b.node.levelDynamic)return 1;if(a.node.levelDynamicb.zMax&&(b.zMax=c[2]),c[2]b.zMax&&(b.zMax=p[e]),p[e]=q&&P<=u&&(g=!0);n&&n>=q&&n<=u&&(Y=!0);v?(E&&(m=c.slice(1,3)),m=
m[1]):l&&(f=c.x,m=c.stackY);a.requireSorting||(y=m>=w&&m<=z);f>u&&R.x=q&&f<=u&&(t=!0),t||g||Y)r.useGPUTranslations||(b.skipTranslation=!0,f=A.toPixels(f,!0),m=F.toPixels(m,!0)),ha&&(H=0,0>m&&(H=m,m=0),r.useGPUTranslations||(H=F.toPixels(H,!0)),d(f,H,0,0,!1)),b.hasMarkers&&!1!==J&&(a.closestPointRangePx=Math.min(a.closestPointRangePx,Math.abs(f-J))),d(f,m,0,"bubble"===a.type?h||1:2,!1),J=f}),J||(f(D),f(R))))}function e(){u=[];y.data=B=
[];p=[]}function l(a){k&&(k.setUniform("xAxisTrans",a.transA),k.setUniform("xAxisMin",a.min),k.setUniform("xAxisMinPad",a.minPixelPadding),k.setUniform("xAxisPointRange",a.pointRange),k.setUniform("xAxisLen",a.len),k.setUniform("xAxisPos",a.pos),k.setUniform("xAxisCVSCoord",!a.horiz))}function g(a){k&&(k.setUniform("yAxisTrans",a.transA),k.setUniform("yAxisMin",a.min),k.setUniform("yAxisMinPad",a.minPixelPadding),k.setUniform("yAxisPointRange",a.pointRange),k.setUniform("yAxisLen",a.len),k.setUniform("yAxisPos",
a.pos),k.setUniform("yAxisCVSCoord",!a.horiz))}function n(a,b){k.setUniform("hasThreshold",a);k.setUniform("translatedThreshold",b)}function w(c){if(c)q=c.chartWidth||800,F=c.chartHeight||400;else return!1;if(!b||!q||!F)return!1;r.timeRendering&&console.time("gl rendering");k.bind();b.viewport(0,0,q,F);k.setPMatrix([2/q,0,0,0,0,-(2/F),0,0,0,0,-2,0,-1,1,-1,1]);12*((d.marker?d.marker.radius:10)||10)),v=a.series.fillOpacity?(new Z(a.series.color)).setOpacity(G(d.fillOpacity,.85)).get():a.series.color;t.bind();d.colorByPoint&&(v=a.series.chart.options.colors[c]);v=h.color(v).rgba;r.useAlpha||(v[3]=1);"add"===d.boostBlending?
(b.blendFunc(b.SRC_ALPHA,b.ONE),b.blendEquation(b.FUNC_ADD)):"mult"===d.boostBlending?b.blendFunc(b.DST_COLOR,b.ZERO):"darken"===d.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.boostThreshold||Number.MAX_VALUE)&&Q(f.min)&&Q(f.max)&&(!a||Q(d.min)&&Q(d.max))},destroyGraphics:function(){var a=this,c=this.points,d,f;if(c)for(f=0;f=t&&g<=b),null!==g&&d>=w&&d<=k&&q))if(a=Math.ceil(e.toPixels(d,!0)),B){if(void 0===r||a===x){E||(l=g);if(void 0===v||g>G)G=
g,v=c;if(void 0===r||l




© 2015 - 2024 Weber Informatics LLC | Privacy Policy