Skip to content

Commit 2802e2f

Browse files
authored
Merge branch 'chartjs:master' into feature/legend-navigation
2 parents e37553f + 0ca1b6e commit 2802e2f

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

docs/general/performance.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ new Chart(ctx, {
7272
});
7373
```
7474

75-
## Parallel rendering with web workers (Chromium only)
75+
## Parallel rendering with web workers
7676

77-
Chromium (Chrome: version 69, Edge: 79, Opera: 56) added the ability to [transfer rendering control of a canvas](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/transferControlToOffscreen) to a web worker. Web workers can use the [OffscreenCanvas API](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas) to render from a web worker onto canvases in the DOM. Chart.js is a canvas-based library and supports rendering in a web worker - just pass an OffscreenCanvas into the Chart constructor instead of a Canvas element. Note that as of today, this API is only supported in Chromium based browsers.
77+
As of 2023, modern browser have the ability to [transfer rendering control of a canvas](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/transferControlToOffscreen) to a web worker. Web workers can use the [OffscreenCanvas API](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas) to render from a web worker onto canvases in the DOM. Chart.js is a canvas-based library and supports rendering in a web worker - just pass an OffscreenCanvas into the Chart constructor instead of a Canvas element.
7878

7979
By moving all Chart.js calculations onto a separate thread, the main thread can be freed up for other uses. Some tips and tricks when using Chart.js in a web worker:
8080

8181
* Transferring data between threads can be expensive, so ensure that your config and data objects are as small as possible. Try generating them on the worker side if you can (workers can make HTTP requests!) or passing them to your worker as ArrayBuffers, which can be transferred quickly from one thread to another.
8282
* You can't transfer functions between threads, so if your config object includes functions you'll have to strip them out before transferring and then add them back later.
8383
* You can't access the DOM from worker threads, so Chart.js plugins that use the DOM (including any mouse interactions) will likely not work.
84-
* Ensure that you have a fallback if you support browsers other than the most modern Chromium browsers.
84+
* Ensure that you have a fallback if you support older browsers.
8585
* Resizing the chart must be done manually. See an example in the worker code below.
8686

8787
Example main thread code:

src/types/index.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,11 +2413,6 @@ export interface LegendOptions<TType extends ChartType> {
24132413
* @default fontSize
24142414
*/
24152415
boxHeight: number;
2416-
/**
2417-
* Padding between the color box and the text
2418-
* @default 1
2419-
*/
2420-
boxPadding: number;
24212416
/**
24222417
* Color of label
24232418
* @see Defaults.color

0 commit comments

Comments
 (0)