d3 6.0 upgrade, scaleLinear not working anymore

30 views
Skip to first unread message

Nico Schlömer

unread,
Sep 30, 2020, 6:38:25 AM9/30/20
to d3-js
After upgrading to d3 6.*, I noticed that
```
.on("click", clicked.bind(this))
```
doesn't do the same as in 5.* anymore. I can't quite say what's going wrong, but the clicked function now receives a MouseEvent where with d3 5.* it got an object that has x0, y0 attributes.

The full code (186 lines of JS) is here [1].

Any hint on what may be going wrong here?

Gordon Woodhull

unread,
Sep 30, 2020, 6:42:53 AM9/30/20
to d3...@googlegroups.com
D3 now passes events directly to listeners


On Sep 30, 2020, at 6:39 AM, Nico Schlömer <nico.sc...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/d3-js/689afff7-a67b-4666-93bb-eb45a6c5a3c5n%40googlegroups.com.

Nico Schlömer

unread,
Sep 30, 2020, 8:15:33 AM9/30/20
to d3-js
Thanks Gordon for the quick response.

I understand that MouseEvent is now passed to `clicked`, I suppose that's the event that's directly passed to the listener. I'm not much interested in the MouseEvent, however, and would like to restore the previous behavior. Can you give me a hint how to achieve this? Or perhaps in d3 6.* I'll have to use another strategy to get my old `d.x0`, `d.y0`?

Gordon Woodhull

unread,
Sep 30, 2020, 9:04:45 AM9/30/20
to d3...@googlegroups.com
They added event as the first parameter; the data is now the second parameter.



On Sep 30, 2020, at 8:16 AM, Nico Schlömer <nico.sc...@gmail.com> wrote:

Thanks Gordon for the quick response.

Nico Schlömer

unread,
Sep 30, 2020, 9:10:36 AM9/30/20
to d3-js
That's it, thank you!
Reply all
Reply to author
Forward
0 new messages