This commit augments d3.time.week and d3.time.weeks with weekday-specific
methods, so that you may pick a starting day for the week other than Sunday. For
backwards-compatibility, the new sunday methods have aliases:
d3.time.sunday = d3.time.week
d3.time.sundays = d3.time.weeks
This commit also adds new weekdayOfYear methods, so that you can determine the
week number without needing to use a d3.time.format. For example, sundayOfYear
returns the week number, where weeks start on Sunday; mondayOfYear does the same
where weeks start on Monday. This commit also adds a dayOfYear method which
returns the day-of-year number for a given date, similar to the time format's %j
directive, but zero-based.
Fixes#512. Fixes#513.
It might be nice to gracefully hide the CSS3-rotated links for browsers
that don't support them. But D3 only really supports current browsers
anyway, and they all support CSS3 rotations.
The returned coordinates are now consistent with absolute positioning
numbers, for parity with the SVG behaviour (current user coordinates).
This is equivalent to [e.offsetX, e.offsetY] but unfortunately this is
buggy and inconsistent in the major browsers.
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 having two implementations for local time and UTC time, we now have
a single local-time implementation and use d3_time_utc to adapt for UTC.
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.
This is useful when stopping the layout in response to a user action,
e.g. if another layout is used to position the nodes in an event
handler. In this case, we don't want the next tick of the force layout
to run as it could undo the positioning work done in the event handler.
This is ported from the Protovis implementation, pv.Layout.Rollup.
The only difference is that the rollup nodes are not instances of any
original nodes (Protovis used pv.extend). Users are expected to use the
"x" and "y" properties of the rollup node, or alternatively the "rolled
up" nodes can be retrieved via the "nodes" property.
A small bug was introduced where the invisible resizers were off by three
pixels. I've also removed the 1-pixel fudge factor that was designed to line up
with stroke and shape-rendering: crispEdges, in favor of simplicity.
The brush component now hides the resizers when empty, rather than requiring you
to do this in CSS. In addition, the brush component also temporarily overrides
the body's cursor style, so that the cursor doesn't flicker when dragging.
The brush component now allows you to add decorative elements to serve as brush
resizers, while keeping the default behavior of a few invisible pixels on the
edge of the extent. Any element you add to ".resize" containers can serve as
visible handles for the brush.
This commit also fixes two small bugs with the brush component. First, we now
track the offset between the extent edge and the mouse, rather than immediately
jumping the extent edge to the mouse position; this was barely noticeable
previously due to the resizers being so thin, but it is very noticeable with
large resizers. Second, the default behavior for the SPACE key is not prevented
whilst dragging.