Граф коммитов

265 Коммитов

Автор SHA1 Сообщение Дата
Michael Bostock 6363881923 Resize a few examples. 2011-02-27 11:56:25 -08:00
Michael Bostock aa69f20936 Restructure choropleth example. 2011-02-25 20:51:05 -08:00
Michael Bostock 198ee5f86d Tweak README. 2011-02-25 10:01:34 -08:00
Michael Bostock a29c802a77 Sort for layout, but don't reorder.
This fixes a bug in the pie layout sorting where we want the sort order to
affect the layout, but not the order in which arcs are rendered—and furthermore
we want the order of arcs to always match the order of data. (If you want to
sort the data, do that before it is passed to the layout.)
2011-02-24 14:36:57 -08:00
Michael Bostock ade083dd56 More convenient pies.
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.
2011-02-24 14:13:05 -08:00
Michael Bostock 23dc44e585 Oops, include sqrt transform. 2011-02-23 13:04:18 -08:00
Michael Bostock 77f81a01fa Merge branch 'master' of github.com:mbostock/d3
Conflicts:
	src/core/core.js
2011-02-23 12:35:41 -08:00
Michael Bostock 3ecb7534ef Non-contiguous cartogram example.
Also includes new d3.geom.polygon.centroid method. Props to Zachary Johnson for
the inspiration!
2011-02-23 12:33:18 -08:00
Mike Bostock 59c32fc669 Fix subgroup sorting in chord layout. 2011-02-23 09:09:43 -08:00
Michael Bostock 6d8a51b7de Merge branch 'array_slice' of https://github.com/jasondavies/d3 into jasondavies-array_slice
Conflicts:
	src/core/call.js
2011-02-19 12:41:21 -08:00
Michael Bostock d563b53d13 Remove slice(arguments). 2011-02-18 15:10:17 -08:00
Jason Davies e6bfd66443 Split `d3_array` into `d3_arrayNodes` and `d3_arrayArguments`. 2011-02-18 19:50:26 +00:00
Jason Davies fe5fdb31c0 Fix `d3_array` for older/more esoteric browsers.
This code is adapted from `makeArray` in Sizzle.js.
2011-02-18 18:40:35 +00:00
Michael Bostock 8da80dcc99 Support for Sizzle.
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.)
2011-02-17 11:56:13 -08:00
Michael Bostock c31590e2f7 Add support for namespaced listeners.
You can now also remove listeners by specifying a null listener.
2011-02-16 09:53:48 -08:00
Jason Davies 67f122b176 Fix scroll events for Firefox 2011-02-16 13:26:54 +00:00
Michael Bostock 77a061f26d Add d3.svg.symbol.
The `symbol` class can be used to generate dot symbols for scatterplots. This
commit also fixes a couple bugs with negative-domain log and pow scales, as well
as tick generation.
2011-02-13 23:20:10 -08:00
Mike Bostock 0e1c1fad17 Add d3.geo.bounds.
This method can be used for computing the bounding box of arbitrary GeoJSON
objects. This commit also fixes a bug in d3.geo.path, such that it will accept
any GeoJSON object, rather than requiring GeoJSON feature objects.
2011-02-11 19:42:52 -08:00
Mike Bostock c34cd15077 Add color-by-area with zoom example.
This uses d3.geo.path to compute the projected area (in square pixels) of each
county in the choropleth. It also usees d3.behavior.zoom to add geometric pan
and zoom.
2011-02-11 17:35:21 -08:00
Michael Bostock 12eb5c13fe Add geometric zooming example. 2011-02-11 13:44:56 -08:00
Michael Bostock d215acef78 Add d3.behavior module.
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.
2011-02-11 13:00:41 -08:00
Michael Bostock b4231227e1 Fix two bugs in transitions.
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)".
2011-02-08 15:59:03 -08:00
Michael Bostock e4935b1bb5 Add brushing & linking to splom. 2011-02-07 09:56:05 -08:00
Michael Bostock 99c31e1637 Don't include empty arrays in d3.split. 2011-02-02 12:59:10 -08:00
Michael Bostock ea5ebb1304 Don't use the null context.
Instead, use the group data array as the context when evaluating the join key
function on the new data.
2011-02-02 12:10:39 -08:00
Michael Bostock 8186c4b764 Restructure chord example. 2011-01-31 21:59:49 -08:00
Michael Bostock f8ae20da9d Simplify data join. Add insert & empty.
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).
2011-01-31 11:00:35 -08:00
Michael Bostock 44e67e29c0 Restructure calendar example. 2011-01-30 22:01:15 -08:00
Michael Bostock 1de75bc55c Fix Firefox bug with style transitions.
You can't set the priority to be undefined; it has to be null. (Even though
null == undefined in JavaScript, but let's not be picky!)
2011-01-28 16:26:09 -08:00
Michael Bostock 811aa10f03 Scale interpolators & range rounding.
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.
2011-01-28 13:14:43 -08:00
Jason Davies 80366082e8 Use `d3.event` to reference current event. 2011-01-27 23:13:56 +00:00
Jason Davies bf4c410a29 Fix for lack of global `event` e.g. in FF 3.6. 2011-01-27 22:58:29 +00:00
Michael Bostock 5748994854 Add d3.scale.quantize.
A quantize scale is much like a linear scale, but it returns a discrete value
from a set range (similar to quantile and ordinal scales).
2011-01-25 11:31:54 -08:00
Michael Bostock 41c91fd037 Merge branch 'force' 2011-01-21 11:59:14 -08:00
Michael Bostock 1a6163cb1a Add d3.geom.quadtree. 2011-01-21 11:59:05 -08:00
Michael Bostock ce07649c53 Move properties.id to id. 2011-01-20 10:40:14 -08:00
Michael Bostock 9ae67c7851 Add ISO-3166 country codes. 2011-01-20 10:25:03 -08:00
Michael Bostock ca2e207573 Fix initial opacity. 2011-01-17 14:16:53 -08:00
Michael Bostock c678ecb447 Remove cruft. 2011-01-17 12:34:02 -08:00
Michael Bostock 870bc20ea6 Remove cruft. 2011-01-17 12:32:19 -08:00
Michael Bostock 65307730a3 Add d3.layout.stack, d3.min, d3.max. 2011-01-17 12:27:29 -08:00
Jason Davies 473ee4fa0b Update examples index. 2011-01-12 00:45:29 +00:00
Michael Bostock 6a4a2d1cc6 Allow d3.geo.albersUsa to be rescaled. 2011-01-11 14:25:25 -08:00
Michael Bostock 487037e1af Merge branch 'jheer-master'
Adds support for contours (d3.geom.contour) and cardinal spline interpolation.
I've extended cardinal spline interpolation to d3.svg.area, and added closed
basis spline interpolation. The spline tension is now set using a named
method, and closed splines can be generated using basis-closed and
cardinal-closed, respectively.

This commit also includes Jeff's nifty clustered force-directed graph example!
2011-01-10 16:05:58 -08:00
Michael Bostock 7048af6b02 Fix a bug in transitions (`tx` is undefined).
If the same element were selected multiple times, then the transition would be
cleared on the associated node, causing `tx` to be undefined. We now abort the
transition in this case, rather than causing a JavaScript error.
2011-01-09 17:33:35 -08:00
Michael Bostock 373ddee706 Add nest, keys, values & entries operators. 2011-01-08 15:18:38 -08:00
Michael Bostock f0bf36690c Fix for nearly whole d3.svg.arc's.
It's surprisingly difficult to render a circle in SVG.
2011-01-05 15:38:38 -08:00
Michael Bostock 888ee9dcfb Reformat us-counties.json for readability. 2011-01-05 15:38:17 -08:00
Michael Bostock bdcb648849 Turn off the compiler's "advanced" optimizations.
The renaming of attributes is totally not worth the hassle of maintaining an
externs file (or using the awkward `foo["bar"]` syntax). The file size
reduction from the advanced optimizations was negligible, besides!
2011-01-05 11:35:39 -08:00
Michael Bostock bfed47b9d9 Ignore NaN in d3.scale.quantile.
Also, expose a `quantiles` method for returning the array of quantile
thresholds.
2011-01-04 15:01:09 -08:00