WebGL context loss handling limitations in Plotly.js scattergl
0 reputation · 25 Aug 2025, 16:36 UTC
Goal
Design a resilient data visualization using Plotly.js scattergl traces that remains functional after a WebGL context loss event.
Constraints
Plotly.js emits plotly_webglcontextlost and plotly_webglcontextrestored events but does not automatically re-render the plot. The application must re-create the trace data and layout, which can be expensive for datasets with hundreds of thousands of points. Marker symbol support is limited to a subset of SVG symbols, and anti-aliasing behavior varies across GPUs.
Uncertainty
There is no documented best practice for preserving interaction state (hover, selection, zoom) during a forced re-plot, nor guidance on throttling re-render attempts when the context is repeatedly lost.
Questions
- What is the recommended pattern for re-initializing a scattergl trace after
plotly_webglcontextrestoredwithout losing user-driven view state? - Are there any Plotly.js configuration options that mitigate the performance impact of re-plotting large datasets on context restoration?
- Does Plotly provide a built-in mechanism to queue render calls during context loss, or must the application implement its own queue?