Skip to content

Commit 0c08054

Browse files
committed
Update to 2.3.2.
1 parent 4975a90 commit 0c08054

25 files changed

Lines changed: 94 additions & 85 deletions

_layouts/api.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="content-type" content="text/html;charset=utf-8">
55
<title>d3.js{% if page.title %} ~ {{ page.title }}{% endif %}</title>
6-
<script type="text/javascript" src="../d3.js?2.3.0"></script>
6+
<script type="text/javascript" src="../d3.js?2.3.2"></script>
77
<style type="text/css">
88

99
@import url("../style.css?1.10.0");

_layouts/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="content-type" content="text/html;charset=utf-8">
55
<title>d3.js{% if page.title %} ~ {{ page.title }}{% endif %}</title>
6-
<script type="text/javascript" src="d3.js?2.3.0"></script>
6+
<script type="text/javascript" src="d3.js?2.3.2"></script>
77
<style type="text/css">
88

99
@import url("style.css?1.10.0");

_layouts/ex.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="content-type" content="text/html;charset=utf-8">
55
<title>d3.js{% if page.title %} ~ {{ page.title }}{% endif %}</title>
6-
<script type="text/javascript" src="../d3.js?2.3.0"></script>
6+
<script type="text/javascript" src="../d3.js?2.3.2"></script>
77
<style type="text/css">
88

99
@import url("../style.css?1.10.0");

_layouts/tutorial.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="content-type" content="text/html;charset=utf-8">
55
<title>d3.js{% if page.title %} ~ {{ page.title }}{% endif %}</title>
6-
<script type="text/javascript" src="../d3.js?2.3.0"></script>
6+
<script type="text/javascript" src="../d3.js?2.3.2"></script>
77
<style type="text/css">
88

99
@import url("../style.css?1.10.0");

d3.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ try {
1010
d3_style_setProperty.call(this, name, value + "", priority);
1111
};
1212
}
13-
d3 = {version: "2.3.0"}; // semver
13+
d3 = {version: "2.3.2"}; // semver
1414
var d3_array = d3_arraySlice; // conversion for NodeLists
1515

1616
function d3_arrayCopy(pseudoarray) {
@@ -1899,16 +1899,18 @@ d3_transitionPrototype.select = function(selector) {
18991899
d3_transitionPrototype.selectAll = function(selector) {
19001900
var subgroups = [],
19011901
subgroup,
1902+
subnodes,
19021903
node;
19031904

19041905
if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
19051906

19061907
for (var j = -1, m = this.length; ++j < m;) {
19071908
for (var group = this[j], i = -1, n = group.length; ++i < n;) {
19081909
if (node = group[i]) {
1909-
subgroups.push(subgroup = selector.call(node.node, node.node.__data__, i));
1910-
for (var k = -1, o = subgroup.length; ++k < o;) {
1911-
subgroup[k] = {node: subgroup[k], delay: node.delay, duration: node.duration};
1910+
subnodes = selector.call(node.node, node.node.__data__, i);
1911+
subgroups.push(subgroup = []);
1912+
for (var k = -1, o = subnodes.length; ++k < o;) {
1913+
subgroup.push({node: subnodes[k], delay: node.delay, duration: node.duration});
19121914
}
19131915
}
19141916
}

d3.layout.js

Lines changed: 60 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -560,9 +560,9 @@ d3.layout.partition = function() {
560560
node.y = node.depth * dy;
561561
node.dx = dx;
562562
node.dy = dy;
563-
if (children) {
563+
if (children && (n = children.length)) {
564564
var i = -1,
565-
n = children.length,
565+
n,
566566
c,
567567
d;
568568
dx = node.value ? dx / node.value : 0;
@@ -576,9 +576,9 @@ d3.layout.partition = function() {
576576
function depth(node) {
577577
var children = node.children,
578578
d = 0;
579-
if (children) {
579+
if (children && (n = children.length)) {
580580
var i = -1,
581-
n = children.length;
581+
n;
582582
while (++i < n) d = Math.max(d, depth(children[i]));
583583
}
584584
return 1 + d;
@@ -1477,9 +1477,9 @@ d3.layout.tree = function() {
14771477
function secondWalk(node, x) {
14781478
node.x = node._tree.prelim + x;
14791479
var children = node.children;
1480-
if (children) {
1480+
if (children && (n = children.length)) {
14811481
var i = -1,
1482-
n = children.length;
1482+
n;
14831483
x += node._tree.mod;
14841484
while (++i < n) {
14851485
secondWalk(children[i], x);
@@ -1584,18 +1584,21 @@ function d3_layout_treeSeparation(a, b) {
15841584
// }
15851585

15861586
function d3_layout_treeLeft(node) {
1587-
return node.children ? node.children[0] : node._tree.thread;
1587+
var children = node.children;
1588+
return children && children.length ? children[0] : node._tree.thread;
15881589
}
15891590

15901591
function d3_layout_treeRight(node) {
1591-
return node.children ? node.children[node.children.length - 1] : node._tree.thread;
1592+
var children = node.children,
1593+
n;
1594+
return children && (n = children.length) ? children[n - 1] : node._tree.thread;
15921595
}
15931596

15941597
function d3_layout_treeSearch(node, compare) {
15951598
var children = node.children;
1596-
if (children) {
1599+
if (children && (n = children.length)) {
15971600
var child,
1598-
n = children.length,
1601+
n,
15991602
i = -1;
16001603
while (++i < n) {
16011604
if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
@@ -1621,11 +1624,11 @@ function d3_layout_treeDeepest(a, b) {
16211624
function d3_layout_treeVisitAfter(node, callback) {
16221625
function visit(node, previousSibling) {
16231626
var children = node.children;
1624-
if (children) {
1627+
if (children && (n = children.length)) {
16251628
var child,
16261629
previousChild = null,
16271630
i = -1,
1628-
n = children.length;
1631+
n;
16291632
while (++i < n) {
16301633
child = children[i];
16311634
visit(child, previousChild);
@@ -1693,57 +1696,61 @@ d3.layout.treemap = function() {
16931696

16941697
// Recursively arranges the specified node's children into squarified rows.
16951698
function squarify(node) {
1696-
if (!node.children) return;
1697-
var rect = pad(node),
1698-
row = [],
1699-
children = node.children.slice(), // copy-on-write
1700-
child,
1701-
best = Infinity, // the best row score so far
1702-
score, // the current row score
1703-
u = Math.min(rect.dx, rect.dy), // initial orientation
1704-
n;
1705-
scale(children, rect.dx * rect.dy / node.value);
1706-
row.area = 0;
1707-
while ((n = children.length) > 0) {
1708-
row.push(child = children[n - 1]);
1709-
row.area += child.area;
1710-
if ((score = worst(row, u)) <= best) { // continue with this orientation
1711-
children.pop();
1712-
best = score;
1713-
} else { // abort, and try a different orientation
1714-
row.area -= row.pop().area;
1715-
position(row, u, rect, false);
1716-
u = Math.min(rect.dx, rect.dy);
1699+
var children = node.children;
1700+
if (children && children.length) {
1701+
var rect = pad(node),
1702+
row = [],
1703+
remaining = children.slice(), // copy-on-write
1704+
child,
1705+
best = Infinity, // the best row score so far
1706+
score, // the current row score
1707+
u = Math.min(rect.dx, rect.dy), // initial orientation
1708+
n;
1709+
scale(remaining, rect.dx * rect.dy / node.value);
1710+
row.area = 0;
1711+
while ((n = remaining.length) > 0) {
1712+
row.push(child = remaining[n - 1]);
1713+
row.area += child.area;
1714+
if ((score = worst(row, u)) <= best) { // continue with this orientation
1715+
remaining.pop();
1716+
best = score;
1717+
} else { // abort, and try a different orientation
1718+
row.area -= row.pop().area;
1719+
position(row, u, rect, false);
1720+
u = Math.min(rect.dx, rect.dy);
1721+
row.length = row.area = 0;
1722+
best = Infinity;
1723+
}
1724+
}
1725+
if (row.length) {
1726+
position(row, u, rect, true);
17171727
row.length = row.area = 0;
1718-
best = Infinity;
17191728
}
1729+
children.forEach(squarify);
17201730
}
1721-
if (row.length) {
1722-
position(row, u, rect, true);
1723-
row.length = row.area = 0;
1724-
}
1725-
node.children.forEach(squarify);
17261731
}
17271732

17281733
// Recursively resizes the specified node's children into existing rows.
17291734
// Preserves the existing layout!
17301735
function stickify(node) {
1731-
if (!node.children) return;
1732-
var rect = pad(node),
1733-
children = node.children.slice(), // copy-on-write
1734-
child,
1735-
row = [];
1736-
scale(children, rect.dx * rect.dy / node.value);
1737-
row.area = 0;
1738-
while (child = children.pop()) {
1739-
row.push(child);
1740-
row.area += child.area;
1741-
if (child.z != null) {
1742-
position(row, child.z ? rect.dx : rect.dy, rect, !children.length);
1743-
row.length = row.area = 0;
1736+
var children = node.children;
1737+
if (children && children.length) {
1738+
var rect = pad(node),
1739+
remaining = children.slice(), // copy-on-write
1740+
child,
1741+
row = [];
1742+
scale(remaining, rect.dx * rect.dy / node.value);
1743+
row.area = 0;
1744+
while (child = remaining.pop()) {
1745+
row.push(child);
1746+
row.area += child.area;
1747+
if (child.z != null) {
1748+
position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
1749+
row.length = row.area = 0;
1750+
}
17441751
}
1752+
children.forEach(stickify);
17451753
}
1746-
node.children.forEach(stickify);
17471754
}
17481755

17491756
// Computes the score for the specified row, as the worst aspect ratio.

d3.layout.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

d3.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ex/box.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ title: Box Plots
1313

1414
<link type="text/css" rel="stylesheet" href="button.css"/>
1515
<link type="text/css" rel="stylesheet" href="box.css"/>
16-
<script type="text/javascript" src="../d3.csv.js?2.3.0"> </script>
17-
<script type="text/javascript" src="../d3.chart.js?2.3.0"> </script>
16+
<script type="text/javascript" src="../d3.csv.js?2.3.2"> </script>
17+
<script type="text/javascript" src="../d3.chart.js?2.3.2"> </script>
1818
<script type="text/javascript" src="box.js"> </script>
1919

2020
Data from the [Michelson–Morley experiment](http://en.wikipedia.org/wiki/Michelson%E2%80%93Morley_experiment).

ex/bubble.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: Bubble Chart
77

88
<div class="gallery" id="chart"> </div>
99
<link type="text/css" rel="stylesheet" href="bubble.css"/>
10-
<script type="text/javascript" src="../d3.layout.js?2.3.0"> </script>
10+
<script type="text/javascript" src="../d3.layout.js?2.3.2"> </script>
1111
<script type="text/javascript" src="bubble.js"> </script>
1212

1313
Implementation based on work by [Jeff Heer](http://jheer.org/). Data shows the

0 commit comments

Comments
 (0)