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
16 changes: 10 additions & 6 deletions src/plot_api/plot_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ exports.plot = function(gd, data, layout, config) {

var fullLayout = gd._fullLayout;

var hasCartesian = fullLayout._has('cartesian');

// Legacy polar plots
if(!fullLayout._has('polar') && data && data[0] && data[0].r) {
Lib.log('Legacy polar charts are deprecated!');
Expand Down Expand Up @@ -426,16 +428,18 @@ exports.plot = function(gd, data, layout, config) {
addFrames,
drawFramework,
marginPushers,
marginPushersAgain,
positionAndAutorange,
subroutines.layoutStyles,
drawAxes,
marginPushersAgain
];
if(hasCartesian) seq.push(positionAndAutorange);
seq.push(subroutines.layoutStyles);
if(hasCartesian) seq.push(drawAxes);
seq.push(
drawData,
finalDraw,
initInteractions,
Plots.rehover,
Plots.previousPromises
];
);

// even if everything we did was synchronous, return a promise
// so that the caller doesn't care which route we took
Expand Down Expand Up @@ -2611,7 +2615,7 @@ function getDiffFlags(oldContainer, newContainer, outerparts, opts) {
}

for(key in newContainer) {
if(!(key in oldContainer)) {
if(!(key in oldContainer || key.charAt(0) === '_' || typeof newContainer[key] === 'function')) {
valObject = getValObject(outerparts.concat(key));

if(valObjectCanBeDataArray(valObject) && Array.isArray(newContainer[key])) {
Expand Down
1 change: 1 addition & 0 deletions src/plots/cartesian/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ exports.clean = function(newFullData, newFullLayout, oldFullData, oldFullLayout)
if(hadCartesian && !hasCartesian) {
purgeSubplotLayers(oldFullLayout._cartesianlayer.selectAll('.subplot'), oldFullLayout);
oldFullLayout._defs.selectAll('.axesclip').remove();
delete oldFullLayout._axisConstraintGroups;
}
// otherwise look for subplots we need to remove
else if(oldSubplotList.cartesian) {
Expand Down
15 changes: 15 additions & 0 deletions test/jasmine/tests/plot_api_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,21 @@ describe('Test plot api', function() {
.catch(fail)
.then(done);
});

it('can drop Cartesian while constraints are active', function(done) {
Plotly.newPlot(gd, [{x: [1, 2, 3], y: [1, 3, 2], z: [2, 3, 1]}], {xaxis: {scaleanchor: 'y'}})
.then(function() {
expect(gd._fullLayout._axisConstraintGroups).toBeDefined();
expect(gd._fullLayout.scene !== undefined).toBe(false);
return Plotly.restyle(gd, {type: 'scatter3d'});
})
.then(function() {
expect(gd._fullLayout._axisConstraintGroups).toBeUndefined();
expect(gd._fullLayout.scene !== undefined).toBe(true);
})
.catch(fail)
.then(done);
});
});

describe('Plotly.deleteTraces', function() {
Expand Down