Permalink
Browse files

Merge branch 'release'

  • Loading branch information...
2 parents 6c4c7d8 + 8a77b18 commit 3f6fefb557533429a3177f8e7073f84d89e53533 @mbostock mbostock committed Aug 25, 2011
View
@@ -40,6 +40,7 @@ d3.core.js: \
src/core/date.js \
src/core/object.js \
src/core/array.js \
+ src/core/this.js \
src/core/functor.js \
src/core/rebind.js \
src/core/ascending.js \
@@ -113,6 +114,7 @@ d3.core.js: \
src/core/transition-delay.js \
src/core/transition-duration.js \
src/core/transition-each.js \
+ src/core/transition-transition.js \
src/core/timer.js \
src/core/noop.js
View
@@ -141,7 +141,7 @@ d3.geo.albersUsa = function() {
function albersUsa(coordinates) {
var lon = coordinates[0],
lat = coordinates[1];
- return (lat < 25
+ return (lat < 21
? (lon < -100 ? hawaii : puertoRico)
: (lat > 50 ? alaska : lower48))(coordinates);
}
View
Oops, something went wrong.
View
@@ -1,4 +1,4 @@
-(function(){d3 = {version: "2.0.1"}; // semver
+(function(){d3 = {version: "2.0.2"}; // semver
if (!Date.now) Date.now = function() {
return +new Date;
};
@@ -18,6 +18,9 @@ function(array, prototype) {
function(array, prototype) {
for (var property in prototype) array[property] = prototype[property];
};
+function d3_this() {
+ return this;
+}
d3.functor = function(v) {
return typeof v === "function" ? v : function() { return v; };
};
@@ -1739,7 +1742,8 @@ function d3_transition(groups, id) {
var tweens = {},
event = d3.dispatch("start", "end"),
- ease = d3_transitionEase;
+ ease = d3_transitionEase,
+ then = Date.now();
groups.id = id;
@@ -1766,15 +1770,15 @@ function d3_transition(groups, id) {
groups.each(function(d, i, j) {
var tweened = [],
node = this,
- delay = groups[j][i].delay - elapsed,
+ delay = groups[j][i].delay,
duration = groups[j][i].duration,
lock = node.__transition__;
if (!lock) lock = node.__transition__ = {active: 0, owner: id};
else if (lock.owner < id) lock.owner = id;
- delay <= 0 ? start(0) : d3.timer(start, delay);
+ delay <= elapsed ? start() : d3.timer(start, delay, then);
- function start(elapsed) {
+ function start() {
if (lock.active <= id) {
lock.active = id;
event.start.dispatch.call(node, d, i);
@@ -1785,8 +1789,7 @@ function d3_transition(groups, id) {
}
}
- delay -= elapsed;
- d3.timer(tick);
+ d3.timer(tick, 0, then);
}
return true;
}
@@ -1813,7 +1816,7 @@ function d3_transition(groups, id) {
}
});
return true;
- });
+ }, 0, then);
return groups;
}
@@ -1949,24 +1952,29 @@ function d3_transition_each(callback) {
}
return this;
}
+d3_transitionPrototype.transition = function() {
+ return this.select(d3_this);
+};
var d3_timer_queue = null,
d3_timer_interval, // is an interval (or frame) active?
d3_timer_timeout; // is a timeout active?
// The timer will continue to fire until callback returns true.
-d3.timer = function(callback, delay) {
- var now = Date.now(),
- found = false,
+d3.timer = function(callback, delay, then) {
+ var found = false,
t0,
t1 = d3_timer_queue;
- if (arguments.length < 2) delay = 0;
- else if (!isFinite(delay)) return;
+ if (arguments.length < 3) {
+ if (arguments.length < 2) delay = 0;
+ else if (!isFinite(delay)) return;
+ then = Date.now();
+ }
// See if the callback's already in the queue.
while (t1) {
if (t1.callback === callback) {
- t1.then = now;
+ t1.then = then;
t1.delay = delay;
found = true;
break;
@@ -1978,7 +1986,7 @@ d3.timer = function(callback, delay) {
// Otherwise, add the callback to the queue.
if (!found) d3_timer_queue = {
callback: callback,
- then: now,
+ then: then,
delay: delay,
next: d3_timer_queue
};
@@ -3504,7 +3512,7 @@ d3.svg.axis = function() {
// Ticks.
var ticks = scale.ticks.apply(scale, tickArguments_),
- tickFormat = tickFormat_ || scale.tickFormat.apply(scale, tickArguments_);
+ tickFormat = tickFormat_ == null ? scale.tickFormat.apply(scale, tickArguments_) : tickFormat_;
// Minor ticks.
var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide),
@@ -3521,7 +3529,7 @@ d3.svg.axis = function() {
tickTransform;
// Domain.
- var range = scale.range(),
+ var range = d3_scaleExtent(scale.range()),
path = g.selectAll(".domain").data([,]),
pathEnter = path.enter().append("svg:path").attr("class", "domain"),
pathUpdate = transition(path);
View
Oops, something went wrong.
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script type="text/javascript" src="../../d3.js"></script>
+ <style type="text/css">
+
+body {
+ font: 10px sans-serif;
+}
+
+line, path {
+ fill: none;
+ stroke: #000;
+ shape-rendering: crispEdges;
+}
+
+.minor :not(.minor) {
+ display: none;
+}
+
+ </style>
+ </head>
+ <body>
+ <script type="text/javascript">
+
+var m = [10, 10, 20, 10],
+ w = 960 - m[1] - m[3],
+ h = 80 - m[0] - m[2],
+ x = d3.scale.linear().domain([.05, .95]).range([0, w]),
+ y = d3.scale.linear().range([0, h]);
+
+var svg = d3.select("body").append("svg:svg")
+ .attr("width", w + m[1] + m[3])
+ .attr("height", h + m[0] + m[2])
+ .append("svg:g")
+ .attr("transform", "translate(" + m[3] + "," + m[0] + ")");
+
+svg.append("svg:g")
+ .attr("class", "x minor")
+ .attr("transform", "translate(0," + h + ")")
+ .call(d3.svg.axis().scale(x).tickSubdivide(2).tickSize(-6));
+
+svg.append("svg:g")
+ .attr("class", "x axis")
+ .attr("transform", "translate(0," + h + ")")
+ .call(d3.svg.axis().scale(x));
+
+ </script>
+ </body>
+</html>
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script type="text/javascript" src="../../d3.js"></script>
+ <style type="text/css">
+
+body {
+ font: 10px sans-serif;
+}
+
+rect {
+ fill: #ddd;
+}
+
+.grid line {
+ stroke: #fff;
+}
+
+.grid line.minor {
+ stroke-width: .5px;
+}
+
+.grid text {
+ display: none;
+}
+
+.axis line {
+ stroke: #000;
+}
+
+path {
+ display: none;
+}
+
+ </style>
+ </head>
+ <body>
+ <script type="text/javascript">
+
+var m = [10, 10, 20, 10],
+ w = 960 - m[1] - m[3],
+ h = 80 - m[0] - m[2],
+ x = d3.scale.linear().domain([.05, .95]).range([0, w]),
+ y = d3.scale.linear().range([0, h]);
+
+var svg = d3.select("body").append("svg:svg")
+ .attr("width", w + m[1] + m[3])
+ .attr("height", h + m[0] + m[2])
+ .append("svg:g")
+ .attr("transform", "translate(" + m[3] + "," + m[0] + ")");
+
+svg.append("svg:rect")
+ .attr("width", w)
+ .attr("height", h)
+
+svg.append("svg:g")
+ .attr("class", "x grid")
+ .attr("transform", "translate(0," + h + ")")
+ .call(d3.svg.axis().scale(x).tickSubdivide(1).tickSize(-h));
+
+svg.append("svg:g")
+ .attr("class", "x axis")
+ .attr("transform", "translate(0," + h + ")")
+ .call(d3.svg.axis().scale(x));
+
+ </script>
+ </body>
+</html>
Oops, something went wrong.

0 comments on commit 3f6fefb

Please sign in to comment.