Skip to content

Commit 5fb7b8f

Browse files
committed
Redeclare valType of title.y to be a 'number' [882]
- Swichting the valType to 'number' spares the custom coerce function. - In addition fixes the missing min and max bounds for y.
1 parent 86a88e2 commit 5fb7b8f

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

src/plots/layout_attributes.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ module.exports = {
8484
].join(' ')
8585
},
8686
y: {
87-
valType: 'any',
87+
valType: 'number',
88+
min: 0,
89+
max: 1,
8890
dflt: 'auto',
8991
role: 'style',
9092
editType: 'layoutstyle',

src/plots/plots.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,19 +1315,6 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) {
13151315
return Lib.coerce(layoutIn, layoutOut, plots.layoutAttributes, attr, dflt);
13161316
}
13171317

1318-
// Special treatment for title.y that can be 'auto'
1319-
// or a number between 0 and 1.
1320-
function coerceTitleY() {
1321-
if(layoutIn.title && isNumeric(layoutIn.title.y)) {
1322-
var propOut = Lib.nestedProperty(layoutOut, 'title.y');
1323-
var opts = Lib.nestedProperty(plots.layoutAttributes, 'title.y').get();
1324-
1325-
Lib.valObjectMeta.number.coerceFunction(layoutIn.title.y, propOut, 'auto', opts);
1326-
} else {
1327-
coerce('title.y');
1328-
}
1329-
}
1330-
13311318
var template = layoutIn.template;
13321319
if(Lib.isPlainObject(template)) {
13331320
layoutOut.template = template;
@@ -1348,7 +1335,7 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) {
13481335
coerce('title.xref');
13491336
coerce('title.yref');
13501337
coerce('title.x');
1351-
coerceTitleY();
1338+
coerce('title.y');
13521339
coerce('title.xanchor');
13531340
coerce('title.yanchor');
13541341
coerce('title.pad.t');

0 commit comments

Comments
 (0)