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

844 Коммитов

Автор SHA1 Сообщение Дата
Mike Bostock e8fcad0cfb Redesigned d3.geo.albersUsa.
This commit changes the albersUsa projection so that it uses a custom projection
stream rather than a custom projection function. The projection stream passes
geometry to all three constituent projections, which are then clipped to their
respective viewports. The result is that geometry that appears in multiple
projections (such as a graticule) is now rendered correctly in each, with
clipping! In addition, the inverse projection is much easier to compute because
the viewport regions of each projection are explicitly defined.
2013-05-19 11:38:22 -07:00
Mike Bostock 3fefb4a48e Merge remote-tracking branch 'origin/fix-interpolate' into 3.1.7 2013-05-15 16:11:06 -07:00
Mike Bostock c8b9164840 Merge remote-tracking branch 'origin/fix-scale-domain' into 3.1.7 2013-05-15 16:10:30 -07:00
Mike Bostock f91973283f Merge remote-tracking branch 'origin/clip-view' into 3.1.7 2013-05-15 16:09:31 -07:00
Mike Bostock 6e650062c0 Merge remote-tracking branch 'origin/geo-bounds' into 3.1.7 2013-05-15 16:09:02 -07:00
Mike Bostock 756ff5c77a Fix #1247 - more robust interpolation, again.
This removes the use of interpolateString if the start and end values passed to
d3.interpolate are different types; the interpolation behavior should be based
solely on the end value. Now if you interpolate an undefined attribute (the
empty string) to a number, it will use number interpolation as expected.

This also fixes interpolateString such that it always returns a string, even if
both the start and end value are coercible to numbers.
2013-05-15 15:48:13 -07:00
Mike Bostock 36ab0dc25a Preserve domains exactly.
Fixes #1241. With d3.scale.pow, d3.scale.sqrt and d3.scale.log, the underlying
implementation is a linear scale. Due to the transformation a linear domain and
the limits of floating-point precision, the reported domain could differ
slightly from what was set. Now, the set domain is preserved exactly.
2013-05-13 15:11:59 -07:00
Jason Davies f69040c9d2 Fix time tests by adding Date to sandbox.
Since tests are now run in their own sandbox, assert.deepEqual was not
properly testing the returned Date objects for equality, as they weren't
instances of the same Date class used by the test itself, causing type
inference to fail.  It was always returning true, even for different
dates.
2013-05-08 11:50:45 +01:00
Jason Davies 67dce478da Remove redundant VERSION from test sandbox.
This is no longer needed due to
22b744b7e6.
2013-05-08 10:44:56 +01:00
Jason Davies e1beaab051 d3.geo.bounds: antimeridian and inflection points.
The behaviour of d3.geo.bounds has been modified slightly, such that the
minimum and maximum longitudes denote minimum and maximum meridians when
going from left to right in a standard equirectangular projection.

If the maximum longitude is in fact numerically smaller than the
meridian, this simply means that the bounds cross the antimeridian.

This fixes several issues:

* The bounding box is now a true minimum-width bounding box.
* Line segments that cross the antimeridian are now correctly handled.
* Similarly, polygons that cross the antimeridian are now correctly
  handled.

Secondly, inflection points are now detected, so that the latitudinal
range is extended in the case where the great arc contains the great
circle’s inflection point.

Lastly, support for polygons has been improved, e.g. those that wind
around the poles, and those that have a counter-clockwise winding order.

Note that as part of the winding order detection, the performance of
d3.geo.area had to be reduced somewhat (by as much as 25%).  This is
because the trick to avoid atan2 calls fails for winding order detection
in the case where a counter-clockwise area strays into a positive
quadrant.  We can reinstate the trick for area-only calculations in
future; I think correct winding order detection is more important at the
moment.

See #1154.
2013-05-05 11:33:15 +01:00
Jason Davies 3eae02e3e6 Fix projection.clipExtent regression.
A bug was introduced in fa514dd08c, where
invisible line segments were incorrectly drawn.

Thanks to @jfirebaugh of iD for spotting it!
2013-05-04 12:34:23 +01:00
Mike Bostock 0c7d1864f2 Saturation is only undefined for black and white. 2013-04-30 16:09:40 -07:00
Mike Bostock 42da3ba98c Merge branch 'grayscale' into 3.1.6 2013-04-30 15:55:25 -07:00
Mike Bostock 7d81f05ff5 Merge branch 'convex-hull' into 3.1.6 2013-04-30 15:54:43 -07:00
Mike Bostock f76f564451 Fix #993; d3.geom.hull is now ccw. 2013-04-30 15:30:56 -07:00
Mike Bostock 9120507d47 Fix #1220 #1218 re. d3.select and d3.selectAll.
This commit fixes d3.select so that it no longer propagates data from the
document element to the selected node when a selector is used. This commit also
fixes d3.select and d3.selectAll such that the returned selection’s group’s
parent node is set to the document element.
2013-04-30 14:49:33 -07:00
Mike Bostock b96e4e3363 Select the document element, not the document.
Fixes #1219.
2013-04-30 14:12:02 -07:00
Mike Bostock 8e5b974f87 Don't build package.json. Fixes #1213. 2013-04-25 11:48:02 -07:00
Mike Bostock b1091b9c50 Add quadtree.extent. Fixes #1207. 2013-04-19 14:57:41 -07:00
Mike Bostock ff5364d7db Allow hue, chroma or saturation to be undefined.
In HSL space, grayscale colors can now have undefined hue rather than assuming a
hue of 0°; likewise black and white can have undefined saturation rather than
assuming 0%. In HCL space, black can now have undefined hue and chroma. (For
non-black grayscale colors, including white, hue and chroma are implied by the
D65 standard referent.)

When interpolating between colors with undefined hue, saturation or chroma, the
defined value is used when available. For example, when interpolating from black
to blue in HCL space, the intermediate colors are now dark blues (#241178)
rather than dark purples (#600054).

Fixes #833.
2013-04-19 10:26:39 -07:00
Scott Cheng c4dd577819 Add test for scale.quantize.invertExtent: out-of-range values and duplicate values in the range 2013-04-18 11:28:07 +08:00
Scott Cheng d479282ab6 Add test for scale.quantize.invertExtent: arbitrary range values 2013-04-18 00:56:37 +08:00
Scott Cheng ea2a48a248 Add test for scale.quantize.invertExtent 2013-04-17 22:47:30 +08:00
Jason Davies 9f25c5f55e Fix typo in test description. 2013-04-11 18:20:44 +01:00
Mike Bostock deae63e688 Merge branch 'fix-null-geometry' into 3.1.5 2013-04-06 19:16:38 -07:00
Mike Bostock ab7af35db9 Ignore null geometries. 2013-04-04 20:50:51 -07:00
JD Isaacks f676389b98 Make clamp implementation more similar to extent 2013-04-02 12:16:50 -04:00
JD Isaacks a829aa260c Add brush.clamp method to specify to clamp extent to range or not 2013-04-02 10:58:44 -04:00
Mike Bostock 6c0c0c2bf4 Favor strictEqual for testing. 2013-03-31 09:48:10 -07:00
Mike Bostock 359546c80c More robust type inference for d3.interpolate.
Fixes #1180 #1179 #1176. Still a work in progress; needs a few more tests.
2013-03-31 09:46:07 -07:00
Adam Sunderland fdf5f93797 cleaner formatting for step interpolation method 2013-03-26 17:11:06 -05:00
Adam Sunderland 0500aaea43 change step-middle to just step 2013-03-26 15:01:05 -05:00
Adam Sunderland 2f82165d5f adding step-middle as interpolation method 2013-03-26 14:50:54 -05:00
Jason Davies f2cce5f57d Add test for clipExtent: redundant closing points. 2013-03-25 08:51:16 +00:00
Jason Davies bcf70c96c9 Add test for quadtree with no bounds. 2013-03-22 00:01:16 +00:00
Jason Davies 34059e22c4 Minor code style fixes. 2013-03-21 22:01:51 +00:00
Jason Davies dcd784246e Add missing semicolons to test. 2013-03-21 12:56:54 +00:00
Jason Davies fd40dc2774 Refactor d3.geom.hull. 2013-03-19 17:19:21 +00:00
Jason Davies 15ec3e8d90 Optimise voronoi for default accessors. 2013-03-19 16:13:11 +00:00
Jason Davies 112ec6fac8 d3.geom.voronoi: always assign input data. 2013-03-19 16:02:09 +00:00
Jason Davies 7643e22714 d3.geom.voronoi: return the configured size. 2013-03-19 15:11:03 +00:00
Jason Davies 7c7366155f Refactor d3.geom.quadtree.
See #1145.
2013-03-19 11:35:51 +00:00
Jason Davies 788f8cd958 Refactor d3.geom.voronoi.
See #1145.
2013-03-19 11:35:49 +00:00
Jason Davies 6d62cc2060 Fix typos in test names. 2013-03-19 10:54:40 +00:00
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
Jason Davies f58b5db715 Fix path.centroid for polygons with holes.
The centroid was not being subtracted for interior polygon rings
(holes), hence it was appearing too far to the right.  The winding order
is ignored.
2012-12-04 20:56:14 +00:00
Jason Davies ba8c8ce170 Add benchmarks and performance improvement.
Dense graticule: 140→110ms/op.
Circle polygons: 69→61ms/op.
Spiral polygons: 3.3→2.6ms/op.
2012-11-21 15:35:44 +00:00
Jason Davies cba8a77bad Improve Polygon clipping.
1. We no longer perform an equality check on GeoJSON polygon endpoints,
since we know that the first and last points should be equal.
2. However, there are special cases where a polygon just touches the
clip edge, generating two coincident intersection points.  Here we avoid
generating a coincident point, and continue as normal.
3. Another special case is where we have coincident intersection points
e.g. due to a self-intersecting polygon.  Here we continue calculating
the winding number as if this is a closed polygon (so we know whether to
insert a polygon around the whole clip edge).
2012-11-20 22:20:54 +00:00
Jason Davies 28fb58b635 Fix polygon clipping. 2012-11-19 13:05:43 +00:00
Mike Bostock 2fc940787f Delete d3.geo.circle clip test. 2012-11-18 10:16:01 -08:00
Mike Bostock 3297cf23e0 Collection centroids are undefined.
It's not always meaningful to define the centroid of a collection because
collections are heterogenous: they can contain points, lines, polygons, or all
these types together. The previous code ignored objects that had dimensionality
lower than the collection's maximum dimensionality; for example, ignoring lines
and points if the collection contains polygons. While this may be what you want,
this feels magical and it's simpler to just define the centroid as undefined.
I'd prefer to force the user to state what they want explicitly, say by creating
a MultiPolygon that merges together a collection's polygons.
2012-11-18 08:40:57 -08:00
Jason Davies ad30a774f0 Add another resampling test for points near poles.
This tests the fix in 091f389499.
2012-11-16 09:35:37 +00:00
Jason Davies f9f4e265f4 Add tests for longitude wrapping. 2012-11-16 09:08:46 +00:00
Jason Davies fbbbfbf239 Add failing test case for Albers artefacts. 2012-11-14 14:51:11 +00:00
Jason Davies dbd0745a8b Another fix for d3.geo.circle Polygon exteriors. 2012-11-14 14:07:33 +00:00
Jason Davies 0bb3d29539 Fix d3.geo.circle Polygon exterior insertion. 2012-11-14 13:24:16 +00:00
Jason Davies 18de5cd5c1 Fix d3.geo.circle clipping of [Multi]Point. 2012-11-14 12:44:29 +00:00
Jason Davies 8ac44493ce Fix resampling along antemeridian. 2012-11-14 11:50:37 +00:00
Jason Davies 112ed8489a Update Phillipines test for d3.geo.albers. 2012-11-13 13:29:03 +00:00
Jason Davies 3c4af15ac6 Fix d3.geo.circle error.
Fixes a regression introduced in
ea7f617e92.

Also fixes a typo in an unrelated test name.
2012-11-13 13:08:06 +00:00
Jason Davies 38c304b68d Add test for d3.geo.circle.
Fixes an error when no angle is explicitly set.
2012-11-10 21:57:56 +00:00
Mike Bostock 835c3e12d0 Add support for 0, - and _ fill padding.
For example, "%-d" formats the day with no padding, "%_d" formats the day with
space-padding equivalent to "%e", and "%0d" formats the day with zero-padding
equivalent to "%d".
2012-10-30 14:42:05 -07:00
Mike Bostock 5cacd70702 Configurable graticule precision. 2012-10-29 19:49:35 -07:00
Mike Bostock 903fbb0a9b Merge branch 'format-align' of git://github.com/jasondavies/d3 into 3.0
Conflicts:
	src/core/format.js
2012-10-29 09:35:01 -07:00
Mike Bostock 6d7b74241a Merge branch 'locale' of git://github.com/jasondavies/d3 into 3.0 2012-10-29 09:23:18 -07:00
Mike Bostock 92ae464cc9 Fix another Voronoi bug with N=2. 2012-10-26 17:29:00 -07:00
Jason Davies b04954bc9f Fix drawing of [Multi]Point geometries. 2012-10-25 18:31:12 +01:00
Mike Bostock 3af91c35e4 Greedy evaluation of transition.{style,attr,text}.
Rather than computing the ending value when the transition starts, the ending
value is computed when the transition is scheduled. This gives more predictable
behavior and makes it easier to debug evaluation errors since they occur
immediately (during user code) rather than inside a d3_timer callback.

The behavior of attrTween and styleTween are unchanged, since the interpolator
can only be constructed once the starting value is known. This commit also
removes d3.tween; I may add this back in a future commit, but I think there is
probably a better way to specify an interpolator for transitions.
2012-10-16 16:47:20 -07:00
Mike Bostock 0794607c39 Changes to transition start & end.
The start event is now fired before any tweens are evaluated, such that you can
do any necessary preprocessing work beforehand. The end event no longer causes
the transition id to be inherited, since we can do that more elegantly now using
transition.transition.
2012-10-16 14:02:08 -07:00
Mike Bostock 1e4b261b39 No more private state for transitions!
This commit moves easing and event listeners down to the node's transition
object, allowing these fields to be modified via post-selection. This removes
the last vestige of private state for transitions.

This required a few changes to tests that depended on the order of callbacks for
tweens and events. Because timers are called back in reverse order, tweens are
now initialized in reverse order, and listeners are now invoked in order.
2012-10-11 12:39:24 -07:00
Mike Bostock d9a1281e08 Fix #438 - degenerate voronoi polygons. 2012-10-06 16:40:37 -07:00
Mike Bostock a77079280a Add tests for d3.geom.quadtree.
Also remove backwards-compatibility for [x, y] input.
2012-10-06 13:19:05 -07:00
Mike Bostock d580a64eba Merge branch 'geo-centroid' of git://github.com/jasondavies/d3 into 3.0 2012-10-06 07:08:59 -07:00
Jason Davies 3cf08d3df1 Add tests and fixes for d3.geo.path().centroid.
These are from #765.
2012-10-06 10:11:47 +01:00
Mike Bostock d3f855ae01 Rename d3.v3.js to d3.js.
We'll still use the major-versioned name file for d3js.org, but this is simpler.
2012-10-05 18:46:05 -07:00
Mike Bostock 3fe30782da Merge branch 'projection' of https://github.com/jasondavies/d3 into 3.0 2012-10-05 17:15:19 -07:00
Mike Bostock c3635192d8 Remove backwards-compatibility for d3.xhr. 2012-10-05 17:05:59 -07:00
Jason Davies d10868bb69 Rename a few variables for consistency. 2012-10-06 01:05:41 +01:00
Mike Bostock 319d9954b9 Remove d3.split. 2012-10-05 16:58:19 -07:00
Mike Bostock ea790608ac Remove d3.geo.azimuthal.
Remove d3.geo.albers origin.
2012-10-05 16:56:49 -07:00
Jason Davies 78815b6783 Reinstate d3.geo.path().centroid.
Also adds support for previously unsupported object types e.g. Points
and LineStrings.
2012-10-06 00:54:21 +01:00
Mike Bostock 0b1b9fbbda Remove d3.first and d3.last.
I never used these. They're fired!
2012-10-05 16:44:48 -07:00
Mike Bostock aa2e17e94c Merge branch 'projection' into 3.0
Conflicts:
	src/core/core.js
2012-10-05 16:35:13 -07:00
Mike Bostock 044f61507c Merge branch 'transition-reselect' into 2.11 2012-10-05 16:29:56 -07:00
Jason Davies d58bbdd6ea Fix d3.geo.path().area. 2012-10-06 00:03:53 +01:00
Mike Bostock 60a25641af Use style rather than attr for "text-anchor".
This makes it easier to override via stylesheet.
2012-10-05 14:50:34 -07:00
Mike Bostock 223d6aa715 Transition reselection.
It is now possible to reselect elements with scheduled transitions and redefine
associated tweens; this enables "post-selection" to customize the behavior of
reusable components undergoing transitions, such as an axis. This commit also
makes it much easier to sequence transitions.

Previously, a transition's tweens were stored privately by the transition and
could only be accessed through the transition. This made it impossible to modify
transitions created by components: the transition is not accessible externally,
and cannot be reselected from the document. Consider the following snippet:

  g.select(".x.axis")
      .call(xAxis)
    .selectAll("text")
      .attr("dy", null);

If `g` is a selection, then this code alters the appearance of the axis as
expected. However, if `g` is a transition, then transition.selectAll creates a
new concurrent transition, and now multiple tweens compete to set the "dy"
attribute. Oy!

Under the new design, an element's scheduled tweens are stored semi-privately on
the node (in the existing node.__transition__). Transition parameters can thus
be reselected and modified by transitions that share the same id. If you now
reselect a transitioning element, you modify the transition rather creating a
competing transition; this should be less surprising and allow greater control.

As a side-effect of this change, it is no longer possible to schedule concurrent
transitions on the same element, even with the same id: only one transition may
be active on a given element at any time. (Note that you can still schedule
multiple future transitions on the same element, and concurrent transitions on
different elements.) For example, you could previously schedule overlapping
transitions with different easing functions, delays or durations, provided you
were careful to avoid conflict. This seems like a relatively obscure use-case
compared to modifying a transition, so I believe this is a reasonable change.

This commit also changes transition.transition, such that the returned
transition starts at the end of the originating transition, rather than
overlapping. This makes it much easier to schedule sequenced transitions without
the complexity of transition.each("end") and d3.select(this).

Also, transitions are now simply arrays of nodes, consistent with selections!
2012-10-05 13:36:11 -07:00
Jason Davies 13c91c2e01 Fix a few bugs.
Hurrah for tests!
2012-10-02 11:25:35 +01:00
Mike Bostock c9cffe7a62 Fix for some redundant points on resampling.
Also restore path.area and add a few tests.
2012-10-01 22:39:17 -07:00
Mike Bostock d27a70f0c0 Refactor d3_geo_type. 2012-10-01 21:50:18 -07:00
Mike Bostock bdc7c3f9e6 Add tests for d3.geo.bounds. 2012-10-01 20:39:38 -07:00
Mike Bostock 95c88ebd06 Enforce built-in precision for outline, too. 2012-10-01 18:20:14 -07:00
Mike Bostock 019583e316 Merge branch 'color' into 2.11 2012-09-28 16:16:53 -07:00
Mike Bostock 428ea4ff92 Fix missing string coercion for d3.tween. 2012-09-28 15:47:13 -07:00
Mike Bostock 78a0284f62 Add @jasondavies' tests for color interpolation. 2012-09-28 15:41:55 -07:00
Mike Bostock 99c444ddaf path(null) should return null.
This frequently happens when a feature is fully clipped.
2012-09-26 21:01:42 -07:00
Mike Bostock 77adc10d86 Checkpoint integration of geo/projection plugin.
This is still a work in progress, but it's a start.
2012-09-23 16:49:11 -07:00
Mike Bostock 8f5ede349e Fix #816 - getters for projection and pointRadius. 2012-09-22 16:08:27 -07:00
Mike Bostock 1bfd9a48d3 Revert previous commit; move urlencode to plugin. 2012-09-19 18:54:36 -07:00
Mike Bostock f6c8059dd5 Add d3.urlencode.
And d3.xhr now detects if the data has a type attribute; if so, this is used to
set the Content-Type header if one has not already been specified. In
conjunction with d3.urlencode, it is now easy to post encoded parameters.
2012-09-19 18:37:23 -07:00
Mike Bostock 79c9737d70 Fix d3.json. 2012-09-19 10:39:24 -07:00