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

203 Коммитов

Автор SHA1 Сообщение Дата
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
Michael Bostock 085eb2fcd0 Add path.area().
This computes the projected area (in square pixels) of the given GeoJSON
object. This is useful for producing choropleth maps that area normalized to
the visible area.
2011-01-04 14:14:53 -08:00
Michael Bostock 19d478f3e0 Add quantile scale. 2011-01-03 10:30:36 -08:00
Michael Bostock 2cdaf6ad00 Fix a bug when rendering certain arcs.
Also, don't forget you need attr("fill-rule", "evenodd") for rings!
2010-12-17 12:50:53 -08:00
Jeffrey Heer 5067f0a35d Move cardinal splines to svg/line.js 2010-12-15 22:06:24 -08:00
Jeffrey Heer 633a931f5b Add cardinal splines and clustered graph example 2010-12-15 09:32:29 -08:00
Jeffrey Heer 70cb5359c9 Merge branch 'master' of git://github.com/mbostock/d3 2010-12-15 08:46:23 -08:00
Michael Bostock 8f757c2ffe Update version number. 2010-12-14 14:41:41 -08:00
Michael Bostock c8a2c9d800 Placeholder ticks for d3.scale.pow.
Just reuse the linear tick algorithm for now.
2010-12-14 14:41:04 -08:00
Michael Bostock be85713584 Fix bug in `classed` operator.
Need to reset the `lastIndex` attribute of the regular expression to 0.
2010-12-10 16:14:42 -08:00
Mike Bostock 2bdf55ce9c Better XHR utilities.
Two new XHR utilities are included in this commit for fetching XML and HTML
data. The latter can be used to scrape data from websites that don't support a
more suitable API (such as JSON or XML), conveniently using the W3C DOM API
including selectors.

Parsing HTML is surprisingly tricky, as browser support for it is poorly
standardized. It's possible to embed the HTML in the current document or an
iframe, but that runs embedded scripts and loads external resources (images,
stylesheets), which is a security hazard!

Our approach uses the DOM Level 2 Range API, and the nonstandard
createContextualFragment method, which is supported by major browsers.
Strangely, WebKit (Chrome & Safari) can only access the body of the loaded
HTML document, whereas Firefox parses the whole document.
2010-12-09 15:04:24 -08:00
Mike Bostock 8a6d054e6b Clarify Tornado installation instructions. 2010-12-09 14:46:45 -08:00
Jeffrey Heer b9ad0a4af1 Minor tweaks and beautification 2010-12-06 20:48:11 -08:00