179 lines
4.9 KiB
JavaScript
179 lines
4.9 KiB
JavaScript
/* *
|
|
*
|
|
* Copyright (c) 2019-2020 Highsoft AS
|
|
*
|
|
* Boost module: stripped-down renderer for higher performance
|
|
*
|
|
* License: highcharts.com/license
|
|
*
|
|
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
*
|
|
* */
|
|
'use strict';
|
|
import '../../parts/Globals.js';
|
|
/**
|
|
* @requires modules/boost
|
|
* @apioption boost
|
|
*/
|
|
/**
|
|
* Set the series threshold for when the boost should kick in globally.
|
|
*
|
|
* Setting to e.g. 20 will cause the whole chart to enter boost mode
|
|
* if there are 20 or more series active. When the chart is in boost mode,
|
|
* every series in it will be rendered to a common canvas. This offers
|
|
* a significant speed improvment in charts with a very high
|
|
* amount of series.
|
|
*
|
|
* @type {number|null}
|
|
* @default null
|
|
* @apioption boost.seriesThreshold
|
|
*/
|
|
/**
|
|
* Enable or disable boost on a chart.
|
|
*
|
|
* @type {boolean}
|
|
* @default true
|
|
* @apioption boost.enabled
|
|
*/
|
|
/**
|
|
* Debugging options for boost.
|
|
* Useful for benchmarking, and general timing.
|
|
*
|
|
* @apioption boost.debug
|
|
*/
|
|
/**
|
|
* Time the series rendering.
|
|
*
|
|
* This outputs the time spent on actual rendering in the console when
|
|
* set to true.
|
|
*
|
|
* @type {boolean}
|
|
* @default false
|
|
* @apioption boost.debug.timeRendering
|
|
*/
|
|
/**
|
|
* Time the series processing.
|
|
*
|
|
* This outputs the time spent on transforming the series data to
|
|
* vertex buffers when set to true.
|
|
*
|
|
* @type {boolean}
|
|
* @default false
|
|
* @apioption boost.debug.timeSeriesProcessing
|
|
*/
|
|
/**
|
|
* Time the the WebGL setup.
|
|
*
|
|
* This outputs the time spent on setting up the WebGL context,
|
|
* creating shaders, and textures.
|
|
*
|
|
* @type {boolean}
|
|
* @default false
|
|
* @apioption boost.debug.timeSetup
|
|
*/
|
|
/**
|
|
* Time the building of the k-d tree.
|
|
*
|
|
* This outputs the time spent building the k-d tree used for
|
|
* markers etc.
|
|
*
|
|
* Note that the k-d tree is built async, and runs post-rendering.
|
|
* Following, it does not affect the performance of the rendering itself.
|
|
*
|
|
* @type {boolean}
|
|
* @default false
|
|
* @apioption boost.debug.timeKDTree
|
|
*/
|
|
/**
|
|
* Show the number of points skipped through culling.
|
|
*
|
|
* When set to true, the number of points skipped in series processing
|
|
* is outputted. Points are skipped if they are closer than 1 pixel from
|
|
* each other.
|
|
*
|
|
* @type {boolean}
|
|
* @default false
|
|
* @apioption boost.debug.showSkipSummary
|
|
*/
|
|
/**
|
|
* Time the WebGL to SVG buffer copy
|
|
*
|
|
* After rendering, the result is copied to an image which is injected
|
|
* into the SVG.
|
|
*
|
|
* If this property is set to true, the time it takes for the buffer copy
|
|
* to complete is outputted.
|
|
*
|
|
* @type {boolean}
|
|
* @default false
|
|
* @apioption boost.debug.timeBufferCopy
|
|
*/
|
|
/**
|
|
* Enable or disable GPU translations. GPU translations are faster than doing
|
|
* the translation in JavaScript.
|
|
*
|
|
* This option may cause rendering issues with certain datasets.
|
|
* Namely, if your dataset has large numbers with small increments (such as
|
|
* timestamps), it won't work correctly. This is due to floating point
|
|
* precission.
|
|
*
|
|
* @type {boolean}
|
|
* @default false
|
|
* @apioption boost.useGPUTranslations
|
|
*/
|
|
/**
|
|
* Enable or disable pre-allocation of vertex buffers.
|
|
*
|
|
* Enabling this will make it so that the binary data arrays required for
|
|
* storing the series data will be allocated prior to transforming the data
|
|
* to a WebGL-compatible format.
|
|
*
|
|
* This saves a copy operation on the order of O(n) and so is significantly more
|
|
* performant. However, this is currently an experimental option, and may cause
|
|
* visual artifacts with some datasets.
|
|
*
|
|
* As such, care should be taken when using this setting to make sure that
|
|
* it doesn't cause any rendering glitches with the given use-case.
|
|
*
|
|
* @type {boolean}
|
|
* @default false
|
|
* @apioption boost.usePreallocated
|
|
*/
|
|
/**
|
|
* Set the point threshold for when a series should enter boost mode.
|
|
*
|
|
* Setting it to e.g. 2000 will cause the series to enter boost mode when there
|
|
* are 2000 or more points in the series.
|
|
*
|
|
* To disable boosting on the series, set the `boostThreshold` to 0. Setting it
|
|
* to 1 will force boosting.
|
|
*
|
|
* Note that the [cropThreshold](plotOptions.series.cropThreshold) also affects
|
|
* this setting. When zooming in on a series that has fewer points than the
|
|
* `cropThreshold`, all points are rendered although outside the visible plot
|
|
* area, and the `boostThreshold` won't take effect.
|
|
*
|
|
* @type {number}
|
|
* @default 5000
|
|
* @requires modules/boost
|
|
* @apioption plotOptions.series.boostThreshold
|
|
*/
|
|
/**
|
|
* If set to true, the whole chart will be boosted if one of the series
|
|
* crosses its threshold, and all the series can be boosted.
|
|
*
|
|
* @type {boolean}
|
|
* @default true
|
|
* @apioption boost.allowForce
|
|
*/
|
|
/**
|
|
* Sets the color blending in the boost module.
|
|
*
|
|
* @type {string}
|
|
* @default undefined
|
|
* @validvalue ["add", "multiply", "darken"]
|
|
* @requires modules/boost
|
|
* @apioption plotOptions.series.boostBlending
|
|
*/
|
|
''; // adds doclets above to transpiled file
|