Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

d3.js in Angular - Property 'event' does not exist on type 'typeof import [duplicate]

Trying to create network graph with Angular 9 and d3.js by following the example in https://medium.com/netscape/visualizing-data-with-angular-and-d3-209dde784aeb

Versions installed are "d3": "^6.2.0", "@types/d3": "^6.1.0"

Getting the below error - Property 'event' does not exist on type

enter image description here

Checked other answers in SO but they are all related to version mismatch and I just got the latest version from d3.

Help please.

like image 752
Jap Evans Avatar asked Aug 31 '25 04:08

Jap Evans


1 Answers

d3.event has been removed in version 6. See also the change log:

D3 now passes events directly to listeners, replacing the d3.event global and bringing D3 inline with vanilla JavaScript and most other frameworks

This answer addresses very well how to access the event object now.

like image 56
Ruben Helsloot Avatar answered Sep 02 '25 17:09

Ruben Helsloot