Skip to content

Commit 7f9845a

Browse files
committed
don't try to edit visible:false splom traces
1 parent fdcdd22 commit 7f9845a

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

src/traces/splom/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,17 @@ function editStyle(gd, cd0) {
309309
var trace = cd0.trace;
310310
var scene = gd._fullLayout._splomScenes[trace.uid];
311311

312-
calcColorscales(trace);
312+
if(scene) {
313+
calcColorscales(trace);
313314

314-
Lib.extendFlat(scene.matrixOptions, convertMarkerStyle(trace));
315-
// TODO [un]selected styles?
315+
Lib.extendFlat(scene.matrixOptions, convertMarkerStyle(trace));
316+
// TODO [un]selected styles?
316317

317-
var opts = Lib.extendFlat({}, scene.matrixOptions, scene.viewOpts);
318+
var opts = Lib.extendFlat({}, scene.matrixOptions, scene.viewOpts);
318319

319-
// TODO this is too long for arrayOk attributes!
320-
scene.matrix.update(opts, null);
320+
// TODO this is too long for arrayOk attributes!
321+
scene.matrix.update(opts, null);
322+
}
321323
}
322324

323325
function hoverPoints(pointData, xval, yval) {

test/jasmine/tests/splom_test.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,35 @@ describe('Test splom interactions:', function() {
983983
.catch(failTest)
984984
.then(done);
985985
});
986+
987+
it('@gl should not fail when editing graph with visible:false traces', function(done) {
988+
Plotly.plot(gd, [{
989+
type: 'splom',
990+
dimensions: [{values: []}, {values: []}]
991+
}, {
992+
type: 'splom',
993+
dimensions: [{values: [1, 2, 3]}, {values: [2, 3, 4]}]
994+
}])
995+
.then(function() {
996+
var fullData = gd._fullData;
997+
var fullLayout = gd._fullLayout;
998+
999+
expect(fullData[0].visible).toBe(false, 'trace 0 visible');
1000+
expect(fullData[1].visible).toBe(true, 'trace 1 visible');
1001+
expect(Object.keys(fullLayout._splomScenes).length).toBe(1, '# of splom scenes');
1002+
expect(fullLayout._splomScenes[fullData[1].uid].matrixOptions.opacity).toBe(1, 'marker opacity');
1003+
1004+
return Plotly.restyle(gd, 'marker.opacity', [undefined, [0.2, 0.3, 0.4]]);
1005+
})
1006+
.then(function() {
1007+
var fullData = gd._fullData;
1008+
var fullLayout = gd._fullLayout;
1009+
1010+
expect(fullLayout._splomScenes[fullData[1].uid].matrixOptions.opacity).toBe(1, 'marker opacity');
1011+
})
1012+
.catch(failTest)
1013+
.then(done);
1014+
});
9861015
});
9871016

9881017
describe('Test splom update switchboard:', function() {

0 commit comments

Comments
 (0)