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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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].
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.
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.
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.
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.
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.