.boost
class: Boost
- class Boost(**kwargs)[source]
Options for the Boost module.
The Boost module allows certain series types to be rendered by WebGL instead of the default SVG. This allows hundreds of thousands of data points to be rendered in milliseconds. In addition to the WebGL rendering it saves time by skipping processing and inspection of the data wherever possible. This introduces some limitations to what features are available in boost mode. See the docs for details.
Note
In addition to the global
HighchartOptions.boost()property, each series has aSeries.boost_threshold()that defines when the boost should kick in.Class Inheritance
digraph inheritance9f8f275981 { bgcolor=transparent; rankdir=TB; size="8.0, 12.0"; "metaclasses.HighchartsMeta" [URL="../internals.html#highcharts_stock.metaclasses.HighchartsMeta",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Metaclass that is used to define the standard interface exposed for serializable"]; "options.boost.Boost" [URL="#highcharts_stock.options.boost.Boost",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Options for the Boost module."]; "metaclasses.HighchartsMeta" -> "options.boost.Boost" [arrowsize=0.5,style="setlinewidth(0.5)"]; }- copy(other=None, overwrite=True, **kwargs)
Copy the configuration settings from this instance to the
otherinstance.- Parameters:
other (
HighchartsMeta) – The target instance to which the properties of this instance should be copied. IfNone, will create a new instance and populate it with properties copied fromself. Defaults toNone.overwrite (
bool) – ifTrue, properties inotherthat are already set will be overwritten by their counterparts inself. Defaults toTrue.kwargs – Additional keyword arguments. Some special descendents of
HighchartsMetamay have special implementations of this method which rely on additional keyword arguments.
- Returns:
A mutated version of
otherwith new property values
- classmethod from_dict(as_dict: dict, allow_snake_case: bool = True)
Construct an instance of the class from a
dictobject.
- classmethod from_js_literal(as_str_or_file, allow_snake_case: bool = True, _break_loop_on_failure: bool = False)
Return a Python object representation of a Highcharts JavaScript object literal.
- Parameters:
as_str_or_file (
str) – The JavaScript object literal, represented either as astror as a filename which contains the JS object literal.allow_snake_case (
bool) – IfTrue, interpretssnake_casekeys as equivalent tocamelCasekeys. Defaults toTrue._break_loop_on_failure (
bool) – IfTrue, will break any looping operations in the event of a failure. Otherwise, will attempt to repair the failure. Defaults toFalse.
- Returns:
A Python object representation of the Highcharts JavaScript object literal.
- Return type:
HighchartsMeta
- classmethod from_json(as_json_or_file, allow_snake_case: bool = True)
Construct an instance of the class from a JSON string.
- Parameters:
as_json_or_file – The JSON string for the object or the filename of a file that contains the JSON string.
allow_snake_case (
bool) – IfTrue, interpretssnake_casekeys as equivalent tocamelCasekeys. Defaults toTrue.
- Returns:
A Python objcet representation of
as_json.- Return type:
HighchartsMeta
- to_dict() dict
Generate a
dictrepresentation of the object compatible with the Highcharts JavaScript library.Note
The
dictrepresentation has a property structure and naming convention that is intentionally consistent with the Highcharts JavaScript library. This is not Pythonic, but it makes managing the interplay between the two languages much, much simpler.
- to_js_literal(filename=None, encoding='utf-8') str | None
Return the object represented as a
strcontaining the JavaScript object literal.
- to_json(filename=None, encoding='utf-8')
Generate a JSON string/byte string representation of the object compatible with the Highcharts JavaScript library.
Note
This method will either return a standard
stror abytesobject depending on the JSON serialization library you are using. For example, if your environment has orjson, the result will be abytesrepresentation of the string.- Parameters:
- Returns:
A JSON representation of the object compatible with the Highcharts library.
- Return type:
- static trim_dict(untrimmed: dict, to_json: bool = False) dict
Remove keys from
untrimmedwhose values areNoneand convert values that have.to_dict()methods.
- static trim_iterable(untrimmed, to_json=False)
Convert any
EnforcedNullTypevalues inuntrimmedto'null'.
- property allow_force: bool | None
If
True, the whole chart will be boosted if one of the series crosses its threshold and all the series can be boosted. Defaults toTrue.- Returns:
Flag indicating whether the entire chart can be boosted in response to one series being boosted.
- Return type:
class:bool <python:bool> or
None
- property debug: BoostDebug | None
Debugging options for boost. Useful for benchmarking, and general timing.
- Return type:
BoostDebugorNone
- property enabled: bool | None
If
True, boost is enabled on the chart. IfFalse, boost is disabled. Defaults toTrue.
- property pixel_ratio: int | None
The pixel ratio for the WebGL content. Defaults to
1.If
0, thewindow.devicePixelRatiois used. This ensures sharp graphics on high DPI displays like Apple’s Retina, as well as when a page is zoomed.Note
The default is left at
1for now, as this is a new feature that has the potential to break existing setups. Over time, when it has been battle tested, the intention is to set it to0by default.Hint
Another use case for this option is to set it to
2in order to make exported and upscaled charts render sharp.Warning
One limitation when using the
pixel_ratiois that the line width of graphs is scaled down. Since the Boost module currently can only render1pxline widths, it is scaled down to a thin0.5pixels on a Retina display.
- property series_threshold: int | None
Set the series threshold for when the boost should kick in globally. Defaults to
50.Setting to e.g.
20will 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.
- property use_gpu_translations: bool | None
If
True, enables GPU translations. GPU translations are faster than doing the translation in JavaScript. Defaults toFalse.Warning
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.
- Returns:
Flag indicating whether to use GPU translations.
- Return type:
boolorNone <python:None.
- property use_preallocated: bool | None
If
True, enables the pre-allocation of vertex buffers. Defaults toFalse.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.
Warning
Enabling this feature 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.
class: BoostDebug
- class BoostDebug(**kwargs)[source]
Debugging options for boost. Useful for benchmarking, and general timing.
Class Inheritance
digraph inheritanced0148b382d { bgcolor=transparent; rankdir=TB; size="8.0, 12.0"; "metaclasses.HighchartsMeta" [URL="../internals.html#highcharts_stock.metaclasses.HighchartsMeta",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Metaclass that is used to define the standard interface exposed for serializable"]; "options.boost.BoostDebug" [URL="#highcharts_stock.options.boost.BoostDebug",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Debugging options for boost. Useful for benchmarking, and general timing."]; "metaclasses.HighchartsMeta" -> "options.boost.BoostDebug" [arrowsize=0.5,style="setlinewidth(0.5)"]; }- copy(other=None, overwrite=True, **kwargs)
Copy the configuration settings from this instance to the
otherinstance.- Parameters:
other (
HighchartsMeta) – The target instance to which the properties of this instance should be copied. IfNone, will create a new instance and populate it with properties copied fromself. Defaults toNone.overwrite (
bool) – ifTrue, properties inotherthat are already set will be overwritten by their counterparts inself. Defaults toTrue.kwargs – Additional keyword arguments. Some special descendents of
HighchartsMetamay have special implementations of this method which rely on additional keyword arguments.
- Returns:
A mutated version of
otherwith new property values
- classmethod from_dict(as_dict: dict, allow_snake_case: bool = True)
Construct an instance of the class from a
dictobject.
- classmethod from_js_literal(as_str_or_file, allow_snake_case: bool = True, _break_loop_on_failure: bool = False)
Return a Python object representation of a Highcharts JavaScript object literal.
- Parameters:
as_str_or_file (
str) – The JavaScript object literal, represented either as astror as a filename which contains the JS object literal.allow_snake_case (
bool) – IfTrue, interpretssnake_casekeys as equivalent tocamelCasekeys. Defaults toTrue._break_loop_on_failure (
bool) – IfTrue, will break any looping operations in the event of a failure. Otherwise, will attempt to repair the failure. Defaults toFalse.
- Returns:
A Python object representation of the Highcharts JavaScript object literal.
- Return type:
HighchartsMeta
- classmethod from_json(as_json_or_file, allow_snake_case: bool = True)
Construct an instance of the class from a JSON string.
- Parameters:
as_json_or_file – The JSON string for the object or the filename of a file that contains the JSON string.
allow_snake_case (
bool) – IfTrue, interpretssnake_casekeys as equivalent tocamelCasekeys. Defaults toTrue.
- Returns:
A Python objcet representation of
as_json.- Return type:
HighchartsMeta
- to_dict() dict
Generate a
dictrepresentation of the object compatible with the Highcharts JavaScript library.Note
The
dictrepresentation has a property structure and naming convention that is intentionally consistent with the Highcharts JavaScript library. This is not Pythonic, but it makes managing the interplay between the two languages much, much simpler.
- to_js_literal(filename=None, encoding='utf-8') str | None
Return the object represented as a
strcontaining the JavaScript object literal.
- to_json(filename=None, encoding='utf-8')
Generate a JSON string/byte string representation of the object compatible with the Highcharts JavaScript library.
Note
This method will either return a standard
stror abytesobject depending on the JSON serialization library you are using. For example, if your environment has orjson, the result will be abytesrepresentation of the string.- Parameters:
- Returns:
A JSON representation of the object compatible with the Highcharts library.
- Return type:
- static trim_dict(untrimmed: dict, to_json: bool = False) dict
Remove keys from
untrimmedwhose values areNoneand convert values that have.to_dict()methods.
- static trim_iterable(untrimmed, to_json=False)
Convert any
EnforcedNullTypevalues inuntrimmedto'null'.
- property show_skip_summary: bool | None
When
True, the number of points skipped in series processing is outputted. Defaults toFalse.Points are skipped if they are closer than 1 pixel from each other.
- property time_buffer_copy: bool | None
When
True, the time it takes for the SVG buffer copy to complete is outputted. Defaults toFalse.
- property time_kd_tree: bool | None
When
True, the time spent building the k-d tree used for markers, etc. will be rendered. Defaults toFalse.Note
Note that the k-d tree is built asynchronously, and runs post-rendering. Thus, it does not affect the performance of the rendering itself.
- property time_rendering: bool | None
When
True, the time spent on actual rendering is outputted to the console. Defaults toFalse.