The process.env.TZ trick no longer seems to work. The fix automatically
adds an offset to the minutes being set, relative to the current
timezone. It assumes that the dates being tested in the scope are not in
DST, since the offset is relative to the timezone offset at the epoch.
Previously, the log scale's tick format would hide all labels when there was not
enough room to display the requested number of ticks; now it at least displays
the power-of-ten labels. Fixes#655.
The transition-test-text callback was failing to fire when using the
latest Node.js master (82bcdbb8aaa4cf58917dc8d3fd4fcfc272512a2c). This
was most likely due to these tests being run in a different order due to
a different object enumeration order.
In future we may want to generate some kind of loop, but it's not clear
what orientation such a loop should have, so perhaps a "non-line" like
this is better as a default.
Previously, if you set the brush extent externally, the extent could drift
slightly because it was internally stored in pixel space rather than in data
space. To avoid drift, the brush now preserves the extent exactly as-set, only
nullifying the externally-set extent when the brush is moved.
We weren't deleting the reference to the removed listener, so we were leaking
memory and returning a stale value on a subsequent get. Also, we now stash the
capture value when setting an event listener, so that we can automatically
remove or replace a listener without the caller needing to specify capture.
Fixes#493. Also terminates any transitions with negative or NaN durations,
rather than having them run infinitely. Also coerces NaN delays to 0 as well, to
likewise avoid infinite transitions.
This method returns the array of data for the first group in the selection. Note
that the data method cannot be used to clear data bindings, since it computes a
data join; use datum(null) to clear bound data.
Unfortunately, "delete" is a reserved word, and older browsers (such as mobile
WebKit) crash if you use reserved words as method names. I'd rather have code
that runs than strictly maintain interface-compatibility with the ES6 map.
This fixes a crash with the symbol type "hasOwnProperty", rather than defaulting
to "circle". This commit also adds new map methods to retrieve the keys, values
and entries. The map class now uses non-enumerable properties (if supported).
This is, essentially, an ES6 shim for a Harmony Map. We will use it instead of
using a bare object, so that we don't need to worry about collision with built-
in properties names (such as "__proto__" and "hasOwnProperty").
This may seem a bit improbable at first, but I ran into this when
testing something unrelated in Firefox, which turns out to have:
"watch" in {} === true
This commit provides a standard interface for time intervals:
interval.floor(date)
interval.ceil(date)
interval.offset(date, k)
interval.range(start, stop, step)
All local-time intervals (such as d3.time.day) have a UTC-equivalent interval,
available as interval.utc (such as d3.time.day.utc).
Fixes#463. Note that for the time.scale, an interval function is required to
nice (such as d3.time.day). In the future, we might relax that to allow a count
of ticks, similar to the ticks method, but in that case we'd also need the
ability to floor to a given tick number (e.g., every other week) and likewise
for ceil. This seems like a reasonable first implementation.
Rather than producing separate files for each module, the default build now
produces a single file. This should encourage better page-load performance as
the files were relatively small. Also, it's easier to deal with only one file
rather than many, especially if you're not quite sure what the dependencies are.
You may still create minimized builds, if you don't want every feature.
This commit also demotes the chart components to the examples directory, rather
than keeping them as part of the core library. As always, D3 is not a charting
library, and these were ever only intended to serve as examples.
I simplified the implementation, though it still seems somewhat magical. I
would be more confident if there were an easy way to extract the mantissa and
exponent from a floating point number, but since JavaScript does not expose the
bitwise representation of numbers, there's no easy way to do it.
Fixes#428. This is built on top of existing tick support for linear scales: for
small intervals, a linear scale computes ticks based on milliseconds; for large
intervals, a linear scale computes ticks based on fractional years. This commit
also extends the time scale's formatter to display milliseconds.
There's an edge condition which is not discussed in the original algorithm
("Visualization of Large Hierarchical Data by Circle Packing", Wang et. al):
what happens if the first intersecting circle C_j is equidistant from C_m and
C_n? In other words, it is both after C_n on the front-chain, and before C_m.
The correct answer is that you should splice the smaller of the two circles. If
C_m is smaller than C_n, then splice from C_j to C_n and set C_m to C_j;
otherwise, splice from C_m to C_j, and set C_n to C_j.
Now if you add an "svg" element, we automatically infer the namespace because
there is an "svg" namespace prefix. In conjunction with inheriting the namespace
from the parent element, this means that namespaces are almost optional!
Previously, each listener function had a private _on property which recorded
whether the listener was enabled; this was set to false when the listener was
removed. (This is necessary because of the copy-on-write semantics when the
array of listeners is modified while events are being dispatched.) If the
listener was registered for multiple event types ("foo" and "bar") then removing
the listener for any type would disable it for all types.
The fix is to wrap the listener in an object. This also has better encapsulation
since the state is kept private.
This required changing assert.length to assert.lengthOf in tests, due to
a Vows.js change to be compatible with Node.js v0.6.x. For further
details:
https://github.com/cloudhead/vows/pull/141
Using d3.range with a floating point step is a bit sketchy, because there's a
chance that too many or too few elements could be generated. Instead, we now we
generate an integer range and scale it accordingly.
Due to the ordering in which the prototypes are defined, it was still undefined!
Also, the empty method depends on the node method being defined. Added a test.
It was previously possible for small differences in the reference time for
subtransitions. This could lead to tearing with expensive transitions, as some
transitions would have slightly different reference times than the others. This
is fixed by passing the reference time along explicitly when deriving a new
transition, either by the transition or selection operators.
The d3.time.format.iso is designed to be compatible with the default JSON
serialization of dates, which includes milliseconds. So, d3.time.format now
supports the %L directive for formatting and parsing milliseconds. This commit
also changes d3.time.format.iso to use native ISO date methods, if available.
This simplifies the implementation and fixes a few bugs. The si prefix format
("s") now supports variable precision; in fact, you are strongly recommended to
specify a precision, such as ".3s".
You can now change the orientation and the axis will redraw correctly. When an
axis is applied by a transition, the subtransitions will properly inherit the
transition id, allowing transitions on reselected elements to continue.
d3.geom.polygon(…).area() assumes screen pixel coordinates with (0, 0)
at the top left, and y increasing going downwards. This results in a
positive area for counterclockwise coordinates. Howver, the default
centroid calculation was assuming "usual" Cartesian coordinates with y
increasing going upwards, hence the centroid coordinates were
incorrectly multiplied by -1.
This fix won't affect d3.geo.path(…).centroid() as it passes a constant
to d3.geom.centroid.
This occurs on Linux, where the directory listing order is different
from OS X and so other tests leave data bound to the "body" element.
This data is then propagated when new elements are appended, and thus
mess up some of the tests!
When computing the reversed baseline, we need to switch between step-before and
step-after, since the points are in reverse order. Otherwise, we're effectively
filling the gap between step-before and step-after.
This also tweaks the array conversion slightly so that it is called by
selection.selectAll rather than d3_selectAll; this guarantees that the selection
groups are always arrays, even when a function selector is used.
The greatArc class is the new name for greatCircle, which actually represents
great arcs. Meanwhile, a new greatCircle class is for great circles. The new
greatCircle class replaces the old clip class, providing clipping and resampling
functionality (using greatArc internally). This isn't backwards-compatible, but
I may forgo the major version number bump in light of the fact that greatCircle
was just added, and not used in any (official) examples or documented.
Note that the Werner projection is a special case with standard parallel
at 90°N, and the Sinusoidal projection is also a special case with
standard parallel at 0°N.
This adds support for filtering the log ticks, such that fewer ticks can be
generated to fit in a small space. This can be used in conjunction with a
custom tick format as well. This commit also changes the default log tick format
to be exponential rather than precision, for consistency.
This test makes sure NaN doesn't creep in due to Math.acos being called
on numbers like +/- 1.000000000004, so it's more descriptive to check
isNaN rather than the exact numerical results.