@@ -70,6 +70,22 @@ Qt-based PlotPy is unavailable in the browser. Use **Plotly.js** (via
7070` react-plotly.js ` ). Mirror the conventions of ` DataLab-Kernel/datalab_kernel/plotly_backend.py `
7171when extending plot features (curve styles, ROI overlays, geometry results).
7272
73+ For ** images** (` ImagePlot.tsx ` , ` MultiImagePlot.tsx ` ) we deliberately avoid Plotly's ` heatmap `
74+ trace — it freezes the UI for several seconds on 2048²+ arrays. Instead we pre-rasterise the
75+ data on an off-screen ` <canvas> ` via ` src/utils/colormap.ts ` (` paintImageData ` ) and feed Plotly
76+ an ` image ` trace. Three non-obvious constraints when touching this path:
77+
78+ - ` image.source ` must be a ** ` data: ` URL** (` canvas.toDataURL ` ). ` blob: ` URLs from
79+ ` URL.createObjectURL ` are silently rejected by Plotly's loader.
80+ - Set ` xaxis.range ` /` yaxis.range ` and ` autorange: false ` explicitly. ` image ` traces carry no
81+ X/Y arrays, so any other trace (e.g. a hidden ` scatter ` for the colorbar) collapses autorange.
82+ - ` image ` traces don't emit ` plotly_hover ` . Tooltips are wired manually via ` onMouseMove ` on
83+ the wrapper, converting client px → data coords with ` gd._fullLayout.xaxis.p2c ` .
84+
85+ The colorbar uses a hidden ` scatter ` trace whose ` marker.colorscale ` is sampled from the same
86+ LUT (` buildColorscale ` ), so it matches the canvas bit-for-bit even for colormaps Plotly
87+ doesn't know natively.
88+
7389## Adding a new processing
7490
7591Processings are discovered by introspecting Sigima's catalog in
@@ -131,7 +147,11 @@ done (bug fix, feature, or any phase of a multi-phase task):
131147 silently break in ways only a browser-driven test catches reliably.
132148 Use a throwaway probe (` tests/e2e/_repro_*.spec.ts ` , deleted
133149 afterwards) when the change does not warrant a permanent regression
134- spec.
150+ spec. A neighbouring perf benchmark or a sibling component's tests
151+ do ** not** count — they may stay green while your code path never
152+ runs. The probe must assert something visible (a DOM node, a trace,
153+ a pixel) rather than just calling ` window.runtime.* ` from
154+ ` page.evaluate ` , which can silently no-op.
1351553 . ** For ` src/runtime/*.py ` changes** , run pytest (` tests/python ` ).
136156
137157## Git workflow
0 commit comments