Skip to content

Commit

Permalink
Merge pull request #50 from vizzuhq/fix_attach_detach
Browse files Browse the repository at this point in the history
Fix attach detach
  • Loading branch information
veghdev authored Nov 28, 2024
2 parents aa736c6 + 02e83b8 commit e5f4a3b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
25 changes: 13 additions & 12 deletions docs/showcases/cocoa/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ const style = {
}
}

const firstStage = 6

function stage(chart, i) {
const palette = colors.slice(i - 1 > 0 ? i - 1 : 0, 8).join(' ')
const prev2 = `Parties-${i + 2}`
Expand All @@ -89,9 +91,9 @@ function stage(chart, i) {
{
config: {
channels: {
y: { detach: [prev2] },
y: { detach: i === firstStage ? [] : [prev2] },
x: { attach: [act] },
label: { detach: [prev2], attach: [prev] }
label: { detach: i === firstStage ? [] : [prev2], attach: i === firstStage ? [] : [prev] }
}
}
},
Expand Down Expand Up @@ -261,21 +263,20 @@ chart.initializing
}
)
)
.then((chart) => stage(chart, 6))
.then((chart) => stage(chart, 5))
.then((chart) => stage(chart, 4))
.then((chart) => stage(chart, 3))
.then((chart) => stage(chart, 2))
.then((chart) => stage(chart, 1))
.then((chart) => stage(chart, 0))
.then((chart) => stage(chart, firstStage))
.then((chart) => stage(chart, firstStage - 1))
.then((chart) => stage(chart, firstStage - 2))
.then((chart) => stage(chart, firstStage - 3))
.then((chart) => stage(chart, firstStage - 4))
.then((chart) => stage(chart, firstStage - 5))
.then((chart) => stage(chart, firstStage - 6))
.then((chart) =>
chart.animate({
config: {
channels: {
y: { detach: ['Parties-2', 'Parties-1'] },
color: { detach: ['Parties-1'] },
y: { detach: ['Parties-1'] },
label: {
detach: ['Parties-2', 'Parties-1'],
detach: ['Parties-1'],
attach: ['Parties-0']
}
}
Expand Down
6 changes: 3 additions & 3 deletions docs/showcases/friends/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,20 +182,20 @@ function slide(seid, actFilter) {
config: {
channels: {
x: {
attach: ['name'],
set: ['name'],
range: {
min: 0,
max: '102%'
}
},
y: {
attach: ['Lines', 'season'],
set: ['Lines', 'season'],
range: {
min: 0,
max: 9.99999
}
},
color: { attach: ['season'] }
color: { set: ['season'] }
},
title: seid
},
Expand Down
2 changes: 1 addition & 1 deletion docs/showcases/musicformats/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ for (let year = 1973; year <= 2020; year++) {
y: { set: ['Format'] },
x: { set: ['Revenue'] },
label: { set: ['Revenue'] },
color: { attach: ['Format'] }
color: { set: ['Format'] }
},
title: 'Music Revenue by Format - Year by Year',
sort: 'byValue'
Expand Down

0 comments on commit e5f4a3b

Please sign in to comment.