Skip to content
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
5 changes: 5 additions & 0 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2954,6 +2954,11 @@ function getDiffFlags(oldContainer, newContainer, outerparts, opts) {
flags.rangesAltered[outerparts[0]] = 1;
}

// clear _inputDomain on cartesian axes with altered domains
if(AX_DOMAIN_RE.test(astr)) {
nestedProperty(newContainer, '_inputDomain').set(null);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This piece is the react equivalent to this block

else if(pleafPlus.match(AX_DOMAIN_RE)) {
nestedProperty(fullLayout, ptrunk + '._inputDomain').set(null);
}

called during relayout.

}

// track datarevision changes
if(key === 'datarevision') {
flags.newDataRevision = 1;
Expand Down
63 changes: 63 additions & 0 deletions test/jasmine/tests/axes_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,69 @@ describe('Test axes', function() {
.catch(failTest)
.then(done);
});

it('can react from different layout *grid* settings', function(done) {
var fig1 = function() {
return {
data: [{}, {xaxis: 'x2'}, {xaxis: 'x3'}, {xaxis: 'x4'}],
layout: {
grid: {
xaxes: ['x', 'x2', 'x3', 'x4'],
yaxes: ['y'],
xgap: 0.1,
ygap: 0.1,
xside: 'bottom',
yside: 'left'
},
xaxis2: {scaleanchor: 'x'},
xaxis3: {scaleanchor: 'x'},
xaxis4: {scaleanchor: 'x'}
}
};
};

var fig2 = function() {
return {
data: [{}, {xaxis: 'x2'}, {xaxis: 'x3'}, {xaxis: 'x4'}],
layout: {
grid: {
xaxes: ['x', 'x2'],
yaxes: ['y'],
xgap: 0.1,
ygap: 0.1,
xside: 'bottom',
yside: 'left'
},
xaxis2: {scaleanchor: 'x'}
}
};
};

var rng = [-1, 6];

Plotly.plot(gd, fig1())
.then(function() {
var msg = 'fig1';
assertRangeDomain('xaxis', rng, [0, 0.230769], [0, 0.230769], msg);
assertRangeDomain('xaxis2', rng, [0.256410, 0.487179], [0.256410, 0.487179], msg);
assertRangeDomain('xaxis3', rng, [0.512820, 0.743589], [0.512820, 0.743589], msg);
})
.then(function() { return Plotly.react(gd, fig2()); })
.then(function() {
var msg = 'fig2';
assertRangeDomain('xaxis', rng, [0, 0.473684], [0, 0.473684], msg);
assertRangeDomain('xaxis2', rng, [0.526315, 1], [0.526315, 1], msg);
})
.then(function() { return Plotly.react(gd, fig1()); })
.then(function() {
var msg = 'back to fig1';
assertRangeDomain('xaxis', rng, [0, 0.230769], [0, 0.230769], msg);
assertRangeDomain('xaxis2', rng, [0.256410, 0.487179], [0.256410, 0.487179], msg);
assertRangeDomain('xaxis3', rng, [0.512820, 0.743589], [0.512820, 0.743589], msg);
})
.catch(failTest)
.then(done);
});
});

describe('categoryorder', function() {
Expand Down