block by mbostock d1f7b58631e71fbf9c568345ee04a60e

Pan & Zoom I

Full Screen

This example demonstrates using d3-zoom to enable interactive panning and zooming of a Canvas element. The current zoom transform is applied to the Canvas using context.translate and context.scale. This technique is similar to applying an SVG transform. An alternate zooming strategy is to transform the data rather than the view; this lets you customize the display on zoom, such as rendering circles that are the same size regardless of scale.

Updated Example →

index.html