Skip to content

sankey: only stash initial view params if trace type is sankey #3802

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 1 commit into from
Apr 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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