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

245 Коммитов

Автор SHA1 Сообщение Дата
Mike Bostock 98ef2d185f Prefer style over attr. 2011-05-26 21:15:28 -07:00
Mike Bostock ce52261abf Default bins using Sturges' formula. 2011-05-21 16:56:12 -07:00
Mike Bostock 08a5aa383f Histogram improvements.
Rename `ticks` to `bins` to match numpy, matplotlib, and Protovis. Also allow
the bins to be specified simply as a count, in which case the range is divided
uniformly into the specified number of bins.

The histogram layout now also takes a `range` property, which specifies the
minimum and maximum value of the histogram rather than implicitly computing it
from the values, which is nice if you expect values to fall in a specific range,
such as [0,1].
2011-05-21 16:38:29 -07:00
Mike Bostock 6ba3097766 Add d3.bisect.
This is similar to pv.search, but more closely modeled after Python's bisect
methods to provide the desired flexibility in searching slices of arrays. This
includes good tests for bisect, and better tests for polylinear and quantile
scales (both of which now use bisect).
2011-05-21 12:56:06 -07:00
Mike Bostock a5d46990c6 Merge branch 'master' into histogram 2011-05-20 16:31:51 -07:00
Mike Bostock 4c998ba2cc Propagate touch identifier in d3.svg.touches.
Also, add a fun little example demonstrating multi-touch.
2011-05-12 11:54:38 -07:00
Mike Bostock e1c6c74f70 Merge branch '===' into release 2011-05-07 16:42:59 -07:00
Mike Bostock b1b6b14143 Merge branch 'monotone' into release 2011-05-07 16:34:01 -07:00
Mike Bostock 86a4f6fa3d Merge remote-tracking branch 'jasondavies/histogram' into histogram 2011-05-02 18:51:36 -07:00
Mike Bostock a3aebbad56 Merge remote-tracking branch 'jasondavies/monotone' into basis 2011-05-02 18:46:08 -07:00
Mike Bostock a0d4d0bd8e Add cardinal-open interpolation. 2011-05-02 18:42:39 -07:00
Mike Bostock d1c406f43c Add basis-open interpolation. 2011-05-02 17:11:44 -07:00
Jason Davies ae5123f84b Add monotone interpolation for lines and areas.
Based on the Protovis implementation.
2011-05-02 09:13:52 +01:00
Jason Davies 0f2846ef17 Add doctype to all examples for consistency. 2011-05-02 00:15:09 +01:00
Jason Davies 48a40eccea Add histogram layout. 2011-05-02 00:04:06 +01:00
Mike Bostock f76e5159b5 Merge branch 'jasondavies-qq'
* jasondavies-qq:
  Improvements to qq chart.
  Add x- and y-scales to Q-Q plot.
  Add Q-Q plot.
2011-04-30 21:18:52 -07:00
Mike Bostock 71622b7cdb Improvements to qq chart. 2011-04-30 21:16:58 -07:00
Mike Bostock 1eaff450d5 Merge branch 'jasondavies-spline-editor'
* jasondavies-spline-editor:
  Minor improvements to spline example.
  Simplify path handling.
  Bind mouse event handlers to window.
  Move spline editor to standalone directory.
  Add spline editor example.
2011-04-30 16:50:45 -07:00
Mike Bostock 5069739b0a Minor improvements to spline example. 2011-04-30 16:47:38 -07:00
Mike Bostock 7c1530fd41 Merge branch 'jasondavies-sort'
* jasondavies-sort:
  Sort example improvements.
  Add parallel option to merge sort example.
  Add animated merge sort example.
2011-04-30 15:58:56 -07:00
Mike Bostock a92535ce8b Sort example improvements.
Simplify the implementation of parallel merge-sort, so that we have one pass per
swap across chunks. Use a data join so that the elements are translated rather
than rotated, since this better conveys the underlying sort. Auto-play the
animation in parallel, and restart a few seconds after it finishes.
2011-04-30 15:56:03 -07:00
Mike Bostock 93ac0c0b14 Add pixelbreaker link. 2011-04-30 13:19:28 -07:00
Mike Bostock c293fde197 Prettify clock example. 2011-04-30 13:13:51 -07:00
Jason Davies 392bcab8f8 Add polar clock example. 2011-04-30 00:19:42 +01:00
Jason Davies f049cb0eaf Add parallel option to merge sort example.
This simply shows the merges happening in parallel.
2011-04-29 16:09:56 +01:00
Jason Davies 249c4f2f0f Add animated merge sort example.
Inspired by the phrase "reminiscent of wind gusting over tall grasses" in
<http://vis.stanford.edu/protovis/ex/sort.html>.

It seemed abominable not to animate the swaying tall grasses!
2011-04-29 15:14:55 +01:00
Jason Davies 1c2546050f Simplify path handling.
There will always be a single <path> element, so no need to handle enter, update
and exit cases.  WebKit seems to erroneously warn (in the error console) that it
can't parse `d=""`.  I can't see anything in the SVG spec disallowing an empty
`d` attribute so I think this is safe to ignore.
2011-04-29 10:14:15 +01:00
Jason Davies 3e72f75f3e Bind mouse event handlers to window.
This produces much nicer behaviour when the mouse dragged outside the <svg>'s
area.  Thanks, Mike!
2011-04-29 10:02:28 +01:00
Jason Davies de1e679cfc Move spline editor to standalone directory.
I've dropped path transitions on Mike's recommendation as D3 doesn't have smart
path interpolation at the moment so they don't work too well.

I've also fixed some issues with data joins.
2011-04-27 21:11:55 +01:00
Jason Davies beb53fe035 Add spline editor example. 2011-04-27 12:20:29 +01:00
Square 3502c5fdf5 Tweak force-dynamic example. 2011-04-26 17:19:43 -07:00
Square f9d0d423f0 Tweak parameters for force example. 2011-04-26 15:50:22 -07:00
Jason Davies 07674c286f Add x- and y-scales to Q-Q plot. 2011-04-25 12:59:11 +01:00
Jason Davies 82153e60b5 Add Q-Q plot. 2011-04-25 11:44:34 +01:00
Mike Bostock 83cb0f09f5 Fix simulation restarting.
If the simulation cools and stops, we need to restart it, rather than just
resetting the alpha parameter. So, it is useful to have both `resume` and
`start` methods on the force layout. This commit also fixes a bug where
mousedown events on draggable nodes would continue to propagate, interfering
with other events (such as clicking to add a node).
2011-04-19 18:02:19 -07:00
Mike Bostock 6804b1c86c Better force layout for dynamic graphs.
You can now register the "drag" behavior on nodes multiple times, and the
correct behavior will result. In addition, the gravitational force now handles
coincident nodes, computing a small random force to separate the nodes rather
than setting the position to NaN.

To demonstrate the new support for dynamic graphs, this commit includes a fun
example where you can click to add new nodes. Any existing nodes within a fixed
distance to the cursor on click will be linked to the new node.
2011-04-19 13:47:19 -07:00
Mike Bostock 7abebefe1e Better center gravity.
Rather than applying gravity to the entire graph, we now apply it to individual
nodes, such that disconnected nodes and subgraphs still have a tendency to drift
towards the center. In addition, rather than using a standard gravitational
force that drops quadratically with distance, we use a weak spring who force
increases with distance. This makes the gravitational effect less noticeable
near the center, and also makes the effect stronger the more the nodes drift
from the center. To balance the center "gravity" with the repulsive charge
force, we also normalize the strength of the gravity based on the number of
nodes in the graph.
2011-04-19 13:03:41 -07:00
Mike Bostock fd804ce47f Better force layout.
Use Barnes-Hut criterion (a fast multipole method) for approximating repulsive
charge forces between nodes. This replaces the previous approach using Floyd-
Warshall to compute the graph theoretic distance between all nodes, eliminating
O(n^3) initialization time. Additionally, the charge force is now O(n lg n) per
iteration rather than O(n^2).

Using the center of mass of the graph, apply gravitional attraction towards the
graph center (based on the layout size). This encourages the graph to stay near
the center rather than drifting away.
2011-04-19 12:39:37 -07:00
Mike Bostock 587b1bb494 Use x+y objects for quadtree points.
This makes the quadtree implementation more compatible with the force layout.
This change is backwards-compatible; if the points are not specified as x+y
objects, they are assumed to be tuples and converted to objects.
2011-04-19 12:19:04 -07:00
Mike Bostock 43e2ccca41 Fix fill color for iOS. 2011-04-14 16:53:33 -07:00
Jason Davies df01727c63 Add some more strict equality checks. 2011-04-14 23:23:53 +01:00
Mike Bostock f028aa00d9 Add bubble chart example. 2011-04-14 14:20:07 -07:00
Mike Bostock de3d1c1a6c Remove examples/index.html.
This is no longer needed, as Python's SimpleHTTPServer does directory listing.
2011-04-13 23:59:15 -07:00
Mike Bostock d4e571eb88 Replace flare.json's with symlinks. 2011-04-13 23:58:46 -07:00
Mike Bostock 2eb4573f42 Merge branch 'box' into release 2011-04-13 23:53:59 -07:00
Mike Bostock 39dea0102f Merge branch 'cluster' into release 2011-04-13 23:51:29 -07:00
Mike Bostock 126e625d21 Add d3.svg.diagonal.
This is a utility for creating a Bézier curve between opposite corners of a
rectangle. This is commonly used to draw smooth curves connecting parent and
child nodes in a hierarchical node-link diagram. A projection may be specified
which allows the curve to be transformed from polar coordinates.

This commit also changes the semantics of the recently-added `links` method,
such that the objects have `source` and `target` properties that match the
default diagonal format.
2011-04-13 23:13:06 -07:00
Mike Bostock 8d7bd91080 Add `links` methods to cluster & tree.
This method can be used to generate an array of parent+child objects for a given
array of nodes. This is convenient for drawing paths from parent to child in
node-link diagrams.
2011-04-13 22:41:30 -07:00
Mike Bostock 60b6a3d2e5 Simplify cluster layout.
The `cluster` layout is now more similar to the `tree` layout, using a
separation function rather than a group property. In addition, the breadth and
depth properties are replaced with x and y, respectively, and scaled according
to the size of the layout.

I've updated the examples to make them more consistent, as well, including the
pretty Bézier curves. In a future commit I'd like to take some of the duplicate
code in the examples and move that into reusable methods.
2011-04-13 22:04:11 -07:00
Mike Bostock c29d4dc1a7 Better box chart transitions.
Preserving object constancy across transitions is tricky! For example, what
happens if we remove the whiskers in a transition? How do we join outliers? This
commit makes a few assumptions explicit:

1. The `quartiles` function must return exactly three elements. This property
must be specified as a function.

2. The `whiskers` function must return exactly 2 elements, or null if no
whiskers are to be displayed. This property must be specified as a function.

3. The `domain` function must return exactly 2 elements, or null if the default
domain should be used. This property can be specified either as a constant or as
a function.

We could generalize this chart to support more than two whiskers, but it doesn't
seem urgent, and it would complicate the transition if the number of whiskers
changes. In a related change, the `whiskers` function does not receive a third
argument containing the quartiles; instead, this is made available by the
`quartiles` property on the values array (the first argument).

The outliers are joined using the `Number` key function. The outlier data is now
stored as indices; this allows reasonable object constancy across transitions
with outliers. Similarly, the tick labels for the quartiles are whiskers are now
separated, such that the whisker labels can be added or removed without spurious
transition.
2011-04-13 17:44:20 -07:00