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

194 Коммитов

Автор SHA1 Сообщение Дата
Jason Davies 3c4af15ac6 Fix d3.geo.circle error.
Fixes a regression introduced in
ea7f617e92.

Also fixes a typo in an unrelated test name.
2012-11-13 13:08:06 +00:00
Mike Bostock 903fbb0a9b Merge branch 'format-align' of git://github.com/jasondavies/d3 into 3.0
Conflicts:
	src/core/format.js
2012-10-29 09:35:01 -07:00
Mike Bostock 3af91c35e4 Greedy evaluation of transition.{style,attr,text}.
Rather than computing the ending value when the transition starts, the ending
value is computed when the transition is scheduled. This gives more predictable
behavior and makes it easier to debug evaluation errors since they occur
immediately (during user code) rather than inside a d3_timer callback.

The behavior of attrTween and styleTween are unchanged, since the interpolator
can only be constructed once the starting value is known. This commit also
removes d3.tween; I may add this back in a future commit, but I think there is
probably a better way to specify an interpolator for transitions.
2012-10-16 16:47:20 -07:00
Mike Bostock 0794607c39 Changes to transition start & end.
The start event is now fired before any tweens are evaluated, such that you can
do any necessary preprocessing work beforehand. The end event no longer causes
the transition id to be inherited, since we can do that more elegantly now using
transition.transition.
2012-10-16 14:02:08 -07:00
Mike Bostock 1e4b261b39 No more private state for transitions!
This commit moves easing and event listeners down to the node's transition
object, allowing these fields to be modified via post-selection. This removes
the last vestige of private state for transitions.

This required a few changes to tests that depended on the order of callbacks for
tweens and events. Because timers are called back in reverse order, tweens are
now initialized in reverse order, and listeners are now invoked in order.
2012-10-11 12:39:24 -07:00
Mike Bostock c3635192d8 Remove backwards-compatibility for d3.xhr. 2012-10-05 17:05:59 -07:00
Mike Bostock 319d9954b9 Remove d3.split. 2012-10-05 16:58:19 -07:00
Mike Bostock 0b1b9fbbda Remove d3.first and d3.last.
I never used these. They're fired!
2012-10-05 16:44:48 -07:00
Mike Bostock 044f61507c Merge branch 'transition-reselect' into 2.11 2012-10-05 16:29:56 -07:00
Mike Bostock 223d6aa715 Transition reselection.
It is now possible to reselect elements with scheduled transitions and redefine
associated tweens; this enables "post-selection" to customize the behavior of
reusable components undergoing transitions, such as an axis. This commit also
makes it much easier to sequence transitions.

Previously, a transition's tweens were stored privately by the transition and
could only be accessed through the transition. This made it impossible to modify
transitions created by components: the transition is not accessible externally,
and cannot be reselected from the document. Consider the following snippet:

  g.select(".x.axis")
      .call(xAxis)
    .selectAll("text")
      .attr("dy", null);

If `g` is a selection, then this code alters the appearance of the axis as
expected. However, if `g` is a transition, then transition.selectAll creates a
new concurrent transition, and now multiple tweens compete to set the "dy"
attribute. Oy!

Under the new design, an element's scheduled tweens are stored semi-privately on
the node (in the existing node.__transition__). Transition parameters can thus
be reselected and modified by transitions that share the same id. If you now
reselect a transitioning element, you modify the transition rather creating a
competing transition; this should be less surprising and allow greater control.

As a side-effect of this change, it is no longer possible to schedule concurrent
transitions on the same element, even with the same id: only one transition may
be active on a given element at any time. (Note that you can still schedule
multiple future transitions on the same element, and concurrent transitions on
different elements.) For example, you could previously schedule overlapping
transitions with different easing functions, delays or durations, provided you
were careful to avoid conflict. This seems like a relatively obscure use-case
compared to modifying a transition, so I believe this is a reasonable change.

This commit also changes transition.transition, such that the returned
transition starts at the end of the originating transition, rather than
overlapping. This makes it much easier to schedule sequenced transitions without
the complexity of transition.each("end") and d3.select(this).

Also, transitions are now simply arrays of nodes, consistent with selections!
2012-10-05 13:36:11 -07:00
Mike Bostock 019583e316 Merge branch 'color' into 2.11 2012-09-28 16:16:53 -07:00
Mike Bostock 428ea4ff92 Fix missing string coercion for d3.tween. 2012-09-28 15:47:13 -07:00
Mike Bostock 78a0284f62 Add @jasondavies' tests for color interpolation. 2012-09-28 15:41:55 -07:00
Mike Bostock 1bfd9a48d3 Revert previous commit; move urlencode to plugin. 2012-09-19 18:54:36 -07:00
Mike Bostock f6c8059dd5 Add d3.urlencode.
And d3.xhr now detects if the data has a type attribute; if so, this is used to
set the Content-Type header if one has not already been specified. In
conjunction with d3.urlencode, it is now easy to post encoded parameters.
2012-09-19 18:37:23 -07:00
Mike Bostock 79c9737d70 Fix d3.json. 2012-09-19 10:39:24 -07:00
Mike Bostock 1c32d23fa4 More flexible XHR framework.
This is backwards-compatible, yet adds numerous features to d3.xhr. You can now:

  * Use standard node-style callbacks (fixes #473).
  * Abort in-flight requests.
  * Listen for progress events.
  * Listen for load, error and abort events separately.
  * Make POST requests (or any other method), including data.
  * Set arbitrary request headers.
  * Have multiple listeners on requests.
2012-09-18 15:49:03 -07:00
Jason Davies 4946a8cf33 d3.format: support negative zeroes. 2012-08-16 08:32:47 +01:00
Jason Davies 22bf99605a d3.format: support center-align. 2012-08-15 23:58:58 +01:00
Jason Davies 0c3ec49dd9 d3.format: support align and non-decimal formats.
This also fixes a minor discrepancy with Python's implementation:
format("013,d")(-42000000) now returns "-0,042,000,000" instead of
"-042,000,000".
2012-08-15 23:25:15 +01:00
Mike Bostock cded852ba4 Add d3.lab and d3.hcl.
Includes d3.interpolateLab and d3.interpolateHcl.
2012-08-08 21:22:21 -07:00
Mike Bostock 952abefad0 Add d3.random.{logNormal,irwinHall}. Fixes #571. 2012-08-08 20:42:12 -07:00
Mike Bostock 15ba641fa3 Merge remote-tracking branch 'origin/map' into 2.10.0
Conflicts:
	src/core/transition-attr.js
	src/core/transition-style.js
2012-08-08 18:08:47 -07:00
Mike Bostock 07f72be0aa Multi-value map support for on. 2012-08-05 16:29:04 -07:00
Mike Bostock 74596a90f7 Remove support for functions that return maps. 2012-08-05 15:52:10 -07:00
Mike Bostock f2b45c132d Multi-value map support for classed. 2012-08-05 14:54:02 -07:00
Mike Bostock ce8852b9b4 Multi-value map support for property. 2012-08-05 09:53:33 -07:00
Mike Bostock 5c1dd6d904 Multi-value map support for style. 2012-08-05 09:53:07 -07:00
Mike Bostock 1976674fc7 Multi-value map support for attr. 2012-08-05 09:52:31 -07:00
Mike Bostock da3131c876 Use hyphen instead of unicode minus for negatives.
Although the unicode minus is typographically correct, using the standard hyphen
is more conventional (and is compatible with standard parsing).
2012-08-02 17:48:26 -07:00
Jason Davies 65a464582d d3.bisect: support very large arrays. 2012-07-31 14:00:26 +01:00
Jason Davies aa3e38e398 Fix and add tests for transition.filter.
Thanks, @mbostock!
2012-07-25 19:36:21 +01:00
Mike Bostock ae1fed7f4f Use shortest path for hue in d3.interpolateHsl.
Fixes #688.
2012-06-28 17:43:26 -07:00
Jason Davies 40ca7f2df7 Remove trailing commas. 2012-05-27 16:13:10 +01:00
Jason Davies 82051284b1 Fix race condition in transition tests.
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.
2012-05-27 15:25:43 +01:00
Mike Bostock 00bc3f05a7 Fix another rounding bug with SI-format.
Turns out 1400 * .001 is 1.4000000000000001, but 1400 / 1000 is 1.4.
2012-04-25 22:18:02 -07:00
Jason Davies e7025c7e4a Update jsdom to v0.2.14.
We can finally re-enable those tests!
2012-04-15 19:59:56 +01:00
Mike Bostock 21fe6d10f2 Fix a bug when interpolating exponent notation.
We weren't properly detecting "1.e2" as a valid number.
2012-03-08 10:56:15 +01:00
Mike Bostock 74be6c13d8 Fix a bug when clearing event listeners.
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.
2012-02-22 21:39:02 -08:00
Mike Bostock 34667bf5e0 Merge branch 'master' of https://github.com/ZeeAgency/d3 into v2.8.0 2012-02-21 22:12:11 -08:00
Mike Bostock 589b12f768 Merge branch 'bisect_accessors' of https://github.com/natevw/d3 into v2.8.0 2012-02-21 21:55:18 -08:00
Mike Bostock f13d60b2ab Force transition duration of at least 1ms.
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.
2012-02-21 18:35:13 -08:00
Mike Bostock 0cf999b08f Query data via selection.data(). Fixes #525.
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.
2012-02-21 13:31:20 -08:00
Mike Bostock f80b1cf244 Add selection.datum. Fixes #489. 2012-02-21 10:31:15 -08:00
Mike Bostock 31b0d3f197 Slight simplification to d3.ns.qualify.
This changes the behavior slightly, but in a good way: if the namespace is
unknown, then it is ignored rather than returning an undefined namespace.
2012-02-21 10:03:23 -08:00
Mike Bostock 003c45e5b3 Adopt d3.map for d3.ease.
Also, if an unknown easing method or mode is specified, fallback to linear-in.
2012-02-21 08:39:42 -08:00
Mike Bostock 1e10e2ca88 Rename map.delete to map.remove.
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.
2012-02-21 08:23:23 -08:00
Mike Bostock a52855962c Don't support interpolating non-enumerables.
We don't need to support interpolating non-enumerable properties; make it
explicit that these properties may or may not be interpolated.
2012-02-20 22:49:31 -08:00
Mike Bostock da43cf2068 map.set returns the set value.
This makes map.set(key, value) equivalent to object[key] = value.
2012-02-20 22:28:42 -08:00
Mike Bostock f1197ed8b6 Use d3.map for d3_svg_symbols.
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).
2012-02-20 21:30:23 -08:00