D3 - Event Listener (On Operator)

About

DOM - Event Listener in D3.

Special operators called event handlers respond to user input and enable interaction.

D3’s on operator exposes the event listeners for native event types.

For consistency with other functional operators, the callback receives the data and index as arguments (d, i), allowing data-driven interaction.

The targeted node is this, and the current event is d3.event. Listeners may coexist on elements through namespaces (e.g., “click.foo”).

D3’s focus on transformations simplifies the specification of scene changes in response to user events; the semantics are the same as initialization.


Powered by ComboStrap