Skip to content

Commit

Permalink
Merge pull request #3802 from plotly/fix-3798
Browse files Browse the repository at this point in the history
sankey: only stash initial view params if trace type is sankey
  • Loading branch information
antoinerg committed Apr 23, 2019
2 parents 36b4773 + 8423780 commit 54fe6e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/traces/sankey/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
12 changes: 12 additions & 0 deletions test/jasmine/tests/sankey_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 54fe6e9

Please sign in to comment.