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

Chapter 14 - Dragging event #50

Open
dung-phan opened this issue Feb 2, 2022 · 1 comment
Open

Chapter 14 - Dragging event #50

dung-phan opened this issue Feb 2, 2022 · 1 comment
Assignees
Labels
next book update To incorporate on the next update to the book v5 This needs revision for D3 v5.x

Comments

@dung-phan
Copy link

Original code:
var dragging = function(d) {
//Log out d3.event, so you can see all the goodies inside
//console.log(d3.event);

It should be function(e,d) and console.log(e) and using e (event) to get access to dx and dy.

Also I have a question:
svg.selectAll("path") .attr("d", path);
Paths and circles in this example (p.301) are updated on svg instead of map which contains the group. Should it be map instead or it shouldn't matter here?
Thanks a lot!

@scotthmurray scotthmurray self-assigned this Mar 15, 2022
@scotthmurray scotthmurray added next book update To incorporate on the next update to the book v5 This needs revision for D3 v5.x labels Mar 15, 2022
@scotthmurray
Copy link
Owner

Thanks @dung-phan! I suspect that you're using a newer version of D3. The book and examples are written to work with v4.5.0 — if you use a newer version (like the current version), you'll have to make some changes.

I've flagged this to update in some future version of the book.

As for your second question, if you point me to which example this is referencing, I can take a look: https://github.com/scotthmurray/d3-book

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next book update To incorporate on the next update to the book v5 This needs revision for D3 v5.x
Projects
None yet
Development

No branches or pull requests

2 participants