News for hackers. Stuff that matters.
Re:D3 6.0 by atonse on Wednesday August 26, 2020 @08:58PM (#24289106)
The first few days I used d3, I really struggled. And I got very frustrated. I simply couldn’t understand why the library was so popular. But I powered through because people whose thought patterns I respected, swore by it.

Then I read some blog post somewhere. I wish I could give that author the credit they deserved. It explained the fundamental building blocks of d3, the selection APIs, etc with such clarity.

Once the light bulb went off, I was able to quickly iterate on some pretty awesome totally custom stuff quickly and have sung d3’s praises ever since (it’s been 5 years).

Re:D3 6.0 by wattenberger on Thursday August 27, 2020 @03:30PM (#24297654)
Sounds similar to this guide I put together - understanding how the different modules work together and who is responsible for what is really helpful.

https://wattenberger.com/blog/d3

Re:D3 6.0 by swyx on Thursday August 27, 2020 @09:34PM (#24300536)
i can confirm that i dreadfully wished for something like this when i muddled through the freecodecamp d3 curriculum in 2017! it was especially confusing as everyone was switching from v3 to v4 right then.

also, hey :)

Re:D3 6.0 by summitsummit on Wednesday August 26, 2020 @09:01PM (#24289129)
can you share that post? im of the former camp as of right now
Re:D3 6.0 by infogulch on Wednesday August 26, 2020 @09:07PM (#24289173)
Presumably, gp has forgotten.

> I wish I could give that author the credit they deserved.

Re:D3 6.0 by siddboots on Wednesday August 26, 2020 @09:20PM (#24289246)
These two posts by the creator, Mike Bostock, sound similar to what the gp described.

https://bost.ocks.org/mike/join/ https://observablehq.com/@d3/selection-join

Re:D3 6.0 by tonto on Wednesday August 26, 2020 @10:31PM (#24289611)
The data join thing is interesting. I'd be curious about other future opportunities for d3 to sync up more with react. Posts like this [0] show that d3 can "just generate the path" and then at that point you can use different renderers like React e.g. return <path d={line(data)}/>. It is more limited doing it this way but more ties into the react model would be wonderful

https://observablehq.com/@d3/d3-line

Re:D3 6.0 by jwilber on Thursday August 27, 2020 @01:47AM (#24290513)
I don’t have any public codebase examples at hand, but what we’ve done at work also works quite well: basically we implement our D3 charts as a class with methods corresponding to desired lifecycle events. We then create a Component wrapper around said class and call the methods during their corresponding lifecycle events. (Idk how confusing or not that was but I wish I had a repo to share to make it clearer).

There’s also a book I read while ago from Swizec Teller on d3 + react integration[0]. It may be dated by now as it’s been some time since I last read it, but it’s worth looking into!

[0] https://leanpub.com/reactd3jses6

Re:D3 6.0 by jcheng on Wednesday August 26, 2020 @10:02PM (#24289459)
That first one is what did it for me, years ago—IMHO it’s not even worth trying to form a mental model of d3 until after you’ve read that.
Re:D3 6.0 by summitsummit on Wednesday August 26, 2020 @09:17PM (#24289228)
yes, i gathered as much. they showed enough desire to give credit and enough interest and skill in the matter that i find it hopeful they could find it again if they sought it out.
Re:D3 6.0 by atonse on Friday August 28, 2020 @01:13PM (#24307388)
Sorry I don't even remember what it looked like. But the guide from @wattenberger is in the same vain. It might have been it :-)

My overall point is that if you are struggling with d3, take a step back and really try to understand the conceptual building blocks. It'll make a world of difference.