Skip to content

Commit d5777e9

Browse files
committed
fix data-referenced shapes on multicategory axes
- lock down annotations in same mock.
1 parent 3d097c2 commit d5777e9

File tree

3 files changed

+78
-2
lines changed

3 files changed

+78
-2
lines changed

src/components/shapes/calc_autorange.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
109
'use strict';
1110

1211
var Lib = require('../../lib');
@@ -84,7 +83,7 @@ function calcPaddingOptions(lineWidth, sizeMode, v0, v1, path, isYAxis) {
8483
}
8584

8685
function shapeBounds(ax, v0, v1, path, paramsToUse) {
87-
var convertVal = (ax.type === 'category') ? ax.r2c : ax.d2c;
86+
var convertVal = (ax.type === 'category' || ax.type === 'multicategory') ? ax.r2c : ax.d2c;
8887

8988
if(v0 !== undefined) return [convertVal(v0), convertVal(v1)];
9089
if(!path) return;
36.8 KB
Loading

test/image/mocks/multicategory-y.json

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"data": [
3+
{
4+
"type": "bar",
5+
"orientation": "h",
6+
"y": [
7+
["2017", "2017", "2017", "2017", "2018", "2018", "2018"],
8+
["q1", "q2", "q3", "q4", "q1", "q2", "q3" ]
9+
],
10+
"x": [1, 2, 3, 1, 3, 2, 3, 1]
11+
},
12+
{
13+
"type": "scatter",
14+
"y": [
15+
["2017", "2017", "2017", "2017", "2018", "2018", "2018"],
16+
["q1", "q2", "q3", "q4", "q1", "q2", "q3"]
17+
],
18+
"x": [1.12, 2.15, 3.07, 1.48, 2.78, 1.95, 2.54, 0.64]
19+
},
20+
21+
{
22+
"mode": "markers",
23+
"marker": {
24+
"symbol": "square"
25+
},
26+
"y": [
27+
["2017", "2017", "2017", "2017", "2018", "2018", "2018"],
28+
["q1", "looooooooooooooooong", "q3", "q4", "q1", "q2", "q3"]
29+
],
30+
"x": [1, 2, 3, 1, 3, 2, 3, 1],
31+
"xaxis": "x2",
32+
"yaxis": "y2"
33+
}
34+
],
35+
"layout": {
36+
"grid": {
37+
"rows": 2,
38+
"columns": 1,
39+
"pattern": "independent",
40+
"ygap": 0.2
41+
},
42+
"yaxis": {
43+
"title": "MULTI-CATEGORY",
44+
"tickfont": {"size": 16},
45+
"ticks": "outside",
46+
"tickson": "boundaries"
47+
},
48+
"yaxis2": {
49+
"title": "MULTI-CATEGORY",
50+
"tickfont": {"size": 12},
51+
"ticks": "outside",
52+
"tickson": "boundaries"
53+
},
54+
"xaxis": {
55+
"domain": [0.05, 1]
56+
},
57+
"xaxis2": {
58+
"domain": [0.3, 1]
59+
},
60+
"showlegend": false,
61+
"hovermode": "y",
62+
"width": 600,
63+
"height": 700,
64+
"annotations": [{
65+
"text": "LOOK",
66+
"xref": "x", "x": 3,
67+
"yref": "y", "y": 6,
68+
"ax": 50, "ay": -50
69+
}],
70+
"shapes": [{
71+
"type": "line",
72+
"xref": "paper", "x0": 0.05, "x1": 1,
73+
"yref": "y", "y0": 7, "y1": 7,
74+
"line": {"color": "red"}
75+
}]
76+
}
77+
}

0 commit comments

Comments
 (0)