zoom.on()

zoom.on(typenames[, listener])

If listener is specified, sets the event listener for the specified typenames and returns the zoom behavior. If an event listener was already registered for the same type and name, the existing listener is removed before the new listener is added. If listener is null, removes the current event listeners for the specified typenames, if any. If listener is not specified, returns the first currently-assigned listener matching the specified typenames, if any. When a specified event is dispatched, each listener will be invoked with the same context and arguments as selection.on listeners: the current datum d and index i, with the this context as the current DOM element.

The typenames is a string containing one or more typename separated by whitespace. Each typename is a type, optionally followed by a period (.) and a name, such as zoom.foo and zoom.bar; the name allows multiple listeners to be registered for the same type. The type must be one of the following:

  • start - after zooming begins (such as on mousedown).
  • zoom - after a change to the zoom transform (such as on mousemove).
  • end - after zooming ends (such as on mouseup ).

See dispatch.on for more.

doc_D3_Js
2016-11-24 10:29:35
Comments
Leave a Comment

Please login to continue.