Skip to content

Commit e5f4a3b

Browse files
authored
Merge pull request #50 from vizzuhq/fix_attach_detach
Fix attach detach
2 parents aa736c6 + 02e83b8 commit e5f4a3b

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
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
}

docs/showcases/friends/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,20 @@ function slide(seid, actFilter) {
182182
config: {
183183
channels: {
184184
x: {
185-
attach: ['name'],
185+
set: ['name'],
186186
range: {
187187
min: 0,
188188
max: '102%'
189189
}
190190
},
191191
y: {
192-
attach: ['Lines', 'season'],
192+
set: ['Lines', 'season'],
193193
range: {
194194
min: 0,
195195
max: 9.99999
196196
}
197197
},
198-
color: { attach: ['season'] }
198+
color: { set: ['season'] }
199199
},
200200
title: seid
201201
},

docs/showcases/musicformats/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ for (let year = 1973; year <= 2020; year++) {
3030
y: { set: ['Format'] },
3131
x: { set: ['Revenue'] },
3232
label: { set: ['Revenue'] },
33-
color: { attach: ['Format'] }
33+
color: { set: ['Format'] }
3434
},
3535
title: 'Music Revenue by Format - Year by Year',
3636
sort: 'byValue'

0 commit comments

Comments
 (0)