D3 Zoom Behavior Part One
  Duration: 14:02
Part of Course: Intermediate D3 Course
This Lesson is for subscribers

D3-zoom-behavior-part-one_280x158
Unlock this lesson NOW!
  • Get expert advice on D3 Zoom Behavior Part One
  • Enjoy access to the complete DashingD3js catalog
  • Start mastering D3.js right now!

Takeaways:

  • The D3 Zoom Behavior, d3.behavior.zoom(), constructs a zoom behavior that creates an even listener to handle zoom gestures (mouse and touch) on the SVG elements you apply the zoom behavior onto
  • The D3 Zoom Behavior Zooming behavior is made up of being able to zoom in and out
  • The D3 Zoom Behavior Panning behavior is made up of being able to pan along the X and Y axis, like a camera panning across an image - everything stays the same distance to everything else, it's just that all of the elements move together
  • The reason D3 Zoom Behavior contains the Zoom & Pan behavior is for specific point zooming - that is, when you zoom in on a specific point, not only do you need to zoom in, you also need to move the camera so that the point you zoomed in is still in the picture (same thing with zoom out)
  • The D3 Zoom Behavior listens for the Mouse Wheel Event, the Mouse Double Click Event, Touch Pinch and Spread Gestures, and similar "zoom" events
  • The D3 Zoom Behavior Scale Method, zoom.scale([scale]), tells you exactly what zoom scale you are operating under (note that it's multiplicative)
  • You can also use the D3 Zoom Behavior Scale Method through the zoom.scaleExtent([minimum, maximum]) to define the upper and lower limits of how far you can zoom in your data visualization
  • D3 has the redefining of the domain for each X and Y axis scale built into the zoom behavior, so you can use D3 SVG Axis to show zoom behavior

This Transcript is for subscribers.

D3-zoom-behavior-part-one_280x158
Unlock this D3 Tutorial NOW!
  • Get expert advice on D3 Zoom Behavior Part One
  • Enjoy access to the complete DashingD3js catalog
  • Start mastering D3.js right now!
<< Back To D3 Screencast and Written Tutorials Index