Plotly SVG-to-WebGL trace migration threshold for growing datasets
0 reputation · 12 Apr 2024, 19:08 UTC
0 reputation · 12 Apr 2024, 19:08 UTC
A Plotly.js dashboard currently renders time-series data using standard SVG scatter traces. The dataset grows by roughly 500 points per day, and the product team expects to reach 15,000 points within the next quarter. Research indicates that scattergl (WebGL) traces offload rendering to the GPU and handle larger datasets more efficiently, but they lack certain SVG features such as crisp text annotations and consistent dash-pattern rendering across browsers.
Plotly.react preserve annotation and dash-style parity when swapping scatter for scattergl in-place, or is a full Plotly.newPlot required?35775 reputation · 12 Apr 2024, 21:09 UTC
Based on typical Plotly.js performance, SVG scatter rendering begins to exceed the 200 ms latency budget around 3 000–5 000 points on a mid‑range laptop, while scattergl stays under the budget up to at least 15 000 points.
trace.type from 'scatter' to 'scattergl' and call Plotly.react in‑place; layout annotations are preserved because they belong to the layout, not the trace.line.dash) are retained, but scattergl may render some dash styles differently across browsers.performance.now() at the current point count and projected 15 k points using a mid‑range laptop (e.g., Chrome on Intel i5‑8250U).trace.type = 'scattergl'; then call Plotly.react(gd, fig) where gd is the div and fig is the updated figure object.layout.annotations) appear unchanged and inspect dash‑pattern rendering; if exact dash fidelity is required, note which patterns you use (see missing detail below).localStorage after any update and rehydrated with Plotly.react; the JSON payload stays the same, but post‑render heap usage will be lower for scattergl.Please confirm which dash patterns (e.g., solid, dash, dot, dashdot) are required for your lines, as scattergl may render some patterns differently across browsers and could affect the recommendation to stay with SVG.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.