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

532 Коммитов

Автор SHA1 Сообщение Дата
Jason Davies adec0a6490 Short-circuit for speed.
Thanks, @mbostock!
2011-09-29 16:33:34 +01:00
Jason Davies 927426f79f Support multiple classes in classed operator.
Fixes #320.
2011-09-29 11:30:20 +01:00
Mike Bostock 9e16bee0a5 Merge branch 'release' 2011-09-27 15:00:27 -07:00
Mike Bostock fd0759f02a Merge branch 'fix-format-zero-sigfig' into release 2011-09-27 13:56:07 -07:00
Mike Bostock 4c179d9386 Merge branch 'scale-log-ticks' into release 2011-09-27 13:55:35 -07:00
Mike Bostock 886f6b8dcf Merge branch 'behavior-click' of https://github.com/jasondavies/d3 into release 2011-09-27 13:54:36 -07:00
Mike Bostock 151d09d479 Merge branch 'release' 2011-09-27 08:47:14 -07:00
Mike Bostock 80fafd527c Add back d3_array for IE9.
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.
2011-09-27 08:45:06 -07:00
Jason Davies a7c318b138 Restore drag click handler to its rightful place. 2011-09-22 23:50:30 +01:00
Jason Davies 4e0edeb423 Less zealous click cancelling.
The click event is prevented from propagating when a drag has occurred
i.e. the mouse has moved between mousedown and mouseup.  This is because
a click event will be triggered after a mousedown and mouseup have
occurred on the same element.  However, we were cancelling the next
click event *anywhere*, regardless of whether mousedown and mouseup
occurred on the same element or not.

As a sanity check, we also check that the click event was triggered on
the same element that mousedown *and* mouseup occurred on, before
cancelling it.  Just in case!
2011-09-22 23:47:35 +01:00
Mike Bostock 7895afbda5 Better log ticks.
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.
2011-09-21 15:32:19 -07:00
Mike Bostock dbd738353d Slight optimization for previous fix. 2011-09-20 16:38:52 -07:00
Peter Woodman 0ca32a8f69 add SI prefix formatting to d3.format 2011-09-20 16:20:06 -07:00
Jason Davies b4c086061e Fix sort due to lack of NodeList.prototype.sort.
NodeList doesn't support .sort() directly, so we need to convert to a
real Array first.  I've done this in selectAll for efficiency i.e. this
avoids a new Array being created every time the same selection is
sorted.  However, it may be slightly more efficient to create the Array
only when sorting, to avoid unnecessary Array creation when sorting
isn't used, which is probably the common case.

Unfortunately it's difficult to test this because JSDOM uses a real
Array instead of a NodeList!
2011-09-19 09:26:25 +01:00
Mike Bostock fb38f19b2e Merge branch 'release' 2011-09-17 20:35:40 -07:00
Mike Bostock 8436904cb3 Tiny optimization. 2011-09-14 11:15:50 -07:00
Mike Bostock f90bc4fd50 Avoid a bug in UglifyJS.
See <https://github.com/mishoo/UglifyJS/issues/215>.
2011-09-02 11:57:59 -07:00
Mike Bostock 7a1f67b1b6 Merge branch 'release' 2011-08-31 17:50:48 -07:00
Mike Bostock 897b0b64e2 Merge branch 'ease-clamp' into release 2011-08-31 17:50:07 -07:00
Jason Davies 3d064526d4 Reverse subpath direction for annulus. 2011-08-31 12:48:01 +01:00
Mike Bostock e7ac548105 Clamp easing functions to [0,1].
Rather than have a treshold in transitions, we now clamp the easing functions.
This guarantees that when the transition ends, the tweens will be called with
t=1, and produce clean output values. Previously, that was not the case for
certain easing functions, such as exp-out and elastic.
2011-08-30 13:07:41 -07:00
Mike Bostock fd10189458 Fix a bug with zero-delay transitions. 2011-08-29 12:13:19 -07:00
Mike Bostock 082beb1eb9 Merge branch 'release' 2011-08-29 11:56:58 -07:00
Mike Bostock fa312bfdd0 Merge branch 'ie9-style' into release 2011-08-29 11:52:45 -07:00
Mike Bostock a4038b87f9 Merge branch 'zero-transitions' into release 2011-08-29 11:52:22 -07:00
Mike Bostock 4273b224b9 Merge branch 'ordinal-string-coercion' into release 2011-08-29 11:51:58 -07:00
Mike Bostock c2e37352ac Fix for IE9's style.setProperty.
IE9 does not string-coerce values, instead throwing an error. We now wrap IE9's
implementation to force string coercion. While it would be simpler to turn on
string-coercion for all browsers inside D3's style operator, this approach
avoids penalizing standards-compliant browsers.

This commit also moves language-compatibility code to a separate directory, and
deletes the obsolete Object.create polyfill, which is no longer needed by D3.
2011-08-28 19:35:53 -07:00
Mike Bostock 55759258fd Fire a tick immediately on start.
This improves the performance of transitions that have already ended (those with
zero duration), as the transition can end immediately on start rather than
waiting for a second tick.
2011-08-28 18:35:32 -07:00
Mike Bostock 51f6641314 Default priority to empty string, not null. 2011-08-28 17:10:52 -07:00
Mike Bostock 874c6f4503 Don't string-coerce ordinal domain values.
Fixes #274. String coerce for uniqueness, but store the original input types in
the domain for subsequent retrieval. This way, you can more easily use
non-strings as domain values (such as dates or numbers).
2011-08-28 15:23:17 -07:00
Mike Bostock a35fc55410 Inherit namespace from parent node.
This allows you to append("g") to an svg:svg, instead of append("svg:g").
2011-08-27 11:38:03 -07:00
Mike Bostock 1e0b80fb3a Merge branch 'release' 2011-08-26 17:00:23 -07:00
Mike Bostock 18519d9c2d Merge branch 'concurrent-transition' into release 2011-08-26 16:58:45 -07:00
Mike Bostock 88e1a6c781 Merge branch 'array-subclass' into release 2011-08-26 16:58:15 -07:00
Mike Bostock 364bf941ca Use reference count rather than owner id.
As of 2.0.0, it's possible to have multiple transitions running concurrently
with the same id. Thus, it is no longer sufficient to check the transition id
to decide whether to delete the transition lock. We now use reference counting
to determine the number of transitions that are scheduled on a given element;
when that number drops to zero, we can delete the transition lock.
2011-08-26 16:50:29 -07:00
Mike Bostock 5aeb312196 Create the root selection after the prototype.
This fixes a breakage on IE9, which doesn't support array subclassing through
prototype injection. On IE9, we then use direct extension of the prototype, but
this can only be done after the prototype is fully-defined.
2011-08-26 13:17:27 -07:00
Mike Bostock f530251899 Fix zooming in Firefox.
We were mistakenly binding Firefox's DOMMouseScroll to dblclick rather than
mousewheel. Also, there's no acceleration on these events, so we need to make
them faster to match the typical behavior of mousewheel.
2011-08-25 09:13:45 -07:00
Mike Bostock fb7e69f75e Fix albersUsa, again. 2011-08-24 18:11:35 -07:00
Mike Bostock 3f6fefb557 Merge branch 'release' 2011-08-24 18:04:29 -07:00
Mike Bostock d5533276bc Add transition.transition.
This derives a new transition from the existing transition, equivalent to (and
implemented as) transition.select(function() { return this; }).
2011-08-24 17:46:10 -07:00
Mike Bostock 0f4152e042 Fix the domain path for polylinear scales. 2011-08-24 16:20:59 -07:00
Mike Bostock ba2a68bb94 Allow tickFormat to be specified as a constant.
This was basically supported already, but there was a slight bug in the truthy
check for tickFormat. Now we check for null rather than falsiness.
2011-08-24 16:11:28 -07:00
Mike Bostock 4e96a35b66 More consistent timing for transitions.
Previously, the start time for a transition could be slightly different for
different elements, even when the transition was created at the same time. This
commit allows timers to be created with an explicit reference time (then),
allowing a transition to be temporaly consistent across elements.
2011-08-24 16:04:47 -07:00
Mike Bostock 6c4c7d8aae Merge branch 'release' 2011-08-24 14:12:59 -07:00
Mike Bostock c63abd74a0 Merge branch 'stray-globals' of https://github.com/jasondavies/d3 into release 2011-08-24 14:11:52 -07:00
Mike Bostock 9d4b6a02fb Fix a bug in selector functions.
They weren't being invoked with the correct syntax (being passed the data and
index, with the current node as the context). This commit also removes the
d3_array wrapper, which does not appear to be necessary; I've forgotten why it
was there in the first place.
2011-08-24 14:08:19 -07:00
Jason Davies 8223554e50 Remove some stray globals in d3.behavior.*. 2011-08-24 18:28:14 +01:00
Mike Bostock 3ea08db753 Merge branch 'release' 2011-08-23 12:53:21 -07:00
Mike Bostock 2af6fbf172 Merge branch 'axis' into release 2011-08-23 12:51:44 -07:00
Mike Bostock 545e9de74c Merge branch 'drag' of https://github.com/jasondavies/d3 into release
This also fixes a few bugs in the new implementation, restoring support for the
offset between the mouse and the dragged element by reporting a delta rather
than an absolute offset. Also, this fixes an infinite loop when an element is
removed from the DOM.
2011-08-23 12:47:46 -07:00
Mike Bostock 95805adc9b Promote the axis component to the svg module.
I'm including the axis component in the core build because it should be useful
in many different visualization types, similar to the other svg components. The
chart module contains a hodgepodge of more obscure visualization types, and
there's no reason to pull those in for more common visualizations. Perhaps most
importantly, the axis component isn't a chart type!
2011-08-23 12:02:12 -07:00
Mike Bostock a4500fcfb1 Allow `on` to return the current listener.
Fixes #216.
2011-08-22 18:50:14 -07:00
Mike Bostock a0fa7a00e5 Tolerate empty domains. Fixes #115. 2011-08-22 18:05:41 -07:00
Mike Bostock 9dc97e87fe Merge branch 'master' into axis 2011-08-22 16:20:54 -07:00
Mike Bostock b21cc8138d Merge branch 'release' 2011-08-22 14:08:18 -07:00
Jason Davies 07affa2265 "psuedo" -> "pseudo". 2011-08-22 21:23:26 +01:00
Mike Bostock 2f1472b67d Expose selection and transition prototypes.
This means that you can now extend D3's selections and transitions with custom
functionality! Also, you can use now instanceof to see whether something is an
instanceof d3.selection or d3.transition.
2011-08-22 11:26:40 -07:00
Mike Bostock 553bd4e36b Expose transition id. 2011-08-21 20:34:22 -07:00
Mike Bostock 51c7e58fdb Add test for transition.remove.
Also fix a bug where it would be possible for an earlier to transition to become
the lock owner. We now guarantee that the lock owner can only increase while
transitions are scheduled on an element.
2011-08-21 15:54:17 -07:00
Mike Bostock af418fb5a4 Better tests for transitions.
This caught a couple bugs in the previous commit. First, I wasn't sending the
correct index (i) to the "end" event listeners, because it was being masked by
a local variable. Second, the transition lock was being incorrectly deleted when
a transition is inherited on the same node and there is zero delay and
d3.timer.flush is called. There was potentially a related bug where the active
field was not being cleared on the transition lock. Yay tests!
2011-08-20 23:50:34 -07:00
Mike Bostock 4b25f0a62b Simplify map implementation. 2011-08-20 17:04:50 -07:00
Mike Bostock 18b9e11414 Prototype injection!
This changes the core implementation of selections and transitions to use
prototype injection rather than direct extension. This offers better performance
by eliminating per-instance overhead from closures and assignment. On browsers
that don't support prototype injection, we fall back to direct extension.

This commit isn't just about performance, though; the code ends up being a lot
cleaner and more separable if we force methods to rely solely on `this`, rather
than capturing surrounding variables with closures.

Most importantly, transitions are now "transparent", like selections. Rather
than opaque objects, transitions are now arrays of nodes, similar to selections.
The nodes are wrapped in an object that stores the delay and duration, which
means you can now inspect the computed delay and duration. (This was the
original motivation for this commit, and will allow chart components to be
call'd on transitions as well as selections.)

Transitions now support the `each` operator with one argument, which has the
same behavior as on selections. The `each` operator now passes a third argument
containing the group index (`j`). Transitions now also support a `tween`
operator, which is a generic mechanism for doing things during a transition; use
this in place of a "tick" event.

This commit also fixes a few bugs. The enter selection now supports the empty
operator; we can add other operators in the future more easily, if we so choose.
Transition's attr operator now supports namespaced attributes. Selection's
property operator no longer parses property namespaces.
2011-08-20 16:27:25 -07:00
Mike Bostock f55d002f03 Merge branch 'enter-update' into axis 2011-08-19 13:57:06 -07:00
Mike Bostock 434b9eedb9 Merge branch 'master' into scale-clone 2011-08-19 13:56:02 -07:00
Mike Bostock 83f4914831 Merge branch 'master' into enter-update 2011-08-19 13:55:43 -07:00
Mike Bostock 402c2e4922 Merge branch 'release' 2011-08-19 11:02:39 -07:00
Mike Bostock d2b152ce7f Fix a bug in ordinal.copy. More tests. 2011-08-18 14:59:55 -07:00
Mike Bostock c513f515c6 Merge branch 'master' into scale-clone 2011-08-18 12:44:31 -07:00
Mike Bostock b7fb05ab0f Merge branch 'test' 2011-08-17 16:24:19 -07:00
Mike Bostock 7c2062f289 Fix a crash when rounding very small numbers. 2011-08-17 16:13:50 -07:00
Mike Bostock 559394bdb9 Better tests for svg.arc.
This also fixes a bug when start and end angle are inverted.
2011-08-17 13:27:55 -07:00
Mike Bostock f23cb315de Add test for scale.quantize. 2011-08-16 22:51:32 -07:00
Mike Bostock 40b98c4d7b Add test for timer.
Also fix a minor bug where we might miss the delay the first callback by an
extra frame, and allow d3.timer to be called with an optional delay.
2011-08-16 21:21:16 -07:00
Mike Bostock ae4306eaa6 Merge branch 'test' 2011-08-16 12:31:00 -07:00
Mike Bostock e3886060b9 Add test for ease. 2011-08-16 12:26:47 -07:00
Mike Bostock eccef138e6 Add test for range.
Also, fix a bug where step could be specified as undefined or null, rather than
checking the arity of the arguments.
2011-08-16 11:16:53 -07:00
Mike Bostock ffb445bb1b Add test for requote.
And, fix a bug where pipes were not escaped.
2011-08-16 10:51:55 -07:00
Mike Bostock 41f769e36c Merge branch 'test' 2011-08-15 22:22:18 -07:00
Mike Bostock c8ad125aee Add test for first and last.
Also fix bugs in ascending and descending when comparing undefined and NaN.
2011-08-15 21:23:34 -07:00
Mike Bostock ceb5f7cc94 Merge branch 'release' 2011-08-15 16:45:54 -07:00
Mike Bostock 9a2c6a0657 Add test for scale.linear.
Woot! Found a bug in d3.interpolate related to string coercion and colors.
2011-08-15 15:12:54 -07:00
Mike Bostock 5d17075bf3 Add scale.copy.
This returns a copy of the scale, such that future modifications to the scale's
domain or range (or other attributes) are isolated from the copy. This is useful
for transitions where you may want to make a copy of a scale before it changes,
such that entering elements can be initialized using the previous copy.
2011-08-12 15:58:42 -07:00
Mike Bostock 5ba1c2a066 Merge branch 'ordinal' 2011-08-01 11:25:42 -07:00
Mike Bostock 9cd6a46019 Fix #236 - scale.pow accepts negative values. 2011-08-01 11:23:26 -07:00
Mike Bostock 7590713270 Fix #66 - setting domain recomputes range. 2011-08-01 11:16:38 -07:00
Mike Bostock 2c52c37b8c Merge branch 'time' 2011-07-31 17:31:24 -07:00
Mike Bostock e2346ad471 Merge branch 'release' 2011-07-31 16:11:35 -07:00
Mike Bostock 6a9eda0b57 Merge branch 'release' 2011-07-20 16:15:57 -07:00
Mike Bostock e2187aab37 Add d3.time.scale. 2011-07-19 18:44:04 -07:00
Mike Bostock a40876cb55 Merge branch 'release' 2011-07-16 20:45:11 -07:00
Mike Bostock b691732401 Merge branch 'master' of https://github.com/tmont/d3 into release 2011-07-16 20:42:18 -07:00
Jason Davies 1a456a90c7 Minor optimisation. 2011-07-16 00:49:25 +01:00
Tommy Montgomery 5d6ec6b4a7 verify that the node to remove after a transition actually has a parent node 2011-07-14 16:39:34 -07:00
Mike Bostock 06ecb617a2 Allow multiple zoom behaviors to coexist.
Any event handlers on the window need to manage global state, as they will be
replaced when another zoom behavior is created.
2011-07-10 10:31:52 -07:00
Mike Bostock 1885dd55c8 Merge branch 'release' 2011-07-09 21:00:51 -07:00
Mike Bostock 075a8789a4 Add d3.quantile. 2011-07-09 15:15:14 -07:00
Mike Bostock 3c8fabbd65 Merge branch 'release' 2011-07-08 22:44:41 -07:00
Mike Bostock 94e20f74f8 Merge branch 'hierarchy' 2011-07-02 17:16:57 -07:00
Mike Bostock a42e4e14ad Merge branch 'vtstarin-master' 2011-07-02 08:49:05 -07:00
Mike Bostock 8dcbe9e2dc Merge branch 'master' of https://github.com/vtstarin/d3 into vtstarin-master 2011-07-02 08:48:16 -07:00
Mike Bostock 96710b4aa8 Add d3.first and d3.last.
These are like d3.min and d3.max, but a bit more flexible for determing the
lowest or highest element in a given array.
2011-06-29 18:50:42 -07:00
Mike Bostock 35fb91d16f Allow quadtree to be built dynamically.
You can now specify the domain of the quadtree upon construction, such that you
can add points to the quadtree dynamically later. The quadtree example now also
shows how to do a quick rectangular search using the quadtree.
2011-06-28 13:27:03 -07:00
vtstarin 6b9d0337a5 removing trailing commas inside object 2011-06-28 08:36:59 +09:30
Mike Bostock a0fd9853f5 Always use the larger value for chord sources. 2011-06-25 10:48:31 -07:00
Mike Bostock 7927a5739a Merge branch 'release' 2011-06-23 20:52:17 -07:00
Mike Bostock 779de6e93e Merge branch 'area' into release 2011-06-23 20:50:36 -07:00
Mike Bostock eac8831208 Add d3.svg.area.radial. 2011-06-23 20:49:33 -07:00
Mike Bostock 9619d87953 Merge branch 'bundle' into area 2011-06-23 20:17:06 -07:00
Mike Bostock 906e7eefc3 Add x0 & x1 accessors to d3.svg.area.
Thanks for the inspiration, @strongh!
2011-06-23 20:03:27 -07:00
Mike Bostock b5465489e7 Merge remote-tracking branch 'jasondavies/area' into area 2011-06-23 19:53:28 -07:00
Mike Bostock 886c4db94d Use a constant for the default y0. 2011-06-23 19:52:09 -07:00
Mike Bostock 2eba032040 Refactor ticks implementation.
This commit adds a new static function for computing the extent (min and max) of
a scale's domain, simplifying the logic in the ticks functions and ensuring
standard behavior (such as repeated values). Also, the linear ticks function is
extracted for reuse by the pow scale.

I opted not to reverse the tick order for descending domains; this might be nice
but it doesn't seem required, so we might as well keep the code small.
2011-06-23 19:45:23 -07:00
Mike Bostock cb3ffebc89 Replace basis+beta with bundle+tension.
There's already a tension parameter, and it seems reasonable to overload this
parameter (originally intended for cardinal splines) to also apply to bundle
splines. The new "bundle" interpolation is identical to "basis" interpolation;
the only difference is that the tension parameter is used to straighten the
basis spline.
2011-06-23 11:28:55 -07:00
Mike Bostock 96a565e314 Add d3.svg.diagonal.radial. 2011-06-22 14:33:34 -07:00
Mike Bostock e60ac77e25 Add d3.svg.line.radial. 2011-06-22 13:17:18 -07:00
Mike Bostock 0aba0702a5 Hierarchical edge bundling improvements.
The input to the layout is now an array of edges to bundle, rather than nodes.
This eliminates the need for an `outgoing` accessor, since the links are passed
to the bundle layout directly.

The svg line generator now supports a beta (straightening; bundle strength)
parameter. I haven't decided if this is the right place or the right name for
it, but it seems like a reasonable starting point. I'm not happy with the cos &
sin needed to produce radial lines (both here and for the diagonal projection in
other examples), but I don't have a good alternative yet.

This commit also tries to make the construction of the links from the layout
nodes a bit easier to follow. The previous code was used another intermediate
representation, and I think it's cleaner to construct the default format
expected by the layouts. However, there's still a good chunk of code required to
massage the JSON format into a node hierarchy and array of dependencies, so I'd
like to find a way to simplify that, too.
2011-06-22 09:46:52 -07:00
Jason Davies c159980f7d Linear and log ticks: support descending domains.
See #185.
2011-06-17 21:18:40 +01:00
Jason Davies 0752a014af d3.svg.area: evaluate x-accessor once per element.
I played with extracting d3_svg_linePoints but this seems simpler.

Fixes #187.
2011-06-17 14:42:23 +01:00
Mike Bostock 68424aeff4 Merge branch 'release' 2011-06-16 21:12:37 -07:00
Jason Davies f90554f41e Add d3.sum.
Fixes #191.
2011-06-15 17:44:58 +01:00
Mike Bostock e2119b8ccf Merge branch 'release' 2011-06-13 17:37:57 -07:00
Mike Bostock 4f16bbd9e7 Regenerate files. 2011-06-13 17:30:30 -07:00
Mike Bostock 1dfcda4888 Better nicing for pow scales. 2011-06-11 18:11:15 -07:00
Mike Bostock f5c1d54b57 Instantiating enter affects update.
Previously, if you instantiated the enter selection via append or insert, you'd
have to re-select to unify the enter and update selection (the post-transform
nodes). Now, simply by appending or inserting the entering nodes, the update
selection automatically refreshes, obviating the need for a reselect. If you
still want to perform actions only on the updating nodes, you can do so by
performing these actions before instantiating the enter selection.
2011-06-11 15:56:18 -07:00
Mike Bostock 4964bb6362 Merge branch 'superformula' 2011-06-11 12:57:35 -07:00
Mike Bostock 920d980b3b Move d3.svg.superformula into an example.
This way, people can play with superformulas if they want them, but we keep the
core library small. If we want to replace the default symbol implementation with
superformulas in the future, we can do that too. For now, be conservative.
2011-06-11 12:54:44 -07:00
Mike Bostock 852ac949d2 Merge branch 'master' into superformula 2011-06-11 12:49:22 -07:00
Mike Bostock 7dc7fe4f53 Merge branch 'release' 2011-06-11 12:40:43 -07:00
Mike Bostock afbeb4cec1 Merge branch 'interpolators' into release 2011-06-11 12:37:23 -07:00
Mike Bostock 40ba7913e0 Add d3.interpolators registry.
This is useful when other modules want to register interpolators for
d3.interpolate without adding an explicit dependency to d3.core.  The
interpolators are applied in reverse order, and the first one that returns
a function is used.

(This commit was authored by @jasondavies and cherry picked.)
2011-06-11 12:32:41 -07:00
Mike Bostock 54ac5e6749 Merge branch 'nice' into release 2011-06-11 12:20:57 -07:00
Mike Bostock 0607c580be Reduce code duplication.
I'm not totally sure about the nicing behavior for pow scales; we might want it
to behave more like nicing for log scales. But this works for now!
2011-06-11 12:17:47 -07:00
Mike Bostock de35e0d094 Tweens are now optional.
If the tween function returns null, then no tween will be applied for the
specified element. The default tween function now returns null if the start and
end value are the same, thus avoiding redundant interpolation.
2011-06-11 11:12:51 -07:00
Jason Davies aeb1212f25 Add semicolons. 2011-06-07 17:32:55 +01:00
Jason Davies dc792de2ef Support for nice polylinear log scales. 2011-06-07 09:45:56 +01:00
Jason Davies 943e2d5a88 Fix nice pow scale.
We can't just rebind the internal linear scale's nice function because the
linear scale's domain is the exponentiated pow domain, so the actual pow domain
would most likely be fractional as the linear scale will round to the nearest
integer exponentiation.
2011-06-07 09:31:23 +01:00
Jason Davies ea8e8785a7 Support for "nice" polylinear scales. 2011-06-07 08:44:02 +01:00
Mike Bostock 8be719280a Merge remote-tracking branch 'biovisualize/master' into superformula 2011-06-06 22:51:16 -07:00
Mike Bostock bfa1a6e48f Add d3.svg.superformula. 2011-06-06 22:38:08 -07:00
chris viau b0d8d439a9 added more shapes 2011-06-07 00:59:18 -04:00
chris viau 06b0b25de0 Added shape tween 2011-06-06 22:55:18 -04:00
Jason Davies 8421fca43d Fix "nice" log scales.
Turns out we just needed to test for reversed domains.

Fixes #176.
2011-06-07 00:38:41 +01:00
Jason Davies e1daa4764c Add d3.scale.log().nice().
Based on the Protovis implementation.  Includes tests.  I'm not sure [10.9, 1.1]
should be "niced" to [10, 10] but this is also the behaviour in Protovis at the
moment.
2011-06-07 00:29:45 +01:00
Jason Davies cdf5f2fa90 Add d3.scale.linear().nice().
Based on the Protovis implementation.  "Nices" the scale, extending the bounds
of the input domain to evenly-rounded values.
2011-06-06 23:34:16 +01:00
Mike Bostock 2e560f6d6e Fix d3.min and d3.max, again.
Unlike Math.min and Math.max, it doesn't make sense to return negative or
positive infinity for d3.min and d3.max; the D3 functions return the minimum
value according to an arbitrary ordering, not by numeric value. Instead, the
minimum or maximum of an empty array, or an array that contains only degenerate
values, should always be undefined.
2011-05-30 13:43:18 -07:00
Mike Bostock 204e00efde Merge branch 'azimuthal' 2011-05-30 09:31:19 -07:00
Mike Bostock 15d7569216 Merge branch 'release' 2011-05-30 09:26:23 -07:00
Mike Bostock c7c2af625f Merge branch 'minmax' into release 2011-05-30 09:23:39 -07:00
Mike Bostock d8c8b5ddd6 Ignore null and undefined in d3.{min,max}.
Fixes #161.
2011-05-30 09:10:13 -07:00
Jason Davies 25e77c4f67 d3.min & d3.max: ignore NaN at [0].
Note: this now returns Infinity and -Infinity for zero-element arrays, whereas
previously an error would have occurred.

Fixes #161.
2011-05-30 09:45:27 +01:00
Jason Davies 7e08dc10ef d3.min & d3.max: pass index and array to accessor.
Fixes #162.
2011-05-30 09:38:17 +01:00
Mike Bostock 8f54652b4f Merge branch 'zip' into release 2011-05-27 14:54:56 -07:00
Mike Bostock 16c40a1b3e Merge remote-tracking branch 'jasondavies/new-parens' into release 2011-05-27 14:54:15 -07:00
Mike Bostock 909b1650b6 Gratuitious micro-optimizations. 2011-05-27 14:46:59 -07:00
Jason Davies 1baf57be30 Fix bugs in d3.zip.
* The returned array should be truncated to the length of the shortest argument.
 * With no arguments it should return an empty array.

I've updated the unit tests to be more verbose to detect the array of
single-element arrays returned for a single argument.
2011-05-27 20:50:27 +01:00
Jason Davies 2403293455 Add d3.zip.
Analagous to Python's built-in zip():
<http://docs.python.org/library/functions.html#zip>

Fixes #145.
2011-05-27 09:36:36 +01:00
Mike Bostock 98ef2d185f Prefer style over attr. 2011-05-26 21:15:28 -07:00
Jason Davies 3941be193a Remove extraneous parentheses from `new` operator.
Parentheses are optional if there are no arguments.
2011-05-22 10:22:28 +01:00
Mike Bostock 71264282b4 Merge branch 'release' 2011-05-21 17:29:05 -07:00
Mike Bostock 5bf17dad6d Merge branch 'format' into release 2011-05-21 17:26:29 -07:00
Mike Bostock 392aa11e9b Simplify new format types.
I removed the `F`, `G` and `E` types, since these are redundant and we don't
have to be slavishly-compatible with Python. Also, I simplified the
implementation of `g`, `e` and `f` so that they use JavaScript's built-in
`toPrecision`, `toExponential` and `toFixed`, respectively. The existing
implementations weren't exactly compatible with Python, anyway, so we might as
well default to using JavaScript's built-ins.
2011-05-21 17:19:31 -07:00
Mike Bostock 0e75d27707 Slightly shorter. 2011-05-21 13:08:52 -07:00
Mike Bostock 6ba3097766 Add d3.bisect.
This is similar to pv.search, but more closely modeled after Python's bisect
methods to provide the desired flexibility in searching slices of arrays. This
includes good tests for bisect, and better tests for polylinear and quantile
scales (both of which now use bisect).
2011-05-21 12:56:06 -07:00
Mike Bostock 85a6feec66 Add support for F, r and p format types.
`F` is an alias for `f`. `r` is a new format type that rounds the input number,
treating the precision field as the desired number of significant digits. This
is similar to `g`, except it never uses exponent notation. `p` is equivalent to
`r`, except it outputs a percentage, as with `%`.
2011-05-20 15:38:09 -07:00
Mike Bostock 01fdc1d93d Add d3.round. 2011-05-20 14:20:17 -07:00
Jason Davies e89b53cc9e Add unit test for exponential notation.
Also fix a bug in precision interpretation.
2011-05-19 21:04:51 +01:00
Jason Davies 643efb9869 Additional types for d3.format.
* "e": exponent notation.
 * "E": same as "e", except uses "E" as a separator.
 * "g": precision is interpreted as signficant digits.
 * "G": same as "g" but uses "E" instead of "e".
 * "n": equivalent to ",g".
 * "%": percentages.

Fixes #149.
2011-05-19 20:57:42 +01:00
Mike Bostock 173a936d68 Merge branch 'release' 2011-05-12 11:56:15 -07:00
Mike Bostock 4c998ba2cc Propagate touch identifier in d3.svg.touches.
Also, add a fun little example demonstrating multi-touch.
2011-05-12 11:54:38 -07:00
Mike Bostock f1a2f62dcb Simplify touches code slightly. 2011-05-12 11:28:31 -07:00
Mike Bostock bdc7023776 Merge branch 'touch' into release 2011-05-12 11:26:09 -07:00
Mike Bostock 25a3a503b5 Add d3.permute. 2011-05-12 10:25:05 -07:00
Jason Davies ab28a0c833 Revert "Remove usage of d3_array for efficiency."
This reverts commit 1bb3e9b025.

The performance difference is negligible, and using d3_array results in smaller
code.
2011-05-12 17:20:07 +01:00
Jason Davies 1bb3e9b025 Remove usage of d3_array for efficiency.
This avoids unnecessarily creating a new array for every touch event.
2011-05-12 10:10:04 +01:00
Jason Davies a5f140709c Add d3.svg.touches for multitouch support. 2011-05-11 17:26:48 +01:00
Jason Davies 5f2e430f25 Add touch support to `d3.svg.mouse`.
This doesn't quite seem like the right place for it, but it seems to work when
using "touchstart", "touchmove" and "touchend" handlers without any adverse
effects on "true" mouse event handlers.

See <http://www.jasondavies.com/apollonian-gasket/> to see an example of
combined touch/mouse handlers working with this change.
2011-05-10 22:42:16 +01:00
Mike Bostock 7c518c547c Merge branch 'polylinear' 2011-05-08 19:54:40 -07:00
Mike Bostock 7ead68822b Delete d3.search.
Not needed for now, since I opted to create customized versions internally.
2011-05-08 19:52:12 -07:00
Mike Bostock c99678e6cf Rename a variable. 2011-05-07 23:24:42 -07:00
Mike Bostock e67e7d7d8b Refactor polylinear scales.
This commit adds a d3_uninterpolate method (private, for now), which is
essentially the inverse of d3.interpolate. It's used to map a value in the
domain to the unit range [0,1], which can then be passed to an interpolator.
2011-05-07 23:20:02 -07:00
Mike Bostock 5d05154ae6 Merge branch 'release' 2011-05-07 16:51:30 -07:00
Mike Bostock e1c6c74f70 Merge branch '===' into release 2011-05-07 16:42:59 -07:00
Mike Bostock ce808da5b3 Merge branch 'immediate-transitions' into release 2011-05-07 16:39:46 -07:00
Mike Bostock ef905bcf1b Merge branch 'data-listeners' into release 2011-05-07 16:35:30 -07:00
Mike Bostock b1b6b14143 Merge branch 'monotone' into release 2011-05-07 16:34:01 -07:00
Mike Bostock 7367df8050 Improved monotone interpolation.
Mainly, I fixed a bug where the coordinates could get set to NaN if two
successive points have the same x-coordinate. But I also cleaned up the
implementation slightly, and compute the initial tangents using finite
differences.
2011-05-07 16:32:48 -07:00
Mike Bostock 8aa986dff1 Merge branch 'issue-78' into release 2011-05-07 11:28:48 -07:00
Mike Bostock 99e2a55614 Cleverly compacted `classed` code.
We can take advantage of JavaScript's invisible hoisting of variables to set
them before they are defined. This simplifies the code for the various special
cases in the `classed` operator, such as for SVG elements and browsers that
support the tokenized class list.
2011-05-07 11:21:59 -07:00
Mike Bostock 59b5ba99be Reorganize some color functions. More tests. 2011-05-07 10:59:49 -07:00
Jason Davies 4024cb6681 Add .hsl().brighter() and .hsl().darker().
Also fix .rgb() and .hsl().
2011-05-05 21:44:40 +01:00
Jason Davies 9e51c6efa3 Propagate data changes to event listeners.
Event listeners are still bound to the index at the time of binding, but data
changes are now visible from the event listener.

Fixes #88.
2011-05-05 18:53:52 +01:00
Jason Davies a591160109 Use prototypes for `d3.rgb()` and `d3.hsl()`.
This turns out to be slightly faster than using structs (`{}`) and is bit
cleaner.  You can now also do:

    d3.rgb(r, g, b).hsl()

and:

    d3.hsl(h, s, l).rgb()

to convert between RGB and HSL.
2011-05-05 17:27:43 +01:00
Jason Davies 8d2bc4b1b3 Simplify `classList` & `className.baseVal` logic. 2011-05-05 16:25:49 +01:00
Jason Davies 2280d51c9d Revert "Use a more precise check for "baseVal" property."
This reverts commit 94d0e1aa18.
2011-05-05 16:20:54 +01:00
Jason Davies 1a83029485 Polylinear scales. Fixes #61.
For example:

    d3.scale.linear()
        .domain([-100, 0, 100])
        .range(["red", "white", "green"]);
2011-05-05 15:29:17 +01:00
Jason Davies 94d0e1aa18 Use a more precise check for "baseVal" property. 2011-05-05 13:31:24 +01:00
Jason Davies 333ddeb07c Use `element.classList` for classed operator.
This is only used if available, and falls back to the regex-based implementation
e.g. for SVG nodes.  See #96.
2011-05-05 13:30:06 +01:00
Jason Davies 668cdaa767 Add `brighter` and `darker` to d3.rgb().
Fixes #138.
2011-05-05 12:38:55 +01:00
Jason Davies bf1be6f5cc Set className to `""` instead of `null`.
Retrieving it in Chrome returns `""` after setting it to `null` anyway.
2011-05-03 17:27:02 +01:00
Jason Davies 7ab5e3567f Better fix for classed operator. Fixes #78. 2011-05-03 17:17:03 +01:00