This adds d3.layout.pie, which can be used to compute the start and end angles for arcs given an arbitrary array of data. In addition, d3.svg.arc now has a `centroid` method that computes the center of the arc, useful for labeling. Together these changes greatly simplify the donut & pie examples. This commit also includes a `map` method for selections, which is similar to the `filter` method. This allows you to map the data bound to the current selection. I'm not currently using it, but it seems like a useful feature for those cases where you want to rebind the current selection to different (but related) data.
D3 now supports Sizzle, preferring Sizzle to the native Selectors API if Sizzle is available. Sizzle internally uses the native Selectors API and thus this should have minimal performance implications; also, it allows you to use Sizzle proprietary extensions such as ":first". This commit also restricts the definition of the enter selection so that only append and insert operations are defined. The other operations were generally unsupported anyway, and it cleans up the code to have separate implementations for insert and append. (I might enable additional operations in the future, such as `filter`, `sort` and `each`, but this seems like a reasonable first pass.)
Includes, as the first behavior, a pan & zoom behavior. The canvas can be panned by dragging the mouse, and zoomed using the mousewheel (or by double-click). By listening to redraw events, users can decide whether to implement geometric zooming (such as by setting the "transform" attribute on an `svg:g` element) or semantic zooming (by changing the domain of a scale object and repositioning elements). This commit also includes two bug fixes. The `d3.format` class now properly groups thousands of negative numbers, and supports the sign specifier. The unicode minus symbol \u2212 is used for negative values. The `d3.scale.pow` class now properly handles negative numbers, as well.
First, always coerce the tween target value (the value of the style or attribute at the end of the transition) to a string. This guarantees that the correct interpolator is chosen, and avoids a null dereference. Second, default color channels to zero rather than undefined, so as to avoid NaN channel values if there is an error parsing the color. This can occur, say, if the background color of a div is unset and defaults to "rgba(0, 0, 0, 0)".
The data join is now specified as a single function of data, as with all other properties. This allows the key to be computed on the previously-bound data, rather than requiring the key to be serialized into the DOM (say, as an attribute). In the case that there is no previously-bound data, it is still possible to access the associated node as the `this` context. The `enter` operator no longer performs an append. For symmetry with the `exit` operator, you must call `append` after obtaining the entering selection. This requires a tiny bit more code, but should make the code more clear. Also, it provides an opportunity to use a different instantiation operator, such as the new `insert` operator. This takes a second argument, which is a selector for the insert-before reference element. For example, the selector ":first-child" will prepend nodes. The `empty` operator allows you to query whether a selection is empty (i.e., contains zero matching nodes).
You can now override the scale interpolator by calling the `interpolate` method. One particularly useful interpolator is the new `d3.interpolateRound`, which is like `interpolateNumber`, except that it returns integers. This makes it easier to produce a scale that outputs exact pixel values, and avoid antialiasing artifacts. For convenience, the quantitative scales have a `rangeRound` method which sets the range and the interpolator at the same time. Similarly, a `rangeRoundBands` has been added to the ordinal scale.