This examples demonstrates how to use D3's brush component to implement focus + context zooming. Click and drag in the small chart below to pan or zoom.
Click to perturb or drag the nodes!
This example demonstrates the flexibility of D3's force layout. By using position Verlet integration, it is easy to add custom forces to a layout. In this example, the nodes are clustered around four foci using additional forces: the odd nodes are pushed down, the even nodes are pushed up, and a similar bisecting force is applied laterally. These custom forces are based purely on the index of the node, but they could just as easily be derived from properties of data!
|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">|
|Zoom/pan map example: integrates d3.geo with d3.behavior with the aim of|
|producing a map that can be panned and zoomed.|
|Iain Dillingham, http://dillingham.me.uk/|
|<title>Zoom/pan map example</title>|
|# CoffeeScript for http://dealloc.me/demos/crime/2011.html|
|# Copyright (c) 2011 Justin Palmer <http://github.com/Caged>|
|# LICENSE: http://www.opensource.org/licenses/mit-license.php|
|hash = document.location.hash|
|year = if hash then hash.replace('#', '') else 2011|
|[pt,pl,pb,pr] = [35, 20, 20, 20]|
|w = (900 - (pl + pr)) / 2|
|h = w|