Skip to content

Commit e4aa7a3

Browse files
committed
improve category autorange mock
1 parent d411262 commit e4aa7a3

File tree

2 files changed

+134
-25
lines changed

2 files changed

+134
-25
lines changed
14.1 KB
Loading

test/image/mocks/category-autorange.json

+134-25
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,40 @@
22
"data":[{
33
"mode": "markers",
44
"x": ["a", "b", "c"],
5-
"y": ["X", "Y", "Z"]
5+
"y": ["X", "Y", "Z"],
6+
"xaxis": "x",
7+
"yaxis": "y"
68
}, {
79
"mode": "markers",
810
"x": ["a", "b", "c"],
911
"y": ["X", "Y", "Z"],
1012
"xaxis": "x2",
1113
"yaxis": "y2"
14+
}, {
15+
"mode": "markers",
16+
"x": ["a", "b", "c"],
17+
"y": ["X", "Y", "Z"],
18+
"xaxis": "x3",
19+
"yaxis": "y3"
20+
}, {
21+
"mode": "markers",
22+
"x": ["a", "b", "c"],
23+
"y": ["X", "Y", "Z"],
24+
"xaxis": "x4",
25+
"yaxis": "y4"
1226
}],
1327
"layout":{
14-
"autosize":false,
1528
"xaxis":{
29+
"categoryarray": ["a", "b", "c", "d"],
30+
"anchor": "x",
1631
"domain": [0, 0.48],
1732
"ticks": "outside",
1833
"mirror":"allticks",
1934
"zeroline":false,
2035
"showline":true
2136
},
2237
"xaxis2":{
38+
"categoryarray": ["a", "b", "c", "d"],
2339
"anchor": "y2",
2440
"domain": [0.52, 1],
2541
"ticks": "outside",
@@ -28,13 +44,40 @@
2844
"showline":true,
2945
"range": [-0.5, 2.5]
3046
},
47+
"xaxis3":{
48+
"categoryarray": ["a", "b", "c", "d"],
49+
"side": "top",
50+
"anchor": "y3",
51+
"domain": [0, 0.48],
52+
"ticks": "outside",
53+
"mirror":"allticks",
54+
"zeroline":false,
55+
"showline":true
56+
},
57+
"xaxis4":{
58+
"categoryarray": ["a", "b", "c", "d"],
59+
"side": "top",
60+
"anchor": "y4",
61+
"domain": [0.52, 1],
62+
"ticks": "outside",
63+
"mirror":"allticks",
64+
"zeroline":false,
65+
"showline":true,
66+
"range": [-0.5, 2.5]
67+
},
3168
"yaxis":{
69+
"categoryarray": ["W", "X", "Y", "Z"],
70+
"anchor": "y",
71+
"title": "letter refs",
72+
"domain": [0, 0.48],
3273
"ticks": "outside",
3374
"mirror":"allticks",
3475
"zeroline":false,
3576
"showline":true
3677
},
3778
"yaxis2":{
79+
"categoryarray": ["W", "X", "Y", "Z"],
80+
"domain": [0, 0.48],
3881
"anchor": "x2",
3982
"side": "right",
4083
"ticks": "outside",
@@ -43,44 +86,110 @@
4386
"showline":true,
4487
"range": [-0.5, 2.5]
4588
},
46-
"height":360,
47-
"width":600,
89+
"yaxis3":{
90+
"categoryarray": ["W", "X", "Y", "Z"],
91+
"title": "number refs",
92+
"domain": [0.52, 1],
93+
"anchor": "x3",
94+
"ticks": "outside",
95+
"mirror":"allticks",
96+
"zeroline":false,
97+
"showline":true
98+
},
99+
"yaxis4":{
100+
"categoryarray": ["W", "X", "Y", "Z"],
101+
"domain": [0.52, 1],
102+
"anchor": "x4",
103+
"side": "right",
104+
"ticks": "outside",
105+
"mirror":"allticks",
106+
"zeroline":false,
107+
"showline":true,
108+
"range": [-0.5, 2.5]
109+
},
110+
"height": 500,
111+
"width": 500,
48112
"showlegend": false,
49-
"margin":{"r":40,"b":40,"l":40,"t":40},
113+
"margin":{"r":40,"b":25,"l":40,"t":55},
50114
"title": "left: auto range || right: set range",
51-
"titlefont": {"size": 12},
115+
"font": {"size": 10},
52116
"annotations":[{
53-
"axref": "x", "ayref": "y",
54-
"text": "bump yrange up",
55-
"x": "a", "y": 3,
56-
"ax": "c", "ay": "3.5",
57-
"xanchor": "left",
58-
"borderpad": 10
117+
"xref": "x", "yref": "y", "axref": "x", "ayref": "y",
118+
"text": "yrange bump",
119+
"x": "a", "y": "X", "ax": "c", "ay": "Z",
120+
"xanchor": "left", "yanchor": "bottom", "borderpad": 10
59121
}, {
60-
"axref": "x", "ayref": "y",
61-
"text": "bump xrange<br>to the left",
62-
"x": "-1", "y": "Y",
63-
"ax": 0, "ay": "X"
122+
"xref": "x", "yref": "y", "showarrow": false,
123+
"text": "xrange bump",
124+
"x": "a", "y": "X",
125+
"xanchor": "right", "borderpad": 10
126+
},
127+
128+
{
129+
"xref": "x2", "yref": "y2", "showarrow": false,
130+
"text": "should not see this",
131+
"x": "b", "y": "Z"
64132
}, {
65-
"xref": "x2", "yref": "y2",
133+
"xref": "x2", "yref": "y2", "showarrow": false,
66134
"text": "should not see this",
67-
"x": "a", "y": 3
135+
"x": "d", "y": "X",
136+
"xanchor": "right", "borderpad": 10
68137
}, {
69-
"xref": "x2", "yref": "y2",
138+
"xref": "x2", "yref": "y2", "showarrow": false,
139+
"text": "invalid category coords<br>should appear in center of graph",
140+
"x": "wrong", "y": "not-gonna-work"
141+
},
142+
143+
{
144+
"xref": "x3", "yref": "y3", "axref": "x3", "ayref": "y3",
145+
"text": "yrange bump",
146+
"x": 1, "y": 2, "ax": 2, "ay": 4.5,
147+
"xanchor": "left", "yanchor": "top", "borderpad": 10
148+
}, {
149+
"xref": "x3", "yref": "y3", "showarrow": false,
150+
"text": "xrange bump",
151+
"x": -2, "y": 2,
152+
"xanchor": "left", "borderpad": 10
153+
},
154+
155+
{
156+
"xref": "x4", "yref": "y4", "showarrow": false,
70157
"text": "should not see this",
71-
"x": "-1", "y": "Y"
158+
"x": -2, "y": 2
159+
}, {
160+
"xref": "x4", "yref": "y4", "showarrow": false,
161+
"text": "should not see this",
162+
"x": 2, "y": 4.5
72163
}],
73164
"shapes": [{
74165
"type": "rectangle",
75166
"line": {"color": "purple"},
76-
"x0": "b", "x1": 4.5,
77-
"y0": -1, "y1": "Z"
78-
}, {
167+
"x0": "b", "x1": "d",
168+
"y0": "W", "y1": "Z"
169+
},
170+
171+
{
79172
"xref": "x2", "yref": "y2",
80173
"type": "rectangle",
81174
"line": {"color": "purple"},
82-
"x0": "b", "x1": 4.5,
83-
"y0": -1, "y1": "Z"
175+
"x0": "---", "x1": "d",
176+
"y0": "wrong", "y1": "Z"
177+
},
178+
179+
{
180+
"xref": "x3", "yref": "y3",
181+
"type": "rectangle",
182+
"line": {"color": "purple"},
183+
"x0": 0.25, "x1": 6,
184+
"y0": 1, "y1": 2.75
185+
},
186+
187+
{
188+
"xref": "x4", "yref": "y4",
189+
"type": "rectangle",
190+
"line": {"color": "purple"},
191+
"x0": 0.25, "x1": 6,
192+
"y0": 1, "y1": 2.75
84193
}]
85194
}
86195
}

0 commit comments

Comments
 (0)