Permalink
Browse files

Merge branch 'release'

  • Loading branch information...
2 parents 06ecb61 + 0afaaa2 commit a40876cb5501064a18d1fd36b6cf832c5d0fb555 @mbostock mbostock committed Jul 17, 2011
Showing with 44 additions and 24 deletions.
  1. +2 −2 d3.chart.js
  2. +1 −1 d3.chart.min.js
  3. +3 −3 d3.js
  4. +15 −5 d3.layout.js
  5. +1 −1 d3.layout.min.js
  6. +2 −2 d3.min.js
  7. +2 −2 src/chart/horizon.js
  8. +1 −1 src/core/core.js
  9. +1 −1 src/core/selection.js
  10. +1 −1 src/core/transition.js
  11. +8 −2 src/layout/force.js
  12. +1 −0 src/layout/pie.js
  13. +6 −3 src/layout/treemap.js
View
@@ -712,13 +712,13 @@ d3.chart.horizon = function() {
};
horizon.width = function(x) {
- if (!arguments.length) return width;
+ if (!arguments.length) return w;
w = +x;
return horizon;
};
horizon.height = function(x) {
- if (!arguments.length) return height;
+ if (!arguments.length) return h;
h = +x;
return horizon;
};
View
Oops, something went wrong.
View
@@ -1,4 +1,4 @@
-(function(){d3 = {version: "1.27.1"}; // semver
+(function(){d3 = {version: "1.27.2"}; // semver
if (!Date.now) Date.now = function() {
return +new Date;
};
@@ -1332,7 +1332,7 @@ function d3_selection(groups) {
for (i = 0; i < n; i++) {
key = join.call(node = group[i], node.__data__, i);
if (key in nodeByKey) {
- exitNodes[j++] = group[i]; // duplicate key
+ exitNodes[j++] = node; // duplicate key
} else {
nodeByKey[key] = node;
}
@@ -1932,7 +1932,7 @@ function d3_transition(groups) {
var owner = tx.owner;
if (owner === transitionId) {
delete this.__transition__;
- if (remove) this.parentNode.removeChild(this);
+ if (remove && this.parentNode) this.parentNode.removeChild(this);
}
d3_transitionInheritId = transitionId;
event.end.dispatch.apply(this, arguments);
View
@@ -560,12 +560,18 @@ function d3_layout_forceAccumulate(quad) {
cy = 0;
quad.count = 0;
if (!quad.leaf) {
- quad.nodes.forEach(function(c) {
+ var nodes = quad.nodes,
+ n = nodes.length,
+ i = -1,
+ c;
+ while (++i < n) {
+ c = nodes[i];
+ if (c == null) continue;
d3_layout_forceAccumulate(c);
quad.count += c.count;
cx += c.count * c.cx;
cy += c.count * c.cy;
- });
+ }
}
if (quad.point) {
// jitter internal nodes that are coincident
@@ -669,6 +675,7 @@ d3.layout.pie = function() {
// Compute the arcs!
var arcs = index.map(function(i) {
return {
+ data: data[i],
value: d = values[i],
startAngle: a,
endAngle: a += d * k
@@ -1712,8 +1719,9 @@ d3.layout.treemap = function() {
// Recursively compute the node area based on value & scale.
function scale(node, k) {
- var children = node.children;
- node.area = node.value * k;
+ var children = node.children,
+ value = node.value;
+ node.area = isNaN(value) || value < 0 ? 0 : value * k;
if (children) {
var i = -1,
n = children.length;
@@ -1789,7 +1797,9 @@ d3.layout.treemap = function() {
}
s *= s;
u *= u;
- return Math.max((u * rmax * ratio) / s, s / (u * rmin * ratio));
+ return rmin || rmax
+ ? Math.max((u * rmax * ratio) / s, s / (u * rmin * ratio))
+ : Infinity;
}
// Positions the specified row of nodes. Modifies `rect`.
View
Oops, something went wrong.
View
Oops, something went wrong.
@@ -177,13 +177,13 @@ d3.chart.horizon = function() {
};
horizon.width = function(x) {
- if (!arguments.length) return width;
+ if (!arguments.length) return w;
w = +x;
return horizon;
};
horizon.height = function(x) {
- if (!arguments.length) return height;
+ if (!arguments.length) return h;
h = +x;
return horizon;
};
View
@@ -1 +1 @@
-d3 = {version: "1.27.1"}; // semver
+d3 = {version: "1.27.2"}; // semver
@@ -136,7 +136,7 @@ function d3_selection(groups) {
for (i = 0; i < n; i++) {
key = join.call(node = group[i], node.__data__, i);
if (key in nodeByKey) {
- exitNodes[j++] = group[i]; // duplicate key
+ exitNodes[j++] = node; // duplicate key
} else {
nodeByKey[key] = node;
}
@@ -97,7 +97,7 @@ function d3_transition(groups) {
var owner = tx.owner;
if (owner === transitionId) {
delete this.__transition__;
- if (remove) this.parentNode.removeChild(this);
+ if (remove && this.parentNode) this.parentNode.removeChild(this);
}
d3_transitionInheritId = transitionId;
event.end.dispatch.apply(this, arguments);
View
@@ -354,12 +354,18 @@ function d3_layout_forceAccumulate(quad) {
cy = 0;
quad.count = 0;
if (!quad.leaf) {
- quad.nodes.forEach(function(c) {
+ var nodes = quad.nodes,
+ n = nodes.length,
+ i = -1,
+ c;
+ while (++i < n) {
+ c = nodes[i];
+ if (c == null) continue;
d3_layout_forceAccumulate(c);
quad.count += c.count;
cx += c.count * c.cx;
cy += c.count * c.cy;
- });
+ }
}
if (quad.point) {
// jitter internal nodes that are coincident
View
@@ -31,6 +31,7 @@ d3.layout.pie = function() {
// Compute the arcs!
var arcs = index.map(function(i) {
return {
+ data: data[i],
value: d = values[i],
startAngle: a,
endAngle: a += d * k
@@ -10,8 +10,9 @@ d3.layout.treemap = function() {
// Recursively compute the node area based on value & scale.
function scale(node, k) {
- var children = node.children;
- node.area = node.value * k;
+ var children = node.children,
+ value = node.value;
+ node.area = isNaN(value) || value < 0 ? 0 : value * k;
if (children) {
var i = -1,
n = children.length;
@@ -87,7 +88,9 @@ d3.layout.treemap = function() {
}
s *= s;
u *= u;
- return Math.max((u * rmax * ratio) / s, s / (u * rmin * ratio));
+ return rmin || rmax
+ ? Math.max((u * rmax * ratio) / s, s / (u * rmin * ratio))
+ : Infinity;
}
// Positions the specified row of nodes. Modifies `rect`.

0 comments on commit a40876c

Please sign in to comment.