Skip to content

Commit 431b663

Browse files
committed
Coerce min/max of x and y depending on xref and yref
1 parent 4feac39 commit 431b663

File tree

3 files changed

+96
-230
lines changed

3 files changed

+96
-230
lines changed

Diff for: src/components/colorbar/attributes.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,14 @@ module.exports = overrideAll({
5757
},
5858
x: {
5959
valType: 'number',
60-
min: -2,
61-
max: 3,
6260
description: [
6361
'Sets the x position with respect to `xref` of the color bar (in plot fraction).',
6462
'When `xref` is *paper*, defaults to 1.02 when `orientation` is *v* and',
6563
'0.5 when `orientation` is *h*.',
6664
'When `xref` is *container*, defaults to *1* when `orientation` is *v* and',
6765
'0.5 when `orientation` is *h*.',
68-
'Must be between *0* and *1* if `xref` is *container*.'
66+
'Must be between *0* and *1* if `xref` is *container*',
67+
'and between *-2* and *3* if `xref` is *paper*.'
6968
].join(' ')
7069
},
7170
xref: {
@@ -98,15 +97,14 @@ module.exports = overrideAll({
9897
},
9998
y: {
10099
valType: 'number',
101-
min: -2,
102-
max: 3,
103100
description: [
104101
'Sets the y position with respect to `yref` of the color bar (in plot fraction).',
105102
'When `yref` is *paper*, defaults to 0.5 when `orientation` is *v* and',
106103
'1.02 when `orientation` is *h*.',
107104
'When `yref` is *container*, defaults to 0.5 when `orientation` is *v* and',
108105
'1 when `orientation` is *h*.',
109-
'Must be between *0* and *1* if `yref` is *container*.'
106+
'Must be between *0* and *1* if `yref` is *container*',
107+
'and between *-2* and *3* if `yref` is *paper*.'
110108
].join(' ')
111109
},
112110
yref: {

Diff for: src/components/colorbar/defaults.js

+18-2
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,26 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) {
5858
defaultY = isPaperY ? 1.02 : 1;
5959
}
6060

61-
coerce('x', defaultX);
61+
Lib.coerce(colorbarIn, colorbarOut, {
62+
x: {
63+
valType: 'number',
64+
min: isPaperX ? -2 : 0,
65+
max: isPaperX ? 3 : 1,
66+
dflt: defaultX,
67+
}
68+
}, 'x');
69+
70+
Lib.coerce(colorbarIn, colorbarOut, {
71+
y: {
72+
valType: 'number',
73+
min: isPaperY ? -2 : 0,
74+
max: isPaperY ? 3 : 1,
75+
dflt: defaultY,
76+
}
77+
}, 'y');
78+
6279
coerce('xanchor', defaultXAnchor);
6380
coerce('xpad');
64-
coerce('y', defaultY);
6581
coerce('yanchor', defaultYAnchor);
6682
coerce('ypad');
6783
Lib.noneOrAll(colorbarIn, colorbarOut, ['x', 'y']);

0 commit comments

Comments
 (0)