Skip to content

Commit 35ff5a7

Browse files
Accept arrays for extra argument of Axes.coerceRef
This way we can say that either 'pixel' or 'paper' is OK for axis references of annotations.
1 parent af7103f commit 35ff5a7

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/components/annotations/defaults.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ function handleAnnotationDefaults(annIn, annOut, fullLayout) {
6060
if(showArrow) {
6161
var arrowPosAttr = 'a' + axLetter;
6262
// axref, ayref
63-
var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, '', 'paper', true);
63+
var aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, '',
64+
['paper','pixel'], true);
6465

6566
// for now the arrow can only be on the same axis or specified as pixels
6667
// TODO: sometime it might be interesting to allow it to be on *any* axis

src/plots/cartesian/axes.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@ axes.coerceRef = function(containerIn, containerOut, gd, attr, dflt, extraOption
9696

9797
attrDef[refAttr] = {
9898
valType: 'enumerated',
99-
values: axlist.concat(extraOption ? [extraOption] : []),
99+
values: axlist.concat(extraOption ?
100+
(typeof extraOption === 'string' ? [extraOption] : extraOption)
101+
: []),
100102
dflt: dflt
101103
};
102104

0 commit comments

Comments
 (0)