Skip to content

Commit a3f1cf8

Browse files
committed
fix root-level multiple-roots view when maxdepth is set
1 parent d5fd040 commit a3f1cf8

File tree

3 files changed

+312
-4
lines changed

3 files changed

+312
-4
lines changed

src/traces/sunburst/plot.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,20 @@ module.exports = function plot(gd, cdmodule) {
5656
return;
5757
}
5858

59-
var sliceData = partition(entry)
60-
.descendants()
61-
.filter(function(d) { return d.y1 <= maxDepth; });
62-
59+
var sliceData = partition(entry).descendants();
6360
var maxHeight = entry.height + 1;
6461
var yOffset = 0;
62+
var cutoff = maxDepth;
6563

6664
if(cd0.hasMultipleRoots && sliceData[0].data.data.pid === '') {
6765
sliceData = sliceData.slice(1);
6866
maxHeight -= 1;
6967
yOffset = 1;
68+
cutoff += 1;
7069
}
7170

71+
sliceData = sliceData.filter(function(pt) { return pt.y1 <= cutoff; });
72+
7273
slices = slices.data(sliceData, function(d) { return d.data.data.id; });
7374

7475
slices.enter().append('g')
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
{
2+
"data": [
3+
{
4+
"type": "sunburst",
5+
"maxdepth": 3,
6+
"ids": [
7+
"Aromas",
8+
"Tastes",
9+
"Aromas-Enzymatic",
10+
"Aromas-Sugar Browning",
11+
"Aromas-Dry Distillation",
12+
"Tastes-Bitter",
13+
"Tastes-Salt",
14+
"Tastes-Sweet",
15+
"Tastes-Sour",
16+
"Enzymatic-Flowery",
17+
"Enzymatic-Fruity",
18+
"Enzymatic-Herby",
19+
"Sugar Browning-Nutty",
20+
"Sugar Browning-Carmelly",
21+
"Sugar Browning-Chocolatey",
22+
"Dry Distillation-Resinous",
23+
"Dry Distillation-Spicy",
24+
"Dry Distillation-Carbony",
25+
"Bitter-Pungent",
26+
"Bitter-Harsh",
27+
"Salt-Sharp",
28+
"Salt-Bland",
29+
"Sweet-Mellow",
30+
"Sweet-Acidy",
31+
"Sour-Winey",
32+
"Sour-Soury",
33+
"Flowery-Floral",
34+
"Flowery-Fragrant",
35+
"Fruity-Citrus",
36+
"Fruity-Berry-like",
37+
"Herby-Alliaceous",
38+
"Herby-Leguminous",
39+
"Nutty-Nut-like",
40+
"Nutty-Malt-like",
41+
"Carmelly-Candy-like",
42+
"Carmelly-Syrup-like",
43+
"Chocolatey-Chocolate-like",
44+
"Chocolatey-Vanilla-like",
45+
"Resinous-Turpeny",
46+
"Resinous-Medicinal",
47+
"Spicy-Warming",
48+
"Spicy-Pungent",
49+
"Carbony-Smokey",
50+
"Carbony-Ashy",
51+
"Pungent-Creosol",
52+
"Pungent-Phenolic",
53+
"Harsh-Caustic",
54+
"Harsh-Alkaline",
55+
"Sharp-Astringent",
56+
"Sharp-Rough",
57+
"Bland-Neutral",
58+
"Bland-Soft",
59+
"Mellow-Delicate",
60+
"Mellow-Mild",
61+
"Acidy-Nippy",
62+
"Acidy-Piquant",
63+
"Winey-Tangy",
64+
"Winey-Tart",
65+
"Soury-Hard",
66+
"Soury-Acrid",
67+
"Floral-Coffee Blossom",
68+
"Floral-Tea Rose",
69+
"Fragrant-Cardamon Caraway",
70+
"Fragrant-Coriander Seeds",
71+
"Citrus-Lemon",
72+
"Citrus-Apple",
73+
"Berry-like-Apricot",
74+
"Berry-like-Blackberry",
75+
"Alliaceous-Onion",
76+
"Alliaceous-Garlic",
77+
"Leguminous-Cucumber",
78+
"Leguminous-Garden Peas",
79+
"Nut-like-Roasted Peanuts",
80+
"Nut-like-Walnuts",
81+
"Malt-like-Balsamic Rice",
82+
"Malt-like-Toast",
83+
"Candy-like-Roasted Hazelnut",
84+
"Candy-like-Roasted Almond",
85+
"Syrup-like-Honey",
86+
"Syrup-like-Maple Syrup",
87+
"Chocolate-like-Bakers",
88+
"Chocolate-like-Dark Chocolate",
89+
"Vanilla-like-Swiss",
90+
"Vanilla-like-Butter",
91+
"Turpeny-Piney",
92+
"Turpeny-Blackcurrant-like",
93+
"Medicinal-Camphoric",
94+
"Medicinal-Cineolic",
95+
"Warming-Cedar",
96+
"Warming-Pepper",
97+
"Pungent-Clove",
98+
"Pungent-Thyme",
99+
"Smokey-Tarry",
100+
"Smokey-Pipe Tobacco",
101+
"Ashy-Burnt",
102+
"Ashy-Charred"
103+
],
104+
"labels": [
105+
"Aromas",
106+
"Tastes",
107+
"Enzymatic",
108+
"Sugar Browning",
109+
"Dry Distillation",
110+
"Bitter",
111+
"Salt",
112+
"Sweet",
113+
"Sour",
114+
"Flowery",
115+
"Fruity",
116+
"Herby",
117+
"Nutty",
118+
"Carmelly",
119+
"Chocolatey",
120+
"Resinous",
121+
"Spicy",
122+
"Carbony",
123+
"Pungent",
124+
"Harsh",
125+
"Sharp",
126+
"Bland",
127+
"Mellow",
128+
"Acidy",
129+
"Winey",
130+
"Soury",
131+
"Floral",
132+
"Fragrant",
133+
"Citrus",
134+
"Berry-like",
135+
"Alliaceous",
136+
"Leguminous",
137+
"Nut-like",
138+
"Malt-like",
139+
"Candy-like",
140+
"Syrup-like",
141+
"Chocolate-like",
142+
"Vanilla-like",
143+
"Turpeny",
144+
"Medicinal",
145+
"Warming",
146+
"Pungent",
147+
"Smokey",
148+
"Ashy",
149+
"Creosol",
150+
"Phenolic",
151+
"Caustic",
152+
"Alkaline",
153+
"Astringent",
154+
"Rough",
155+
"Neutral",
156+
"Soft",
157+
"Delicate",
158+
"Mild",
159+
"Nippy",
160+
"Piquant",
161+
"Tangy",
162+
"Tart",
163+
"Hard",
164+
"Acrid",
165+
"Coffee Blossom",
166+
"Tea Rose",
167+
"Cardamon Caraway",
168+
"Coriander Seeds",
169+
"Lemon",
170+
"Apple",
171+
"Apricot",
172+
"Blackberry",
173+
"Onion",
174+
"Garlic",
175+
"Cucumber",
176+
"Garden Peas",
177+
"Roasted Peanuts",
178+
"Walnuts",
179+
"Balsamic Rice",
180+
"Toast",
181+
"Roasted Hazelnut",
182+
"Roasted Almond",
183+
"Honey",
184+
"Maple Syrup",
185+
"Bakers",
186+
"Dark Chocolate",
187+
"Swiss",
188+
"Butter",
189+
"Piney",
190+
"Blackcurrant-like",
191+
"Camphoric",
192+
"Cineolic",
193+
"Cedar",
194+
"Pepper",
195+
"Clove",
196+
"Thyme",
197+
"Tarry",
198+
"Pipe Tobacco",
199+
"Burnt",
200+
"Charred"
201+
],
202+
"parents": [
203+
"",
204+
"",
205+
"Aromas",
206+
"Aromas",
207+
"Aromas",
208+
"Tastes",
209+
"Tastes",
210+
"Tastes",
211+
"Tastes",
212+
"Aromas-Enzymatic",
213+
"Aromas-Enzymatic",
214+
"Aromas-Enzymatic",
215+
"Aromas-Sugar Browning",
216+
"Aromas-Sugar Browning",
217+
"Aromas-Sugar Browning",
218+
"Aromas-Dry Distillation",
219+
"Aromas-Dry Distillation",
220+
"Aromas-Dry Distillation",
221+
"Tastes-Bitter",
222+
"Tastes-Bitter",
223+
"Tastes-Salt",
224+
"Tastes-Salt",
225+
"Tastes-Sweet",
226+
"Tastes-Sweet",
227+
"Tastes-Sour",
228+
"Tastes-Sour",
229+
"Enzymatic-Flowery",
230+
"Enzymatic-Flowery",
231+
"Enzymatic-Fruity",
232+
"Enzymatic-Fruity",
233+
"Enzymatic-Herby",
234+
"Enzymatic-Herby",
235+
"Sugar Browning-Nutty",
236+
"Sugar Browning-Nutty",
237+
"Sugar Browning-Carmelly",
238+
"Sugar Browning-Carmelly",
239+
"Sugar Browning-Chocolatey",
240+
"Sugar Browning-Chocolatey",
241+
"Dry Distillation-Resinous",
242+
"Dry Distillation-Resinous",
243+
"Dry Distillation-Spicy",
244+
"Dry Distillation-Spicy",
245+
"Dry Distillation-Carbony",
246+
"Dry Distillation-Carbony",
247+
"Bitter-Pungent",
248+
"Bitter-Pungent",
249+
"Bitter-Harsh",
250+
"Bitter-Harsh",
251+
"Salt-Sharp",
252+
"Salt-Sharp",
253+
"Salt-Bland",
254+
"Salt-Bland",
255+
"Sweet-Mellow",
256+
"Sweet-Mellow",
257+
"Sweet-Acidy",
258+
"Sweet-Acidy",
259+
"Sour-Winey",
260+
"Sour-Winey",
261+
"Sour-Soury",
262+
"Sour-Soury",
263+
"Flowery-Floral",
264+
"Flowery-Floral",
265+
"Flowery-Fragrant",
266+
"Flowery-Fragrant",
267+
"Fruity-Citrus",
268+
"Fruity-Citrus",
269+
"Fruity-Berry-like",
270+
"Fruity-Berry-like",
271+
"Herby-Alliaceous",
272+
"Herby-Alliaceous",
273+
"Herby-Leguminous",
274+
"Herby-Leguminous",
275+
"Nutty-Nut-like",
276+
"Nutty-Nut-like",
277+
"Nutty-Malt-like",
278+
"Nutty-Malt-like",
279+
"Carmelly-Candy-like",
280+
"Carmelly-Candy-like",
281+
"Carmelly-Syrup-like",
282+
"Carmelly-Syrup-like",
283+
"Chocolatey-Chocolate-like",
284+
"Chocolatey-Chocolate-like",
285+
"Chocolatey-Vanilla-like",
286+
"Chocolatey-Vanilla-like",
287+
"Resinous-Turpeny",
288+
"Resinous-Turpeny",
289+
"Resinous-Medicinal",
290+
"Resinous-Medicinal",
291+
"Spicy-Warming",
292+
"Spicy-Warming",
293+
"Spicy-Pungent",
294+
"Spicy-Pungent",
295+
"Carbony-Smokey",
296+
"Carbony-Smokey",
297+
"Carbony-Ashy",
298+
"Carbony-Ashy"
299+
]
300+
}
301+
],
302+
"layout": {
303+
"margin": {"l": 0, "r": 0, "b": 0, "t": 0},
304+
"width": 500,
305+
"height": 500
306+
}
307+
}

0 commit comments

Comments
 (0)