Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
f5eabf5
Skip glyph outline vertices of scatter3d markers without an outline
katosh Dec 4, 2026
60fa4a1
Add scene.markerrender to draw scatter3d circle markers as discs
katosh Dec 4, 2026
563f8d4
Skip the recalc after a range change of constrained axes of regl traces
katosh Dec 4, 2026
60d91da
Pin gl-plot3d and gl-scatter3d to the forks with order independent tr…
katosh Dec 4, 2026
426f2b8
Add scene.oit to blend translucent scatter3d markers by depth
katosh Dec 4, 2026
f39fb94
Pin gl-plot3d to the fork that draws alwaysOnTop objects last
katosh Dec 4, 2026
21b03b3
Add alwaysontop to scatter3d traces to keep a highlight visible
katosh Dec 4, 2026
8f7beda
Pin gl-plot3d, gl-select-static, and gl-scatter3d to the pick pass br…
katosh Dec 4, 2026
4f93087
Draw the gl3d pick pass on demand, and none for scenes without hover
katosh Dec 4, 2026
8de1f27
Pin regl-scatter2d to a fork commit with typed positions
katosh Dec 4, 2026
0811d51
Pass Float32Array x and y of scattergl traces to regl-scatter2d
katosh Dec 4, 2026
b34d913
Build the hover tree of a large scattergl trace at the first read
katosh Dec 4, 2026
a019f22
Add the draftlog for the scattergl Float32Array changes
katosh Dec 4, 2026
6cec460
State the fallback of scene.markerrender in its description
katosh Dec 4, 2026
4bbc57a
Pin gl-scatter3d to the typed positions branch
katosh Dec 4, 2026
2c178c8
Keep typed scatter3d positions flat, and on the GPU between plot calls
katosh Dec 4, 2026
7d11ad7
Add scene.datascale to keep the scale of a 3D scene for legendonly tr…
katosh Dec 4, 2026
9264e52
Merge branch 'pr/oit' into pr/all
katosh Dec 4, 2026
aa122b6
Merge branch 'pr/alwaysontop' into pr/all
katosh Dec 4, 2026
bae041e
Create the WebGL context of the focus layer only for selections
katosh Dec 4, 2026
8dff38b
Merge branch 'pr/disc-markers' into pr/all
katosh Dec 4, 2026
7219380
Merge branch 'pr/glyph-outline' into pr/all
katosh Dec 4, 2026
a1bc01d
Merge branch 'pr/typed3d-v2' into pr/all
katosh Dec 4, 2026
20aa451
Merge branch 'pr/gl3d-pick-v2' into pr/all
katosh Dec 4, 2026
d09091e
Merge branch 'pr/scattergl-typed' into pr/all
katosh Dec 4, 2026
2289060
Merge branch 'pr/gl2d-focus-context-v3' into pr/all
katosh Dec 4, 2026
9b9a1c9
Merge branch 'pr/gl2d-scaleanchor' into pr/all
katosh Dec 4, 2026
ff9da14
Pin the combined package branches and rebuild the stackgl bundle
katosh Dec 4, 2026
e5c18fc
Regenerate the schema for the combined attributes
katosh Dec 4, 2026
2441332
Move the regl-scatter2d pin to a commit without build scripts
katosh Dec 4, 2026
14d6c6a
Pin regl-scatter2d to a fork commit with the level of detail draws
katosh Dec 4, 2026
6aa60d9
Add scene.hidden and scene.setHidden to the scattergl scene
katosh Dec 4, 2026
6292b4c
Add an opt-in level of detail to scattergl (layout.lod, plotly_lod)
katosh Dec 4, 2026
dc83abc
Merge branch 'pr/disc-markers' into pr/lod-v3
katosh Dec 4, 2026
8fff818
Add an opt-in level of detail for camera moves to gl3d (scene.lod)
katosh Dec 4, 2026
ea4ab99
Add the schema and the draftlog of layout.lod and scene.lod
katosh Dec 4, 2026
f671afc
Merge branch 'pr/scattergl-typed' into pr/all
katosh Dec 4, 2026
94f16c7
Pin regl-scatter2d to the combined branch without build scripts
katosh Dec 4, 2026
0ecd09e
Test scene.oit with disc markers
katosh Dec 4, 2026
50c8f57
Merge branch 'pr/lod-v3' into pr/all
katosh Dec 4, 2026
df03826
Regenerate the schema with layout.lod and scene.lod
katosh Dec 4, 2026
c9d1df0
Test scene.lod with the pick pass on demand
katosh Dec 4, 2026
4bd6578
Keep the scene.markerrender description of the base branch
katosh Dec 4, 2026
06c56d7
Remove the leading space from the level of detail draftlog
katosh Dec 4, 2026
624036a
Test that a typed disc trace above the pick id range keeps no hover p…
katosh Dec 4, 2026
66082c2
Merge branch 'pr/lod-v3' into pr/all
katosh Dec 4, 2026
4a5568d
Draw a translucent level of detail preview as dense as the full picture
katosh Dec 4, 2026
e1bc4c4
Merge branch 'pr/lod-v3' into pr/all
katosh Dec 4, 2026
ac1c172
Pin the combined package branches with the denser thinned draws
katosh Dec 4, 2026
fd8cfbb
Test a thinned translucent disc cloud with scene.oit auto
katosh Dec 4, 2026
dae4331
Count the uploads on the context that regl uses
katosh Dec 5, 2026
6d0689f
Wait with readPixels when the timer query extension has no functions
katosh Dec 5, 2026
85178c4
Wait for the scene frame in the pick specs, and test a pointer event …
katosh Dec 5, 2026
3222b59
Merge branch 'pr/scattergl-typed' into pr/all
katosh Dec 5, 2026
02611db
Merge branch 'pr/lod-v3' into pr/all
katosh Dec 5, 2026
4bd6f7d
Pin gl-plot3d to the pick pass that waits for the frame of a change
katosh Dec 5, 2026
5e45f30
Pin gl-plot3d to the combined branch with the pick pass that waits fo…
katosh Dec 5, 2026
b43fad4
Merge branch 'pr/gl3d-pick-v2' into pr/all
katosh Dec 5, 2026
66cec41
Name the early pointer spec after what it tests
katosh Dec 5, 2026
53971c4
Pin gl-plot3d to the pick pass that waits 1 ms after a frame
katosh Dec 5, 2026
a2509b5
Pin gl-plot3d to the pick pass that waits 1 ms after a change of the …
katosh Dec 5, 2026
6366e47
Pin gl-plot3d to the combined branch with the 1 ms wait of the pick pass
katosh Dec 5, 2026
994a4a6
Merge branch 'pr/gl3d-pick-v2' into pr/all
katosh Dec 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions draftlogs/XXXX-alwaysontop_add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Add `alwaysontop` to `scatter3d` traces to draw their markers last, over everything else [[#XXXX](https://github.com/plotly/plotly.js/pull/XXXX)]
1 change: 1 addition & 0 deletions draftlogs/XXXX-datascale_add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Add `scene.datascale` to let traces hidden in the legend keep the scale of a 3D scene, so that the positions of the other traces stay on the GPU [[#XXXX](https://github.com/plotly/plotly.js/pull/XXXX)]
1 change: 1 addition & 0 deletions draftlogs/XXXX-focus-context_change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Create the WebGL context of the `scattergl` and `splom` focus layer only when a selection starts (a selection drag mode or selected points) [[#XXXX](https://github.com/plotly/plotly.js/pull/XXXX)]
1 change: 1 addition & 0 deletions draftlogs/XXXX-glyph-outline_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix `scatter3d` allocating glyph outline vertices for markers without an outline, which cuts the vertex count of a circle marker from 104 to 60 [[#XXXX](https://github.com/plotly/plotly.js/pull/XXXX)]
1 change: 1 addition & 0 deletions draftlogs/XXXX-lod_add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Add `layout.lod` and `layout.scene.lod` to draw a preview of every k-th point first in `scattergl` plots and while the camera moves in `scatter3d` plots of many points, with the full picture drawn when the plot is at rest, the `plotly_lod` event, and `scene.hidden` / `scene.setHidden` to hide `scattergl` traces without a recalculation [[#XXXX](https://github.com/plotly/plotly.js/pull/XXXX)]
1 change: 1 addition & 0 deletions draftlogs/XXXX-markerrender_add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Add `scene.markerrender` to draw `scatter3d` circle markers as one-vertex discs instead of glyph meshes, which cuts the memory of a marker from 4,160 bytes to 36 bytes [[#XXXX](https://github.com/plotly/plotly.js/pull/XXXX)]
1 change: 1 addition & 0 deletions draftlogs/XXXX-oit_add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Add `scene.oit` to blend translucent `scatter3d` markers by depth in place of draw order [[#XXXX](https://github.com/plotly/plotly.js/pull/XXXX)]
1 change: 1 addition & 0 deletions draftlogs/XXXX-pick_change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Draw the gl3d pick pass when a pointer event needs it instead of in every frame that moves the camera, skip it when no trace of the scene can be picked, draw no frame for a hover that changes nothing in the picture, and make `scene.hovermode: false` pick only on a button press without emitting hover events [[#XXXX](https://github.com/plotly/plotly.js/pull/XXXX)]
1 change: 1 addition & 0 deletions draftlogs/XXXX-pick_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix hover and click on `scatter3d` traces with more than 16,777,215 points naming other points: such a trace is drawn but not picked, with a console warning [[#XXXX](https://github.com/plotly/plotly.js/pull/XXXX)]
1 change: 1 addition & 0 deletions draftlogs/XXXX-scaleanchor_change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Skip the recalculation after a range change of axes with `scaleanchor`, if every trace is a regl trace and the ranges of the constrained axes are fixed [[#XXXX](https://github.com/plotly/plotly.js/pull/XXXX)]
1 change: 1 addition & 0 deletions draftlogs/XXXX-scattergl-typed_change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Upload `Float32Array` `x` and `y` of markers-only `scattergl` traces without a copy, and build the hover index of large traces only when the graph has hover [[#XXXX](https://github.com/plotly/plotly.js/pull/XXXX)]
1 change: 1 addition & 0 deletions draftlogs/XXXX-typed3d_change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Convert typed `x`, `y`, and `z` of a `scatter3d` trace with markers only to one `Float32Array`, scan the data one time for the bounds, and keep the positions on the GPU when a later plot call gives the same data [[#XXXX](https://github.com/plotly/plotly.js/pull/XXXX)]
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"probe-image-size": "^7.5.0",
"regl-error2d": "^2.0.12",
"regl-line2d": "^3.1.4",
"regl-scatter2d": "^3.4.0",
"regl-scatter2d": "github:settylab/regl-scatter2d#37e65835d22ff96b1b4e759cf857549143f18ad8",
"regl-splom": "^1.0.14",
"strongly-connected-components": "^1.0.1",
"svg-path-sdf": "^2.0.0",
Expand Down
6 changes: 6 additions & 0 deletions src/lib/clear_gl_canvases.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ module.exports = function clearGlCanvases(gd) {
var fullLayout = gd._fullLayout;

if(fullLayout._glcanvas && fullLayout._glcanvas.size()) {
// A scattergl scene with a level of detail can keep a copy of the full picture on screen.
for(const id in fullLayout._plots) {
const scene = fullLayout._plots[id]._scene;
if(scene?.lod?.beforeClear) scene.lod.beforeClear();
}

fullLayout._glcanvas.each(function(d) {
if(d.regl) d.regl.clear({color: true, depth: true});
});
Expand Down
7 changes: 6 additions & 1 deletion src/lib/prepare_regl.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ var createRegl = require('@plotly/regl');
*
* @param {DOM node or object} gd : graph div object
* @param {array} extensions : list of extension to pass to createRegl
* @param {object} reglPrecompiled : precompiled regl code for strict bundles
* @param {boolean} needsFocusLayer : if true, also create the regl instance of the focus layer.
* A graph with parcoords always gets that instance.
*
* @return {boolean} true if all createRegl calls succeeded, false otherwise
*/
module.exports = function prepareRegl(gd, extensions, reglPrecompiled) {
module.exports = function prepareRegl(gd, extensions, reglPrecompiled, needsFocusLayer) {
var fullLayout = gd._fullLayout;
var success = true;

Expand All @@ -29,6 +32,8 @@ module.exports = function prepareRegl(gd, extensions, reglPrecompiled) {
}
// only parcoords needs pick layer
if(d.pick && !fullLayout._has('parcoords')) return;
// Browsers limit the WebGL contexts of a page, so the focus layer gets a context only on request
if (d.key === 'focusLayer' && !needsFocusLayer && !fullLayout._has('parcoords')) return;

try {
d.regl = createRegl({
Expand Down
32 changes: 31 additions & 1 deletion src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2205,7 +2205,8 @@ function _relayout(gd, aobj) {
// specifying arbitrary ranges for all axes in the group.
// this way some ranges may expand beyond what's specified,
// as they do at first draw, to satisfy the constraints.
flags.calc = true;
// The replot applies the constraints from the axes. A recalc uploads every regl trace again.
flags[constraintsNeedCalc(gd, group) ? 'calc' : 'plot'] = true;
for (var groupAxId in group) {
if (!rangesAltered[groupAxId]) {
Axes.getFromId(gd, groupAxId)._constraintShrinkable = true;
Expand Down Expand Up @@ -2245,6 +2246,35 @@ function _relayout(gd, aobj) {
};
}

/**
* Decide if a relayout that alters the ranges of a constraint group needs a recalc.
*
* @param gd - the graph div
* @param group - the constraint group, keyed by axis id
* @returns false if every trace is a regl trace and every axis of the group has a fixed range, else true
*/
function constraintsNeedCalc(gd, group) {
const fullData = gd._fullData || [];
for (let i = 0; i < fullData.length; i++) {
if (!Registry.traceIs(fullData[i], 'regl')) return true;
}
for (const axId in group) {
const axIn = Axes.getFromId(gd, axId)?._input;
if (!axIn) return true;
const range = axIn.range;
const fixed =
axIn.autorange === false ||
(axIn.autorange === undefined &&
Array.isArray(range) &&
range.length === 2 &&
range[0] !== null &&
range[1] !== null);
// An autorange needs the extremes of a new calc
if (!fixed) return true;
}
return false;
}

/*
* updateAutosize: we made a change, does it change the autosize result?
* puts the new size into fullLayout
Expand Down
9 changes: 9 additions & 0 deletions src/plots/gl3d/layout/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) {
*/

var bgcolor = coerce('bgcolor');
coerce('oit');
// A scene without `lod` gets no `lod` container.
if(Lib.isPlainObject(sceneLayoutIn.lod) && coerce('lod.minpoints')) {
coerce('lod.budget');
coerce('lod.maxstride');
coerce('lod.settle');
}
var bgColorCombined = Color.combine(bgcolor, opts.paper_bgcolor);

var cameraKeys = ['up', 'center', 'eye'];
Expand All @@ -62,6 +69,8 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) {
}

coerce('camera.projection.type');
coerce('markerrender');
coerce('datascale');

/*
* coerce to positive number (min 0) but also do not accept 0 (>0 not >=0)
Expand Down
85 changes: 85 additions & 0 deletions src/plots/gl3d/layout/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,34 @@ module.exports = {
yaxis: gl3dAxisAttrs,
zaxis: gl3dAxisAttrs,

markerrender: {
valType: 'enumerated',
values: ['glyph', 'disc', 'auto'],
dflt: 'glyph',
editType: 'plot',
description: [
'Sets how circle markers of *scatter3d* traces are drawn.',
'The symbols *circle* and *circle-open* have two forms.',
'*glyph* draws each marker as a mesh of 60 to 104 vertices. This is the default.',
'*disc* draws each marker as one round point sprite. It needs far less memory and draws faster.',
'The edge of a disc differs from the edge of a glyph by about one pixel.',
'A marker with another symbol, a projection on the axes, or a size above the point size limit of the GPU is drawn as a glyph.',
'*auto* is currently the same as *disc*.'
].join(' ')
},
datascale: {
valType: 'enumerated',
values: ['visible', 'all'],
dflt: 'visible',
editType: 'plot',
description: [
'Determines which traces set the scale that the data of this scene is drawn at.',
'With *visible*, hiding or showing a trace that changes the extent of the data',
'changes the scale, and the positions of every trace are converted and uploaded again.',
'With *all*, traces that are hidden with `visible: *legendonly*` count as well,',
'so hiding and showing them leaves the positions of the other traces as they are.'
].join(' ')
},
dragmode: {
valType: 'enumerated',
values: ['orbit', 'turntable', 'zoom', 'pan', false],
Expand All @@ -150,6 +178,63 @@ module.exports = {
'Determines the mode of hover interactions for this scene.'
].join(' ')
},
oit: {
valType: 'enumerated',
values: ['off', 'auto'],
dflt: 'off',
editType: 'plot',
description: [
'Determines how translucent `scatter3d` markers blend.',
'With *off*, the markers blend in draw order.',
'The picture then depends on the order of the traces and of the points.',
'With *auto*, the markers blend by depth and the draw order has no effect.',
'This uses extra render passes and float render targets.',
'The targets need memory in proportion to the size of the plot.',
'If the graphics hardware lacks a feature, plotly.js falls back to *off*.',
'The scene reports the result in `getOITStatus()` and in the `plotly_oitstatus` event.'
].join(' ')
},
lod: {
minpoints: {
valType: 'number',
min: 0,
dflt: 0,
editType: 'plot',
description: [
'Sets the number of `scatter3d` disc markers from which a camera move shows a preview.',
'A preview draws every k-th marker of every trace and no pick pass.',
'The scene draws every marker again `settle` milliseconds after the last camera move.',
'0 turns the preview off.',
'The graph emits `plotly_lod` when the state changes.'
].join(' ')
},
budget: {
valType: 'number',
min: 1,
dflt: 2500000,
editType: 'plot',
description: [
'Sets the largest number of markers in a preview.',
'The stride k is the smallest power of two, from 2 to `maxstride`,',
'that brings the markers within this number.'
].join(' ')
},
maxstride: {
valType: 'integer',
min: 2,
dflt: 64,
editType: 'plot',
description: 'Sets the largest stride of a preview.'
},
settle: {
valType: 'number',
min: 0,
dflt: 150,
editType: 'plot',
description: 'Sets the time in milliseconds between the last camera move and the full picture.'
},
editType: 'plot'
},
uirevision: {
valType: 'any',
editType: 'none',
Expand Down
Loading
Loading