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

700 Коммитов

Автор SHA1 Сообщение Дата
Mike Bostock 627b55189e Don't expose transient points.
Data-in and data-out. Although I could see it being useful to access the
computed coordinates, but I think in the common case, these will be implemented
as simple accessors.
2013-03-15 17:15:20 -07:00
Jason Davies fa6ef52de9 Add d3.layout.voronoi.{links,triangles}. 2013-03-15 23:33:21 +00:00
Jason Davies 537e9e234a Add simple test for d3.interpolateTransform. 2013-03-15 16:55:53 +00:00
Jason Davies d476dffdef Fix a couple of typos. 2013-03-14 22:43:18 +00:00
Mike Bostock 0d7c6c55e7 Use _ to disambiguate local vs. global d3. 2013-03-14 15:14:12 -07:00
Mike Bostock 1ac0fa09a9 Fix the time zone for testing. 2013-03-14 14:28:25 -07:00
Mike Bostock 05e9f190e3 Fix all the tests. 2013-03-14 14:11:40 -07:00
Mike Bostock a4fed02b8c Get most transition tests working again. 2013-03-14 13:59:18 -07:00
Mike Bostock bd09d37e6c Refactor time tests for minimal load. 2013-03-14 13:29:24 -07:00
Mike Bostock 68be0ac8c8 Rename assert and XMLHttpRequest. 2013-03-14 13:00:04 -07:00
Mike Bostock ecbf93d922 Standardize test environment. 2013-03-14 12:58:16 -07:00
Mike Bostock 4c3469d336 Refactor selection tests for better isolation.
Fixes #939.
2013-03-14 12:36:21 -07:00
Mike Bostock 36c59cd233 Fix two failing assert.throws.
Since smash.load uses a separate context, any exceptions it throws use a
different Error class, and thus the assert.throws fails. So, instead, just allow
any exception type to be thrown.
2013-03-14 10:58:17 -07:00
Mike Bostock e1842fccac Refactor scale tests for minimal load. 2013-03-14 10:52:01 -07:00
Mike Bostock a6fa0c4f6b Refactor layout tests for minimal loading. 2013-03-14 10:35:04 -07:00
Jason Davies dd971666a6 Refactor selection tests for minimal loading. 2013-03-14 17:25:23 +00:00
Mike Bostock 697db5217a Refactor interpolate tests for minimal loading. 2013-03-14 10:18:11 -07:00
Mike Bostock 1ff5f504a9 Refactor geom tests for minimal loading. 2013-03-14 09:43:53 -07:00
Mike Bostock 480bfb6c51 Refactor geo tests for minimal loading. 2013-03-14 09:41:29 -07:00
Mike Bostock ae9d4a402a Refactor format tests for minimal loading. 2013-03-14 09:19:27 -07:00
Mike Bostock af25181df8 Refactor event tests for minimal loading. 2013-03-14 09:17:39 -07:00
Mike Bostock 8e9db961f9 Refactor dsv tests for minimal loading. 2013-03-14 09:16:05 -07:00
Mike Bostock 2831f6c7c4 Refactor cor tests for minimal loading. 2013-03-14 09:09:50 -07:00
Mike Bostock 97f034a44d Refactor color tests for minimal loading. 2013-03-14 09:06:31 -07:00
Mike Bostock f37405d1b8 Refactor array tests for minimal loading. 2013-03-14 09:00:13 -07:00
Mike Bostock 0f2b61ae93 Refactor svg tests using smash. 2013-03-14 08:46:45 -07:00
Mike Bostock e65d455ac6 Reuse global d3's document for xhr test. 2013-03-14 08:42:29 -07:00
Mike Bostock 5627ecdb9a Allow load expression to be overridden. 2013-03-14 08:16:52 -07:00
Mike Bostock 608902c907 Checkpoint test refactoring. 2013-03-13 23:21:23 -07:00
Mike Bostock 3442685b36 Refactor core tests using smash. 2013-03-13 19:16:59 -07:00
Mike Bostock 04fe8f8e4b Refactor color tests using smash. 2013-03-13 19:13:38 -07:00
Mike Bostock fe0d6f3ea6 Refactor array tests using smash. 2013-03-13 19:10:53 -07:00
Mike Bostock 5c4282f51a Don't import index; move ns to core. 2013-03-13 13:58:41 -07:00
Jason Davies d93f45ee82 Fix small-circle clipping of lines.
This corrects the handling of lines that are long enough to have two
visible or invisible endpoints, but still cross the small circle and
thus have an invisible or visible intermediate segment.

Fixes #1127.
2013-03-13 17:47:52 +00:00
Jason Davies 9d1925012d Support for {selection,dispatch}.on(".foo", null).
This allows all listeners with a particular name to be removed.

Fixes #880.
2013-03-13 12:15:17 +00:00
Mike Bostock 58dc604177 Move tests to match new source structure. 2013-03-13 02:08:02 -07:00
Mike Bostock d0441e6170 Automatic precision for custom tick formats.
You can now pass a format specifier to scale.tickFormat (for linear, pow and
identity scales). If the format specifier doesn't have a defined precision, the
precision will be set automatically by the scale, returning the appropriate
format. This provides a convenient, declarative way of specifying a format whose
precision will be automatically set by the scale.

This works with axes, too! For example, `axis.ticks(10, "%")` will now use a
percentage format rather than the default format, while still computing the
appropriate precision.

This commit also includes a fix to make d3.format more robust when unreasonable
precisions are specified. Rather than throwing an error, the nearest reasonable
value is used instead.

Fixes #912.
2013-03-11 18:06:05 -07:00
Mike Bostock ed81d3db2f Merge branch 'rotation-invert' of git://github.com/jasondavies/d3 into 3.1.0 2013-03-11 15:33:49 -07:00
Mike Bostock 13e2781206 More comprehensive projection tests. 2013-03-11 15:33:40 -07:00
Jason Davies 759947a2ad Add rotation.invert.
Fixes #1134.
2013-03-11 21:49:54 +00:00
Mike Bostock 09f6c76329 Add conic projections. Fixes #1133. 2013-03-11 13:43:05 -07:00
Mike Bostock 28c7b46b5a Add transverseMercator; remove custom scales.
This adds d3.geo.transverseMercator and removes the custom default scales from
the mercator and equirectangular projections. Also, this commit removes the
built-in 2π scale factor from the mercator projection, simplifying the
implementation and making it consistent with transverseMercator and GDAL. This
is a partial fix for #1133; see also d3/d3-plugins#55.
2013-03-11 12:58:00 -07:00
Mike Bostock 8d3c6d43f6 JSDOM now correctly returns null.
Previous versions of JSDOM erroneously returned null rather than the empty
string, but this has now been fixed. Note: this depends on tmpvar/jsdom#582
which has not yet been merged to master.
2013-03-11 10:57:57 -07:00
Mike Bostock f1c8b090da Fix a couple bugs in d3_dsv.format. 2013-03-07 12:05:49 -08:00
Mike Bostock fe09bb0cc2 Allow objects as input to d3_dsv.format.
The previous implementation of format, which only supported arrays as input, is
retained as d3_dsv.formatRows; for backwards-compatibility, d3_dsv.format allows
both arrays and objects as input (to be removed in 4.0). This change makes
format and formatRows symmetric with parse and parseRows, respectively.

To compute the set of fields from all objects, two passes are required. Fields
are listed in discovery order, so that in the common case where all fields are
defined on all objects, the order of columns in the generated DSV will match the
property iteration order of the first object.

This supersedes #1106 and fixes #509; thank you to @smcgivern and @hammer for
suggesting this feature.
2013-03-07 07:53:08 -08:00
Mike Bostock c58471c9a9 Merge branch 'nest-map' into 3.1.0 2013-03-05 20:56:30 -08:00
Mike Bostock aad4969807 Merge branch 'insert-function' into 3.1.0 2013-03-05 20:54:58 -08:00
Mike Bostock 01f681213f Merge branch 'voronoi-layout' into 3.1.0 2013-03-05 20:49:22 -08:00
Mike Bostock 98d09c8aa7 Merge branch 'scale-log-base' into 3.1.0 2013-03-05 20:46:22 -08:00
Mike Bostock 66ca29e17a Merge branch 'dsv-parse-function' into 3.1.0 2013-03-05 20:45:54 -08:00
Mike Bostock e8d8b13498 Merge branch 'geo-length' into 3.1.0 2013-03-05 20:45:25 -08:00
Mike Bostock 995b69946b Merge branch 'rotation' into 3.1.0 2013-03-05 20:44:20 -08:00
Mike Bostock cac8883fe3 Merge branch 'albers-usa-invert' of git://github.com/jasondavies/d3 into 3.1.0 2013-03-05 20:43:51 -08:00
Mike Bostock a7294db376 Merge branch 'd3.set' of git://github.com/jfirebaugh/d3 into 3.1.0 2013-03-05 20:42:53 -08:00
Mike Bostock 48f3fa8716 Merge branch 'minor-graticule' into 3.1.0
Conflicts:
	src/geo/interpolate.js
2013-03-05 19:28:39 -08:00
Mike Bostock dcf6b26773 Merge branch 'master' into rotation 2013-03-05 10:07:34 -08:00
Mike Bostock 04e4b57e2a More sensible ticks when not base 10. 2013-03-05 09:40:00 -08:00
Mike Bostock 5ef9dcd38a Add d3.scale.log base. Fixes #928.
Still need to implement sensible behavior for log.ticks without base 10, but I
haven't decided what would be appropriate yet.
2013-03-05 09:26:46 -08:00
Mike Bostock a3bb93a749 Fix vows clobbering our custom asserts. 2013-03-05 09:01:18 -08:00
Mike Bostock ff137ede76 Fix tests for d3.rebind. 2013-03-03 09:06:48 -08:00
Mike Bostock 9323c2314f Add tests for d3.geo.rotation.
Also, fix vows clobbering our custom asserts.
2013-03-02 15:09:02 -08:00
Mike Bostock 88c4a86e71 Add d3.layout.voronoi.
A more user-friendly version of d3.geom.voronoi. Fixes #1100.
2013-03-02 14:46:45 -08:00
Mike Bostock 95543f7bab Allow optional row conversion function to d3_dsv. 2013-03-02 13:54:44 -08:00
Mike Bostock aeb620b3a8 Allow row conversion function for d3.dsv.parse. 2013-03-02 13:49:50 -08:00
Mike Bostock 873db8d893 Allow before function for selection.insert.
Similar to selection.select(function), the before argument to selection.insert
can now be specified as a function, so that the caller can specify the before
node dynamically. Supersedes #1071.
2013-03-02 10:32:22 -08:00
Mike Bostock f4a4d700dc Add tests for d3.geo.length.
Also return the perimeter for polygons.
2013-03-01 14:12:24 -08:00
Jason Davies 4ce9bffe91 Add d3.geo.albersUsa.invert. 2013-02-26 00:55:58 +00:00
Jason Davies 889aacc43d Fix d3.geo.interpolate for coincident points.
This also improves accuracy for small distances, using the haversine
distance formula instead of the law of cosines.

Fixes #1080.
2013-02-18 13:06:29 +00:00
Mike Bostock 50a552093f Allow d3.map to be used with d3.nest’s map.
You can now pass a map type to d3.nest’s map function. For example, if you pass
d3.map as the second argument to nest.map(array, type), the returned value will
be an instance of d3.map rather than a bar object. In addition to offering
better protection against built-in property names, d3.map offers more convenient
iteration methods.
2013-02-11 11:56:32 -08:00
John Firebaugh 1e8a579810 Add d3.set
Taking inspiration from d3.map, d3.set is a simple shim for ES6 sets.
2013-02-09 14:42:04 -08:00
Mike Bostock a7164684b2 Merge branch 'geo-area-fast' of https://github.com/jasondavies/d3 into 3.0.6 2013-02-06 10:59:09 -08:00
Mike Bostock 8ad35ce03b Merge branch 'fix-format-round' into 3.0.6 2013-02-06 10:57:55 -08:00
Mike Bostock e35f3a6484 Merge branch 'fix-force-drag' into 3.0.6 2013-02-06 10:52:35 -08:00
Mike Bostock 5988b1daf1 Merge branch 'fix-sort-null' into 3.0.6 2013-02-06 10:52:10 -08:00
Mike Bostock d287b63511 Don’t expose d3_functor for link properties.
Fixes #895.
2013-02-06 10:48:13 -08:00
Mike Bostock 093bd8485a Fix for invalid axis.orient. Fixes #905. 2013-02-06 10:25:19 -08:00
Mike Bostock 2a0e2a1266 Sort null nodes at the end.
Previously, null nodes were passed to the comparator and were indistinguishable
from non-null nodes with no bound data. For consistency with other selection
operators that skip null nodes, it seems preferrable to put null nodes at the
end of the selection rather than passing them to the comparator. Fixes #881.
2013-02-06 10:18:52 -08:00
Jason Davies b9bf5302b4 Add test case for tiny Polygon area. 2013-02-05 21:35:58 +00:00
Mike Bostock 2e24cf9be8 Use µ rather than μ.
That is, MICRO SIGN (\xb5) rather than GREEK SMALL LETTER MU (\u03bc).
2013-02-01 10:30:51 -08:00
Jason Davies 3dcdfbfe1f Fix a couple of edge cases. 2013-02-01 16:51:47 +00:00
Mike Bostock a31f59274e Fix rounded format specifier; fixes #1042. 2013-02-01 08:09:12 -08:00
Jason Davies 9c3ad8f53b Optimise d3.geo.area.
This incorporates two enhancements:

1. A simpler formulation for the area of a spherical triangle with one
   vertex at the south pole.
2. Instead of calling atan2 for every point, we use the identity:
     ∑ arg(z) = arg(∏ z),
   where z is a complex number, and only call atan2 once for each
   polygon, instead opting for a cheaper complex number multiplication
   for each point.

This is around 3x faster than the old implementation as measured by the
included benchmark.
2013-01-31 17:34:05 +00:00
Jason Davies 5c9b90ce07 d3.geo.distance: accuracy for small distances. 2013-01-31 13:27:21 +00:00
Mike Bostock 183060d40f Upgrade dependencies; remove Sizzle dependency. 2013-01-24 09:26:22 -08:00
Mike Bostock 6b06c4526b Deprecate d3.geo.greatArc; add d3.geo.distance.
Now that D3 supports great-arc interpolation automatically for projections,
there is no need for a great arc feature generator, as a simple LineString
geometry object is equivalent. For the same reason, d3.geo.graticule does not
need to use supersampling on meridians, since meridians are great arcs.

This commit also adds d3.geo.distance(a, b) for computing the length of the
great arc between points a and b in radians, as a replacement for the
deprecated d3.geo.greatArc method, and a faster alternative to constructing a
d3.geo.interpolate solely to measure distance.

Fixes #1021 #1024.
2013-01-23 15:46:34 -08:00
Mike Bostock 45d3a18178 Default graticule step is now 10°. Better tests. 2013-01-16 10:21:29 -08:00
Mike Bostock 58fb99d589 Fix big with constant greatArc target.
The local variable `t` was masking the private field of the same name. The use
of single-letter variables is preferred for smaller scopes.
2013-01-13 11:02:16 -08:00
Mike Bostock c96250ecb7 Merge branch 'fix-duplicate-keys' into 3.0.3 2013-01-10 16:41:55 -08:00
Mike Bostock 9c6be3c574 Add test and fix for duplicate keys. 2013-01-08 15:32:21 -08:00
Mike Bostock 2810d3cc1b Fix for duplicate keys in selection.data.
Fixes #997. The enter, update and exit selections are now initialized as fixed-
length arrays rather than dynamically populated with nulls. If duplicate keys
are used for either data or selected elements, only the first datum or element
is considered and subsequent data or elements are ignored.
2013-01-08 15:18:59 -08:00
Jason Davies 475b18f2df Allow projection.invert to return null.
Previously this would throw errors.
2013-01-05 01:45:43 +00:00
Mike Bostock 633fd273bd Merge branch 'geo-circle' of https://github.com/jasondavies/d3 into 3.0.2 2013-01-01 15:52:03 -08:00
Mike Bostock 2e072713e3 Fix path.bounds with fallback stream.
Fixes #987.
2013-01-01 15:50:17 -08:00
Jason Davies f6891ef901 Fix d3.geo.circle.origin.
3D rotations are not commutative, so we must perform an inverse rotation
to move something from origin [0, 0] to [λ, φ].  Normally we are moving
origin [λ, φ] to [0, 0].
2012-12-29 13:09:12 +00:00
Mike Bostock 8b0c10f8e5 Merge branch 'fix-geo-bounds-collection' of https://github.com/natevw/d3 into 3.0.1 2012-12-28 09:18:41 -08:00
Mike Bostock cd1b2d0696 Merge branch 'geo-centroid' of https://github.com/jasondavies/d3 into 3.0.1 2012-12-28 09:18:15 -08:00
Nathan Vander Wilt 33bf32723f test for problematic nesting case 2012-12-28 10:37:24 -06:00
Jason Davies e7ea256dc1 d3.geo.centroid: fix handling of mixed geometries. 2012-12-27 12:57:52 +00:00
Jason Davies 963a5e862e Fix treemap slice-dice mode.
For even depths, it was falling back to Math.min(rect.dx, rect.dy)
instead of always "dicing" (rect.dy).
2012-12-25 02:51:36 +00:00
Mike Bostock 315e3ab7b8 Fix benchmark by restoring test data file. 2012-12-20 22:47:10 -08:00
Mike Bostock abaa6f1645 Fix broken tests due to missing sample data. 2012-12-20 15:37:09 -08:00
Mike Bostock 6d27e13f9f Move touch example to tests. 2012-12-19 16:50:07 -08:00
Mike Bostock d354200f5e Move more transform tests. 2012-12-19 12:55:44 -08:00
Mike Bostock 2782e793e3 Move mouse test. 2012-12-19 12:53:05 -08:00
Mike Bostock e6da19f7d0 Move transform tests. 2012-12-19 12:52:35 -08:00
Mike Bostock b5021f13c8 Oops, add missing file. 2012-12-19 12:20:14 -08:00
Mike Bostock 223a047b3a Move sample HTML file to test/data. 2012-12-19 11:49:16 -08:00
Mike Bostock 4e32681308 Use identity projection when null. 2012-12-18 20:21:22 -08:00
Mike Bostock b632cf1902 Coerce to number for d3.quantile.
This avoids string concatentation on fractional p-values.
2012-12-18 11:38:12 -08:00
Jason Davies 5396d39965 Fix CCW polygon detection issue.
The south pole rotation could result in line segments that go through
the poles.  These are characterised by a 180° longitudinal difference.
These cases were not handled properly by the approximation algorithm,
but it now handles both north and south pole cases.
2012-12-18 01:00:58 +00:00
Jason Davies 8e8699bbd5 Fix speling. 2012-12-14 13:40:45 +00:00
Jason Davies 1a7810bddd Adjust threshold for distortion resampling.
Includes test case.
2012-12-14 13:05:59 +00:00
Jason Davies 01a7e187ea Add test for pointRadius function type coercion. 2012-12-14 01:12:30 +00:00
Jason Davies b085292ea8 Add type coercion for d3.geo.path.pointRadius. 2012-12-13 19:09:15 +00:00
Jason Davies e3b7823f74 Fixes for d3.geo[.path].centroid.
Mixed geometries should now be supported correctly for both.
2012-12-13 13:34:52 +00:00
Jason Davies 44425c1874 Update centroid tests to use undefined. 2012-12-13 13:10:44 +00:00
Jason Davies 5e0c131f32 d3.geo.centroid: {Feature,Geometry}Collection.
This computes the centroid of the geometries with the highest dimension.
2012-12-13 13:00:51 +00:00
Jason Davies 3d84b49ae4 Better handling of ambiguous centroids.
Rather than doing something like picking the last seen point, return
an undefined centroid if it is ambiguous.

Users can decide what to do, e.g. when picking an origin for a rotating
globe, using the last coordinate in a MultiPoint or LineString seems
reasonable in an ambiguous situation.
2012-12-13 12:48:52 +00:00
Jason Davies b87bcbc22a Implement d3.geo.centroid via d3.geo.stream. 2012-12-13 12:22:41 +00:00
Jason Davies b8ab3ad3ef Benchmark U.S. counties.
This is useful to see how fast we can process polygons that don't
intersect with the clip edge.
2012-12-13 10:57:38 +00:00
Mike Bostock 1c529da03e Silence bogus test failures. 2012-12-12 21:22:54 -08:00
Jason Davies 37f64b74f2 Fix streaming polygon clipping. 2012-12-13 02:01:04 +00:00
Mike Bostock 08b4357087 Don't emit closing points in rings.
This breaks d3.geo.path area & centroid, and d3.geo.area. Fix incoming.
2012-12-12 16:54:58 -08:00
Mike Bostock 32e13768bd Merge branch 'geo-refactor' of https://github.com/jasondavies/d3 into 3.0 2012-12-12 14:13:03 -08:00
Mike Bostock 2e88ce7f03 Add tests for d3.geo.stream. 2012-12-12 13:56:41 -08:00
Jason Davies 33e24962be Refactor clipping to use streams.
Work in progress: everything is treated as lines at the moment.
2012-12-12 21:33:59 +00:00
Jason Davies 876a6542d8 Minor optimisation. 2012-12-12 13:51:10 +00:00
Jason Davies b1d078db1a More robust handling of polygons with empty ring(s).
This is a valid situation but won't usually happen at the moment since
we don't return empty rings when clipping.
2012-12-12 12:01:36 +00:00
Jason Davies 913173ea7f Graticule: s/GeometryCollection/MultiLineString. 2012-12-12 11:57:25 +00:00
Jason Davies 31d59cfc93 Fix d3.geo.circle.origin. 2012-12-12 08:51:31 +00:00
Jason Davies eb7a56e943 Simplify.
This includes a minor tweak to d3_geo_type to avoid errors if the object
is null e.g. due to being removed by clipping.
2012-12-12 00:11:08 +00:00
Jason Davies bc06b2ec57 Refactor d3.geo.projection to be more data-driven. 2012-12-11 21:43:14 +00:00
Jason Davies 34180a7485 More accurate winding order check. 2012-12-10 23:09:14 +00:00
Jason Davies 7dfdcda0b2 d3.geo.area: fix holes. 2012-12-10 12:01:36 +00:00
Jason Davies a9e47f3b8a d3.geo.area: improve handling of tiny polygons. 2012-12-09 20:46:14 +00:00
Jason Davies e0c91c1e27 d3.geo.area: return positive areas. 2012-12-09 20:32:01 +00:00
Jason Davies 7860b0d31e Add d3.geo.area.
See #941.
2012-12-09 19:42:05 +00:00
Jason Davies 2467834ec2 Add d3.geo.centroid.
Polygons are temporarily treated as lines while I work on adding area
weighting.

See #941.
2012-12-09 11:29:29 -08:00
Jason Davies 86e159872f s/º/°/g 2012-12-08 14:48:54 +00:00
Jason Davies 915f044b8f Fix loss of significance for d3.geom.polygon.area. 2012-12-06 10:40:06 +00:00
Jason Davies 531b443c09 Take into account clipping when computing centroids. 2012-12-05 21:30:13 +00:00
Jason Davies bf180cb8a0 Take into account clipping when computing areas.
This can be optimised later.
2012-12-05 20:35:50 +00:00
Jason Davies 25098ab0ff Add Sphere centroid and area. 2012-12-05 20:04:18 +00:00
Jason Davies 050b1c319e Define a new "Sphere" GeoJSON type.
This allows us to generate the clip outline for whole-earth projections
with arbitrary rotations.

Internally, this is interpreted as a polygon with null coordinates.
2012-12-05 18:39:57 +00:00
Jason Davies 36702f197f Revert "Restore support for empty & ccw polygons."
This reverts commit 7712dcd59e.

Unfortunately, this caused empty polygons to be interpreted as "the
whole sphere", which is undesirable.  Also, it is more useful to have a
definite graticule outline, at least for a graticule that doesn't cover
the whole sphere.
2012-12-05 18:16:35 +00:00
Mike Bostock 7712dcd59e Restore support for empty & ccw polygons. 2012-12-05 09:48:24 -08:00
Jason Davies 4d268a7966 Add some test cases for small U.S. counties.
These were originally anticlockwise in examples/data/us-counties.  I
have corrected the ordering for these tests.
2012-12-05 09:14:07 -08:00
Jason Davies e6ab7219b8 Detect polygon direction using area calculation.
This fixes various problems that were occurring due to winding numbers
being tricky on a finite sphere.

This also includes some cleanup and fixes for degenerate points.
2012-12-05 09:14:07 -08:00
Jason Davies acbce53ec5 Fix antemeridian clip point ordering. 2012-12-05 09:13:51 -08:00
Jason Davies 210085d3ea Fix antemeridian degeneracy handling. 2012-12-05 09:13:13 -08:00