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

1320 Коммитов

Автор SHA1 Сообщение Дата
Mike Bostock 61c568f818 Merge branch '3.4.7' 2014-05-18 21:42:53 -07:00
Mike Bostock 1b47a8c9f2 Merge branch 'non-recursive-tree' into 3.4.7 2014-05-18 21:41:34 -07:00
Mike Bostock 1896136dfe Make scaling non-recursive. 2014-05-18 15:08:16 -07:00
Mike Bostock ea7b43e8d7 Abbreviate internal variables. 2014-05-18 08:17:13 -07:00
Mike Bostock b567b5d106 Non-recursive hierarchy layout. 2014-05-17 23:27:01 -07:00
Mike Bostock 9d0bbefa94 Non-recursive tree layout. 2014-05-17 22:25:28 -07:00
Mike Bostock 082c9593e2 Don’t store temporary variables on tree nodes.
Rather than creating a temporary _tree hash on the tree nodes to store temporary
variables needed to compute the tree layout, the tree is wrapped. This
eliminates the risk of a namespace collision, and eliminates the need to
subsequently delete temporary variables. (They will be garbage collected.)
2014-05-17 20:32:59 -07:00
Mike Bostock 31d0712f1e Fix #1850 - multiple touchstart targets. 2014-04-22 12:13:58 -07:00
Mike Bostock 49ba8afebb Merge branch '3.4.6' 2014-04-13 20:55:29 -07:00
Mike Bostock 55dc3a20c3 Merge branch 'mean' into 3.4.6 2014-04-13 20:54:52 -07:00
Mike Bostock c693847f2f Merge branch 'fix-parse-timezone' into 3.4.6 2014-04-13 20:54:19 -07:00
Jason Davies c0e84e2ca0 Optimise d3.mean.
Originally we were using Welford’s algorithm, but this is primarily
useful when computing the variance in a numerically stable manner, since
Welford’s approach requires an incremental mean.

I’ve removed a test for the mean of more than one instance of
Number.MAX_VALUE as this is unlikely to occur in practice; most likely
this was the reason I used Welford’s algorithm in the first place.

There’s a paper [1] comparing various algorithms for computing the mean,
and Welford’s is actually slightly less accurate than the naïve
approach.  There are some more accurate approaches but I think it’s
overkill for d3.mean.

[1] Youngs, Edward A., and Elliot M. Cramer. "Some results relevant to
choice of sum and sum-of-product algorithms." Technometrics 13.3 (1971):
657-665.

Related: #1842.
2014-04-11 14:09:10 +01:00
Mike Bostock 00d7183a3a Fix #1839 - sign of parsed timezone offset. 2014-04-10 16:43:16 -07:00
Mike Bostock 4c9f77d257 The quantile scale should ignore null, too. 2014-04-08 08:03:44 -07:00
Mike Bostock 92c9d9d87a Merge branch '3.4.5' 2014-04-07 21:43:32 -07:00
Mike Bostock 378526d91c Merge remote-tracking branch 'origin/geo-empty-polygon' into 3.4.5 2014-04-07 21:41:17 -07:00
Mike Bostock 500538afe2 Only coalesce exact string matches.
If there are a lot of matching numbers, it’s faster to do direct string equality
comparisons than it is to coerce to a number and compare numerically.
2014-04-05 21:50:33 -07:00
Mike Bostock 4adb0c24f5 Optimize interpolateString. 2014-04-05 21:41:03 -07:00
Jason Davies a264d55e15 Don’t generate empty polygons during clipping.
Fixes #1823; spurious closePath events were being generated for
degenerate polygons due to generation of empty polygons and rings in
rare cases.
2014-04-04 14:29:23 +01:00
Mike Bostock fa55eead41 Merge branch '3.4.4' 2014-03-24 20:45:44 -07:00
Mike Bostock d3bbf394af Save a few bytes. 2014-03-23 22:57:35 -07:00
Mike Bostock abbe1c75c1 Preserve tick ordering when updating axis.
Fixes #1748.
2014-03-23 22:53:07 -07:00
Mike Bostock b86e4e4ae1 Getter support for transition.{delay,duration}.
Fixes #1773.
2014-03-23 22:53:07 -07:00
Mike Bostock 28538c40d2 Default to suitable precision.
The point of this method is to pick the right precision for you!
2014-03-23 22:53:07 -07:00
Mike Bostock fe797df41e More standard precision interpretation.
Rather than overload the meaning of precision to bias the selection of the SI
prefix, always use the standard SI prefix, and use the precision in the same
sense as with fixed digits: the number of digits after the decimal point.
2014-03-23 22:53:03 -07:00
Mike Bostock 621558c28f Consistent SI-prefix for small numbers.
For reasons that I can’t recall, the SI-prefix behavior was different for small
numbers (between -1 and 1) than it was for large numbers. This commit enforces
consistent behavior, so that the coefficient is always in the range [1, 1000),
like in engineering notation.

For example, the old d3.format("s") would display 0.01 as "0.01", whereas the
new behavior displays it as "10m".
2014-03-23 22:52:59 -07:00
Mike Bostock 91531cf7ff Consistent SI-prefix for ticks. Fixes #1746.
When a SI-prefix format (type "s") is passed to scale.tickFormat, compute a
suitable SI-prefix based on the maximum value in the range, and then use that
prefix for all ticks rather than computing the SI-prefix on a per-tick basis.
2014-03-23 22:52:54 -07:00
Mike Bostock d6ca25e87d Fix ordinal scales with singleton domains.
Fixes #1717. Turns out, -1 % 1 is 0!
2014-03-23 22:52:50 -07:00
Mike Bostock f9e00b1d35 Listen to the touch target.
This ensures that if the touch target is removed from the DOM during a zoom
gesture, the zoom behavior continues to receive events; touch events, unlike
other events, are always dispatched to the target of the touchstart event rather than the window.
2014-03-23 22:52:50 -07:00
Mike Bostock e03b645429 Better ticks for subsecond domains.
Rather than starting the ticks on the minimum domain value, round up based on
the step size. Fixes #1757.
2014-03-23 22:52:46 -07:00
Timmy Willison 086de835b2 Shorten selectAll to just `Sizzle` 2014-03-23 22:52:42 -07:00
Timmy Willison 336f3afc8c Remove redundant Sizzle.uniqueSort call 2014-03-23 22:52:31 -07:00
Mike Bostock defe5bc848 Clamp latitude for conic conformal projection.
The Lambert conic conformal projection extends to infinity along the outer edge
of the projection, and thus the latitude must be clamped either at -π/2 or +π/2
depending on the parallels. Fixes #1802.
2014-03-23 22:52:25 -07:00
Mike Bostock 2b14807055 Remove workaround for WebKit bug 44083.
This was fixed in 2010, so I think it’s safe to remove the workaround now.
2014-03-23 22:52:19 -07:00
Mike Bostock 467f1490c9 d3.touch defaults to changedTouches.
This way, it’s easier to tell whether the touch changed during the event. This
also fixes #1600 because the drag behavior now only dispatches a drag event on
elements that moved, even if multiple touches are active.
2014-03-23 22:52:13 -07:00
Mike Bostock 387249155f Add d3.touch; fix #1786.
The drag behavior no longer crashes when the element being dragged is removed
from the DOM. In addition, the new d3.touch method extracts a single identified
touch from the current touch event, making it more efficient during multitouch.
The drag behavior now assigns touchmove and touchend listeners on the target
element of the touchstart event, rather than the window.
2014-03-23 22:52:06 -07:00
Mike Bostock ee23f94141 Fix all touches ending on any touch ending.
The drag behavior registers a touchend listener for each started touch; however,
a touchend event is dispatched to ALL listeners when any touch ends, not just
for the corresponding starting touch. The drag behavior must therefore detect
whenever the ending touch is the corresponding starting touch, and ignore other
ending touches.

This fixes the drag behavior during multitouch, as discussed in #1786.
2014-03-23 22:51:47 -07:00
Mike Bostock 947c609050 Prefer interpolateNumber when coercible to number.
Objects that are coercible to numbers, such as Dates, are often more usefully
interpolated as numbers rather than as objects.
2014-03-23 22:51:26 -07:00
Mike Bostock 90b6c0b913 Instead of bisectBy, replace bisector.
For backwards-compatibility, bisector checks the arity of the specified
function, and if the function only takes a single argument, it is wrapped with a
suitable comparator.
2014-03-23 22:51:07 -07:00
Mike Bostock 3c7cc81b62 Add d3.bisectBy(comparator).
Fixes #1766. Unlike d3.bisector(accessor), this allows you to define a bisector
that works in reverse order.

An awkward aspect of implementing bisection on top of a comparator is that it is
often the case that the sorted array contains objects (e.g., rows from a TSV),
while the search value is a primitive value (e.g., a number). Thus, you want to
apply an accessor to the array elements but not to the search value.

The solution here is to invoke the comparator deterministically: the first
argument is always an element from the array, and the second argument is always
the search value. This lets a comparator apply an accessor to array elements but
not to search values.
2014-03-23 22:51:07 -07:00
Mike Bostock a4bd16705e Merge branch 'safe-sin' 2014-02-27 07:50:18 -08:00
Jason Davies bef5de7510 Workaround for lack of symmetry in Math.sin.
Chrome 33 included some sin/cos optimisations, which unfortunately broke
our assumption that sin(-x) + sin(x) = 0 for all x.  More details here:

  https://code.google.com/p/v8/issues/detail?id=3006

This fix uses:

  sin(x) = sgn(x) * sin(abs(x))

and:

  cos(x) = cos(abs(x))

where it matters, which fixes area calculations for degenerate polygons
such as:

  {"type":"Polygon",
   "coordinates":[[[-0.0002,0.0001],[0.0002,0.0001],[-0.0002,0.0001]]]}

Fixes #1753.
2014-02-27 00:29:52 +00:00
Mike Bostock 04fa5dd385 Merge branch 'fix-prefix' 2014-02-18 08:39:33 -08:00
Mike Bostock 0cb6cd9283 Tweak comment. Add another test. 2014-02-18 08:38:48 -08:00
Mike Bostock 657effbeea Fix a winding order bug in viewport clipping.
Introduced by bfce5d5d11 (<= vs <).
2014-01-13 11:42:04 -08:00
Mike Bostock f41170a268 Non-redundant locale grouping definition. 2014-01-10 09:52:03 -08:00
Mike Bostock 5c6cc73906 Consolidate symbol definition. 2014-01-09 21:40:47 -08:00
Mike Bostock ba170a5054 Merge branch 'locale' into 3.4 2014-01-09 16:43:32 -08:00
Mike Bostock e4259453f6 Bump version number. 2014-01-09 15:36:18 -08:00
Mike Bostock a18c8a23fb Merge branch 'force-charge-distance' into 3.4 2014-01-09 15:33:53 -08:00