Skip to content

Commit d2b07b5

Browse files
committed
improve mocks to show various percentage values and colorscale using value
1 parent 1860826 commit d2b07b5

File tree

4 files changed

+513
-117
lines changed

4 files changed

+513
-117
lines changed
Loading
Loading

test/image/mocks/treemap_with-without_values.json

Lines changed: 258 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"data": [
33
{
44
"type": "treemap",
5-
"textinfo": "label+value+percent parent+percent entry+percent root",
5+
"textinfo": "label+value+percent parent+percent entry+percent root+text+current path",
66
"hoverinfo": "all",
77
"name": "without values",
88
"level": "Oscar",
@@ -65,14 +65,14 @@
6565
],
6666
"domain": {
6767
"x": [
68-
0,
69-
0.48
68+
0.01,
69+
0.33
7070
]
7171
}
7272
},
7373
{
7474
"type": "treemap",
75-
"textinfo": "label+value+percent parent+percent entry+percent root",
75+
"textinfo": "label+value+percent parent+percent entry+percent root+text+current path",
7676
"hoverinfo": "all",
7777
"name": "with values",
7878
"level": "Oscar",
@@ -106,32 +106,207 @@
106106
],
107107
"branchvalues": "total",
108108
"values": [
109-
20,
110-
1,
111-
19,
112-
1,
113-
1,
114-
17,
115-
1,
116-
1,
117-
1,
118-
14,
119-
1,
120-
1,
109+
40,
110+
2,
111+
38,
112+
1.5,
113+
2.5,
114+
34,
121115
1,
116+
2,
117+
3,
118+
28,
119+
1.25,
120+
1.75,
121+
2.25,
122+
2.75,
123+
20,
122124
1,
125+
1.5,
126+
2,
127+
2.5,
128+
3,
123129
10,
124130
1,
131+
1.5,
132+
2,
133+
2.5,
134+
3
135+
],
136+
"text": [
137+
"forty",
138+
"two",
139+
"thirty-eight",
140+
"one and a half",
141+
"two and a half",
142+
"thirty-four",
143+
"one",
144+
"two",
145+
"three",
146+
"twenty-eight",
147+
"one and twenty-five hundredths",
148+
"one and seventy-five hundredths",
149+
"two and twenty-five hundredths",
150+
"two and seventy-five hundredths",
151+
"twenty",
152+
"one",
153+
"one and a half",
154+
"two",
155+
"two and a half",
156+
"three",
157+
"ten",
158+
"one",
159+
"one and a half",
160+
"two",
161+
"two and a half",
162+
"three"
163+
],
164+
"parents": [
165+
"",
166+
"Alpha",
167+
"Alpha",
168+
"Charlie",
169+
"Charlie",
170+
"Charlie",
171+
"Foxtrot",
172+
"Foxtrot",
173+
"Foxtrot",
174+
"Foxtrot",
175+
"Juliet",
176+
"Juliet",
177+
"Juliet",
178+
"Juliet",
179+
"Juliet",
180+
"Oscar",
181+
"Oscar",
182+
"Oscar",
183+
"Oscar",
184+
"Oscar",
185+
"Oscar",
186+
"Uniform",
187+
"Uniform",
188+
"Uniform",
189+
"Uniform",
190+
"Uniform",
191+
"Uniform"
192+
],
193+
"marker": {
194+
"colorscale": [
195+
[
196+
0,
197+
"#FFF"
198+
],
199+
[
200+
0.01,
201+
"#0FF"
202+
],
203+
[
204+
0.1,
205+
"#00F"
206+
],
207+
[
208+
1,
209+
"#000"
210+
]
211+
]
212+
},
213+
"domain": {
214+
"x": [
215+
0.34,
216+
0.66
217+
]
218+
}
219+
},
220+
{
221+
"type": "treemap",
222+
"textinfo": "label+value+percent parent+percent entry+percent root+text+current path",
223+
"hoverinfo": "all",
224+
"name": "with values",
225+
"level": "Oscar",
226+
"labels": [
227+
"Alpha",
228+
"Bravo",
229+
"Charlie",
230+
"Delta",
231+
"Echo",
232+
"Foxtrot",
233+
"Golf",
234+
"Hotel",
235+
"India",
236+
"Juliet",
237+
"Kilo",
238+
"Lima",
239+
"Mike",
240+
"November",
241+
"Oscar",
242+
"Papa",
243+
"Quebec",
244+
"Romeo",
245+
"Sierra",
246+
"Tango",
247+
"Uniform",
248+
"Victor",
249+
"Whiskey",
250+
"X ray",
251+
"Yankee",
252+
"Zulu"
253+
],
254+
"branchvalues": "remainder",
255+
"values": [
256+
0,
257+
2,
258+
0,
259+
1.5,
260+
2.5,
261+
0,
125262
1,
263+
2,
264+
3,
265+
0,
266+
1.25,
267+
1.75,
268+
2.25,
269+
2.75,
270+
0,
126271
1,
272+
1.5,
273+
2,
274+
2.5,
275+
3,
276+
0,
127277
1,
128-
1,
129-
5,
130-
1,
131-
1,
132-
1,
133-
1,
134-
1
278+
1.5,
279+
2,
280+
2.5,
281+
3
282+
],
283+
"text": [
284+
"zero",
285+
"two",
286+
"zero",
287+
"one and a half",
288+
"two and a half",
289+
"zero",
290+
"one",
291+
"two",
292+
"three",
293+
"zero",
294+
"one and twenty-five hundredths",
295+
"one and seventy-five hundredths",
296+
"two and twenty-five hundredths",
297+
"two and seventy-five hundredths",
298+
"zero",
299+
"one",
300+
"one and a half",
301+
"two",
302+
"two and a half",
303+
"three",
304+
"zero",
305+
"one",
306+
"one and a half",
307+
"two",
308+
"two and a half",
309+
"three"
135310
],
136311
"parents": [
137312
"",
@@ -163,12 +338,29 @@
163338
"Uniform"
164339
],
165340
"marker": {
166-
"colorscale": "Blues"
341+
"colorscale": [
342+
[
343+
0,
344+
"#FFF"
345+
],
346+
[
347+
0.01,
348+
"#0FF"
349+
],
350+
[
351+
0.1,
352+
"#00F"
353+
],
354+
[
355+
1,
356+
"#000"
357+
]
358+
]
167359
},
168360
"domain": {
169361
"x": [
170-
0.52,
171-
1
362+
0.67,
363+
0.99
172364
]
173365
}
174366
}
@@ -178,23 +370,57 @@
178370
"t": 50,
179371
"l": 0,
180372
"r": 0,
181-
"b": 0
373+
"b": 25
182374
},
183-
"width": 1000,
375+
"width": 1500,
184376
"height": 600,
377+
"shapes": [
378+
{
379+
"type": "rect",
380+
"layer": "above",
381+
"x0": 0.01,
382+
"x1": 0.33,
383+
"y0": 0,
384+
"y1": 1
385+
},
386+
{
387+
"type": "rect",
388+
"layer": "above",
389+
"x0": 0.34,
390+
"x1": 0.66,
391+
"y0": 0,
392+
"y1": 1
393+
},
394+
{
395+
"type": "rect",
396+
"layer": "above",
397+
"x0": 0.67,
398+
"x1": 0.99,
399+
"y0": 0,
400+
"y1": 1
401+
}
402+
],
185403
"annotations": [
186404
{
187405
"showarrow": false,
188-
"text": "<b>without values<br>",
189-
"x": 0.24,
406+
"text": "<b>with counted leaves<br>",
407+
"x": 0.17,
408+
"xanchor": "center",
409+
"y": 0,
410+
"yanchor": "top"
411+
},
412+
{
413+
"showarrow": false,
414+
"text": "<b>with values and branchvalues: total<br>",
415+
"x": 0.5,
190416
"xanchor": "center",
191417
"y": 0,
192418
"yanchor": "top"
193419
},
194420
{
195421
"showarrow": false,
196-
"text": "<b>with values<br>",
197-
"x": 0.76,
422+
"text": "<b>with values and branchvalues: remainder<br>",
423+
"x": 0.83,
198424
"xanchor": "center",
199425
"y": 0,
200426
"yanchor": "top"

0 commit comments

Comments
 (0)