Skip to content

Commit 02e83b8

Browse files
committed
fix cocoa
1 parent 3c199a5 commit 02e83b8

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

docs/showcases/cocoa/main.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ const style = {
7878
}
7979
}
8080

81+
const firstStage = 6
82+
8183
function stage(chart, i) {
8284
const palette = colors.slice(i - 1 > 0 ? i - 1 : 0, 8).join(' ')
8385
const prev2 = `Parties-${i + 2}`
@@ -89,9 +91,9 @@ function stage(chart, i) {
8991
{
9092
config: {
9193
channels: {
92-
y: { detach: [prev2] },
94+
y: { detach: i === firstStage ? [] : [prev2] },
9395
x: { attach: [act] },
94-
label: { detach: [prev2], attach: [prev] }
96+
label: { detach: i === firstStage ? [] : [prev2], attach: i === firstStage ? [] : [prev] }
9597
}
9698
}
9799
},
@@ -261,21 +263,20 @@ chart.initializing
261263
}
262264
)
263265
)
264-
.then((chart) => stage(chart, 6))
265-
.then((chart) => stage(chart, 5))
266-
.then((chart) => stage(chart, 4))
267-
.then((chart) => stage(chart, 3))
268-
.then((chart) => stage(chart, 2))
269-
.then((chart) => stage(chart, 1))
270-
.then((chart) => stage(chart, 0))
266+
.then((chart) => stage(chart, firstStage))
267+
.then((chart) => stage(chart, firstStage - 1))
268+
.then((chart) => stage(chart, firstStage - 2))
269+
.then((chart) => stage(chart, firstStage - 3))
270+
.then((chart) => stage(chart, firstStage - 4))
271+
.then((chart) => stage(chart, firstStage - 5))
272+
.then((chart) => stage(chart, firstStage - 6))
271273
.then((chart) =>
272274
chart.animate({
273275
config: {
274276
channels: {
275-
y: { detach: ['Parties-2', 'Parties-1'] },
276-
color: { detach: ['Parties-1'] },
277+
y: { detach: ['Parties-1'] },
277278
label: {
278-
detach: ['Parties-2', 'Parties-1'],
279+
detach: ['Parties-1'],
279280
attach: ['Parties-0']
280281
}
281282
}

0 commit comments

Comments
 (0)