Skip to content

Commit 2c2b342

Browse files
committed
Update to 2.7.1
1 parent d51446e commit 2c2b342

25 files changed

Lines changed: 60 additions & 57 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.7.0"></script>
6+
<script type="text/javascript" src="../d3.js?2.7.1"></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.7.0"></script>
6+
<script type="text/javascript" src="d3.js?2.7.1"></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.7.0"></script>
6+
<script type="text/javascript" src="../d3.js?2.7.1"></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.7.0"></script>
6+
<script type="text/javascript" src="../d3.js?2.7.1"></script>
77
<style type="text/css">
88

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

d3.js

Lines changed: 26 additions & 21 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.7.0"}; // semver
13+
d3 = {version: "2.7.1"}; // semver
1414
var d3_array = d3_arraySlice; // conversion for NodeLists
1515

1616
function d3_arrayCopy(pseudoarray) {
@@ -424,9 +424,10 @@ d3.round = function(x, n) {
424424
};
425425
d3.xhr = function(url, mime, callback) {
426426
var req = new XMLHttpRequest;
427-
if (arguments.length < 3) callback = mime;
427+
if (arguments.length < 3) callback = mime, mime = null;
428428
else if (mime && req.overrideMimeType) req.overrideMimeType(mime);
429429
req.open("GET", url, true);
430+
if (mime) req.setRequestHeader("Accept", mime);
430431
req.onreadystatechange = function() {
431432
if (req.readyState === 4) callback(req.status < 300 ? req : null);
432433
};
@@ -1574,16 +1575,18 @@ d3_selectionPrototype.property = function(name, value) {
15741575
? propertyFunction : propertyConstant));
15751576
};
15761577
d3_selectionPrototype.text = function(value) {
1577-
return arguments.length < 1 ? this.node().textContent
1578-
: (this.each(typeof value === "function"
1579-
? function() { this.textContent = value.apply(this, arguments); }
1580-
: function() { this.textContent = value; }));
1578+
return arguments.length < 1
1579+
? this.node().textContent : this.each(typeof value === "function"
1580+
? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null
1581+
? function() { this.textContent = ""; }
1582+
: function() { this.textContent = value; });
15811583
};
15821584
d3_selectionPrototype.html = function(value) {
1583-
return arguments.length < 1 ? this.node().innerHTML
1584-
: (this.each(typeof value === "function"
1585-
? function() { this.innerHTML = value.apply(this, arguments); }
1586-
: function() { this.innerHTML = value; }));
1585+
return arguments.length < 1
1586+
? this.node().innerHTML : this.each(typeof value === "function"
1587+
? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null
1588+
? function() { this.innerHTML = ""; }
1589+
: function() { this.innerHTML = value; });
15871590
};
15881591
// TODO append(node)?
15891592
// TODO append(function)?
@@ -2276,9 +2279,13 @@ var d3_timer_frame = window.requestAnimationFrame
22762279
|| window.msRequestAnimationFrame
22772280
|| function(callback) { setTimeout(callback, 17); };
22782281
d3.transform = function(string) {
2279-
d3_transformG.setAttribute("transform", string);
2280-
var t = d3_transformG.transform.baseVal.consolidate();
2281-
return new d3_transform(t ? t.matrix : d3_transformIdentity);
2282+
var g = document.createElementNS(d3.ns.prefix.svg, "g"),
2283+
identity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0};
2284+
return (d3.transform = function(string) {
2285+
g.setAttribute("transform", string);
2286+
var t = g.transform.baseVal.consolidate();
2287+
return new d3_transform(t ? t.matrix : identity);
2288+
})(string);
22822289
};
22832290

22842291
// Compute x-scale and normalize the first row.
@@ -2330,9 +2337,7 @@ function d3_transformCombine(a, b, k) {
23302337
return a;
23312338
}
23322339

2333-
var d3_transformG = document.createElementNS(d3.ns.prefix.svg, "g"),
2334-
d3_transformIdentity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0},
2335-
d3_transformDegrees = 180 / Math.PI;
2340+
var d3_transformDegrees = 180 / Math.PI;
23362341
function d3_noop() {}
23372342
d3.scale = {};
23382343

@@ -2716,7 +2721,7 @@ function d3_scale_ordinal(domain, ranger) {
27162721
};
27172722

27182723
scale.rangeExtent = function() {
2719-
return ranger.x;
2724+
return ranger.t === "range" ? d3_scaleExtent(ranger.x) : ranger.x;
27202725
};
27212726

27222727
scale.copy = function() {
@@ -3503,10 +3508,10 @@ d3.svg.chord = function() {
35033508
var s = subgroup(this, source, d, i),
35043509
t = subgroup(this, target, d, i);
35053510
return "M" + s.p0
3506-
+ arc(s.r, s.p1) + (equals(s, t)
3511+
+ arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t)
35073512
? curve(s.r, s.p1, s.r, s.p0)
35083513
: curve(s.r, s.p1, t.r, t.p0)
3509-
+ arc(t.r, t.p1)
3514+
+ arc(t.r, t.p1, t.a1 - t.a0)
35103515
+ curve(t.r, t.p1, s.r, s.p0))
35113516
+ "Z";
35123517
}
@@ -3529,8 +3534,8 @@ d3.svg.chord = function() {
35293534
return a.a0 == b.a0 && a.a1 == b.a1;
35303535
}
35313536

3532-
function arc(r, p) {
3533-
return "A" + r + "," + r + " 0 0,1 " + p;
3537+
function arc(r, p, a) {
3538+
return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p;
35343539
}
35353540

35363541
function curve(r0, p0, r1, p1) {

d3.layout.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -628,19 +628,17 @@ d3.layout.pie = function() {
628628
: function(i, j) { return sort(data[i], data[j]); });
629629

630630
// Compute the arcs!
631-
var arcs = index.map(function(i) {
632-
return {
631+
// They are stored in the original data's order.
632+
var arcs = [];
633+
index.forEach(function(i) {
634+
arcs[i] = {
633635
data: data[i],
634636
value: d = values[i],
635637
startAngle: a,
636638
endAngle: a += d * k
637639
};
638640
});
639-
640-
// Return the arcs in the original data's order.
641-
return data.map(function(d, i) {
642-
return arcs[index[i]];
643-
});
641+
return arcs;
644642
}
645643

646644
/**
@@ -1392,7 +1390,7 @@ d3.layout.cluster = function() {
13921390
// Second walk, normalizing x & y to the desired size.
13931391
d3_layout_treeVisitAfter(root, function(node) {
13941392
node.x = (node.x - x0) / (x1 - x0) * size[0];
1395-
node.y = (1 - node.y / root.y) * size[1];
1393+
node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
13961394
});
13971395

13981396
return nodes;

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.7.0"> </script>
17-
<script type="text/javascript" src="../d3.chart.js?2.7.0"> </script>
16+
<script type="text/javascript" src="../d3.csv.js?2.7.1"> </script>
17+
<script type="text/javascript" src="../d3.chart.js?2.7.1"> </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.7.0"> </script>
10+
<script type="text/javascript" src="../d3.layout.js?2.7.1"> </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)