简体   繁体   中英

A list of event types that d3js supports

I am using d3.js to create a data vis tool. I read in d3 documentation that event listener can be registered using selection.on(type[, listener[, capture]]) API. As it is documented here:

https://github.com/mbostock/d3/wiki/Selections#wiki-on

However, I cannot find a list of event types that d3 supports. Now I know there are 'click' event, 'mouseover' event and 'mouseout' event. What else does it support?

Thanks a lot.

D3 supports any Javascript event in the on method -- including custom events created by other code.

The MDN Event Reference is a good list of types of events that will be created by the browser.

Pay attention to which types of DOM objects can respond to which types of events, though. The element within the d3 selection has to receive the event for the D3 on method to be able to react to it.

Also be aware that for some complex types of user interaction, like dragging, it is easier to use a d3 behavior object , which monitors multiple system events, both mouse movements and touch screen movements, and creates custom events that you can then react to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM