Skip to content

Commit 8423780

Browse files
committed
sankey: only stash initial view params if trace type is sankey
1 parent 36b4773 commit 8423780

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/traces/sankey/plot.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ module.exports = function plot(gd, calcData) {
128128
var size = fullLayout._size;
129129

130130
// stash initial view
131-
for(var i = 0; i < calcData.length; i++) {
131+
for(var i = 0; i < gd._fullData.length; i++) {
132+
if(gd._fullData[i].type !== cn.sankey) continue;
132133
if(!gd._fullData[i]._viewInitial) {
133134
var node = gd._fullData[i].node;
134135
gd._fullData[i]._viewInitial = {

test/jasmine/tests/sankey_test.js

+12
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,18 @@ describe('sankey tests', function() {
610610
.then(done);
611611
});
612612

613+
it('works as a subplot in the presence of other trace types', function(done) {
614+
var mockCopy = Lib.extendDeep({}, require('@mocks/sankey_subplots_circular'));
615+
616+
mockCopy.data[0] = {
617+
y: [5, 1, 4, 3, 2]
618+
};
619+
620+
Plotly.plot(gd, mockCopy)
621+
.catch(failTest)
622+
.then(done);
623+
});
624+
613625
['0', '1'].forEach(function(finalUIRevision) {
614626
it('on Plotly.react, it preserves the groups depending on layout.uirevision', function(done) {
615627
var uirevisions = ['0', finalUIRevision];

0 commit comments

Comments
 (0)