d3-rails 3.5.6 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +25 -5
- data/Rakefile +18 -0
- data/app/assets/javascripts/d3.js +15616 -8932
- data/app/assets/javascripts/d3.min.js +8 -5
- data/app/assets/javascripts/d3.v3.js +199 -148
- data/app/assets/javascripts/d3.v3.min.js +5 -5
- data/app/assets/javascripts/d3.v4.js +16187 -0
- data/app/assets/javascripts/d3.v4.min.js +8 -0
- data/lib/d3/rails/version.rb +1 -1
- metadata +11 -10
@@ -1,6 +1,6 @@
|
|
1
1
|
!function() {
|
2
2
|
var d3 = {
|
3
|
-
version: "3.5.
|
3
|
+
version: "3.5.17"
|
4
4
|
};
|
5
5
|
var d3_arraySlice = [].slice, d3_array = function(list) {
|
6
6
|
return d3_arraySlice.call(list);
|
@@ -220,20 +220,20 @@
|
|
220
220
|
while (i < n) pairs[i] = [ p0 = p1, p1 = array[++i] ];
|
221
221
|
return pairs;
|
222
222
|
};
|
223
|
-
d3.
|
224
|
-
if (!(n =
|
225
|
-
for (var i = -1, m = d3.min(
|
226
|
-
for (var j = -1, n,
|
227
|
-
|
223
|
+
d3.transpose = function(matrix) {
|
224
|
+
if (!(n = matrix.length)) return [];
|
225
|
+
for (var i = -1, m = d3.min(matrix, d3_transposeLength), transpose = new Array(m); ++i < m; ) {
|
226
|
+
for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n; ) {
|
227
|
+
row[j] = matrix[j][i];
|
228
228
|
}
|
229
229
|
}
|
230
|
-
return
|
230
|
+
return transpose;
|
231
231
|
};
|
232
|
-
function
|
232
|
+
function d3_transposeLength(d) {
|
233
233
|
return d.length;
|
234
234
|
}
|
235
|
-
d3.
|
236
|
-
return d3.
|
235
|
+
d3.zip = function() {
|
236
|
+
return d3.transpose(arguments);
|
237
237
|
};
|
238
238
|
d3.keys = function(map) {
|
239
239
|
var keys = [];
|
@@ -620,9 +620,10 @@
|
|
620
620
|
return d3_selectAll(selector, this);
|
621
621
|
};
|
622
622
|
}
|
623
|
+
var d3_nsXhtml = "http://www.w3.org/1999/xhtml";
|
623
624
|
var d3_nsPrefix = {
|
624
625
|
svg: "http://www.w3.org/2000/svg",
|
625
|
-
xhtml:
|
626
|
+
xhtml: d3_nsXhtml,
|
626
627
|
xlink: "http://www.w3.org/1999/xlink",
|
627
628
|
xml: "http://www.w3.org/XML/1998/namespace",
|
628
629
|
xmlns: "http://www.w3.org/2000/xmlns/"
|
@@ -631,10 +632,7 @@
|
|
631
632
|
prefix: d3_nsPrefix,
|
632
633
|
qualify: function(name) {
|
633
634
|
var i = name.indexOf(":"), prefix = name;
|
634
|
-
if (i >= 0)
|
635
|
-
prefix = name.slice(0, i);
|
636
|
-
name = name.slice(i + 1);
|
637
|
-
}
|
635
|
+
if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
|
638
636
|
return d3_nsPrefix.hasOwnProperty(prefix) ? {
|
639
637
|
space: d3_nsPrefix[prefix],
|
640
638
|
local: name
|
@@ -808,7 +806,7 @@
|
|
808
806
|
function d3_selection_creator(name) {
|
809
807
|
function create() {
|
810
808
|
var document = this.ownerDocument, namespace = this.namespaceURI;
|
811
|
-
return namespace ? document.
|
809
|
+
return namespace === d3_nsXhtml && document.documentElement.namespaceURI === d3_nsXhtml ? document.createElement(name) : document.createElementNS(namespace, name);
|
812
810
|
}
|
813
811
|
function createNS() {
|
814
812
|
return this.ownerDocument.createElementNS(name.space, name.local);
|
@@ -845,12 +843,14 @@
|
|
845
843
|
if (key) {
|
846
844
|
var nodeByKeyValue = new d3_Map(), keyValues = new Array(n), keyValue;
|
847
845
|
for (i = -1; ++i < n; ) {
|
848
|
-
if (
|
849
|
-
|
850
|
-
|
851
|
-
|
846
|
+
if (node = group[i]) {
|
847
|
+
if (nodeByKeyValue.has(keyValue = key.call(node, node.__data__, i))) {
|
848
|
+
exitNodes[i] = node;
|
849
|
+
} else {
|
850
|
+
nodeByKeyValue.set(keyValue, node);
|
851
|
+
}
|
852
|
+
keyValues[i] = keyValue;
|
852
853
|
}
|
853
|
-
keyValues[i] = keyValue;
|
854
854
|
}
|
855
855
|
for (i = -1; ++i < m; ) {
|
856
856
|
if (!(node = nodeByKeyValue.get(keyValue = key.call(groupData, nodeData = groupData[i], i)))) {
|
@@ -862,7 +862,7 @@
|
|
862
862
|
nodeByKeyValue.set(keyValue, true);
|
863
863
|
}
|
864
864
|
for (i = -1; ++i < n; ) {
|
865
|
-
if (nodeByKeyValue.get(keyValues[i]) !== true) {
|
865
|
+
if (i in keyValues && nodeByKeyValue.get(keyValues[i]) !== true) {
|
866
866
|
exitNodes[i] = group[i];
|
867
867
|
}
|
868
868
|
}
|
@@ -1054,7 +1054,7 @@
|
|
1054
1054
|
group = d3_array(d3_selectAll(nodes, d3_document));
|
1055
1055
|
group.parentNode = d3_document.documentElement;
|
1056
1056
|
} else {
|
1057
|
-
group = nodes;
|
1057
|
+
group = d3_array(nodes);
|
1058
1058
|
group.parentNode = null;
|
1059
1059
|
}
|
1060
1060
|
return d3_selection([ group ]);
|
@@ -1205,7 +1205,7 @@
|
|
1205
1205
|
}
|
1206
1206
|
function dragstart(id, position, subject, move, end) {
|
1207
1207
|
return function() {
|
1208
|
-
var that = this, target = d3.event.target, parent = that.parentNode, dispatch = event.of(that, arguments), dragged = 0, dragId = id(), dragName = ".drag" + (dragId == null ? "" : "-" + dragId), dragOffset, dragSubject = d3.select(subject(target)).on(move + dragName, moved).on(end + dragName, ended), dragRestore = d3_event_dragSuppress(target), position0 = position(parent, dragId);
|
1208
|
+
var that = this, target = d3.event.target.correspondingElement || d3.event.target, parent = that.parentNode, dispatch = event.of(that, arguments), dragged = 0, dragId = id(), dragName = ".drag" + (dragId == null ? "" : "-" + dragId), dragOffset, dragSubject = d3.select(subject(target)).on(move + dragName, moved).on(end + dragName, ended), dragRestore = d3_event_dragSuppress(target), position0 = position(parent, dragId);
|
1209
1209
|
if (origin) {
|
1210
1210
|
dragOffset = origin.apply(that, arguments);
|
1211
1211
|
dragOffset = [ dragOffset.x - position0[0], dragOffset.y - position0[1] ];
|
@@ -1233,7 +1233,7 @@
|
|
1233
1233
|
function ended() {
|
1234
1234
|
if (!position(parent, dragId)) return;
|
1235
1235
|
dragSubject.on(move + dragName, null).on(end + dragName, null);
|
1236
|
-
dragRestore(dragged
|
1236
|
+
dragRestore(dragged);
|
1237
1237
|
dispatch({
|
1238
1238
|
type: "dragend"
|
1239
1239
|
});
|
@@ -1285,18 +1285,22 @@
|
|
1285
1285
|
}
|
1286
1286
|
var ρ = Math.SQRT2, ρ2 = 2, ρ4 = 4;
|
1287
1287
|
d3.interpolateZoom = function(p0, p1) {
|
1288
|
-
var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2];
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1288
|
+
var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S;
|
1289
|
+
if (d2 < ε2) {
|
1290
|
+
S = Math.log(w1 / w0) / ρ;
|
1291
|
+
i = function(t) {
|
1292
|
+
return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(ρ * t * S) ];
|
1293
|
+
};
|
1294
|
+
} else {
|
1295
|
+
var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + ρ4 * d2) / (2 * w0 * ρ2 * d1), b1 = (w1 * w1 - w0 * w0 - ρ4 * d2) / (2 * w1 * ρ2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
|
1296
|
+
S = (r1 - r0) / ρ;
|
1297
|
+
i = function(t) {
|
1298
|
+
var s = t * S, coshr0 = d3_cosh(r0), u = w0 / (ρ2 * d1) * (coshr0 * d3_tanh(ρ * s + r0) - d3_sinh(r0));
|
1294
1299
|
return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / d3_cosh(ρ * s + r0) ];
|
1295
|
-
}
|
1296
|
-
return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(ρ * s) ];
|
1300
|
+
};
|
1297
1301
|
}
|
1298
|
-
|
1299
|
-
return
|
1302
|
+
i.duration = S * 1e3;
|
1303
|
+
return i;
|
1300
1304
|
};
|
1301
1305
|
d3.behavior.zoom = function() {
|
1302
1306
|
var view = {
|
@@ -1366,8 +1370,9 @@
|
|
1366
1370
|
view = {
|
1367
1371
|
x: view.x,
|
1368
1372
|
y: view.y,
|
1369
|
-
k:
|
1373
|
+
k: null
|
1370
1374
|
};
|
1375
|
+
scaleTo(+_);
|
1371
1376
|
rescale();
|
1372
1377
|
return zoom;
|
1373
1378
|
};
|
@@ -1466,7 +1471,7 @@
|
|
1466
1471
|
}), center0 = null;
|
1467
1472
|
}
|
1468
1473
|
function mousedowned() {
|
1469
|
-
var that = this,
|
1474
|
+
var that = this, dispatch = event.of(that, arguments), dragged = 0, subject = d3.select(d3_window(that)).on(mousemove, moved).on(mouseup, ended), location0 = location(d3.mouse(that)), dragRestore = d3_event_dragSuppress(that);
|
1470
1475
|
d3_selection_interrupt.call(that);
|
1471
1476
|
zoomstarted(dispatch);
|
1472
1477
|
function moved() {
|
@@ -1476,7 +1481,7 @@
|
|
1476
1481
|
}
|
1477
1482
|
function ended() {
|
1478
1483
|
subject.on(mousemove, null).on(mouseup, null);
|
1479
|
-
dragRestore(dragged
|
1484
|
+
dragRestore(dragged);
|
1480
1485
|
zoomended(dispatch);
|
1481
1486
|
}
|
1482
1487
|
}
|
@@ -2114,17 +2119,19 @@
|
|
2114
2119
|
};
|
2115
2120
|
d3.csv = d3.dsv(",", "text/csv");
|
2116
2121
|
d3.tsv = d3.dsv(" ", "text/tab-separated-values");
|
2117
|
-
var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout,
|
2122
|
+
var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_frame = this[d3_vendorSymbol(this, "requestAnimationFrame")] || function(callback) {
|
2118
2123
|
setTimeout(callback, 17);
|
2119
2124
|
};
|
2120
|
-
d3.timer = function(
|
2125
|
+
d3.timer = function() {
|
2126
|
+
d3_timer.apply(this, arguments);
|
2127
|
+
};
|
2128
|
+
function d3_timer(callback, delay, then) {
|
2121
2129
|
var n = arguments.length;
|
2122
2130
|
if (n < 2) delay = 0;
|
2123
2131
|
if (n < 3) then = Date.now();
|
2124
2132
|
var time = then + delay, timer = {
|
2125
2133
|
c: callback,
|
2126
2134
|
t: time,
|
2127
|
-
f: false,
|
2128
2135
|
n: null
|
2129
2136
|
};
|
2130
2137
|
if (d3_timer_queueTail) d3_timer_queueTail.n = timer; else d3_timer_queueHead = timer;
|
@@ -2134,7 +2141,8 @@
|
|
2134
2141
|
d3_timer_interval = 1;
|
2135
2142
|
d3_timer_frame(d3_timer_step);
|
2136
2143
|
}
|
2137
|
-
|
2144
|
+
return timer;
|
2145
|
+
}
|
2138
2146
|
function d3_timer_step() {
|
2139
2147
|
var now = d3_timer_mark(), delay = d3_timer_sweep() - now;
|
2140
2148
|
if (delay > 24) {
|
@@ -2153,22 +2161,21 @@
|
|
2153
2161
|
d3_timer_sweep();
|
2154
2162
|
};
|
2155
2163
|
function d3_timer_mark() {
|
2156
|
-
var now = Date.now();
|
2157
|
-
|
2158
|
-
|
2159
|
-
|
2160
|
-
d3_timer_active = d3_timer_active.n;
|
2164
|
+
var now = Date.now(), timer = d3_timer_queueHead;
|
2165
|
+
while (timer) {
|
2166
|
+
if (now >= timer.t && timer.c(now - timer.t)) timer.c = null;
|
2167
|
+
timer = timer.n;
|
2161
2168
|
}
|
2162
2169
|
return now;
|
2163
2170
|
}
|
2164
2171
|
function d3_timer_sweep() {
|
2165
2172
|
var t0, t1 = d3_timer_queueHead, time = Infinity;
|
2166
2173
|
while (t1) {
|
2167
|
-
if (t1.
|
2168
|
-
t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;
|
2169
|
-
} else {
|
2174
|
+
if (t1.c) {
|
2170
2175
|
if (t1.t < time) time = t1.t;
|
2171
2176
|
t1 = (t0 = t1).n;
|
2177
|
+
} else {
|
2178
|
+
t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;
|
2172
2179
|
}
|
2173
2180
|
}
|
2174
2181
|
d3_timer_queueTail = t0;
|
@@ -2183,7 +2190,7 @@
|
|
2183
2190
|
var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
|
2184
2191
|
d3.formatPrefix = function(value, precision) {
|
2185
2192
|
var i = 0;
|
2186
|
-
if (value) {
|
2193
|
+
if (value = +value) {
|
2187
2194
|
if (value < 0) value *= -1;
|
2188
2195
|
if (precision) value = d3.round(value, d3_format_precision(value, precision));
|
2189
2196
|
i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
|
@@ -2533,7 +2540,8 @@
|
|
2533
2540
|
if (i != string.length) return null;
|
2534
2541
|
if ("p" in d) d.H = d.H % 12 + d.p * 12;
|
2535
2542
|
var localZ = d.Z != null && d3_date !== d3_date_utc, date = new (localZ ? d3_date_utc : d3_date)();
|
2536
|
-
if ("j" in d) date.setFullYear(d.y, 0, d.j); else if ("
|
2543
|
+
if ("j" in d) date.setFullYear(d.y, 0, d.j); else if ("W" in d || "U" in d) {
|
2544
|
+
if (!("w" in d)) d.w = "W" in d ? 1 : 0;
|
2537
2545
|
date.setFullYear(d.y, 0, 1);
|
2538
2546
|
date.setFullYear(d.y, 0, "W" in d ? (d.w + 6) % 7 + d.W * 7 - (date.getDay() + 5) % 7 : d.w + d.U * 7 - (date.getDay() + 6) % 7);
|
2539
2547
|
} else date.setFullYear(d.y, d.m, d.d);
|
@@ -3517,7 +3525,7 @@
|
|
3517
3525
|
λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ, point0 = point;
|
3518
3526
|
}
|
3519
3527
|
}
|
3520
|
-
return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum <
|
3528
|
+
return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < -ε) ^ winding & 1;
|
3521
3529
|
}
|
3522
3530
|
function d3_geo_clipCircle(radius) {
|
3523
3531
|
var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = abs(cr) > ε, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians);
|
@@ -5985,54 +5993,68 @@
|
|
5985
5993
|
f: 0
|
5986
5994
|
};
|
5987
5995
|
d3.interpolateTransform = d3_interpolateTransform;
|
5988
|
-
function
|
5989
|
-
|
5990
|
-
|
5991
|
-
|
5996
|
+
function d3_interpolateTransformPop(s) {
|
5997
|
+
return s.length ? s.pop() + "," : "";
|
5998
|
+
}
|
5999
|
+
function d3_interpolateTranslate(ta, tb, s, q) {
|
6000
|
+
if (ta[0] !== tb[0] || ta[1] !== tb[1]) {
|
6001
|
+
var i = s.push("translate(", null, ",", null, ")");
|
5992
6002
|
q.push({
|
5993
|
-
i:
|
6003
|
+
i: i - 4,
|
5994
6004
|
x: d3_interpolateNumber(ta[0], tb[0])
|
5995
6005
|
}, {
|
5996
|
-
i:
|
6006
|
+
i: i - 2,
|
5997
6007
|
x: d3_interpolateNumber(ta[1], tb[1])
|
5998
6008
|
});
|
5999
6009
|
} else if (tb[0] || tb[1]) {
|
6000
6010
|
s.push("translate(" + tb + ")");
|
6001
|
-
} else {
|
6002
|
-
s.push("");
|
6003
6011
|
}
|
6004
|
-
|
6012
|
+
}
|
6013
|
+
function d3_interpolateRotate(ra, rb, s, q) {
|
6014
|
+
if (ra !== rb) {
|
6005
6015
|
if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
|
6006
6016
|
q.push({
|
6007
|
-
i: s.push(s
|
6017
|
+
i: s.push(d3_interpolateTransformPop(s) + "rotate(", null, ")") - 2,
|
6008
6018
|
x: d3_interpolateNumber(ra, rb)
|
6009
6019
|
});
|
6010
6020
|
} else if (rb) {
|
6011
|
-
s.push(s
|
6021
|
+
s.push(d3_interpolateTransformPop(s) + "rotate(" + rb + ")");
|
6012
6022
|
}
|
6013
|
-
|
6023
|
+
}
|
6024
|
+
function d3_interpolateSkew(wa, wb, s, q) {
|
6025
|
+
if (wa !== wb) {
|
6014
6026
|
q.push({
|
6015
|
-
i: s.push(s
|
6027
|
+
i: s.push(d3_interpolateTransformPop(s) + "skewX(", null, ")") - 2,
|
6016
6028
|
x: d3_interpolateNumber(wa, wb)
|
6017
6029
|
});
|
6018
6030
|
} else if (wb) {
|
6019
|
-
s.push(s
|
6031
|
+
s.push(d3_interpolateTransformPop(s) + "skewX(" + wb + ")");
|
6020
6032
|
}
|
6021
|
-
|
6022
|
-
|
6033
|
+
}
|
6034
|
+
function d3_interpolateScale(ka, kb, s, q) {
|
6035
|
+
if (ka[0] !== kb[0] || ka[1] !== kb[1]) {
|
6036
|
+
var i = s.push(d3_interpolateTransformPop(s) + "scale(", null, ",", null, ")");
|
6023
6037
|
q.push({
|
6024
|
-
i:
|
6038
|
+
i: i - 4,
|
6025
6039
|
x: d3_interpolateNumber(ka[0], kb[0])
|
6026
6040
|
}, {
|
6027
|
-
i:
|
6041
|
+
i: i - 2,
|
6028
6042
|
x: d3_interpolateNumber(ka[1], kb[1])
|
6029
6043
|
});
|
6030
|
-
} else if (kb[0]
|
6031
|
-
s.push(s
|
6044
|
+
} else if (kb[0] !== 1 || kb[1] !== 1) {
|
6045
|
+
s.push(d3_interpolateTransformPop(s) + "scale(" + kb + ")");
|
6032
6046
|
}
|
6033
|
-
|
6047
|
+
}
|
6048
|
+
function d3_interpolateTransform(a, b) {
|
6049
|
+
var s = [], q = [];
|
6050
|
+
a = d3.transform(a), b = d3.transform(b);
|
6051
|
+
d3_interpolateTranslate(a.translate, b.translate, s, q);
|
6052
|
+
d3_interpolateRotate(a.rotate, b.rotate, s, q);
|
6053
|
+
d3_interpolateSkew(a.skew, b.skew, s, q);
|
6054
|
+
d3_interpolateScale(a.scale, b.scale, s, q);
|
6055
|
+
a = b = null;
|
6034
6056
|
return function(t) {
|
6035
|
-
var i = -1, o;
|
6057
|
+
var i = -1, n = q.length, o;
|
6036
6058
|
while (++i < n) s[(o = q[i]).i] = o.x(t);
|
6037
6059
|
return s.join("");
|
6038
6060
|
};
|
@@ -6136,7 +6158,7 @@
|
|
6136
6158
|
index: di,
|
6137
6159
|
startAngle: x0,
|
6138
6160
|
endAngle: x,
|
6139
|
-
value:
|
6161
|
+
value: groupSums[di]
|
6140
6162
|
};
|
6141
6163
|
x += padding;
|
6142
6164
|
}
|
@@ -6204,7 +6226,7 @@
|
|
6204
6226
|
return chord;
|
6205
6227
|
};
|
6206
6228
|
d3.layout.force = function() {
|
6207
|
-
var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, chargeDistance2 = d3_layout_forceChargeDistance2, gravity = .1, theta2 = .64, nodes = [], links = [], distances, strengths, charges;
|
6229
|
+
var force = {}, event = d3.dispatch("start", "tick", "end"), timer, size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, chargeDistance2 = d3_layout_forceChargeDistance2, gravity = .1, theta2 = .64, nodes = [], links = [], distances, strengths, charges;
|
6208
6230
|
function repulse(node) {
|
6209
6231
|
return function(quad, x1, _, x2) {
|
6210
6232
|
if (quad.point !== node) {
|
@@ -6228,6 +6250,7 @@
|
|
6228
6250
|
}
|
6229
6251
|
force.tick = function() {
|
6230
6252
|
if ((alpha *= .99) < .005) {
|
6253
|
+
timer = null;
|
6231
6254
|
event.end({
|
6232
6255
|
type: "end",
|
6233
6256
|
alpha: alpha = 0
|
@@ -6245,7 +6268,7 @@
|
|
6245
6268
|
l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
|
6246
6269
|
x *= l;
|
6247
6270
|
y *= l;
|
6248
|
-
t.x -= x * (k = s.weight / (
|
6271
|
+
t.x -= x * (k = s.weight + t.weight ? s.weight / (s.weight + t.weight) : .5);
|
6249
6272
|
t.y -= y * k;
|
6250
6273
|
s.x += x * (k = 1 - k);
|
6251
6274
|
s.y += y * k;
|
@@ -6341,13 +6364,21 @@
|
|
6341
6364
|
if (!arguments.length) return alpha;
|
6342
6365
|
x = +x;
|
6343
6366
|
if (alpha) {
|
6344
|
-
if (x > 0)
|
6367
|
+
if (x > 0) {
|
6368
|
+
alpha = x;
|
6369
|
+
} else {
|
6370
|
+
timer.c = null, timer.t = NaN, timer = null;
|
6371
|
+
event.end({
|
6372
|
+
type: "end",
|
6373
|
+
alpha: alpha = 0
|
6374
|
+
});
|
6375
|
+
}
|
6345
6376
|
} else if (x > 0) {
|
6346
6377
|
event.start({
|
6347
6378
|
type: "start",
|
6348
6379
|
alpha: alpha = x
|
6349
6380
|
});
|
6350
|
-
|
6381
|
+
timer = d3_timer(force.tick);
|
6351
6382
|
}
|
6352
6383
|
return force;
|
6353
6384
|
};
|
@@ -6601,7 +6632,7 @@
|
|
6601
6632
|
function pie(data) {
|
6602
6633
|
var n = data.length, values = data.map(function(d, i) {
|
6603
6634
|
return +value.call(pie, d, i);
|
6604
|
-
}), a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle), da = (typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a, p = Math.min(Math.abs(da) / n, +(typeof padAngle === "function" ? padAngle.apply(this, arguments) : padAngle)), pa = p * (da < 0 ? -1 : 1), k = (da - n * pa) /
|
6635
|
+
}), a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle), da = (typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a, p = Math.min(Math.abs(da) / n, +(typeof padAngle === "function" ? padAngle.apply(this, arguments) : padAngle)), pa = p * (da < 0 ? -1 : 1), sum = d3.sum(values), k = sum ? (da - n * pa) / sum : 0, index = d3.range(n), arcs = [], v;
|
6605
6636
|
if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
|
6606
6637
|
return values[j] - values[i];
|
6607
6638
|
} : function(i, j) {
|
@@ -7314,10 +7345,8 @@
|
|
7314
7345
|
}
|
7315
7346
|
function treemap(d) {
|
7316
7347
|
var nodes = stickies || hierarchy(d), root = nodes[0];
|
7317
|
-
root.x = 0;
|
7318
|
-
root.
|
7319
|
-
root.dx = size[0];
|
7320
|
-
root.dy = size[1];
|
7348
|
+
root.x = root.y = 0;
|
7349
|
+
if (root.value) root.dx = size[0], root.dy = size[1]; else root.dx = root.dy = 0;
|
7321
7350
|
if (stickies) hierarchy.revalue(root);
|
7322
7351
|
scale([ root ], root.dx * root.dy / root.value);
|
7323
7352
|
(stickies ? stickify : squarify)(root);
|
@@ -7537,7 +7566,9 @@
|
|
7537
7566
|
return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
|
7538
7567
|
}
|
7539
7568
|
function d3_scale_linearNice(domain, m) {
|
7540
|
-
|
7569
|
+
d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));
|
7570
|
+
d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));
|
7571
|
+
return domain;
|
7541
7572
|
}
|
7542
7573
|
function d3_scale_linearTickRange(domain, m) {
|
7543
7574
|
if (m == null) m = 10;
|
@@ -7639,10 +7670,11 @@
|
|
7639
7670
|
scale.tickFormat = function(n, format) {
|
7640
7671
|
if (!arguments.length) return d3_scale_logFormat;
|
7641
7672
|
if (arguments.length < 2) format = d3_scale_logFormat; else if (typeof format !== "function") format = d3.format(format);
|
7642
|
-
var k = Math.max(
|
7643
|
-
Math.floor), e;
|
7673
|
+
var k = Math.max(1, base * n / scale.ticks().length);
|
7644
7674
|
return function(d) {
|
7645
|
-
|
7675
|
+
var i = d / pow(Math.round(log(d)));
|
7676
|
+
if (i * base < base - .5) i *= base;
|
7677
|
+
return i <= k ? format(d) : "";
|
7646
7678
|
};
|
7647
7679
|
};
|
7648
7680
|
scale.copy = function() {
|
@@ -7981,11 +8013,16 @@
|
|
7981
8013
|
} else {
|
7982
8014
|
x2 = y2 = 0;
|
7983
8015
|
}
|
7984
|
-
if ((rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) {
|
8016
|
+
if (da > ε && (rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) {
|
7985
8017
|
cr = r0 < r1 ^ cw ? 0 : 1;
|
7986
|
-
var
|
8018
|
+
var rc1 = rc, rc0 = rc;
|
8019
|
+
if (da < π) {
|
8020
|
+
var oc = x3 == null ? [ x2, y2 ] : x1 == null ? [ x0, y0 ] : d3_geom_polygonIntersect([ x0, y0 ], [ x3, y3 ], [ x1, y1 ], [ x2, y2 ]), ax = x0 - oc[0], ay = y0 - oc[1], bx = x1 - oc[0], by = y1 - oc[1], kc = 1 / Math.sin(Math.acos((ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))) / 2), lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
8021
|
+
rc0 = Math.min(rc, (r0 - lc) / (kc - 1));
|
8022
|
+
rc1 = Math.min(rc, (r1 - lc) / (kc + 1));
|
8023
|
+
}
|
7987
8024
|
if (x1 != null) {
|
7988
|
-
var
|
8025
|
+
var t30 = d3_svg_arcCornerTangents(x3 == null ? [ x2, y2 ] : [ x3, y3 ], [ x0, y0 ], r1, rc1, cw), t12 = d3_svg_arcCornerTangents([ x1, y1 ], [ x2, y2 ], r1, rc1, cw);
|
7989
8026
|
if (rc === rc1) {
|
7990
8027
|
path.push("M", t30[0], "A", rc1, ",", rc1, " 0 0,", cr, " ", t30[1], "A", r1, ",", r1, " 0 ", 1 - cw ^ d3_svg_arcSweep(t30[1][0], t30[1][1], t12[1][0], t12[1][1]), ",", cw, " ", t12[1], "A", rc1, ",", rc1, " 0 0,", cr, " ", t12[0]);
|
7991
8028
|
} else {
|
@@ -7995,7 +8032,7 @@
|
|
7995
8032
|
path.push("M", x0, ",", y0);
|
7996
8033
|
}
|
7997
8034
|
if (x3 != null) {
|
7998
|
-
var
|
8035
|
+
var t03 = d3_svg_arcCornerTangents([ x0, y0 ], [ x3, y3 ], r0, -rc0, cw), t21 = d3_svg_arcCornerTangents([ x2, y2 ], x1 == null ? [ x0, y0 ] : [ x1, y1 ], r0, -rc0, cw);
|
7999
8036
|
if (rc === rc0) {
|
8000
8037
|
path.push("L", t21[0], "A", rc0, ",", rc0, " 0 0,", cr, " ", t21[1], "A", r0, ",", r0, " 0 ", cw ^ d3_svg_arcSweep(t21[1][0], t21[1][1], t03[1][0], t03[1][1]), ",", 1 - cw, " ", t03[1], "A", rc0, ",", rc0, " 0 0,", cr, " ", t03[0]);
|
8001
8038
|
} else {
|
@@ -8077,7 +8114,7 @@
|
|
8077
8114
|
return (x0 - x1) * y0 - (y0 - y1) * x0 > 0 ? 0 : 1;
|
8078
8115
|
}
|
8079
8116
|
function d3_svg_arcCornerTangents(p0, p1, r1, rc, cw) {
|
8080
|
-
var x01 = p0[0] - p1[0], y01 = p0[1] - p1[1], lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x1 = p0[0] + ox, y1 = p0[1] + oy, x2 = p1[0] + ox, y2 = p1[1] + oy, x3 = (x1 + x2) / 2, y3 = (y1 + y2) / 2, dx = x2 - x1, dy = y2 - y1, d2 = dx * dx + dy * dy, r = r1 - rc, D = x1 * y2 - x2 * y1, d = (dy < 0 ? -1 : 1) * Math.sqrt(r * r * d2 - D * D), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x3, dy0 = cy0 - y3, dx1 = cx1 - x3, dy1 = cy1 - y3;
|
8117
|
+
var x01 = p0[0] - p1[0], y01 = p0[1] - p1[1], lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x1 = p0[0] + ox, y1 = p0[1] + oy, x2 = p1[0] + ox, y2 = p1[1] + oy, x3 = (x1 + x2) / 2, y3 = (y1 + y2) / 2, dx = x2 - x1, dy = y2 - y1, d2 = dx * dx + dy * dy, r = r1 - rc, D = x1 * y2 - x2 * y1, d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x3, dy0 = cy0 - y3, dx1 = cx1 - x3, dy1 = cy1 - y3;
|
8081
8118
|
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
|
8082
8119
|
return [ [ cx0 - ox, cy0 - oy ], [ cx0 * r1 / r, cy0 * r1 / r ] ];
|
8083
8120
|
}
|
@@ -8149,10 +8186,10 @@
|
|
8149
8186
|
value.closed = /-closed$/.test(key);
|
8150
8187
|
});
|
8151
8188
|
function d3_svg_lineLinear(points) {
|
8152
|
-
return points.join("L");
|
8189
|
+
return points.length > 1 ? points.join("L") : points + "Z";
|
8153
8190
|
}
|
8154
8191
|
function d3_svg_lineLinearClosed(points) {
|
8155
|
-
return
|
8192
|
+
return points.join("L") + "Z";
|
8156
8193
|
}
|
8157
8194
|
function d3_svg_lineStep(points) {
|
8158
8195
|
var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
|
@@ -8174,7 +8211,7 @@
|
|
8174
8211
|
return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, -1), d3_svg_lineCardinalTangents(points, tension));
|
8175
8212
|
}
|
8176
8213
|
function d3_svg_lineCardinalClosed(points, tension) {
|
8177
|
-
return points.length < 3 ?
|
8214
|
+
return points.length < 3 ? d3_svg_lineLinearClosed(points) : points[0] + d3_svg_lineHermite((points.push(points[0]),
|
8178
8215
|
points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
|
8179
8216
|
}
|
8180
8217
|
function d3_svg_lineCardinal(points, tension) {
|
@@ -8610,9 +8647,11 @@
|
|
8610
8647
|
var d3_selection_interrupt = d3_selection_interruptNS(d3_transitionNamespace());
|
8611
8648
|
function d3_selection_interruptNS(ns) {
|
8612
8649
|
return function() {
|
8613
|
-
var lock, active;
|
8614
|
-
if ((lock = this[ns]) && (active = lock[lock.active])) {
|
8615
|
-
|
8650
|
+
var lock, activeId, active;
|
8651
|
+
if ((lock = this[ns]) && (active = lock[activeId = lock.active])) {
|
8652
|
+
active.timer.c = null;
|
8653
|
+
active.timer.t = NaN;
|
8654
|
+
if (--lock.count) delete lock[activeId]; else delete this[ns];
|
8616
8655
|
lock.active += .5;
|
8617
8656
|
active.event && active.event.interrupt.call(this, this.__data__, active.index);
|
8618
8657
|
}
|
@@ -8867,12 +8906,68 @@
|
|
8867
8906
|
var lock = node[ns] || (node[ns] = {
|
8868
8907
|
active: 0,
|
8869
8908
|
count: 0
|
8870
|
-
}), transition = lock[id];
|
8909
|
+
}), transition = lock[id], time, timer, duration, ease, tweens;
|
8910
|
+
function schedule(elapsed) {
|
8911
|
+
var delay = transition.delay;
|
8912
|
+
timer.t = delay + time;
|
8913
|
+
if (delay <= elapsed) return start(elapsed - delay);
|
8914
|
+
timer.c = start;
|
8915
|
+
}
|
8916
|
+
function start(elapsed) {
|
8917
|
+
var activeId = lock.active, active = lock[activeId];
|
8918
|
+
if (active) {
|
8919
|
+
active.timer.c = null;
|
8920
|
+
active.timer.t = NaN;
|
8921
|
+
--lock.count;
|
8922
|
+
delete lock[activeId];
|
8923
|
+
active.event && active.event.interrupt.call(node, node.__data__, active.index);
|
8924
|
+
}
|
8925
|
+
for (var cancelId in lock) {
|
8926
|
+
if (+cancelId < id) {
|
8927
|
+
var cancel = lock[cancelId];
|
8928
|
+
cancel.timer.c = null;
|
8929
|
+
cancel.timer.t = NaN;
|
8930
|
+
--lock.count;
|
8931
|
+
delete lock[cancelId];
|
8932
|
+
}
|
8933
|
+
}
|
8934
|
+
timer.c = tick;
|
8935
|
+
d3_timer(function() {
|
8936
|
+
if (timer.c && tick(elapsed || 1)) {
|
8937
|
+
timer.c = null;
|
8938
|
+
timer.t = NaN;
|
8939
|
+
}
|
8940
|
+
return 1;
|
8941
|
+
}, 0, time);
|
8942
|
+
lock.active = id;
|
8943
|
+
transition.event && transition.event.start.call(node, node.__data__, i);
|
8944
|
+
tweens = [];
|
8945
|
+
transition.tween.forEach(function(key, value) {
|
8946
|
+
if (value = value.call(node, node.__data__, i)) {
|
8947
|
+
tweens.push(value);
|
8948
|
+
}
|
8949
|
+
});
|
8950
|
+
ease = transition.ease;
|
8951
|
+
duration = transition.duration;
|
8952
|
+
}
|
8953
|
+
function tick(elapsed) {
|
8954
|
+
var t = elapsed / duration, e = ease(t), n = tweens.length;
|
8955
|
+
while (n > 0) {
|
8956
|
+
tweens[--n].call(node, e);
|
8957
|
+
}
|
8958
|
+
if (t >= 1) {
|
8959
|
+
transition.event && transition.event.end.call(node, node.__data__, i);
|
8960
|
+
if (--lock.count) delete lock[id]; else delete node[ns];
|
8961
|
+
return 1;
|
8962
|
+
}
|
8963
|
+
}
|
8871
8964
|
if (!transition) {
|
8872
|
-
|
8965
|
+
time = inherit.time;
|
8966
|
+
timer = d3_timer(schedule, 0, time);
|
8873
8967
|
transition = lock[id] = {
|
8874
8968
|
tween: new d3_Map(),
|
8875
8969
|
time: time,
|
8970
|
+
timer: timer,
|
8876
8971
|
delay: inherit.delay,
|
8877
8972
|
duration: inherit.duration,
|
8878
8973
|
ease: inherit.ease,
|
@@ -8880,49 +8975,6 @@
|
|
8880
8975
|
};
|
8881
8976
|
inherit = null;
|
8882
8977
|
++lock.count;
|
8883
|
-
d3.timer(function(elapsed) {
|
8884
|
-
var delay = transition.delay, duration, ease, timer = d3_timer_active, tweened = [];
|
8885
|
-
timer.t = delay + time;
|
8886
|
-
if (delay <= elapsed) return start(elapsed - delay);
|
8887
|
-
timer.c = start;
|
8888
|
-
function start(elapsed) {
|
8889
|
-
if (lock.active > id) return stop();
|
8890
|
-
var active = lock[lock.active];
|
8891
|
-
if (active) {
|
8892
|
-
--lock.count;
|
8893
|
-
delete lock[lock.active];
|
8894
|
-
active.event && active.event.interrupt.call(node, node.__data__, active.index);
|
8895
|
-
}
|
8896
|
-
lock.active = id;
|
8897
|
-
transition.event && transition.event.start.call(node, node.__data__, i);
|
8898
|
-
transition.tween.forEach(function(key, value) {
|
8899
|
-
if (value = value.call(node, node.__data__, i)) {
|
8900
|
-
tweened.push(value);
|
8901
|
-
}
|
8902
|
-
});
|
8903
|
-
ease = transition.ease;
|
8904
|
-
duration = transition.duration;
|
8905
|
-
d3.timer(function() {
|
8906
|
-
timer.c = tick(elapsed || 1) ? d3_true : tick;
|
8907
|
-
return 1;
|
8908
|
-
}, 0, time);
|
8909
|
-
}
|
8910
|
-
function tick(elapsed) {
|
8911
|
-
if (lock.active !== id) return 1;
|
8912
|
-
var t = elapsed / duration, e = ease(t), n = tweened.length;
|
8913
|
-
while (n > 0) {
|
8914
|
-
tweened[--n].call(node, e);
|
8915
|
-
}
|
8916
|
-
if (t >= 1) {
|
8917
|
-
transition.event && transition.event.end.call(node, node.__data__, i);
|
8918
|
-
return stop();
|
8919
|
-
}
|
8920
|
-
}
|
8921
|
-
function stop() {
|
8922
|
-
if (--lock.count) delete lock[id]; else delete node[ns];
|
8923
|
-
return 1;
|
8924
|
-
}
|
8925
|
-
}, 0, time);
|
8926
8978
|
}
|
8927
8979
|
}
|
8928
8980
|
d3.svg.axis = function() {
|
@@ -8976,7 +9028,7 @@
|
|
8976
9028
|
};
|
8977
9029
|
axis.ticks = function() {
|
8978
9030
|
if (!arguments.length) return tickArguments_;
|
8979
|
-
tickArguments_ = arguments;
|
9031
|
+
tickArguments_ = d3_array(arguments);
|
8980
9032
|
return axis;
|
8981
9033
|
};
|
8982
9034
|
axis.tickValues = function(x) {
|
@@ -9498,6 +9550,5 @@
|
|
9498
9550
|
d3.xml = d3_xhrType(function(request) {
|
9499
9551
|
return request.responseXML;
|
9500
9552
|
});
|
9501
|
-
if (typeof define === "function" && define.amd) define(d3); else if (typeof module === "object" && module.exports) module.exports = d3;
|
9502
|
-
this.d3 = d3;
|
9553
|
+
if (typeof define === "function" && define.amd) this.d3 = d3, define(d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3;
|
9503
9554
|
}();
|