Skip to content

Commit a45eca6

Browse files
committed
Adjust logic for default setting
1 parent 49ddf46 commit a45eca6

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/plots/cartesian/layout_attributes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,8 +1020,8 @@ module.exports = {
10201020
editType: 'plot',
10211021
description: [
10221022
'Moves the axis a given number of pixels from where it would have been otherwise.',
1023-
'If `shiftauto=true`, then this defaults to a padding of `-3` if `side=left`',
1024-
'and `+3` if `side=right`. Defaults to `0` if `shiftauto=false`.',
1023+
'If `autoshift=true`, then this defaults to a padding of `-3` if `side=left`',
1024+
'and `+3` if `side=right`. Defaults to `0` if `autoshift=false`.',
10251025
'Only has an effect if `anchor` is set to *free*.'
10261026
].join(' ')
10271027
},

src/plots/cartesian/position_defaults.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer
1111
var letter = options.letter;
1212
var grid = options.grid;
1313
var overlayingDomain = options.overlayingDomain;
14-
var dfltAnchor, dfltDomain, dfltSide, dfltPosition, dfltAutoshift, dfltShift, dfltAutomargin;
14+
var dfltAnchor, dfltDomain, dfltSide, dfltPosition, dfltShift, dfltAutomargin;
1515

1616
if(grid) {
1717
dfltDomain = grid._domains[letter][grid._axisMap[containerOut._id]];
@@ -27,9 +27,8 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer
2727
dfltAnchor = dfltAnchor || (isNumeric(containerIn.position) ? 'free' : (counterAxes[0] || 'free'));
2828
dfltSide = dfltSide || (letter === 'x' ? 'bottom' : 'left');
2929
dfltPosition = dfltPosition || 0;
30-
dfltAutoshift = dfltAutoshift || false;
31-
dfltShift = dfltShift || 0;
32-
dfltAutomargin = dfltAutomargin || false;
30+
dfltShift = 0;
31+
dfltAutomargin = false;
3332

3433
var anchor = Lib.coerce(containerIn, containerOut, {
3534
anchor: {
@@ -48,14 +47,16 @@ module.exports = function handlePositionDefaults(containerIn, containerOut, coer
4847
}, 'side');
4948

5049
if(anchor === 'free') {
51-
var autoshift = coerce('autoshift', dfltAutoshift);
52-
if(autoshift === true) {
53-
dfltPosition = side === 'left' ? overlayingDomain[0] : overlayingDomain[1];
54-
dfltAutomargin = containerOut.automargin ? containerOut.automargin : true;
55-
dfltShift = side === 'left' ? -3 : 3;
50+
if(letter === 'y') {
51+
var autoshift = coerce('autoshift');
52+
if(autoshift === true) {
53+
dfltPosition = side === 'left' ? overlayingDomain[0] : overlayingDomain[1];
54+
dfltAutomargin = containerOut.automargin ? containerOut.automargin : true;
55+
dfltShift = side === 'left' ? -3 : 3;
56+
}
57+
coerce('shift', dfltShift);
5658
}
5759
coerce('position', dfltPosition);
58-
coerce('shift', dfltShift);
5960
}
6061
coerce('automargin', dfltAutomargin);
6162

0 commit comments

Comments
 (0)