diff --git a/src/traces/sankey/plot.js b/src/traces/sankey/plot.js index efca619c727..b7b953548f3 100644 --- a/src/traces/sankey/plot.js +++ b/src/traces/sankey/plot.js @@ -128,7 +128,8 @@ module.exports = function plot(gd, calcData) { var size = fullLayout._size; // stash initial view - for(var i = 0; i < calcData.length; i++) { + for(var i = 0; i < gd._fullData.length; i++) { + if(gd._fullData[i].type !== cn.sankey) continue; if(!gd._fullData[i]._viewInitial) { var node = gd._fullData[i].node; gd._fullData[i]._viewInitial = { diff --git a/test/jasmine/tests/sankey_test.js b/test/jasmine/tests/sankey_test.js index b0613a0cc1c..90259123690 100644 --- a/test/jasmine/tests/sankey_test.js +++ b/test/jasmine/tests/sankey_test.js @@ -610,6 +610,18 @@ describe('sankey tests', function() { .then(done); }); + it('works as a subplot in the presence of other trace types', function(done) { + var mockCopy = Lib.extendDeep({}, require('@mocks/sankey_subplots_circular')); + + mockCopy.data[0] = { + y: [5, 1, 4, 3, 2] + }; + + Plotly.plot(gd, mockCopy) + .catch(failTest) + .then(done); + }); + ['0', '1'].forEach(function(finalUIRevision) { it('on Plotly.react, it preserves the groups depending on layout.uirevision', function(done) { var uirevisions = ['0', finalUIRevision];