Skip to content

Commit b6c5610

Browse files
committed
plots: make autosize dflt *true* on layouts with no set width / height
... for backward compatibly, in particular https://plot.ly/javascript/responsive-fluid-layout/ - reset patched modebar, and resize test to original.
1 parent 77971f4 commit b6c5610

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/plots/plots.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,17 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut) {
896896
color: globalFont.color
897897
});
898898

899-
coerce('autosize');
899+
// Make sure that autosize is defaulted to *true*
900+
// on layouts with no set width and height for backward compatibly,
901+
// in particular https://plot.ly/javascript/responsive-fluid-layout/
902+
//
903+
// Before https://github.com/plotly/plotly.js/pull/635 ,
904+
// layouts with no set width and height were set temporary set to 'initial'
905+
// to pass through the autosize routine
906+
//
907+
// This behavior is subject to change in v2.
908+
coerce('autosize', !(layoutIn.width && layoutIn.height));
909+
900910
coerce('width');
901911
coerce('height');
902912
coerce('margin.l');

test/jasmine/tests/modebar_test.js

-1
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,6 @@ describe('ModeBar', function() {
643643
}];
644644

645645
var mockLayout = {
646-
autosize: true,
647646
xaxis: {
648647
anchor: 'y',
649648
domain: [0, 0.5],

test/jasmine/tests/plots_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ describe('Test Plots', function() {
304304
beforeAll(function(done) {
305305
gd = createGraphDiv();
306306

307-
Plotly.plot(gd, [{ x: [1, 2, 3], y: [2, 3, 4] }], { autosize: true })
307+
Plotly.plot(gd, [{ x: [1, 2, 3], y: [2, 3, 4] }])
308308
.then(function() {
309309
gd.style.width = '400px';
310310
gd.style.height = '400px';

0 commit comments

Comments
 (0)