-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
property x0shift, x1shift, y0shift, y1shift for adjusting the shape coordinates #7005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
aa0cd7a
44d1858
7abea61
a617017
c2f7f27
fdcaa0c
9921522
3ac32f3
6680745
ada2289
e11f6f6
1bfb22d
04466db
91db7c8
4bbb669
ab935ac
82de6b1
f9c44bf
b00d4d8
8cf665a
78a7e5e
18e7c84
5509ee6
6f8e5a6
7de45c3
9ac970a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Add property x_shift/y_shift for shapes/selections referencing (multi-)category axes [[#7005](https://github.com/plotly/plotly.js/pull/7005)] | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,29 @@ module.exports = overrideAll(templatedArray('selection', { | |
description: 'Sets the selection\'s end y position.' | ||
}, | ||
|
||
xshift: { | ||
valType: 'number', | ||
dflt: 0, | ||
min: -0.5, | ||
max: 0.5, | ||
my-tien marked this conversation as resolved.
Show resolved
Hide resolved
|
||
editType: 'calc', | ||
description: [ | ||
'Only relevant if xref is a (multi-)category axes. Shifts x0 and x1 by a fraction of', | ||
'the reference unit.' | ||
my-tien marked this conversation as resolved.
Show resolved
Hide resolved
|
||
].join(' ') | ||
}, | ||
yshift: { | ||
valType: 'number', | ||
dflt: 0, | ||
min: -0.5, | ||
max: 0.5, | ||
editType: 'calc', | ||
description: [ | ||
'Only relevant if yref is a (multi-)category axes. Shifts y0 and y1 by a fraction of', | ||
'the reference unit.' | ||
].join(' ') | ||
}, | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should also add these to |
||
path: { | ||
valType: 'string', | ||
editType: 'arraydraw', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"data": [ | ||
{ | ||
archmoj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"y": [ | ||
["A", "A", "B", "B"], ["C", "D", "C", "D"] | ||
], | ||
"x": [ | ||
1, 2, 3, 4 | ||
], | ||
"type": "bar", | ||
"marker": { | ||
"color": "rgba(153, 217, 234, 1)" | ||
}, | ||
"orientation": "h" | ||
}, | ||
{ | ||
"y": [ | ||
["A", "A", "B", "B"], ["C", "D", "C", "D"] | ||
], | ||
"x": [ | ||
4, 3, 2, 1 | ||
], | ||
"type": "bar", | ||
"orientation": "h" | ||
} | ||
], | ||
"layout": { | ||
"shapes": [ | ||
{ | ||
"layer": "above", | ||
"type": "rect", | ||
"label": { | ||
"text": "around A,D", | ||
"textposition": "bottom center", | ||
"textangle": 0 | ||
}, | ||
"line": { | ||
"color": "black", | ||
"width": 3.0 | ||
}, | ||
"y0": ["A", "C"], | ||
my-tien marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"y1": ["A", "D"], | ||
"x0": 0, | ||
"x1": 0.25, | ||
"yshift": 0.5, | ||
"xref": "paper" | ||
}, | ||
{ | ||
"layer": "above", | ||
"type": "line", | ||
"label": { | ||
"text": "on B,D", | ||
"textposition": "middle", | ||
"textangle": 0 | ||
}, | ||
"line": { | ||
"color": "blue", | ||
"width": 3.0 | ||
}, | ||
"y0": ["B", "D"], | ||
"y1": ["B", "D"], | ||
"x0": 0, | ||
"x1": 0.25, | ||
"xref": "paper" | ||
}, | ||
{ | ||
"layer": "above", | ||
"type": "line", | ||
"label": { | ||
"text": "Before B,D", | ||
"textposition": "middle", | ||
"textangle": 0 | ||
}, | ||
"line": { | ||
"color": "green", | ||
"width": 3.0 | ||
}, | ||
"y0": ["B", "D"], | ||
"y1": ["B", "D"], | ||
"x0": 0, | ||
"x1": 0.25, | ||
"yshift": -0.5, | ||
"xref": "paper" | ||
} | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"x": [ | ||
"A", "B", "C", "D" | ||
], | ||
"y": [ | ||
1, 2, 3, 4 | ||
], | ||
"type": "bar" | ||
} | ||
], | ||
"layout": { | ||
"width": 600, | ||
"shapes": [ | ||
{ | ||
"layer": "above", | ||
"type": "line", | ||
"label": { | ||
"text": "right from A", | ||
"textposition": "end", | ||
"textangle": 0 | ||
}, | ||
"line": { | ||
"color": "yellow", | ||
"width": 3.0 | ||
}, | ||
"x0": "A", | ||
"x1": "A", | ||
"y0": 0, | ||
"y1": 0.5, | ||
"xshift": 0.5, | ||
"yref": "paper" | ||
}, | ||
{ | ||
"layer": "above", | ||
"type": "line", | ||
"label": { | ||
"text": "slightly left from D", | ||
"textposition": "end", | ||
"textangle": 0 | ||
}, | ||
"line": { | ||
"color": "pink", | ||
"width": 3.0 | ||
}, | ||
"x0": 3, | ||
"x1": 3, | ||
"y0": 0, | ||
"y1": 0.5, | ||
"xshift": -0.25, | ||
"yref": "paper" | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this also working for a path? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, this should only do something when using x0, x1, y0, y1 |
||
], | ||
"selections": [ | ||
{ | ||
"x0": 0, | ||
"x1": 4, | ||
"y0": 1, | ||
"y1": 3, | ||
"xshift": -0.5 | ||
} | ||
] | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.