Skip to content

Aggressive splom perf #3057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Oct 4, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
56f2ee9
update scattergl & splom 'text' attr description
etpinard Sep 18, 2018
3574ece
move splom scene ref to fullLayout
etpinard Sep 27, 2018
8d0cac5
use styleOnSelect for scatter[polar]gl and splom
etpinard Sep 27, 2018
8282d91
compute marker.size axis 'ppad' value once per splom traces,
etpinard Sep 27, 2018
73acd7e
merge options before matrix.update call
etpinard Sep 27, 2018
cc5f0ca
speed up 'axrange' edits
etpinard Sep 27, 2018
17e30d2
aggressively try to speed 'axrange' edits for splom
etpinard Sep 27, 2018
4792f08
optimize lsInner for splom
etpinard Sep 27, 2018
f415e96
first-cut editType:'style' pathway for sploms
etpinard Sep 27, 2018
3eb91c0
no need to re-calc 'regl' traces in-and-out of arrayOk values
etpinard Sep 27, 2018
145cad3
try implementing a fast 'markerSize' editType
etpinard Sep 27, 2018
6de1ae4
add supplyDefaults bypass 'axrange' optimization to Plotly.update
etpinard Oct 1, 2018
aaf6312
apply no-need-for-<rect.bg> optimization to all cartesian subplots
etpinard Oct 1, 2018
478c669
speed up splom.clean
etpinard Oct 1, 2018
81eb48b
introduce redrawReglTraces subroutine
etpinard Oct 2, 2018
0243451
:hocho: obsolete sortBasePlotModules
etpinard Oct 2, 2018
dcacd78
use redrawReglTraces on drag
etpinard Oct 2, 2018
68dfbc1
use redrawReglTraces on polar drag
etpinard Oct 2, 2018
c02330c
fix #2797 - clear full canvas and use redrawReglTraces on selections
etpinard Oct 2, 2018
02263b9
use redrawReglTraces in edit subroutines
etpinard Oct 2, 2018
f179c2f
skip canvas/context size mismatch test on CI
etpinard Oct 2, 2018
cd8d8ab
Merge pull request #3067 from plotly/redraw-regl-traces-subroutine
etpinard Oct 2, 2018
0aad7ea
fixup (add missing @gl)
etpinard Oct 2, 2018
078c086
clear axis types when restyling splom show(upper|lower)half
etpinard Oct 2, 2018
00cae48
Revert "clear axis types when restyling splom show(upper|lower)half"
etpinard Oct 3, 2018
5878223
make trace `(x|y)axes` always have the same length dimensions`
etpinard Oct 4, 2018
c2ecb3a
:hocho: obsolete args
etpinard Oct 4, 2018
31d5606
fixup comments
etpinard Oct 4, 2018
ea38664
add noCI tag to misbehaving tests
etpinard Oct 4, 2018
4137433
place splom axes on bottom/left sides when just diagonal is missing
etpinard Oct 4, 2018
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
32 changes: 27 additions & 5 deletions src/plot_api/subroutines.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,12 +466,34 @@ exports.drawMainTitle = function(gd) {
// supplyDefaults brought in an array that was already
// in gd.data but not in gd._fullData previously
exports.doTraceStyle = function(gd) {
for(var i = 0; i < gd.calcdata.length; i++) {
var cdi = gd.calcdata[i],
_module = ((cdi[0] || {}).trace || {})._module || {},
arraysToCalcdata = _module.arraysToCalcdata;
var fullLayout = gd._fullLayout;
var editStyleCalls = [];
var i;

for(i = 0; i < gd.calcdata.length; i++) {
var cd = gd.calcdata[i];
var cd0 = cd[0] || {};
var trace = cd0.trace || {};
var _module = trace._module || {};

var arraysToCalcdata = _module.arraysToCalcdata;
if(arraysToCalcdata) arraysToCalcdata(cd, trace);

var editStyle = _module.editStyle;
if(editStyle) editStyleCalls.push({fn: editStyle, cd0: cd0});
}

if(editStyleCalls.length) {
clearGlCanvases(gd);

if(arraysToCalcdata) arraysToCalcdata(cdi, cdi[0].trace);
if(fullLayout._hasOnlyLargeSploms) {
fullLayout._splomGrid.draw();
}

for(i = 0; i < editStyleCalls.length; i++) {
var edit = editStyleCalls[i];
edit.fn(gd, edit.cd0);
}
}

Plots.style(gd);
Expand Down
21 changes: 20 additions & 1 deletion src/traces/splom/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@

'use strict';

var scatterAttrs = require('../scatter/attributes');
var colorAttrs = require('../../components/colorscale/attributes');
var scatterGlAttrs = require('../scattergl/attributes');
var cartesianIdRegex = require('../../plots/cartesian/constants').idRegex;
var templatedArray = require('../../plot_api/plot_template').templatedArray;
var extendFlat = require('../../lib/extend').extendFlat;

var scatterMarkerAttrs = scatterAttrs.marker;
var scatterMarkerLineAttrs = scatterMarkerAttrs.line;

function makeAxesValObject(axLetter) {
return {
valType: 'info_array',
Expand Down Expand Up @@ -96,7 +101,21 @@ module.exports = {
'this trace\'s (x,y) coordinates.'
].join(' ')
}),
marker: scatterGlAttrs.marker,

marker: extendFlat({}, colorAttrs('marker'), {
symbol: scatterMarkerAttrs.symbol,
size: scatterMarkerAttrs.size,
sizeref: scatterMarkerAttrs.sizeref,
sizemin: scatterMarkerAttrs.sizemin,
sizemode: scatterMarkerAttrs.sizemode,
opacity: scatterMarkerAttrs.opacity,
colorbar: scatterMarkerAttrs.colorbar,
line: extendFlat({}, colorAttrs('marker.line'), {
width: scatterMarkerLineAttrs.width,
editType: 'calc'
}),
editType: 'calc'
}),

xaxes: makeAxesValObject('x'),
yaxes: makeAxesValObject('y'),
Expand Down
18 changes: 18 additions & 0 deletions src/traces/splom/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,23 @@ function plotOne(gd, cd0) {
scene.draw();
}

function editStyle(gd, cd0) {
var trace = cd0.trace;
var scene = gd._fullLayout._splomScenes[trace.uid];

calcColorscales(trace);

Lib.extendFlat(scene.matrixOptions, convertMarkerStyle(trace));
// TODO [un]selected styles?

var opts = Lib.extendFlat({}, scene.matrixOptions, scene.viewOpts);

// TODO this is too long for arrayOk attributes!
scene.matrix.update(opts, null);

scene.draw();
}

function hoverPoints(pointData, xval, yval) {
var cd = pointData.cd;
var trace = cd[0].trace;
Expand Down Expand Up @@ -476,6 +493,7 @@ module.exports = {
hoverPoints: hoverPoints,
selectPoints: selectPoints,
styleOnSelect: styleOnSelect,
editStyle: editStyle,

meta: {
description: [
Expand Down
53 changes: 53 additions & 0 deletions test/jasmine/tests/splom_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,10 @@ describe('Test splom update switchboard:', function() {
});
}

function toPlainArray(typedArray) {
return Array.prototype.slice.call(typedArray);
}

it('@gl should trigger minimal sequence for axis range updates (large splom case)', function(done) {
var fig = Lib.extendDeep({}, require('@mocks/splom_large.json'));
var matrix, regl, splomGrid;
Expand Down Expand Up @@ -851,6 +855,55 @@ describe('Test splom update switchboard:', function() {
.catch(failTest)
.then(done);
});

it('@gl should trigger minimal sequence for marker style updates', function(done) {
var fig = Lib.extendDeep({}, require('@mocks/splom_0.json'));
var scene, matrix, regl;

Plotly.plot(gd, fig).then(function() {
var fullLayout = gd._fullLayout;
var trace = gd._fullData[0];
scene = fullLayout._splomScenes[trace.uid];
matrix = scene.matrix;
regl = matrix.regl;

methods = [
[Plots, 'supplyDefaults'],
[Plots, 'doCalcdata'],
[Axes, 'doTicks'],
[regl, 'clear'],
[matrix, 'update'],
[matrix, 'draw']
];
addSpies();

expect(toPlainArray(scene.matrixOptions.color))
.toBeCloseToArray([31, 119, 180, 255], 1, 'base color');
expect(scene.matrixOptions.size).toBe(3, 'base size');
expect(fullLayout.xaxis.range).toBeCloseToArray([0.851, 3.148], 1, 'base xrng');

return Plotly.restyle(gd, 'marker.color', 'black');
})
.then(function() {
var msg = 'after scaler marker.color restyle';

assertSpies(msg, [
['supplyDefaults', 1],
['doCalcdata', 0],
['doTicks', 0],
['regl clear', 1],
['update', 1],
['draw', 1]
]);

expect(toPlainArray(scene.matrixOptions.color))
.toBeCloseToArray([0, 0, 0, 255], 1, msg);

return Plotly.restyle(gd, 'marker.color', [['red', 'green', 'blue']]);
})
.catch(failTest)
.then(done);
});
});

describe('Test splom hover:', function() {
Expand Down