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

245 Коммитов

Автор SHA1 Сообщение Дата
Jason Davies 12663738d9 Fix quartile calculation.
The outliers were being incorrectly excluded when computing the quartiles.  I've
also added a +/-1.5 IQR whiskers computation for the Morley-Michelson example,
so it replicates the R plot exactly.
2011-04-13 23:40:00 +01:00
Jason Davies f9569c5aac Minor optimisations. 2011-04-13 23:27:52 +01:00
Jason Davies a7b3c3265c Remove unused title svg:g. 2011-04-13 23:20:16 +01:00
Jason Davies 3477764db0 Fix randomize button. 2011-04-13 23:16:10 +01:00
Jason Davies 6c8cef1eef Add Michelson-Morley data for box plot example.
Source: R statistical project
Original source: A. J. Weekes (1986) A Genstat Primer. London: Edward Arnold.
2011-04-13 23:12:18 +01:00
Jason Davies 88eabf1969 Continue renaming "boxplot" to "box". 2011-04-13 22:33:15 +01:00
Jason Davies 0b8aa07ed2 Rename "boxplot" to "box". 2011-04-13 22:31:53 +01:00
Jason Davies d288e69016 Remove `outlierSymbol` property.
Circles are simpler.
2011-04-13 22:27:25 +01:00
Jason Davies 9721e6f045 Display outliers.
The symbol can be specified using the `outlierSymbol` property, which specifies
the `d` attribute for an SVG path.
2011-04-13 21:59:37 +01:00
Jason Davies 755529dba8 Add `whiskers` property to box plot.
This specifies a function that takes the sorted data array, and returns an array
of datum positions that should marked with whiskers.  The default implementation
is to return `[0, length-1]` i.e. the minimum and maximum.

Data outside of the whiskers are considered outliers, and are not included in
the quartile calculation.
2011-04-13 21:23:49 +01:00
Jason Davies 2e8cd200df Add boxplot chart. 2011-04-13 19:57:57 +01:00
Mike Bostock 776f332af6 More pretty Béziers. 2011-04-11 13:52:21 -07:00
Mike Bostock 0ca148d37e Add pretty Bézier curves. 2011-04-11 13:22:24 -07:00
Mike Bostock c5c6614d9e Simplify pack layout.
The pack layout now sorts nodes by ascending value by default. The `radius`
property is removed, as the radius is always computed from the node value. The
`spacing` property is also removed; it doesn't seem particularly useful. The
`radius` property is renamed to `r` to match `x` and `y`.

I also optimized the implementation slightly, and namespaced temporary state
under the prefix `_pack_`.
2011-04-11 12:44:17 -07:00
Jason Davies 5ef525385a Add cluster-radial to examples index. 2011-04-11 11:25:19 +01:00
Jason Davies 6ebe9e5779 Add cluster (dendogram) layout.
Based on the Protovis version.  The only difference is that I've dropped
the `orient`, `innerRadius` and `outerRadius` properties so that the D3
version is more flexible.
2011-04-11 11:19:59 +01:00
Jason Davies ccfbb06729 Add circle-packing layout.
Based on the Protovis layout.  I've kept the convention of using `size`
for the width/height and `separation` for the spacing.  The Protovis
layout had a `size` property but this was used to compute the radius.
I've left this out as I've assumed it's straightforward enough to pass
in the appropriate `radius` function instead.  Likewise, I think the
existing hierarchy `sort` property can handle situations that `order`
was intended for in the Protovis version.
2011-04-11 10:01:11 +01:00
Mike Bostock 9f71e4e211 Fix a bug in cardinal-closed interpolation. 2011-04-10 23:26:35 -07:00
Mike Bostock ca3585ec97 Move tree examples into div#chart. 2011-04-10 18:59:41 -07:00
Mike Bostock 597443b3b0 Rotate text by 180 when upside-down. 2011-04-10 18:37:23 -07:00
Mike Bostock 2c03029045 Compute wrap-around separation. 2011-04-10 13:56:34 -07:00
Mike Bostock 7151746fbe Add tree-radial example. 2011-04-10 13:29:32 -07:00
Mike Bostock 0c88813f56 Generalizing tree layout.
Rather than specifying an orientation, compute the layout in normalized space. In a future change,
I'd also like to clean up the temporary state that is stored on tree nodes, and record dx and dy
attributes per node that could be used to compute a space-filling layout.
2011-04-10 12:07:17 -07:00
Mike Bostock dfd0ad354d Render links below nodes and labels. 2011-04-10 10:45:51 -07:00
Jason Davies f208a5be09 Add Reingold-Tilford tree layout.
This is based on the Protovis layout; virtually no changes were needed
to the code aside from handling of previous and next siblings.
2011-04-10 16:20:51 +01:00
Mike Bostock bf180dc9af Fix a transition bug in bullet chart.
We were computing the tick join based on the (new) format function, but doesn't
produce the desired effect: the new format is applied on the old data. Thus, the
wrong join occurs if, say, the value 0.5 with the new format results in "0". The
correct join compares the old text content to the new format value.
2011-04-09 13:56:28 -07:00
Mike Bostock d9d85f0e03 No initial transition. 2011-04-09 13:00:38 -07:00
Mike Bostock 40be541c4c Restructure bullet chart example. 2011-04-09 12:38:48 -07:00
Jason Davies ef7b5ccb3c Push bullet chart state into ticks element data.
This means chart state (the original x-scale) is no longer bound to the
chart instance, so a single instance can be reused on multiple elements.
2011-04-09 16:41:26 +01:00
Michael Bostock e8b345d0f8 Make randomizer a bit more exciting. 2011-04-08 16:42:43 -07:00
Michael Bostock 448b72622c Rename var. 2011-04-08 16:36:16 -07:00
Michael Bostock 17259b94ff Add another bullet example.
This example shows how to preserve scales across multiples using a single chart
instance, as opposed to bullet-multiples which uses distinct chart instances to
supply separate scales. I still think it'd be better to use a single chart
instance in both cases, but then I need a different place to hide the scale
state.
2011-04-08 16:03:01 -07:00
Michael Bostock 4fda3a3ebf Use separate charts for bullet-multiples.
This way, we get separate scales for the small multiples, which makes sense
given our data. However, I'm not totally convinced this is the right way to
implement separate scales, because it's a bit awkward to create separate chart
instances that look identical. Also, it's unfortunate that the charts are
stateful; it'd be better to somehow store the scale as data on the nodes, so
that chart specifications could be more easily reused. Then, there might be a
method to fix the domain rather than computing the domain per-chart.
2011-04-08 15:46:14 -07:00
Michael Bostock 33260423a3 Extract title & subtitle from bullet chart.
It's nice, but I think it's a bit more flexible to not have it as part of the
chart specification. This way, people can define titles however they like. It
might be nice to take a similar approach with reference ticks in the future.
2011-04-08 14:40:29 -07:00
Jason Davies 598f47e1c9 Simplify bullet charts as per Mike's suggestions. 2011-04-08 18:37:59 +01:00
Jason Davies 0f82a4d047 Simplify bullet multiples example.
Thanks Mike!
2011-04-08 18:25:08 +01:00
Jason Davies 21c7ec3c26 Bullet charts: title and subtitle support. 2011-04-08 11:24:51 +01:00
Jason Davies 202205fa5e Add some missing semicolons. 2011-04-08 10:56:41 +01:00
Jason Davies 6aba18bc61 Bullet charts: support for "right" orientation. 2011-04-08 10:54:12 +01:00
Michael Bostock 1b1a9485cb Bullet chart transitions.
We now preserve object constancy for ticks across transitions. By caching a
reference to the previous x-scale, we can initialize entering objects in the
correct location, then transition them to the new scale as they fade in. Also,
we use the `map` operator to convert the data to a standard representation that
is suitable for the bullet chart, and compute derivate data needed across
multiples.
2011-04-07 16:57:33 -07:00
Jason Davies 34ffbbf1d0 Define bullet chart duration as property. 2011-04-07 22:36:25 +01:00
Jason Davies 34a055adc4 Add optional duration for bullet chart transitions. 2011-04-07 22:29:04 +01:00
Jason Davies 28c54a822f Bullet charts: support dynamic data. 2011-04-07 19:32:48 +01:00
Jason Davies 0e54ee835d Remove extraneous CSS styles from bullet example. 2011-04-07 19:05:15 +01:00
Jason Davies 73de44469b Add example and fixes for bullet multiples. 2011-04-07 18:54:31 +01:00
Jason Davies 344d7da26d Use bound data for bullet chart.
As per Mike's suggestion.
2011-04-07 18:39:35 +01:00
Jason Davies edf75a3c36 Move bullet to new `chart` module. 2011-04-07 17:54:03 +01:00
Jason Davies b08ecad5ed Replace percentages with width/height properties.
Percentages were too tricky for adding margins.
2011-04-06 20:49:15 +01:00
Jason Davies c85195b14b Use percentages for simpler flexibility. 2011-04-06 20:16:12 +01:00
Jason Davies 28fbabf768 First stab at bullet layout. 2011-04-06 19:47:55 +01:00
Michael Bostock b6ec18374b Add some color. 2011-04-01 12:08:37 -07:00
Michael Bostock b49c878e1c Delete examples/__main__.py. 2011-03-30 09:07:08 -07:00
Michael Bostock 286e3d2b06 Merge branch 'examples_index_filename' of https://github.com/jasondavies/d3 into jasondavies-examples_index_filename 2011-03-30 02:59:24 -07:00
Jason Davies 3b2a08a77a Default filename `index.html` for examples server. 2011-03-30 10:32:09 +01:00
Michael Bostock 99c2580971 Obesity data for cartogram. 2011-03-29 14:57:01 -07:00
Michael Bostock 937529eff3 Merge branch 'jasondavies-ie9_xhr' 2011-03-15 09:24:45 -07:00
Michael Bostock 5f4e950002 Sticky treemap layouts!
The treemap layout can now be set to "sticky" mode, which preserves the row
arrangements from an earlier layout. This is particularly handy for animating
treemaps, as it avoids the temporary occlusion as nodes swap positions. Thanks
to @philogb and the New York Times for the inspiration!
2011-03-14 23:39:11 -07:00
Michael Bostock aa0b9f8c3e Restructure sunburst example. 2011-03-12 22:08:17 -08:00
Mike Bostock a00c9a5631 Simplify interpolator slightly. 2011-03-12 21:20:41 -08:00
Mike Bostock 52bf6c978a Expose d3.layout.hierarchy.sort.
Also, add nifty transitions to the sunburst example.
2011-03-12 21:14:07 -08:00
Michael Bostock abae3f9263 Add hierarchy & partition layouts.
Also, expose d3.rebind to make it a bit easier to compose classes.
2011-03-12 10:27:05 -08:00
Michael Bostock 2ace7e6814 Merge branch 'master' into mbostock-master 2011-03-12 09:03:06 -08:00
Michael Bostock 11cea2e332 Merge branch 'master' of github.com:mbostock/d3 2011-03-11 11:40:24 -08:00
Michael Bostock 7c7be4b17c Use linear gradient rather than image. 2011-03-11 11:39:11 -08:00
Mike Bostock 42237509de Display calendar immediately; color on data. 2011-03-10 11:55:26 -08:00
Michael Bostock 4bf129f49e Use localhost rather than 0.0.0.0. 2011-03-09 09:28:21 -08:00
Michael Bostock 31c47f8f99 Tiny simplification. 2011-03-03 16:01:18 -08:00
Michael Bostock 36e935a8c8 Add force & treemap to d3.layout. 2011-03-03 15:43:57 -08:00
Michael Bostock 3cfb007d9d Add proper rounding to treemap layout! 2011-03-03 14:20:18 -08:00
Michael Bostock 125ea93b63 Make force-directed graphs draggable. 2011-02-28 17:02:58 -08:00
Michael Bostock 32c06207a2 Merge branch 'master' of github.com:mbostock/d3 2011-02-28 15:05:37 -08:00
Michael Bostock 6b8839eab6 Add treemap example.
Still a work in progress. Need to decide on the appropriate API for representing
tree structures; not sure I want to go the heavyweight pv.dom route. May also
need rounding to exact pixel values.
2011-02-28 15:04:20 -08:00
Mike Bostock 07fe0f5d90 Restructure cartogram example. 2011-02-28 10:12:25 -08:00
Mike Bostock 99b4f2ec30 Turn off shape-rendering: crispEdges. 2011-02-27 18:34:47 -08:00
Mike Bostock ced7b7242b Better force-directed layout.
Use the Floyd-Warshall algorithm to compute the shortest path between nodes, and
use that graph theoretic distance as the distance constraint for the Gauss-
Seidel relaxation. In addition, have the constraint alpha decay over time, as in
Simulated Annealing.
2011-02-27 18:22:23 -08:00
Michael Bostock 62ef98e817 Restructure voronoi example. 2011-02-27 13:05:55 -08:00
Michael Bostock b8cc4c9708 Restructure stack and stream examples. 2011-02-27 13:03:00 -08:00
Michael Bostock 85de0bed70 Fix vertical offset in calendar example. 2011-02-27 12:36:11 -08:00
Michael Bostock 8a00d72850 Resize chord example. 2011-02-27 12:33:02 -08:00
Michael Bostock 127ecdea25 Restructure splom example. 2011-02-27 12:21:11 -08:00
Michael Bostock 7b1df15bfe Restructure force example. 2011-02-27 12:09:27 -08:00
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 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 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
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 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 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
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