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

844 Коммитов

Автор SHA1 Сообщение Дата
ljani 6dd366a307 Add Finnish locale 2014-05-18 21:36:35 -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 378526d91c Merge remote-tracking branch 'origin/geo-empty-polygon' into 3.4.5 2014-04-07 21:41:17 -07:00
Mike Bostock 253631cbe8 Run each benchmark separately. 2014-04-05 22:24:21 -07:00
Mike Bostock 8b32c70d79 Add d3.interpolateString benchmark. 2014-04-05 22:05:11 -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 994235b3f9 Test for interpolate to null.
I’m not entirely sure this is the most useful behavior, but since typeof null is
"object" and +null is 0, interpolating to null is equivalent to interpolating to
the number zero.
2014-03-24 09:02:48 -07:00
Mike Bostock abbe1c75c1 Preserve tick ordering when updating axis.
Fixes #1748.
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 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 adeaf20195 Merge pull request #1800 from rogerbramon/ca_ES-locale
Add ca-ES for localization
2014-03-23 20:24:32 -07:00
Jim Kang a2fae346b0 Updated quadtree tests to check the `nodes` property of the node (a d3_geom_quadtreeNode) instead of treating the node as an array (which it is not) and trying to check indexes within it. e.g. `node[2]`. 2014-03-22 00:50:22 -04:00
Roger Bramon 17e1f96730 Add ca-ES for localization 2014-03-21 22:04:36 +01:00
Fabricio Tavares de Oliveira cc64f19b94 Add pt-BR for localization.
Taken into account multiple locales support, and not custom build.
2014-03-17 10:11:34 -03:00
Mike Bostock 0cb6cd9283 Tweak comment. Add another test. 2014-02-18 08:38:48 -08:00
jbblanchet d42e8c7bc5 Updated test/locale for suffix bug 2014-02-11 21:29:15 -05:00
Mike Bostock 45502ac0ec Use non-breaking space in ru_RU example. 2014-01-09 16:44:43 -08:00
Mike Bostock ba170a5054 Merge branch 'locale' into 3.4 2014-01-09 16:43:32 -08:00
Mike Bostock c7c447578b Merge branch 'master' into 3.4 2014-01-09 16:38:12 -08:00
Mike Bostock 8f919c4fe7 Actually use seedrandom.
The tests are run in a sandboxed environment, and so didn’t have access to the
same global Math whose random was being overridden.
2014-01-09 16:37:18 -08:00
Mike Bostock f8b79c9605 Merge branch 'locale' into 3.4 2014-01-09 15:33:19 -08:00
Mike Bostock 534d44b0c1 Merge branch 'map-size-empty' into 3.4 2014-01-09 15:32:48 -08:00
Mike Bostock 9e778009ac Merge branch 'define' into 3.4 2014-01-09 15:32:10 -08:00
Mike Bostock d0a047ae80 Merge branch 'better-hull2' of https://github.com/DanGoldbach/d3 into 3.4 2014-01-09 15:31:05 -08:00
Mike Bostock aee121427d Restore Math.random on teardown. 2014-01-09 15:25:16 -08:00
Mike Bostock e44ae3c0ca Merge branch 'random-tests' of https://github.com/DanGoldbach/d3 into random-tests 2014-01-09 15:14:25 -08:00
Mike Bostock 99ff885b96 Support AMD/RequireJS.
When d3.js is loaded, it now prefers the AMD define function or module.exports
if available; the global `d3` is only set if neither of these are available. A
side benefit of this change is that browserify, bower and component can now load
the D3 library directly rather than needing a custom definition.
2014-01-09 13:54:49 -08:00
Mike Bostock 8b1e0ea9fe Add tests for d3.locale. 2014-01-09 11:07:32 -08:00
Mike Bostock da785c66ee Allow currency prefix and suffix.
This commit allows the currency symbol to appear either at the beginning or end
(or both, but that should be rare).
2014-01-09 10:50:11 -08:00
Mike Bostock 4c2917d30c Add test for timeFormat.multi. 2014-01-08 15:47:10 -08:00
Mike Bostock af76f54098 Simplify. 2014-01-08 13:04:51 -08:00
Mike Bostock c3c2bd67b6 Better {set,map}.forEach tests.
Adapted from @DanGoldbach’s fa618397f6f09c274c72b11dcd91800456d1604a.
2014-01-08 13:04:51 -08:00
Mike Bostock fc153902a6 Implement {map,set}.{size,empty}. Fixes #1648. 2014-01-08 13:04:51 -08:00
Stuart Glaser 250905535e Added failing test for nice() on millisec interval 2013-12-15 17:06:47 -08:00
Mike Bostock 0a12e31fe2 Fix #1664 - empty classed string.
The regex used for split was returning [""] for the input "", rather than [].
2013-12-13 15:57:10 -08:00
Daniel Goldbach 97d9cb30a8 Use `inDelta` not `equals` for double comparisons in polygon area test 2013-12-05 19:05:38 +11:00
Daniel Goldbach cdbb9b7838 Use a proper lognormal CDF approximation 2013-11-24 13:49:32 +11:00
Daniel Goldbach eee58b81a8 Better var names and comments 2013-11-24 13:14:12 +11:00