Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nest deprecated #8

Open
SaFrMo opened this issue Jan 23, 2021 · 0 comments
Open

nest deprecated #8

SaFrMo opened this issue Jan 23, 2021 · 0 comments

Comments

@SaFrMo
Copy link

SaFrMo commented Jan 23, 2021

Absolutely love this tutorial, thanks for connecting the dots on D3's data structures and Vue's reactivity!

One thing I noticed while working through was that the nest function has been deprecated in favor of group and rollup. I was able to arrive at the same result with some changes in the Chart component:

// replace this:
const nestedTweets = d3
    .nest()
    .key(d => d.user)
    .entries(this.tweetData);

// with this:
const nestedTweets = d3.group(this.tweetData, d => d.user)
// replace this:
const packableTweets = { id: 'All Tweets', values: nestedTweets }
return d3
    .hierarchy(packableTweets, d => d.values)
    .sum(d =>
        d.retweets ? d.retweets.length + d.favorites.length + 1 : 1
    )

// with this:
return d3
    .hierarchy(nestedTweets)
    .sum(d =>
        d.retweets ? d.retweets.length + d.favorites.length + 1 : 1
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant