Skip to content

Commit b00d4d8

Browse files
committed
Remove shift properties from selection for now
1 parent f9c44bf commit b00d4d8

File tree

6 files changed

+2
-94
lines changed

6 files changed

+2
-94
lines changed

draftlogs/7005_add.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
- Add property x0shift, x1shift, y0shift, y1shift for shapes/selections referencing (multi-)category axes [[#7005](https://github.com/plotly/plotly.js/pull/7005)]
1+
- Add property x0shift, x1shift, y0shift, y1shift for shapes referencing (multi-)category axes, with thanks to @my-tien for the contribution! [[#7005](https://github.com/plotly/plotly.js/pull/7005)]

src/components/selections/attributes.js

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -54,51 +54,6 @@ module.exports = overrideAll(templatedArray('selection', {
5454
description: 'Sets the selection\'s end y position.'
5555
},
5656

57-
x0shift: {
58-
valType: 'number',
59-
dflt: 0,
60-
min: -1,
61-
max: 1,
62-
editType: 'calc',
63-
description: [
64-
'Only relevant if `xref` is a (multi-)category axes. Shifts `x0` by a fraction of the',
65-
'reference unit. E.g. -0.5 corresponds to the start of the category and 0.5 corresponds to the end of the category.'
66-
].join(' ')
67-
},
68-
x1shift: {
69-
valType: 'number',
70-
dflt: 0,
71-
min: -1,
72-
max: 1,
73-
editType: 'calc',
74-
description: [
75-
'Only relevant if `xref` is a (multi-)category axes. Shifts `x1` by a fraction of the',
76-
'reference unit. E.g. -0.5 corresponds to the start of the category and 0.5 corresponds to the end of the category.'
77-
].join(' ')
78-
},
79-
y0shift: {
80-
valType: 'number',
81-
dflt: 0,
82-
min: -1,
83-
max: 1,
84-
editType: 'calc',
85-
description: [
86-
'Only relevant if `yref` is a (multi-)category axes. Shifts `y0` by a fraction of the',
87-
'reference unit. E.g. -0.5 corresponds to the start of the category and 0.5 corresponds to the end of the category.'
88-
].join(' ')
89-
},
90-
y1shift: {
91-
valType: 'number',
92-
dflt: 0,
93-
min: -1,
94-
max: 1,
95-
editType: 'calc',
96-
description: [
97-
'Only relevant if `yref` is a (multi-)category axes. Shifts `y1` by a fraction of the',
98-
'reference unit. E.g. -0.5 corresponds to the start of the category and 0.5 corresponds to the end of the category.'
99-
].join(' ')
100-
},
101-
10257
path: {
10358
valType: 'string',
10459
editType: 'arraydraw',

src/components/selections/defaults.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,6 @@ function handleSelectionDefaults(selectionIn, selectionOut, fullLayout) {
7070

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

src/components/shapes/helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ function convertPath(options, x2p, y2p) {
287287
function getPixelShift(axis, shift) {
288288
shift = shift || 0;
289289
var shiftPixels = 0;
290-
if(axis) {
290+
if(axis && shift) {
291291
var isVertical = axis._id.charAt(0) === 'y';
292292
if(axis.type === 'category' || axis.type === 'multicategory') {
293293
if(isVertical) {

test/image/mocks/zzz_shape_shift_vertical.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,6 @@
6262
"x1shift": -0.25,
6363
"yref": "paper"
6464
}
65-
],
66-
"selections": [
67-
{
68-
"x0": 0,
69-
"x1": 3,
70-
"y0": 1,
71-
"y1": 3,
72-
"x0shift": -0.5,
73-
"x1shift": 0.5
74-
}
7565
]
7666
}
7767
}

test/plot-schema.json

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9555,27 +9555,11 @@
95559555
"editType": "arraydraw",
95569556
"valType": "any"
95579557
},
9558-
"x0shift": {
9559-
"description": "Only relevant if `xref` is a (multi-)category axes. Shifts `x0` by a fraction of the reference unit. E.g. -0.5 corresponds to the start of the category and 0.5 corresponds to the end of the category.",
9560-
"dflt": 0,
9561-
"editType": "arraydraw",
9562-
"max": 1,
9563-
"min": -1,
9564-
"valType": "number"
9565-
},
95669558
"x1": {
95679559
"description": "Sets the selection's end x position.",
95689560
"editType": "arraydraw",
95699561
"valType": "any"
95709562
},
9571-
"x1shift": {
9572-
"description": "Only relevant if `xref` is a (multi-)category axes. Shifts `x1` by a fraction of the reference unit. E.g. -0.5 corresponds to the start of the category and 0.5 corresponds to the end of the category.",
9573-
"dflt": 0,
9574-
"editType": "arraydraw",
9575-
"max": 1,
9576-
"min": -1,
9577-
"valType": "number"
9578-
},
95799563
"xref": {
95809564
"description": "Sets the selection's x coordinate axis. If set to a x axis id (e.g. *x* or *x2*), the `x` position refers to a x coordinate. If set to *paper*, the `x` position refers to the distance from the left of the plotting area in normalized coordinates where *0* (*1*) corresponds to the left (right). If set to a x axis ID followed by *domain* (separated by a space), the position behaves like for *paper*, but refers to the distance in fractions of the domain length from the left of the domain of that axis: e.g., *x2 domain* refers to the domain of the second x axis and a x position of 0.5 refers to the point between the left and the right of the domain of the second x axis.",
95819565
"editType": "arraydraw",
@@ -9590,27 +9574,11 @@
95909574
"editType": "arraydraw",
95919575
"valType": "any"
95929576
},
9593-
"y0shift": {
9594-
"description": "Only relevant if `yref` is a (multi-)category axes. Shifts `y0` by a fraction of the reference unit. E.g. -0.5 corresponds to the start of the category and 0.5 corresponds to the end of the category.",
9595-
"dflt": 0,
9596-
"editType": "arraydraw",
9597-
"max": 1,
9598-
"min": -1,
9599-
"valType": "number"
9600-
},
96019577
"y1": {
96029578
"description": "Sets the selection's end y position.",
96039579
"editType": "arraydraw",
96049580
"valType": "any"
96059581
},
9606-
"y1shift": {
9607-
"description": "Only relevant if `yref` is a (multi-)category axes. Shifts `y1` by a fraction of the reference unit. E.g. -0.5 corresponds to the start of the category and 0.5 corresponds to the end of the category.",
9608-
"dflt": 0,
9609-
"editType": "arraydraw",
9610-
"max": 1,
9611-
"min": -1,
9612-
"valType": "number"
9613-
},
96149582
"yref": {
96159583
"description": "Sets the selection's x coordinate axis. If set to a y axis id (e.g. *y* or *y2*), the `y` position refers to a y coordinate. If set to *paper*, the `y` position refers to the distance from the bottom of the plotting area in normalized coordinates where *0* (*1*) corresponds to the bottom (top). If set to a y axis ID followed by *domain* (separated by a space), the position behaves like for *paper*, but refers to the distance in fractions of the domain length from the bottom of the domain of that axis: e.g., *y2 domain* refers to the domain of the second y axis and a y position of 0.5 refers to the point between the bottom and the top of the domain of the second y axis.",
96169584
"editType": "arraydraw",

0 commit comments

Comments
 (0)