Skip to content

Commit 3ac32f3

Browse files
committed
Only coerce x0/x1/y0/y1shift if referenced axis is category/multicategory
1 parent 9921522 commit 3ac32f3

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/components/selections/defaults.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ function handleSelectionDefaults(selectionIn, selectionOut, fullLayout) {
4949
coerce('line.color');
5050
coerce('line.width');
5151
coerce('line.dash');
52-
coerce('x0shift');
53-
coerce('x1shift');
54-
coerce('y0shift');
55-
coerce('y1shift');
5652

5753
// positioning
5854
var axLetters = ['x', 'y'];
@@ -74,6 +70,11 @@ function handleSelectionDefaults(selectionIn, selectionOut, fullLayout) {
7470

7571
// Coerce x0, x1, y0, y1
7672
if(noPath) {
73+
if(ax.type === 'category' || ax.type === 'multicategory') {
74+
coerce(axLetter + '0shift');
75+
coerce(axLetter + '1shift');
76+
}
77+
7778
// hack until V3.0 when log has regular range behavior - make it look like other
7879
// ranges to send to coerce, then put it back after
7980
// this is all to give reasonable default position behavior on log axes, which is

src/components/shapes/defaults.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) {
7575
var pos2r;
7676
var r2pos;
7777

78-
coerce('x0shift');
79-
coerce('x1shift');
80-
coerce('y0shift');
81-
coerce('y1shift');
82-
8378
// xref, yref
8479
var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, undefined,
8580
'paper');
@@ -90,6 +85,10 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) {
9085
ax._shapeIndices.push(shapeOut._index);
9186
r2pos = helpers.rangeToShapePosition(ax);
9287
pos2r = helpers.shapePositionToRange(ax);
88+
if(ax.type === 'category' || ax.type === 'multicategory') {
89+
coerce(axLetter + '0shift');
90+
coerce(axLetter + '1shift');
91+
}
9392
} else {
9493
pos2r = r2pos = Lib.identity;
9594
}

0 commit comments

Comments
 (0)