Skip to content

Commit 5c85981

Browse files
committed
fix multicategory ax.cleanPos
1 parent e71b7df commit 5c85981

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

src/plots/cartesian/set_convert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ module.exports = function setConvert(ax, fullLayout) {
322322
ax.p2r = p2l;
323323

324324
ax.cleanPos = function(v) {
325-
if(typeof v === 'string' && v !== '') return v;
325+
if(Array.isArray(v) || (typeof v === 'string' && v !== '')) return v;
326326
return ensureNumber(v);
327327
};
328328
}
Loading

test/image/mocks/box-violin-x0-category-position.json

+26
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
"x0": 0.5,
2020
"type": "violin"
2121
},
22+
{
23+
"y": [ 0.6, 0.7, 0.3, 0.6, 0, 0.5, 0.7, 0.9, 0.5, 0.8, 0.7, 0.2, 0.1, 0.3, 0.1, 0.9, 0.6, 0.6, 0.9, 1, 0.3, 0.6, 0.8, 0.5, 0.6, 0.7, 0.3, 0.6, 0, 0.5, 0.7, 0.9, 0.5, 0.8, 0.7, 0.2 ],
24+
"x0": ["2017", "day 1"],
25+
"type": "violin"
26+
},
27+
{
28+
"y": [ 0.6, 0.7, 0.3, 0.6, 0, 0.5, 0.7, 0.9, 0.5, 0.8, 0.7, 0.2, 0.1, 0.3, 0.1, 0.9, 0.6, 0.6, 0.9, 1, 0.3, 0.6, 0.8, 0.5, 0.6, 0.7, 0.3, 0.6, 0, 0.5, 0.7, 0.9, 0.5, 0.8, 0.7, 0.2 ],
29+
"x0": "2017,day 2",
30+
"type": "violin"
31+
},
32+
2233
{
2334
"y": [ 0.2, 0.2, 0.6, 1, 0.5, 0.4, 0.2, 0.7, 0.9, 0.1, 0.5, 0.3, 0.6, 0.7, 0.3, 0.6, 0, 0.5, 0.7, 0.9, 0.5, 0.8, 0.7, 0.2 ],
2435
"x": [ "day 1", "day 1", "day 1", "day 1", "day 1", "day 1", "day 2",
@@ -52,6 +63,21 @@
5263
"text": "violin at x0:0.5",
5364
"y": 1.5
5465
},
66+
{
67+
"xref": "x",
68+
"yref": "y",
69+
"x": ["2017", "day 1"],
70+
"text": "violin at x0:[2017,day 1]",
71+
"y": 1.5
72+
},
73+
{
74+
"xref": "x",
75+
"yref": "y",
76+
"x": "2017,day 2",
77+
"text": "violin at x0:\"2017,day 2\"",
78+
"y": 1.5,
79+
"ay": -50
80+
},
5581
{
5682
"xref": "x2",
5783
"yref": "y2",

0 commit comments

Comments
 (0)