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

381 Коммитов

Автор SHA1 Сообщение Дата
Mike Bostock c1d7fbc172 Merge branch 'touch' into release
This includes nearly a complete rewrite of d3.behavior.zoom, more closely
modeled after the Polymaps po.drag, po.touch and po.wheel classes. This makes
the code simpler and also fixes a bug when releasing one of two fingers.
2011-07-09 20:30:14 -07:00
Mike Bostock aa928b6c3e Merge branch 'jasondavies/force-touch' into release
I simplified the implementation to only support single-touch. I also opted not
to include touch support in the force-dynamic example (and other examples), just
because it complicates the examples too much. Touch is nice but I don't want it
to interfere with people learning the basics.

This merge also has an extra bonus fix: you can now have multiple force layouts
with dragging on the same page, and the drag behavior will do the direct the
event to the appropriate force layout.
2011-07-09 15:55:44 -07:00
Mike Bostock 0bedbd739f Merge branch 'kde' into release 2011-07-09 14:45:19 -07:00
Mike Bostock 4cb00f4e92 Add force-directed map example. 2011-07-08 22:39:34 -07:00
Jason Davies 7f8db7fd14 Remove force.gravityCenter.
Simpler to perform gravity calculations in a custom tick handler.
2011-07-09 00:24:17 +01:00
Jason Davies ca8870778a Add per-node gravity: force.gravityCenter.
This allows the Dorling/Demers cartograms to be slightly closer to the real
geography.

Also, fix the Dorling collision detection as self-collisions were previously
being detected.  Thanks, Mike!

Lastly, I've removed the variable per-link distance as this is no longer needed.
2011-07-08 23:23:50 +01:00
Jason Davies 287b2ea59e Add strokes to Dorling and Demers cartograms. 2011-07-08 22:55:23 +01:00
Jason Davies 9f0e6271f9 Add Demers cartogram example.
Like a Dorling cartogram, but with squares instead of circles.
2011-07-08 22:41:01 +01:00
Jason Davies 564418ff62 Nicer colors for Dorling cartogram. 2011-07-08 22:19:28 +01:00
Jason Davies bb5d7873a7 Use collision detection for Dorling cartogram. 2011-07-08 22:11:49 +01:00
Jason Davies 679d816dfd Initial version of Dorling cartogram example.
This version uses variable-length links, but I think collision detection
performed after initial positioning at state centroids would look better.
2011-07-08 21:55:31 +01:00
Jason Davies 71490ced64 Add missing force.linkStrength property.
Also update examples to use force.linkDistance instead of force.distance.
2011-07-08 21:23:41 +01:00
Jason Davies fe11bc6493 Remove dangling d3.stats.js reference. 2011-07-06 23:19:45 +01:00
Jason Davies 2e765ae60e Move data files and delete symlinks. 2011-07-06 20:29:48 +01:00
Jason Davies 7c461b2205 Merge branch 'master' into kde
Conflicts:
	Makefile
	d3.js
	d3.min.js
	src/core/sum.js
2011-07-06 19:54:58 +01:00
Jason Davies e0a0455f7b Move d3.stats to external lib, science.stats.js! 2011-07-06 18:57:14 +01:00
Mike Bostock 489eb0cde7 Delete symlinks. 2011-07-04 09:43:37 -07:00
Mike Bostock 1104e6fd83 Move flare-imports.json to the data folder. 2011-07-04 09:41:32 -07:00
Mike Bostock b6983951e1 Merge branch 'master' of https://github.com/jmalonzo/d3 into jmalonzo-master 2011-07-04 09:38:25 -07:00
Jan Alonzo 598cd6a08c Update cartogram/choropleth symlink to point to examples/data.
Related: 6bdbe4b863
2011-07-04 17:05:56 +10:00
Mike Bostock 1e64727eca Prettier colors. 2011-07-03 07:59:09 -07:00
Mike Bostock 6e972732d8 Add force toggle example. 2011-07-03 07:46:07 -07:00
Mike Bostock 0696bf089f Backwards-compatibility for inlining.
There's now a new API for invoking the hierarchy layout (hierarchy.nodes) rather
than calling the layout function directly. Calling the new API enables inlining,
which is disabled by default for backwards-compatibility.
2011-07-02 17:14:34 -07:00
Mike Bostock 4bf829f46f Add expandable tree. 2011-07-02 16:38:00 -07:00
Mike Bostock 70b9f51ba4 Fix interrupted transitions. 2011-07-02 16:36:59 -07:00
Mike Bostock 6bdbe4b863 Move data files into examples directory.
This way, we don't need symlinks (which don't work on Windows). This commit also
simplifies the structure of the flare.json file, so that we don't need to tricky
conversion of the JSON map—it can be read directly by the hierarchy layout.
2011-07-02 16:31:12 -07:00
Mike Bostock bd505a22a9 Remove `inline` property, making it the default. 2011-07-02 15:59:19 -07:00
Mike Bostock 2773cd9f27 Adopt inline(true) for all hierarchy examples.
The ones with transitions were a bit trickier, because they depended on the
layout creating new copy of the nodes when the layout runs.
2011-07-02 15:49:50 -07:00
Mike Bostock 35fb91d16f Allow quadtree to be built dynamically.
You can now specify the domain of the quadtree upon construction, such that you
can add points to the quadtree dynamically later. The quadtree example now also
shows how to do a quick rectangular search using the quadtree.
2011-06-28 13:27:03 -07:00
Mike Bostock e2cedca817 Better stroke colors. 2011-06-25 13:26:32 -07:00
Mike Bostock a0fd9853f5 Always use the larger value for chord sources. 2011-06-25 10:48:31 -07:00
Mike Bostock b14b441f55 Add flare dependency chord diagram. 2011-06-25 10:41:38 -07:00
Mike Bostock eac8831208 Add d3.svg.area.radial. 2011-06-23 20:49:33 -07:00
Mike Bostock cb3ffebc89 Replace basis+beta with bundle+tension.
There's already a tension parameter, and it seems reasonable to overload this
parameter (originally intended for cardinal splines) to also apply to bundle
splines. The new "bundle" interpolation is identical to "basis" interpolation;
the only difference is that the tension parameter is used to straighten the
basis spline.
2011-06-23 11:28:55 -07:00
Mike Bostock a934fd0511 Extract duplicate code from bundle examples. 2011-06-22 17:09:31 -07:00
Mike Bostock 641ccf18c3 Rename bundle.css. 2011-06-22 16:49:01 -07:00
Mike Bostock 2069d26e1a Simplify mouseover interaction. 2011-06-22 16:42:14 -07:00
Mike Bostock 96a565e314 Add d3.svg.diagonal.radial. 2011-06-22 14:33:34 -07:00
Mike Bostock e60ac77e25 Add d3.svg.line.radial. 2011-06-22 13:17:18 -07:00
Jason Davies 9915e30d9c Listen for "mousemove" on window.
I think this gives a better experience on big monitors. :-) I've also used
d3.timer to update the paths in case there is a backlog of mousemove events.
I'm not sure this is necessary but in testing on a fast machine sometimes it
processes two mousemove events and only draws the most recent one with this
change.
2011-06-22 20:03:49 +01:00
Jason Davies 4efd99f6be Revert "Use approximate sin/cos for faster interpolation."
This reverts commit c5450fa62a.

It turns out this approximation is not that much faster than Math.{sin,cos}; I
think the perceived performance is more related to the responsiveness to the
"mousemove" event.
2011-06-22 19:54:43 +01:00
Jason Davies c5450fa62a Use approximate sin/cos for faster interpolation.
This particular approximation is taken from
<http://www.devmaster.net/forums/showthread.php?t=5784> but there may well be
better ones out there.  This seems to work nicely though!
2011-06-22 18:56:58 +01:00
Mike Bostock 5f41452ed2 Change bundle strength on mousemove. 2011-06-22 10:25:57 -07:00
Mike Bostock 0aba0702a5 Hierarchical edge bundling improvements.
The input to the layout is now an array of edges to bundle, rather than nodes.
This eliminates the need for an `outgoing` accessor, since the links are passed
to the bundle layout directly.

The svg line generator now supports a beta (straightening; bundle strength)
parameter. I haven't decided if this is the right place or the right name for
it, but it seems like a reasonable starting point. I'm not happy with the cos &
sin needed to produce radial lines (both here and for the diagonal projection in
other examples), but I don't have a good alternative yet.

This commit also tries to make the construction of the links from the layout
nodes a bit easier to follow. The previous code was used another intermediate
representation, and I think it's cleaner to construct the default format
expected by the layouts. However, there's still a good chunk of code required to
massage the JSON format into a node hierarchy and array of dependencies, so I'd
like to find a way to simplify that, too.
2011-06-22 09:46:52 -07:00
Jason Davies 65a2370526 Make d3.layout.bundle layout-independent.
I've included an example of using it with treemaps.
2011-06-22 09:11:23 +01:00
Jason Davies b17d4e1133 Minor clean ups. 2011-06-17 18:39:56 +01:00
Jason Davies a386da4e6c Add hierarchical edge bundling layout!
Based on <http://cs.stanford.edu/people/mbostock/iv/dependency-tree.html>.

See #194.
2011-06-17 18:34:49 +01:00
Jason Davies b7e20a4310 Couple of tweaks to reset gravity.
Firstly, when the mouse exits the area the gravity coordinates are nullified.
Secondly, if the user switches to another window, the gravity coordinates are
nullified (otherwise the appropriate "mouseout" event may be missed).
2011-06-15 23:20:14 +01:00
Mike Bostock 563b6d1cc3 Merge branch 'boid' 2011-06-12 14:07:08 -07:00
Jason Davies cac32ebc58 Move d3.ai.boid to voroboids example.
From Mike:

> This way, we keep the core library small, and we can make
> non-backwards compatible changes without bumping the major version
> number.
2011-06-12 21:40:58 +01:00
Jason Davies 0270071984 Merge remote branch 'mbostock/boid' into boid 2011-06-12 21:13:43 +01:00
Mike Bostock 24431337d7 Add force multi-foci example. 2011-06-12 13:11:48 -07:00
Mike Bostock fe9ed1bd1d Color voronoi cells by area. 2011-06-12 12:59:02 -07:00
Jason Davies a8bc56d914 U.S. spelling for consistency. 2011-06-12 20:42:36 +01:00
Jason Davies 3d3ac3b147 Add "boid" flocking: d3.ai.boid().
Includes interactive "voroboids" example!
2011-06-12 20:09:15 +01:00
Mike Bostock 9bf55832ea Minor tweak. 2011-06-11 17:15:35 -07:00
Mike Bostock 54031e1363 Add superformula explorer. 2011-06-11 16:59:42 -07:00
Mike Bostock acdc72799e Relocate superformula dot example. 2011-06-11 13:00:28 -07:00
Mike Bostock 920d980b3b Move d3.svg.superformula into an example.
This way, people can play with superformulas if they want them, but we keep the
core library small. If we want to replace the default symbol implementation with
superformulas in the future, we can do that too. For now, be conservative.
2011-06-11 12:54:44 -07:00
Mike Bostock 852ac949d2 Merge branch 'master' into superformula 2011-06-11 12:49:22 -07:00
Mike Bostock d756caa0d8 Simplify subclassing of hierarchy layout.
The subclasses can't use the same object as the parent class, because they are
functions. But, there's no reason to duplicate the code that rebinds the methods
onto the subclass.
2011-06-11 11:31:42 -07:00
Mike Bostock 96837e4d0d Add title. 2011-06-06 22:50:10 -07:00
Mike Bostock bfa1a6e48f Add d3.svg.superformula. 2011-06-06 22:38:08 -07:00
Jason Davies e8b7177396 Extract stats code from Q-Q example. 2011-06-06 09:12:32 +01:00
Mike Bostock 953bebb17c Add zoomable icicle & sunburst. 2011-06-02 23:25:28 -07:00
Mike Bostock d68551b59b Add Marimekko chart example. 2011-06-02 12:17:41 -07:00
Mike Bostock a1cc8cbef2 Merge branch 'master' into azimuthal 2011-05-30 09:29:34 -07:00
Mike Bostock e2fc8bfe52 Merge branch 'master' into azimuthal 2011-05-28 22:57:18 -07:00
Mike Bostock b9eff658a3 Stereographic & orthographic projections!
These now have arbitrary origins, as well. Still need to clip, though.
2011-05-28 00:13:53 -07:00
Mike Bostock 0eb59e7c98 Merge branch 'horizon' into release 2011-05-27 14:58:06 -07:00
Mike Bostock 16c40a1b3e Merge remote-tracking branch 'jasondavies/new-parens' into release 2011-05-27 14:54:15 -07:00
Mike Bostock 98ef2d185f Prefer style over attr. 2011-05-26 21:15:28 -07:00
Mike Bostock c75ebe10a9 Transitions for horizon bands! 2011-05-26 00:10:14 -07:00
Jason Davies 02b478367a Dynamic force example: Safari/multi-touch support.
For some reason Safari wasn't capturing `mousemove` events on the <svg> element
unless a suitable <rect> was added.
2011-05-23 21:09:04 +01:00
Jason Davies 5f03fa2276 Merge branch 'mbostock-master' into kde
Add missing `d3.sum` source file too.

Conflicts:
	Makefile
	d3.chart.min.js
	d3.js
	d3.min.js
2011-05-23 09:45:34 +01:00
Mike Bostock a15165398d Horizon chart improvements.
Use width and height attributes instead of size, for consistency with other
chart templates. (Though, note that chart templates are inconsistent with
layouts in this regard, which use a size property. But let's remain locally
consistent for now.) Default x and y properties to [0] and [1] to match the
defaults of d3.svg.area.

Add support for mode and interpolate properties. The mode can be either "offset"
or "mirror", with the default being "offset". The interpolate property is the
same as that used by d3.svg.area, and defaults to "linear".

The horizon chart now properly clips the horizon layers, such that if a horizon
chart is use within a larger SVG element, it will not extend the chart bounds.
In addition, this commit fixes a bug in how unique IDs are assigned to the clip
and area paths; it's a shame that SVG does not support a way to refer to paths
locally.

Note that because negative values are offset or mirrored, the horizon chart will
render twice as many paths (use elements) as the requested number of bands. For
example, if the default bands of 1 is used, there will be one negative band and
one positive band. In the data has no negative values, then the negative band
will be empty. Keep this in mind as it affects the layer's class attribute
(such as "q0-3" and "q2-3" for the default single-band horizon).
2011-05-22 11:26:46 -07:00
Jason Davies 3941be193a Remove extraneous parentheses from `new` operator.
Parentheses are optional if there are no arguments.
2011-05-22 10:22:28 +01: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
Jason Davies 5e606729a4 Add reusable horizon chart.
Still to do: support negative values (offset or mirror modes).

Fixes #152.
2011-05-21 10:24:23 +01:00
Mike Bostock a5d46990c6 Merge branch 'master' into histogram 2011-05-20 16:31:51 -07:00
Jason Davies 987755b01e Updates. 2011-05-14 18:58:30 +01: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
Jason Davies 4898052101 Add bandwidth selectors for Gaussian kernels.
Thanks @jfirebaugh for the suggestion!  Implementation is based on that of R's
stats module:
<http://stat.ethz.ch/R-manual/R-patched/library/stats/html/bandwidth.html>

This brings a few additional operators to `d3.stats`, including a fairly
rudimentary implementation of variance, discussed at
<http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Two-pass_algorithm>.
2011-05-10 19:06:24 +01:00
Mike Bostock 5259ee9dc4 Merge branch 'histogram' into kde 2011-05-09 20:32:27 -07:00
Jason Davies 7c533d26cc Add kernel density estimation.
Kernel density estimation is provided via `d3.stats.kde` and the kernel is
configurable; several common kernels are provided in `d3.stats.kernel`.
2011-05-10 00:11:31 +01: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