provide virtual WebGL support
@emilykl is already working on this.
Since Mar 25, 2024.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Plotly.js v2.28.0 added support for virtual-webgl, which allows you to put arbitrarily many WebGL-based graphs on a single page, as opposed to the limit of typically 4-8 before you hit the maximum contexts a browser will give you (note most desktop browsers give you up to 16 contexts, but one plotly.js graph uses up to 3 contexts). We would like to expose this option in Dash too. It can already be done by adding https://unpkg.com/virtual-webgl@1.0.6/src/virtual-webgl.js to external_scripts (or downloading that and putting it in your assets folder), so we could just document that, but it would be nicer to have a built-in way to do this.
Two important things to note about this:
- It's expected to have some performance impact, so if you only have one or two WebGL graphs at a time you're likely better off not using it, though we haven't quantified this.
- It takes over ALL WebGL on the page, not just plotly.js. This could be good, as you can then put an unlimited number of WebGL-based components of any type on the page, however we haven't tested it with other components so it's possible there will be issues. Aside from plotly.js (
dcc.Graph), WebGL is used by somedash-biocomponents,dash-vtk,dash-deck, and possibly others (I don't thinkdash-cytoscapeordash-leafletuse WebGL but I'm not 100% sure of this).
Initially I was thinking we would make this opt-in as a prop of dcc.Graph, but because of the global (and irreversible) nature of this I'm now thinking a global setting like a Dash() constructor arg would be better.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.