Skip to content

Commit 5506ed4

Browse files
committed
Improve documentation and simplify syntax
1 parent 56605bc commit 5506ed4

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/plots/cartesian/layout_attributes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +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+
'Accepts both positive and negative values, which will shift the axis either right',
1024+
'or left, respectively.',
10231025
'If `autoshift=true`, then this defaults to a padding of `-3` if `side=left`',
10241026
'and `+3` if `side=right`. Defaults to `0` if `autoshift=false`.',
10251027
'Only has an effect if `anchor` is set to *free*.'

src/plots/plots.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1960,14 +1960,10 @@ function needsRedrawForShift(gd) {
19601960
return false;
19611961
}
19621962
var axList = axisIDs.list(gd, '', true);
1963-
var isShift = false;
19641963
for(var ax in axList) {
1965-
if(isShift === true) {
1966-
return isShift;
1967-
}
1968-
isShift = (axList[ax].autoshift === true || axList[ax].shift !== undefined) ? true : false;
1964+
if(axList[ax].autoshift || axList[ax].shift !== undefined) return true;
19691965
}
1970-
return isShift;
1966+
return false;
19711967
}
19721968

19731969
plots.doAutoMargin = function(gd) {

test/plot-schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10742,7 +10742,7 @@
1074210742
"valType": "boolean"
1074310743
},
1074410744
"shift": {
10745-
"description": "Moves the axis a given number of pixels from where it would have been otherwise. If `autoshift=true`, then this defaults to a padding of `-3` if `side=left` and `+3` if `side=right`. Defaults to `0` if `autoshift=false`. Only has an effect if `anchor` is set to *free*.",
10745+
"description": "Moves the axis a given number of pixels from where it would have been otherwise. Accepts both positive and negative values, which will shift the axis either right or left, respectively. If `autoshift=true`, then this defaults to a padding of `-3` if `side=left` and `+3` if `side=right`. Defaults to `0` if `autoshift=false`. Only has an effect if `anchor` is set to *free*.",
1074610746
"editType": "plot",
1074710747
"valType": "number"
1074810748
},
@@ -11750,7 +11750,7 @@
1175011750
"valType": "boolean"
1175111751
},
1175211752
"shift": {
11753-
"description": "Moves the axis a given number of pixels from where it would have been otherwise. If `autoshift=true`, then this defaults to a padding of `-3` if `side=left` and `+3` if `side=right`. Defaults to `0` if `autoshift=false`. Only has an effect if `anchor` is set to *free*.",
11753+
"description": "Moves the axis a given number of pixels from where it would have been otherwise. Accepts both positive and negative values, which will shift the axis either right or left, respectively. If `autoshift=true`, then this defaults to a padding of `-3` if `side=left` and `+3` if `side=right`. Defaults to `0` if `autoshift=false`. Only has an effect if `anchor` is set to *free*.",
1175411754
"editType": "plot",
1175511755
"valType": "number"
1175611756
},

0 commit comments

Comments
 (0)