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

98 Коммитов

Автор SHA1 Сообщение Дата
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 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 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
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 1a6163cb1a Add d3.geom.quadtree. 2011-01-21 11:59:05 -08:00
Michael Bostock 65307730a3 Add d3.layout.stack, d3.min, d3.max. 2011-01-17 12:27:29 -08: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 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
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
Michael Bostock 7278115d96 Update version to 0.27.1. 2010-12-06 15:36:22 -08:00
Michael Bostock 6d97ab2218 Add `classed` operator for toggling CSS classes. 2010-11-30 13:40:05 -08:00
Michael Bostock bbcf25ef7d Fix a bug with zero-duration transitions.
Also, don't generate chords if both the source and target value are zero.
2010-11-28 16:28:48 -08:00
Mike Bostock 6307364a45 Add layout module, with layout.chord class. 2010-11-28 13:15:07 -08:00
Mike Bostock f02364dada More refactoring of svg.chord. 2010-11-28 11:39:35 -08:00
Mike Bostock c86d8bc1be Allow chords to link back to themselves. 2010-11-27 18:19:30 -08:00
Mike Bostock 5ae51b2538 Simplify svg.chord API.
We now use the same property accessors (startAngle, endAngle and radius) for
two source and target objects. Note that you don't have to structure your data
hierarchically; you can define a source and target accessor that restructures
the data on the fly.
2010-11-27 14:13:02 -08:00
Michael Bostock c021172fe8 Add d3.{split,merge}.
These are symmetric operators for splitting and merging (blending) arrays. The
split operator is useful for line and area charts where some of the data
points may be undefined; split the data into subarrays and render each as its
own line or area. This commit also fixes a bug in d3.svg.line when the data
array is empty.
2010-11-27 10:35:11 -08:00
Mike Bostock 163a37e7cd Add svg.chord class. 2010-11-27 01:07:00 -08:00
Michael Bostock b786b5c607 Add b-spline support to d3.svg.{line,area}.
I'll add support for other types of splines shortly. These classes now also
support constants for the various x and y properties. Also, the area class can
now be used with a variable baseline (y0) for creating streamgraphs. I will
update the current streamgraph demo to use d3.svg.area in a future commit.
2010-11-26 17:55:45 -08:00
Michael Bostock 46b5d541bd Minor beautification. 2010-11-22 23:58:27 -08:00
Michael Bostock 9761e25a4a Fix externs. Fix reentrant events. 2010-11-18 17:33:56 -08:00
Michael Bostock 35ec68a74e RGB-HSL and HSL-RGB conversion. New categorical colors. 2010-11-16 00:05:22 -08:00
Michael Bostock 7cb9d581b2 Add selection.node(). 2010-11-11 18:32:13 -08:00
Michael Bostock 9f9255800a Add transition.remove. Better staged transitions.
Transitions created within the end event of an earlier transition now reuse
the same transition ID, which allows staged transitions to continue in
parallel even if the a later transition has been scheduled. Now that
transitions support remove, we can dispatch transition end events even if the
active transition does not own the element.
2010-11-10 15:46:58 -08:00
Michael Bostock 7f7ce5cc09 Another fix for concurrent transitions.
Don't run older transitions after newer transitions complete.
2010-11-09 17:54:52 -08:00
Michael Bostock cf6db8aed2 Fix overlapping exit & update transitions. 2010-11-09 16:14:49 -08:00
Michael Bostock 138fd92978 Add Mercator projection. 2010-11-09 14:45:31 -08:00
Michael Bostock d21a500ea8 Fix bug in style tween. 2010-11-09 14:42:31 -08:00
Michael Bostock caab7aabd7 Cancel concurrent transitions. 2010-11-08 22:49:31 -08:00
Michael Bostock ef4088ebbe Defer interpolator initialization.
We don't want to compute the start value of the interpolator until the
instance starts transitioning.
2010-11-08 21:55:31 -08:00
Michael Bostock 57059e32a3 Replace previous optimization with filter.
It's probably best to assume that if the attr is being set, it's changing, and
therefore we shouldn't check the original value. The caller can now use the
filter operator to optimize, if needed.
2010-11-07 08:53:34 -08:00
Michael Bostock cfe47b5ad5 Add mouseover interaction to Voronoi example.
Also, change svg.mouse so that it returns an array [x, y] rather than {x, y};
this makes it easier to convert to a string, e.g., for SVG's transform
attribute. Also, optimize selection.attr so that it checks the attribute value
before setting the attribute. (I thought it would be slower to check, but
surprisingly it's not!)
2010-11-07 00:12:45 -07:00
Michael Bostock 46b80565c9 Almost complete strptime & strftime. 2010-11-05 16:23:53 -07:00
Michael Bostock 197ff6bd56 Optimize csv.parse slightly. 2010-11-05 00:36:34 -07:00
Michael Bostock 4e6dc7c5a8 Globals in development version need d3_ prefix. 2010-11-05 00:30:23 -07:00