d3-rails 3.5.6 → 3.5.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +8 -1
- data/Rakefile +18 -0
- data/app/assets/javascripts/d3.js +182 -134
- data/app/assets/javascripts/d3.min.js +5 -5
- data/app/assets/javascripts/d3.v3.js +182 -134
- data/app/assets/javascripts/d3.v3.min.js +5 -5
- data/lib/d3/rails/version.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 629f71246435a681bf58722453cd4cfea3348a66
|
4
|
+
data.tar.gz: 9f71a1509f19c57e88e481c27f26989e66a8f4c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e9e5fc31ad6dc91e43e41aa7284fd5ce96ffaa22dbcb94ab2dad425017e35eb803d876ca52794305089a9babdf5c1767f79393b54665f15d88b204e5809aafb
|
7
|
+
data.tar.gz: 05fd61f1a92f02fd7ee5fff36a9b975b6117e5a6b945b693d42045c37ec161612a7eb41861350f35de20c10d9f154c97baef8e4f1100ae8766d48e2d426a8aa0
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -6,7 +6,7 @@ d3-rails provides D3 for Rails 3.1 and higher.
|
|
6
6
|
|
7
7
|
## Version
|
8
8
|
|
9
|
-
d3-rails comes with version 3.5.
|
9
|
+
d3-rails comes with version 3.5.11 of D3.js. and will track the always
|
10
10
|
mirror the version of D3 it comes with.
|
11
11
|
|
12
12
|
|
@@ -21,3 +21,10 @@ Please note that D3 is provided via the asset pipeline and you do *not* need to
|
|
21
21
|
Then add it to your manifest file, most probably at `app/assets/javascripts/application.js`:
|
22
22
|
|
23
23
|
//= require d3
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
To update the D3 version contained in the gem, you can run the following rake task
|
28
|
+
```bash
|
29
|
+
bundle exec rake d3:update_version
|
30
|
+
```
|
data/Rakefile
CHANGED
@@ -1,2 +1,20 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
namespace :d3 do
|
5
|
+
desc 'Update d3 version'
|
6
|
+
task :update_version do
|
7
|
+
`curl -o app/assets/javascripts/d3.js https://raw.githubusercontent.com/mbostock/d3/master/d3.js`
|
8
|
+
`curl -o app/assets/javascripts/d3.min.js https://raw.githubusercontent.com/mbostock/d3/master/d3.min.js`
|
9
|
+
`cp app/assets/javascripts/d3.js app/assets/javascripts/d3.v3.js`
|
10
|
+
`cp app/assets/javascripts/d3.min.js app/assets/javascripts/d3.v3.min.js`
|
11
|
+
version = `grep 'version: ".*"' app/assets/javascripts/d3.js | cut -d '"' -f 2`.strip
|
12
|
+
message = <<-MSG
|
13
|
+
Please update the version to #{version} manually in the following files:
|
14
|
+
* CHANGELOG.md
|
15
|
+
* README.md
|
16
|
+
* lib/d3/rails/version.rb
|
17
|
+
MSG
|
18
|
+
puts message.strip.squeeze ' '
|
19
|
+
end
|
20
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
!function() {
|
2
2
|
var d3 = {
|
3
|
-
version: "3.5.
|
3
|
+
version: "3.5.11"
|
4
4
|
};
|
5
5
|
var d3_arraySlice = [].slice, d3_array = function(list) {
|
6
6
|
return d3_arraySlice.call(list);
|
@@ -631,10 +631,7 @@
|
|
631
631
|
prefix: d3_nsPrefix,
|
632
632
|
qualify: function(name) {
|
633
633
|
var i = name.indexOf(":"), prefix = name;
|
634
|
-
if (i >= 0)
|
635
|
-
prefix = name.slice(0, i);
|
636
|
-
name = name.slice(i + 1);
|
637
|
-
}
|
634
|
+
if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1);
|
638
635
|
return d3_nsPrefix.hasOwnProperty(prefix) ? {
|
639
636
|
space: d3_nsPrefix[prefix],
|
640
637
|
local: name
|
@@ -845,12 +842,14 @@
|
|
845
842
|
if (key) {
|
846
843
|
var nodeByKeyValue = new d3_Map(), keyValues = new Array(n), keyValue;
|
847
844
|
for (i = -1; ++i < n; ) {
|
848
|
-
if (
|
849
|
-
|
850
|
-
|
851
|
-
|
845
|
+
if (node = group[i]) {
|
846
|
+
if (nodeByKeyValue.has(keyValue = key.call(node, node.__data__, i))) {
|
847
|
+
exitNodes[i] = node;
|
848
|
+
} else {
|
849
|
+
nodeByKeyValue.set(keyValue, node);
|
850
|
+
}
|
851
|
+
keyValues[i] = keyValue;
|
852
852
|
}
|
853
|
-
keyValues[i] = keyValue;
|
854
853
|
}
|
855
854
|
for (i = -1; ++i < m; ) {
|
856
855
|
if (!(node = nodeByKeyValue.get(keyValue = key.call(groupData, nodeData = groupData[i], i)))) {
|
@@ -862,7 +861,7 @@
|
|
862
861
|
nodeByKeyValue.set(keyValue, true);
|
863
862
|
}
|
864
863
|
for (i = -1; ++i < n; ) {
|
865
|
-
if (nodeByKeyValue.get(keyValues[i]) !== true) {
|
864
|
+
if (i in keyValues && nodeByKeyValue.get(keyValues[i]) !== true) {
|
866
865
|
exitNodes[i] = group[i];
|
867
866
|
}
|
868
867
|
}
|
@@ -1054,7 +1053,7 @@
|
|
1054
1053
|
group = d3_array(d3_selectAll(nodes, d3_document));
|
1055
1054
|
group.parentNode = d3_document.documentElement;
|
1056
1055
|
} else {
|
1057
|
-
group = nodes;
|
1056
|
+
group = d3_array(nodes);
|
1058
1057
|
group.parentNode = null;
|
1059
1058
|
}
|
1060
1059
|
return d3_selection([ group ]);
|
@@ -1233,7 +1232,7 @@
|
|
1233
1232
|
function ended() {
|
1234
1233
|
if (!position(parent, dragId)) return;
|
1235
1234
|
dragSubject.on(move + dragName, null).on(end + dragName, null);
|
1236
|
-
dragRestore(dragged
|
1235
|
+
dragRestore(dragged);
|
1237
1236
|
dispatch({
|
1238
1237
|
type: "dragend"
|
1239
1238
|
});
|
@@ -1285,18 +1284,22 @@
|
|
1285
1284
|
}
|
1286
1285
|
var ρ = Math.SQRT2, ρ2 = 2, ρ4 = 4;
|
1287
1286
|
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
|
-
|
1287
|
+
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;
|
1288
|
+
if (d2 < ε2) {
|
1289
|
+
S = Math.log(w1 / w0) / ρ;
|
1290
|
+
i = function(t) {
|
1291
|
+
return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(ρ * t * S) ];
|
1292
|
+
};
|
1293
|
+
} else {
|
1294
|
+
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);
|
1295
|
+
S = (r1 - r0) / ρ;
|
1296
|
+
i = function(t) {
|
1297
|
+
var s = t * S, coshr0 = d3_cosh(r0), u = w0 / (ρ2 * d1) * (coshr0 * d3_tanh(ρ * s + r0) - d3_sinh(r0));
|
1294
1298
|
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) ];
|
1299
|
+
};
|
1297
1300
|
}
|
1298
|
-
|
1299
|
-
return
|
1301
|
+
i.duration = S * 1e3;
|
1302
|
+
return i;
|
1300
1303
|
};
|
1301
1304
|
d3.behavior.zoom = function() {
|
1302
1305
|
var view = {
|
@@ -1366,8 +1369,9 @@
|
|
1366
1369
|
view = {
|
1367
1370
|
x: view.x,
|
1368
1371
|
y: view.y,
|
1369
|
-
k:
|
1372
|
+
k: null
|
1370
1373
|
};
|
1374
|
+
scaleTo(+_);
|
1371
1375
|
rescale();
|
1372
1376
|
return zoom;
|
1373
1377
|
};
|
@@ -1466,7 +1470,7 @@
|
|
1466
1470
|
}), center0 = null;
|
1467
1471
|
}
|
1468
1472
|
function mousedowned() {
|
1469
|
-
var that = this,
|
1473
|
+
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
1474
|
d3_selection_interrupt.call(that);
|
1471
1475
|
zoomstarted(dispatch);
|
1472
1476
|
function moved() {
|
@@ -1476,7 +1480,7 @@
|
|
1476
1480
|
}
|
1477
1481
|
function ended() {
|
1478
1482
|
subject.on(mousemove, null).on(mouseup, null);
|
1479
|
-
dragRestore(dragged
|
1483
|
+
dragRestore(dragged);
|
1480
1484
|
zoomended(dispatch);
|
1481
1485
|
}
|
1482
1486
|
}
|
@@ -2114,17 +2118,19 @@
|
|
2114
2118
|
};
|
2115
2119
|
d3.csv = d3.dsv(",", "text/csv");
|
2116
2120
|
d3.tsv = d3.dsv(" ", "text/tab-separated-values");
|
2117
|
-
var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout,
|
2121
|
+
var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_frame = this[d3_vendorSymbol(this, "requestAnimationFrame")] || function(callback) {
|
2118
2122
|
setTimeout(callback, 17);
|
2119
2123
|
};
|
2120
|
-
d3.timer = function(
|
2124
|
+
d3.timer = function() {
|
2125
|
+
d3_timer.apply(this, arguments);
|
2126
|
+
};
|
2127
|
+
function d3_timer(callback, delay, then) {
|
2121
2128
|
var n = arguments.length;
|
2122
2129
|
if (n < 2) delay = 0;
|
2123
2130
|
if (n < 3) then = Date.now();
|
2124
2131
|
var time = then + delay, timer = {
|
2125
2132
|
c: callback,
|
2126
2133
|
t: time,
|
2127
|
-
f: false,
|
2128
2134
|
n: null
|
2129
2135
|
};
|
2130
2136
|
if (d3_timer_queueTail) d3_timer_queueTail.n = timer; else d3_timer_queueHead = timer;
|
@@ -2134,7 +2140,8 @@
|
|
2134
2140
|
d3_timer_interval = 1;
|
2135
2141
|
d3_timer_frame(d3_timer_step);
|
2136
2142
|
}
|
2137
|
-
|
2143
|
+
return timer;
|
2144
|
+
}
|
2138
2145
|
function d3_timer_step() {
|
2139
2146
|
var now = d3_timer_mark(), delay = d3_timer_sweep() - now;
|
2140
2147
|
if (delay > 24) {
|
@@ -2153,22 +2160,21 @@
|
|
2153
2160
|
d3_timer_sweep();
|
2154
2161
|
};
|
2155
2162
|
function d3_timer_mark() {
|
2156
|
-
var now = Date.now();
|
2157
|
-
|
2158
|
-
|
2159
|
-
|
2160
|
-
d3_timer_active = d3_timer_active.n;
|
2163
|
+
var now = Date.now(), timer = d3_timer_queueHead;
|
2164
|
+
while (timer) {
|
2165
|
+
if (now >= timer.t && timer.c(now - timer.t)) timer.c = null;
|
2166
|
+
timer = timer.n;
|
2161
2167
|
}
|
2162
2168
|
return now;
|
2163
2169
|
}
|
2164
2170
|
function d3_timer_sweep() {
|
2165
2171
|
var t0, t1 = d3_timer_queueHead, time = Infinity;
|
2166
2172
|
while (t1) {
|
2167
|
-
if (t1.
|
2168
|
-
t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;
|
2169
|
-
} else {
|
2173
|
+
if (t1.c) {
|
2170
2174
|
if (t1.t < time) time = t1.t;
|
2171
2175
|
t1 = (t0 = t1).n;
|
2176
|
+
} else {
|
2177
|
+
t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;
|
2172
2178
|
}
|
2173
2179
|
}
|
2174
2180
|
d3_timer_queueTail = t0;
|
@@ -2183,7 +2189,7 @@
|
|
2183
2189
|
var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
|
2184
2190
|
d3.formatPrefix = function(value, precision) {
|
2185
2191
|
var i = 0;
|
2186
|
-
if (value) {
|
2192
|
+
if (value = +value) {
|
2187
2193
|
if (value < 0) value *= -1;
|
2188
2194
|
if (precision) value = d3.round(value, d3_format_precision(value, precision));
|
2189
2195
|
i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
|
@@ -2533,7 +2539,8 @@
|
|
2533
2539
|
if (i != string.length) return null;
|
2534
2540
|
if ("p" in d) d.H = d.H % 12 + d.p * 12;
|
2535
2541
|
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 ("
|
2542
|
+
if ("j" in d) date.setFullYear(d.y, 0, d.j); else if ("W" in d || "U" in d) {
|
2543
|
+
if (!("w" in d)) d.w = "W" in d ? 1 : 0;
|
2537
2544
|
date.setFullYear(d.y, 0, 1);
|
2538
2545
|
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
2546
|
} else date.setFullYear(d.y, d.m, d.d);
|
@@ -5985,54 +5992,68 @@
|
|
5985
5992
|
f: 0
|
5986
5993
|
};
|
5987
5994
|
d3.interpolateTransform = d3_interpolateTransform;
|
5988
|
-
function
|
5989
|
-
|
5990
|
-
|
5991
|
-
|
5995
|
+
function d3_interpolateTransformPop(s) {
|
5996
|
+
return s.length ? s.pop() + "," : "";
|
5997
|
+
}
|
5998
|
+
function d3_interpolateTranslate(ta, tb, s, q) {
|
5999
|
+
if (ta[0] !== tb[0] || ta[1] !== tb[1]) {
|
6000
|
+
var i = s.push("translate(", null, ",", null, ")");
|
5992
6001
|
q.push({
|
5993
|
-
i:
|
6002
|
+
i: i - 4,
|
5994
6003
|
x: d3_interpolateNumber(ta[0], tb[0])
|
5995
6004
|
}, {
|
5996
|
-
i:
|
6005
|
+
i: i - 2,
|
5997
6006
|
x: d3_interpolateNumber(ta[1], tb[1])
|
5998
6007
|
});
|
5999
6008
|
} else if (tb[0] || tb[1]) {
|
6000
6009
|
s.push("translate(" + tb + ")");
|
6001
|
-
} else {
|
6002
|
-
s.push("");
|
6003
6010
|
}
|
6004
|
-
|
6011
|
+
}
|
6012
|
+
function d3_interpolateRotate(ra, rb, s, q) {
|
6013
|
+
if (ra !== rb) {
|
6005
6014
|
if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
|
6006
6015
|
q.push({
|
6007
|
-
i: s.push(s
|
6016
|
+
i: s.push(d3_interpolateTransformPop(s) + "rotate(", null, ")") - 2,
|
6008
6017
|
x: d3_interpolateNumber(ra, rb)
|
6009
6018
|
});
|
6010
6019
|
} else if (rb) {
|
6011
|
-
s.push(s
|
6020
|
+
s.push(d3_interpolateTransformPop(s) + "rotate(" + rb + ")");
|
6012
6021
|
}
|
6013
|
-
|
6022
|
+
}
|
6023
|
+
function d3_interpolateSkew(wa, wb, s, q) {
|
6024
|
+
if (wa !== wb) {
|
6014
6025
|
q.push({
|
6015
|
-
i: s.push(s
|
6026
|
+
i: s.push(d3_interpolateTransformPop(s) + "skewX(", null, ")") - 2,
|
6016
6027
|
x: d3_interpolateNumber(wa, wb)
|
6017
6028
|
});
|
6018
6029
|
} else if (wb) {
|
6019
|
-
s.push(s
|
6030
|
+
s.push(d3_interpolateTransformPop(s) + "skewX(" + wb + ")");
|
6020
6031
|
}
|
6021
|
-
|
6022
|
-
|
6032
|
+
}
|
6033
|
+
function d3_interpolateScale(ka, kb, s, q) {
|
6034
|
+
if (ka[0] !== kb[0] || ka[1] !== kb[1]) {
|
6035
|
+
var i = s.push(d3_interpolateTransformPop(s) + "scale(", null, ",", null, ")");
|
6023
6036
|
q.push({
|
6024
|
-
i:
|
6037
|
+
i: i - 4,
|
6025
6038
|
x: d3_interpolateNumber(ka[0], kb[0])
|
6026
6039
|
}, {
|
6027
|
-
i:
|
6040
|
+
i: i - 2,
|
6028
6041
|
x: d3_interpolateNumber(ka[1], kb[1])
|
6029
6042
|
});
|
6030
|
-
} else if (kb[0]
|
6031
|
-
s.push(s
|
6043
|
+
} else if (kb[0] !== 1 || kb[1] !== 1) {
|
6044
|
+
s.push(d3_interpolateTransformPop(s) + "scale(" + kb + ")");
|
6032
6045
|
}
|
6033
|
-
|
6046
|
+
}
|
6047
|
+
function d3_interpolateTransform(a, b) {
|
6048
|
+
var s = [], q = [];
|
6049
|
+
a = d3.transform(a), b = d3.transform(b);
|
6050
|
+
d3_interpolateTranslate(a.translate, b.translate, s, q);
|
6051
|
+
d3_interpolateRotate(a.rotate, b.rotate, s, q);
|
6052
|
+
d3_interpolateSkew(a.skew, b.skew, s, q);
|
6053
|
+
d3_interpolateScale(a.scale, b.scale, s, q);
|
6054
|
+
a = b = null;
|
6034
6055
|
return function(t) {
|
6035
|
-
var i = -1, o;
|
6056
|
+
var i = -1, n = q.length, o;
|
6036
6057
|
while (++i < n) s[(o = q[i]).i] = o.x(t);
|
6037
6058
|
return s.join("");
|
6038
6059
|
};
|
@@ -6136,7 +6157,7 @@
|
|
6136
6157
|
index: di,
|
6137
6158
|
startAngle: x0,
|
6138
6159
|
endAngle: x,
|
6139
|
-
value:
|
6160
|
+
value: groupSums[di]
|
6140
6161
|
};
|
6141
6162
|
x += padding;
|
6142
6163
|
}
|
@@ -6204,7 +6225,7 @@
|
|
6204
6225
|
return chord;
|
6205
6226
|
};
|
6206
6227
|
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;
|
6228
|
+
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
6229
|
function repulse(node) {
|
6209
6230
|
return function(quad, x1, _, x2) {
|
6210
6231
|
if (quad.point !== node) {
|
@@ -6228,6 +6249,7 @@
|
|
6228
6249
|
}
|
6229
6250
|
force.tick = function() {
|
6230
6251
|
if ((alpha *= .99) < .005) {
|
6252
|
+
timer = null;
|
6231
6253
|
event.end({
|
6232
6254
|
type: "end",
|
6233
6255
|
alpha: alpha = 0
|
@@ -6245,7 +6267,7 @@
|
|
6245
6267
|
l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
|
6246
6268
|
x *= l;
|
6247
6269
|
y *= l;
|
6248
|
-
t.x -= x * (k = s.weight / (
|
6270
|
+
t.x -= x * (k = s.weight + t.weight ? s.weight / (s.weight + t.weight) : .5);
|
6249
6271
|
t.y -= y * k;
|
6250
6272
|
s.x += x * (k = 1 - k);
|
6251
6273
|
s.y += y * k;
|
@@ -6341,13 +6363,21 @@
|
|
6341
6363
|
if (!arguments.length) return alpha;
|
6342
6364
|
x = +x;
|
6343
6365
|
if (alpha) {
|
6344
|
-
if (x > 0)
|
6366
|
+
if (x > 0) {
|
6367
|
+
alpha = x;
|
6368
|
+
} else {
|
6369
|
+
timer.c = null, timer.t = NaN, timer = null;
|
6370
|
+
event.end({
|
6371
|
+
type: "end",
|
6372
|
+
alpha: alpha = 0
|
6373
|
+
});
|
6374
|
+
}
|
6345
6375
|
} else if (x > 0) {
|
6346
6376
|
event.start({
|
6347
6377
|
type: "start",
|
6348
6378
|
alpha: alpha = x
|
6349
6379
|
});
|
6350
|
-
|
6380
|
+
timer = d3_timer(force.tick);
|
6351
6381
|
}
|
6352
6382
|
return force;
|
6353
6383
|
};
|
@@ -6601,7 +6631,7 @@
|
|
6601
6631
|
function pie(data) {
|
6602
6632
|
var n = data.length, values = data.map(function(d, i) {
|
6603
6633
|
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) /
|
6634
|
+
}), 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
6635
|
if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
|
6606
6636
|
return values[j] - values[i];
|
6607
6637
|
} : function(i, j) {
|
@@ -7314,10 +7344,8 @@
|
|
7314
7344
|
}
|
7315
7345
|
function treemap(d) {
|
7316
7346
|
var nodes = stickies || hierarchy(d), root = nodes[0];
|
7317
|
-
root.x = 0;
|
7318
|
-
root.
|
7319
|
-
root.dx = size[0];
|
7320
|
-
root.dy = size[1];
|
7347
|
+
root.x = root.y = 0;
|
7348
|
+
if (root.value) root.dx = size[0], root.dy = size[1]; else root.dx = root.dy = 0;
|
7321
7349
|
if (stickies) hierarchy.revalue(root);
|
7322
7350
|
scale([ root ], root.dx * root.dy / root.value);
|
7323
7351
|
(stickies ? stickify : squarify)(root);
|
@@ -7639,10 +7667,11 @@
|
|
7639
7667
|
scale.tickFormat = function(n, format) {
|
7640
7668
|
if (!arguments.length) return d3_scale_logFormat;
|
7641
7669
|
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;
|
7670
|
+
var k = Math.max(1, base * n / scale.ticks().length);
|
7644
7671
|
return function(d) {
|
7645
|
-
|
7672
|
+
var i = d / pow(Math.round(log(d)));
|
7673
|
+
if (i * base < base - .5) i *= base;
|
7674
|
+
return i <= k ? format(d) : "";
|
7646
7675
|
};
|
7647
7676
|
};
|
7648
7677
|
scale.copy = function() {
|
@@ -7981,11 +8010,16 @@
|
|
7981
8010
|
} else {
|
7982
8011
|
x2 = y2 = 0;
|
7983
8012
|
}
|
7984
|
-
if ((rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) {
|
8013
|
+
if (da > ε && (rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) {
|
7985
8014
|
cr = r0 < r1 ^ cw ? 0 : 1;
|
7986
|
-
var
|
8015
|
+
var rc1 = rc, rc0 = rc;
|
8016
|
+
if (da < π) {
|
8017
|
+
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]);
|
8018
|
+
rc0 = Math.min(rc, (r0 - lc) / (kc - 1));
|
8019
|
+
rc1 = Math.min(rc, (r1 - lc) / (kc + 1));
|
8020
|
+
}
|
7987
8021
|
if (x1 != null) {
|
7988
|
-
var
|
8022
|
+
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
8023
|
if (rc === rc1) {
|
7990
8024
|
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
8025
|
} else {
|
@@ -7995,7 +8029,7 @@
|
|
7995
8029
|
path.push("M", x0, ",", y0);
|
7996
8030
|
}
|
7997
8031
|
if (x3 != null) {
|
7998
|
-
var
|
8032
|
+
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
8033
|
if (rc === rc0) {
|
8000
8034
|
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
8035
|
} else {
|
@@ -8077,7 +8111,7 @@
|
|
8077
8111
|
return (x0 - x1) * y0 - (y0 - y1) * x0 > 0 ? 0 : 1;
|
8078
8112
|
}
|
8079
8113
|
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;
|
8114
|
+
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
8115
|
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
|
8082
8116
|
return [ [ cx0 - ox, cy0 - oy ], [ cx0 * r1 / r, cy0 * r1 / r ] ];
|
8083
8117
|
}
|
@@ -8149,10 +8183,10 @@
|
|
8149
8183
|
value.closed = /-closed$/.test(key);
|
8150
8184
|
});
|
8151
8185
|
function d3_svg_lineLinear(points) {
|
8152
|
-
return points.join("L");
|
8186
|
+
return points.length > 1 ? points.join("L") : points + "Z";
|
8153
8187
|
}
|
8154
8188
|
function d3_svg_lineLinearClosed(points) {
|
8155
|
-
return
|
8189
|
+
return points.join("L") + "Z";
|
8156
8190
|
}
|
8157
8191
|
function d3_svg_lineStep(points) {
|
8158
8192
|
var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
|
@@ -8174,7 +8208,7 @@
|
|
8174
8208
|
return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, -1), d3_svg_lineCardinalTangents(points, tension));
|
8175
8209
|
}
|
8176
8210
|
function d3_svg_lineCardinalClosed(points, tension) {
|
8177
|
-
return points.length < 3 ?
|
8211
|
+
return points.length < 3 ? d3_svg_lineLinearClosed(points) : points[0] + d3_svg_lineHermite((points.push(points[0]),
|
8178
8212
|
points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
|
8179
8213
|
}
|
8180
8214
|
function d3_svg_lineCardinal(points, tension) {
|
@@ -8610,9 +8644,11 @@
|
|
8610
8644
|
var d3_selection_interrupt = d3_selection_interruptNS(d3_transitionNamespace());
|
8611
8645
|
function d3_selection_interruptNS(ns) {
|
8612
8646
|
return function() {
|
8613
|
-
var lock, active;
|
8614
|
-
if ((lock = this[ns]) && (active = lock[lock.active])) {
|
8615
|
-
|
8647
|
+
var lock, activeId, active;
|
8648
|
+
if ((lock = this[ns]) && (active = lock[activeId = lock.active])) {
|
8649
|
+
active.timer.c = null;
|
8650
|
+
active.timer.t = NaN;
|
8651
|
+
if (--lock.count) delete lock[activeId]; else delete this[ns];
|
8616
8652
|
lock.active += .5;
|
8617
8653
|
active.event && active.event.interrupt.call(this, this.__data__, active.index);
|
8618
8654
|
}
|
@@ -8867,12 +8903,68 @@
|
|
8867
8903
|
var lock = node[ns] || (node[ns] = {
|
8868
8904
|
active: 0,
|
8869
8905
|
count: 0
|
8870
|
-
}), transition = lock[id];
|
8906
|
+
}), transition = lock[id], time, timer, duration, ease, tweens;
|
8907
|
+
function schedule(elapsed) {
|
8908
|
+
var delay = transition.delay;
|
8909
|
+
timer.t = delay + time;
|
8910
|
+
if (delay <= elapsed) return start(elapsed - delay);
|
8911
|
+
timer.c = start;
|
8912
|
+
}
|
8913
|
+
function start(elapsed) {
|
8914
|
+
var activeId = lock.active, active = lock[activeId];
|
8915
|
+
if (active) {
|
8916
|
+
active.timer.c = null;
|
8917
|
+
active.timer.t = NaN;
|
8918
|
+
--lock.count;
|
8919
|
+
delete lock[activeId];
|
8920
|
+
active.event && active.event.interrupt.call(node, node.__data__, active.index);
|
8921
|
+
}
|
8922
|
+
for (var cancelId in lock) {
|
8923
|
+
if (+cancelId < id) {
|
8924
|
+
var cancel = lock[cancelId];
|
8925
|
+
cancel.timer.c = null;
|
8926
|
+
cancel.timer.t = NaN;
|
8927
|
+
--lock.count;
|
8928
|
+
delete lock[cancelId];
|
8929
|
+
}
|
8930
|
+
}
|
8931
|
+
timer.c = tick;
|
8932
|
+
d3_timer(function() {
|
8933
|
+
if (timer.c && tick(elapsed || 1)) {
|
8934
|
+
timer.c = null;
|
8935
|
+
timer.t = NaN;
|
8936
|
+
}
|
8937
|
+
return 1;
|
8938
|
+
}, 0, time);
|
8939
|
+
lock.active = id;
|
8940
|
+
transition.event && transition.event.start.call(node, node.__data__, i);
|
8941
|
+
tweens = [];
|
8942
|
+
transition.tween.forEach(function(key, value) {
|
8943
|
+
if (value = value.call(node, node.__data__, i)) {
|
8944
|
+
tweens.push(value);
|
8945
|
+
}
|
8946
|
+
});
|
8947
|
+
ease = transition.ease;
|
8948
|
+
duration = transition.duration;
|
8949
|
+
}
|
8950
|
+
function tick(elapsed) {
|
8951
|
+
var t = elapsed / duration, e = ease(t), n = tweens.length;
|
8952
|
+
while (n > 0) {
|
8953
|
+
tweens[--n].call(node, e);
|
8954
|
+
}
|
8955
|
+
if (t >= 1) {
|
8956
|
+
transition.event && transition.event.end.call(node, node.__data__, i);
|
8957
|
+
if (--lock.count) delete lock[id]; else delete node[ns];
|
8958
|
+
return 1;
|
8959
|
+
}
|
8960
|
+
}
|
8871
8961
|
if (!transition) {
|
8872
|
-
|
8962
|
+
time = inherit.time;
|
8963
|
+
timer = d3_timer(schedule, 0, time);
|
8873
8964
|
transition = lock[id] = {
|
8874
8965
|
tween: new d3_Map(),
|
8875
8966
|
time: time,
|
8967
|
+
timer: timer,
|
8876
8968
|
delay: inherit.delay,
|
8877
8969
|
duration: inherit.duration,
|
8878
8970
|
ease: inherit.ease,
|
@@ -8880,49 +8972,6 @@
|
|
8880
8972
|
};
|
8881
8973
|
inherit = null;
|
8882
8974
|
++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
8975
|
}
|
8927
8976
|
}
|
8928
8977
|
d3.svg.axis = function() {
|
@@ -8976,7 +9025,7 @@
|
|
8976
9025
|
};
|
8977
9026
|
axis.ticks = function() {
|
8978
9027
|
if (!arguments.length) return tickArguments_;
|
8979
|
-
tickArguments_ = arguments;
|
9028
|
+
tickArguments_ = d3_array(arguments);
|
8980
9029
|
return axis;
|
8981
9030
|
};
|
8982
9031
|
axis.tickValues = function(x) {
|
@@ -9498,6 +9547,5 @@
|
|
9498
9547
|
d3.xml = d3_xhrType(function(request) {
|
9499
9548
|
return request.responseXML;
|
9500
9549
|
});
|
9501
|
-
if (typeof define === "function" && define.amd) define(d3); else if (typeof module === "object" && module.exports) module.exports = d3;
|
9502
|
-
this.d3 = d3;
|
9550
|
+
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
9551
|
}();
|