d3-rails 3.4.11 → 3.4.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/app/assets/javascripts/d3.js +202 -220
- data/app/assets/javascripts/d3.min.js +5 -5
- data/app/assets/javascripts/d3.v3.js +202 -220
- data/app/assets/javascripts/d3.v3.min.js +5 -5
- data/lib/d3/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 448b4456604b6b4ec016e2df9cd2f9071dc5dee7
|
4
|
+
data.tar.gz: b74cf5c2c333af859432610867924a42fbfd1391
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e0e3ac25b4e49bc1079bfc68a418cc716c69575e4d66e181222805dedaba0458613f6e5e416226f722550e93dd6fd6f18e849379de9e95b49b265d357eced36
|
7
|
+
data.tar.gz: 28d4e1376ae65ff571fe49178307ab8ac9ae940b1d41ce04f2d9a212bccd126165151db0aab7308e64cebe15c713e0717704b991ec74b8c32dfd95c9c38056ea
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
!function() {
|
2
2
|
var d3 = {
|
3
|
-
version: "3.4.
|
3
|
+
version: "3.4.13"
|
4
4
|
};
|
5
5
|
if (!Date.now) Date.now = function() {
|
6
6
|
return +new Date();
|
@@ -78,24 +78,27 @@
|
|
78
78
|
}
|
79
79
|
return [ a, c ];
|
80
80
|
};
|
81
|
+
function d3_number(x) {
|
82
|
+
return x === null ? NaN : +x;
|
83
|
+
}
|
84
|
+
function d3_numeric(x) {
|
85
|
+
return !isNaN(x);
|
86
|
+
}
|
81
87
|
d3.sum = function(array, f) {
|
82
88
|
var s = 0, n = array.length, a, i = -1;
|
83
89
|
if (arguments.length === 1) {
|
84
|
-
while (++i < n) if (
|
90
|
+
while (++i < n) if (d3_numeric(a = +array[i])) s += a;
|
85
91
|
} else {
|
86
|
-
while (++i < n) if (
|
92
|
+
while (++i < n) if (d3_numeric(a = +f.call(array, array[i], i))) s += a;
|
87
93
|
}
|
88
94
|
return s;
|
89
95
|
};
|
90
|
-
function d3_number(x) {
|
91
|
-
return x != null && !isNaN(x);
|
92
|
-
}
|
93
96
|
d3.mean = function(array, f) {
|
94
97
|
var s = 0, n = array.length, a, i = -1, j = n;
|
95
98
|
if (arguments.length === 1) {
|
96
|
-
while (++i < n) if (
|
99
|
+
while (++i < n) if (d3_numeric(a = d3_number(array[i]))) s += a; else --j;
|
97
100
|
} else {
|
98
|
-
while (++i < n) if (
|
101
|
+
while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) s += a; else --j;
|
99
102
|
}
|
100
103
|
return j ? s / j : undefined;
|
101
104
|
};
|
@@ -104,9 +107,13 @@
|
|
104
107
|
return e ? v + e * (values[h] - v) : v;
|
105
108
|
};
|
106
109
|
d3.median = function(array, f) {
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
+
var numbers = [], n = array.length, a, i = -1;
|
111
|
+
if (arguments.length === 1) {
|
112
|
+
while (++i < n) if (d3_numeric(a = d3_number(array[i]))) numbers.push(a);
|
113
|
+
} else {
|
114
|
+
while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) numbers.push(a);
|
115
|
+
}
|
116
|
+
return numbers.length ? d3.quantile(numbers.sort(d3_ascending), .5) : undefined;
|
110
117
|
};
|
111
118
|
function d3_bisector(compare) {
|
112
119
|
return {
|
@@ -223,15 +230,11 @@
|
|
223
230
|
return k;
|
224
231
|
}
|
225
232
|
function d3_class(ctor, properties) {
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
});
|
232
|
-
}
|
233
|
-
} catch (e) {
|
234
|
-
ctor.prototype = properties;
|
233
|
+
for (var key in properties) {
|
234
|
+
Object.defineProperty(ctor.prototype, key, {
|
235
|
+
value: properties[key],
|
236
|
+
enumerable: false
|
237
|
+
});
|
235
238
|
}
|
236
239
|
}
|
237
240
|
d3.map = function(object) {
|
@@ -241,62 +244,63 @@
|
|
241
244
|
}); else for (var key in object) map.set(key, object[key]);
|
242
245
|
return map;
|
243
246
|
};
|
244
|
-
function d3_Map() {
|
247
|
+
function d3_Map() {
|
248
|
+
this._ = Object.create(null);
|
249
|
+
}
|
250
|
+
var d3_map_proto = "__proto__", d3_map_zero = "\x00";
|
245
251
|
d3_class(d3_Map, {
|
246
252
|
has: d3_map_has,
|
247
253
|
get: function(key) {
|
248
|
-
return this[
|
254
|
+
return this._[d3_map_escape(key)];
|
249
255
|
},
|
250
256
|
set: function(key, value) {
|
251
|
-
return this[
|
257
|
+
return this._[d3_map_escape(key)] = value;
|
252
258
|
},
|
253
259
|
remove: d3_map_remove,
|
254
260
|
keys: d3_map_keys,
|
255
261
|
values: function() {
|
256
262
|
var values = [];
|
257
|
-
this.
|
258
|
-
values.push(value);
|
259
|
-
});
|
263
|
+
for (var key in this._) values.push(this._[key]);
|
260
264
|
return values;
|
261
265
|
},
|
262
266
|
entries: function() {
|
263
267
|
var entries = [];
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
value: value
|
268
|
-
});
|
268
|
+
for (var key in this._) entries.push({
|
269
|
+
key: d3_map_unescape(key),
|
270
|
+
value: this._[key]
|
269
271
|
});
|
270
272
|
return entries;
|
271
273
|
},
|
272
274
|
size: d3_map_size,
|
273
275
|
empty: d3_map_empty,
|
274
276
|
forEach: function(f) {
|
275
|
-
for (var key in this
|
277
|
+
for (var key in this._) f.call(this, d3_map_unescape(key), this._[key]);
|
276
278
|
}
|
277
279
|
});
|
278
|
-
|
280
|
+
function d3_map_escape(key) {
|
281
|
+
return (key += "") === d3_map_proto || key[0] === d3_map_zero ? d3_map_zero + key : key;
|
282
|
+
}
|
283
|
+
function d3_map_unescape(key) {
|
284
|
+
return (key += "")[0] === d3_map_zero ? key.slice(1) : key;
|
285
|
+
}
|
279
286
|
function d3_map_has(key) {
|
280
|
-
return
|
287
|
+
return d3_map_escape(key) in this._;
|
281
288
|
}
|
282
289
|
function d3_map_remove(key) {
|
283
|
-
key =
|
284
|
-
return key in this && delete this[key];
|
290
|
+
return (key = d3_map_escape(key)) in this._ && delete this._[key];
|
285
291
|
}
|
286
292
|
function d3_map_keys() {
|
287
293
|
var keys = [];
|
288
|
-
this.
|
289
|
-
keys.push(key);
|
290
|
-
});
|
294
|
+
for (var key in this._) keys.push(d3_map_unescape(key));
|
291
295
|
return keys;
|
292
296
|
}
|
293
297
|
function d3_map_size() {
|
294
298
|
var size = 0;
|
295
|
-
for (var key in this
|
299
|
+
for (var key in this._) ++size;
|
296
300
|
return size;
|
297
301
|
}
|
298
302
|
function d3_map_empty() {
|
299
|
-
for (var key in this
|
303
|
+
for (var key in this._) return false;
|
300
304
|
return true;
|
301
305
|
}
|
302
306
|
d3.nest = function() {
|
@@ -367,22 +371,21 @@
|
|
367
371
|
if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]);
|
368
372
|
return set;
|
369
373
|
};
|
370
|
-
function d3_Set() {
|
374
|
+
function d3_Set() {
|
375
|
+
this._ = Object.create(null);
|
376
|
+
}
|
371
377
|
d3_class(d3_Set, {
|
372
378
|
has: d3_map_has,
|
373
|
-
add: function(
|
374
|
-
this[
|
375
|
-
return
|
376
|
-
},
|
377
|
-
remove: function(value) {
|
378
|
-
value = d3_map_prefix + value;
|
379
|
-
return value in this && delete this[value];
|
379
|
+
add: function(key) {
|
380
|
+
this._[d3_map_escape(key += "")] = true;
|
381
|
+
return key;
|
380
382
|
},
|
383
|
+
remove: d3_map_remove,
|
381
384
|
values: d3_map_keys,
|
382
385
|
size: d3_map_size,
|
383
386
|
empty: d3_map_empty,
|
384
387
|
forEach: function(f) {
|
385
|
-
for (var
|
388
|
+
for (var key in this._) f.call(this, d3_map_unescape(key));
|
386
389
|
}
|
387
390
|
});
|
388
391
|
d3.behavior = {};
|
@@ -399,7 +402,7 @@
|
|
399
402
|
}
|
400
403
|
function d3_vendorSymbol(object, name) {
|
401
404
|
if (name in object) return name;
|
402
|
-
name = name.charAt(0).toUpperCase() + name.
|
405
|
+
name = name.charAt(0).toUpperCase() + name.slice(1);
|
403
406
|
for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) {
|
404
407
|
var prefixName = d3_vendorPrefixes[i] + name;
|
405
408
|
if (prefixName in object) return prefixName;
|
@@ -416,8 +419,8 @@
|
|
416
419
|
d3_dispatch.prototype.on = function(type, listener) {
|
417
420
|
var i = type.indexOf("."), name = "";
|
418
421
|
if (i >= 0) {
|
419
|
-
name = type.
|
420
|
-
type = type.
|
422
|
+
name = type.slice(i + 1);
|
423
|
+
type = type.slice(0, i);
|
421
424
|
}
|
422
425
|
if (type) return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);
|
423
426
|
if (arguments.length === 2) {
|
@@ -558,8 +561,8 @@
|
|
558
561
|
qualify: function(name) {
|
559
562
|
var i = name.indexOf(":"), prefix = name;
|
560
563
|
if (i >= 0) {
|
561
|
-
prefix = name.
|
562
|
-
name = name.
|
564
|
+
prefix = name.slice(0, i);
|
565
|
+
name = name.slice(i + 1);
|
563
566
|
}
|
564
567
|
return d3_nsPrefix.hasOwnProperty(prefix) ? {
|
565
568
|
space: d3_nsPrefix[prefix],
|
@@ -762,29 +765,26 @@
|
|
762
765
|
function bind(group, groupData) {
|
763
766
|
var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData;
|
764
767
|
if (key) {
|
765
|
-
var nodeByKeyValue = new d3_Map(),
|
768
|
+
var nodeByKeyValue = new d3_Map(), keyValues = new Array(n), keyValue;
|
766
769
|
for (i = -1; ++i < n; ) {
|
767
|
-
keyValue = key.call(node = group[i], node.__data__, i)
|
768
|
-
if (nodeByKeyValue.has(keyValue)) {
|
770
|
+
if (nodeByKeyValue.has(keyValue = key.call(node = group[i], node.__data__, i))) {
|
769
771
|
exitNodes[i] = node;
|
770
772
|
} else {
|
771
773
|
nodeByKeyValue.set(keyValue, node);
|
772
774
|
}
|
773
|
-
keyValues
|
775
|
+
keyValues[i] = keyValue;
|
774
776
|
}
|
775
777
|
for (i = -1; ++i < m; ) {
|
776
|
-
keyValue = key.call(groupData, nodeData = groupData[i], i)
|
777
|
-
|
778
|
+
if (!(node = nodeByKeyValue.get(keyValue = key.call(groupData, nodeData = groupData[i], i)))) {
|
779
|
+
enterNodes[i] = d3_selection_dataNode(nodeData);
|
780
|
+
} else if (node !== true) {
|
778
781
|
updateNodes[i] = node;
|
779
782
|
node.__data__ = nodeData;
|
780
|
-
} else if (!dataByKeyValue.has(keyValue)) {
|
781
|
-
enterNodes[i] = d3_selection_dataNode(nodeData);
|
782
783
|
}
|
783
|
-
|
784
|
-
nodeByKeyValue.remove(keyValue);
|
784
|
+
nodeByKeyValue.set(keyValue, true);
|
785
785
|
}
|
786
786
|
for (i = -1; ++i < n; ) {
|
787
|
-
if (nodeByKeyValue.
|
787
|
+
if (nodeByKeyValue.get(keyValues[i]) !== true) {
|
788
788
|
exitNodes[i] = group[i];
|
789
789
|
}
|
790
790
|
}
|
@@ -911,7 +911,7 @@
|
|
911
911
|
};
|
912
912
|
d3_selectionPrototype.size = function() {
|
913
913
|
var n = 0;
|
914
|
-
this
|
914
|
+
d3_selection_each(this, function() {
|
915
915
|
++n;
|
916
916
|
});
|
917
917
|
return n;
|
@@ -1008,7 +1008,7 @@
|
|
1008
1008
|
};
|
1009
1009
|
function d3_selection_on(type, listener, capture) {
|
1010
1010
|
var name = "__on" + type, i = type.indexOf("."), wrap = d3_selection_onListener;
|
1011
|
-
if (i > 0) type = type.
|
1011
|
+
if (i > 0) type = type.slice(0, i);
|
1012
1012
|
var filter = d3_selection_onFilters.get(type);
|
1013
1013
|
if (filter) type = filter, wrap = d3_selection_onFilter;
|
1014
1014
|
function onRemove() {
|
@@ -1116,13 +1116,13 @@
|
|
1116
1116
|
var rect = container.getBoundingClientRect();
|
1117
1117
|
return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
|
1118
1118
|
}
|
1119
|
-
d3.
|
1120
|
-
if (arguments.length <
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
}
|
1119
|
+
d3.touch = function(container, touches, identifier) {
|
1120
|
+
if (arguments.length < 3) identifier = touches, touches = d3_eventSource().changedTouches;
|
1121
|
+
if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) {
|
1122
|
+
if ((touch = touches[i]).identifier === identifier) {
|
1123
|
+
return d3_mousePoint(container, touch);
|
1124
|
+
}
|
1125
|
+
}
|
1126
1126
|
};
|
1127
1127
|
d3.behavior.drag = function() {
|
1128
1128
|
var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null, mousedown = dragstart(d3_noop, d3.mouse, d3_behavior_dragMouseSubject, "mousemove", "mouseup"), touchstart = dragstart(d3_behavior_dragTouchId, d3.touch, d3_behavior_dragTouchSubject, "touchmove", "touchend");
|
@@ -1182,6 +1182,14 @@
|
|
1182
1182
|
function d3_behavior_dragMouseSubject() {
|
1183
1183
|
return d3_window;
|
1184
1184
|
}
|
1185
|
+
d3.touches = function(container, touches) {
|
1186
|
+
if (arguments.length < 2) touches = d3_eventSource().touches;
|
1187
|
+
return touches ? d3_array(touches).map(function(touch) {
|
1188
|
+
var point = d3_mousePoint(container, touch);
|
1189
|
+
point.identifier = touch.identifier;
|
1190
|
+
return point;
|
1191
|
+
}) : [];
|
1192
|
+
};
|
1185
1193
|
var π = Math.PI, τ = 2 * π, halfπ = π / 2, ε = 1e-6, ε2 = ε * ε, d3_radians = π / 180, d3_degrees = 180 / π;
|
1186
1194
|
function d3_sgn(x) {
|
1187
1195
|
return x > 0 ? 1 : x < 0 ? -1 : 0;
|
@@ -1377,10 +1385,11 @@
|
|
1377
1385
|
}
|
1378
1386
|
}
|
1379
1387
|
function touchstarted() {
|
1380
|
-
var that = this, dispatch = event.of(that, arguments), locations0 = {}, distance0 = 0, scale0, zoomName = ".zoom-" + d3.event.changedTouches[0].identifier, touchmove = "touchmove" + zoomName, touchend = "touchend" + zoomName, targets = [], subject = d3.select(that)
|
1388
|
+
var that = this, dispatch = event.of(that, arguments), locations0 = {}, distance0 = 0, scale0, zoomName = ".zoom-" + d3.event.changedTouches[0].identifier, touchmove = "touchmove" + zoomName, touchend = "touchend" + zoomName, targets = [], subject = d3.select(that), dragRestore = d3_event_dragSuppress();
|
1381
1389
|
d3_selection_interrupt.call(that);
|
1382
1390
|
started();
|
1383
1391
|
zoomstarted(dispatch);
|
1392
|
+
subject.on(mousedown, null).on(touchstart, started);
|
1384
1393
|
function relocate() {
|
1385
1394
|
var touches = d3.touches(that);
|
1386
1395
|
scale0 = view.k;
|
@@ -1539,7 +1548,7 @@
|
|
1539
1548
|
}
|
1540
1549
|
d3.lab = d3_lab;
|
1541
1550
|
function d3_lab(l, a, b) {
|
1542
|
-
return this instanceof d3_lab ? void (this.l = +l, this.a = +a, this.b = +b) : arguments.length < 2 ? l instanceof d3_lab ? new d3_lab(l.l, l.a, l.b) : l instanceof d3_hcl ? d3_hcl_lab(l.
|
1551
|
+
return this instanceof d3_lab ? void (this.l = +l, this.a = +a, this.b = +b) : arguments.length < 2 ? l instanceof d3_lab ? new d3_lab(l.l, l.a, l.b) : l instanceof d3_hcl ? d3_hcl_lab(l.h, l.c, l.l) : d3_rgb_lab((l = d3_rgb(l)).r, l.g, l.b) : new d3_lab(l, a, b);
|
1543
1552
|
}
|
1544
1553
|
var d3_lab_K = 18;
|
1545
1554
|
var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;
|
@@ -1623,7 +1632,7 @@
|
|
1623
1632
|
}
|
1624
1633
|
}
|
1625
1634
|
if (color = d3_rgb_names.get(format)) return rgb(color.r, color.g, color.b);
|
1626
|
-
if (format != null && format.charAt(0) === "#" && !isNaN(color = parseInt(format.
|
1635
|
+
if (format != null && format.charAt(0) === "#" && !isNaN(color = parseInt(format.slice(1), 16))) {
|
1627
1636
|
if (format.length === 4) {
|
1628
1637
|
r = (color & 3840) >> 4;
|
1629
1638
|
r = r >> 4 | r;
|
@@ -1842,7 +1851,7 @@
|
|
1842
1851
|
};
|
1843
1852
|
function respond() {
|
1844
1853
|
var status = request.status, result;
|
1845
|
-
if (!status && request
|
1854
|
+
if (!status && d3_xhrHasResponse(request) || status >= 200 && status < 300 || status === 304) {
|
1846
1855
|
try {
|
1847
1856
|
result = response.call(xhr, request);
|
1848
1857
|
} catch (e) {
|
@@ -1914,6 +1923,10 @@
|
|
1914
1923
|
callback(error == null ? request : null);
|
1915
1924
|
} : callback;
|
1916
1925
|
}
|
1926
|
+
function d3_xhrHasResponse(request) {
|
1927
|
+
var type = request.responseType;
|
1928
|
+
return type && type !== "text" ? request.response : request.responseText;
|
1929
|
+
}
|
1917
1930
|
d3.dsv = function(delimiter, mimeType) {
|
1918
1931
|
var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);
|
1919
1932
|
function dsv(url, row, callback) {
|
@@ -1966,7 +1979,7 @@
|
|
1966
1979
|
} else if (c === 10) {
|
1967
1980
|
eol = true;
|
1968
1981
|
}
|
1969
|
-
return text.
|
1982
|
+
return text.slice(j + 1, i).replace(/""/g, '"');
|
1970
1983
|
}
|
1971
1984
|
while (I < N) {
|
1972
1985
|
var c = text.charCodeAt(I++), k = 1;
|
@@ -1974,9 +1987,9 @@
|
|
1974
1987
|
eol = true;
|
1975
1988
|
if (text.charCodeAt(I) === 10) ++I, ++k;
|
1976
1989
|
} else if (c !== delimiterCode) continue;
|
1977
|
-
return text.
|
1990
|
+
return text.slice(j, I - k);
|
1978
1991
|
}
|
1979
|
-
return text.
|
1992
|
+
return text.slice(j);
|
1980
1993
|
}
|
1981
1994
|
while ((t = token()) !== EOF) {
|
1982
1995
|
var a = [];
|
@@ -1984,7 +1997,7 @@
|
|
1984
1997
|
a.push(t);
|
1985
1998
|
t = token();
|
1986
1999
|
}
|
1987
|
-
if (f &&
|
2000
|
+
if (f && (a = f(a, n++)) == null) continue;
|
1988
2001
|
rows.push(a);
|
1989
2002
|
}
|
1990
2003
|
return rows;
|
@@ -2018,14 +2031,6 @@
|
|
2018
2031
|
};
|
2019
2032
|
d3.csv = d3.dsv(",", "text/csv");
|
2020
2033
|
d3.tsv = d3.dsv(" ", "text/tab-separated-values");
|
2021
|
-
d3.touch = function(container, touches, identifier) {
|
2022
|
-
if (arguments.length < 3) identifier = touches, touches = d3_eventSource().changedTouches;
|
2023
|
-
if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) {
|
2024
|
-
if ((touch = touches[i]).identifier === identifier) {
|
2025
|
-
return d3_mousePoint(container, touch);
|
2026
|
-
}
|
2027
|
-
}
|
2028
|
-
};
|
2029
2034
|
var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_active, d3_timer_frame = d3_window[d3_vendorSymbol(d3_window, "requestAnimationFrame")] || function(callback) {
|
2030
2035
|
setTimeout(callback, 17);
|
2031
2036
|
};
|
@@ -2115,21 +2120,22 @@
|
|
2115
2120
|
};
|
2116
2121
|
}
|
2117
2122
|
function d3_locale_numberFormat(locale) {
|
2118
|
-
var locale_decimal = locale.decimal, locale_thousands = locale.thousands, locale_grouping = locale.grouping, locale_currency = locale.currency, formatGroup = locale_grouping ? function(value) {
|
2119
|
-
var i = value.length, t = [], j = 0, g = locale_grouping[0];
|
2123
|
+
var locale_decimal = locale.decimal, locale_thousands = locale.thousands, locale_grouping = locale.grouping, locale_currency = locale.currency, formatGroup = locale_grouping && locale_thousands ? function(value, width) {
|
2124
|
+
var i = value.length, t = [], j = 0, g = locale_grouping[0], length = 0;
|
2120
2125
|
while (i > 0 && g > 0) {
|
2126
|
+
if (length + g + 1 > width) g = Math.max(1, width - length);
|
2121
2127
|
t.push(value.substring(i -= g, i + g));
|
2128
|
+
if ((length += g + 1) > width) break;
|
2122
2129
|
g = locale_grouping[j = (j + 1) % locale_grouping.length];
|
2123
2130
|
}
|
2124
2131
|
return t.reverse().join(locale_thousands);
|
2125
2132
|
} : d3_identity;
|
2126
2133
|
return function(specifier) {
|
2127
|
-
var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "", symbol = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, prefix = "", suffix = "", integer = false;
|
2134
|
+
var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "-", symbol = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, prefix = "", suffix = "", integer = false, exponent = true;
|
2128
2135
|
if (precision) precision = +precision.substring(1);
|
2129
2136
|
if (zfill || fill === "0" && align === "=") {
|
2130
2137
|
zfill = fill = "0";
|
2131
2138
|
align = "=";
|
2132
|
-
if (comma) width -= Math.floor((width - 1) / 4);
|
2133
2139
|
}
|
2134
2140
|
switch (type) {
|
2135
2141
|
case "n":
|
@@ -2156,6 +2162,8 @@
|
|
2156
2162
|
if (symbol === "#") prefix = "0" + type.toLowerCase();
|
2157
2163
|
|
2158
2164
|
case "c":
|
2165
|
+
exponent = false;
|
2166
|
+
|
2159
2167
|
case "d":
|
2160
2168
|
integer = true;
|
2161
2169
|
precision = 0;
|
@@ -2176,7 +2184,7 @@
|
|
2176
2184
|
return function(value) {
|
2177
2185
|
var fullSuffix = suffix;
|
2178
2186
|
if (integer && value % 1) return "";
|
2179
|
-
var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign;
|
2187
|
+
var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign === "-" ? "" : sign;
|
2180
2188
|
if (scale < 0) {
|
2181
2189
|
var unit = d3.formatPrefix(value, precision);
|
2182
2190
|
value = unit.scale(value);
|
@@ -2185,10 +2193,17 @@
|
|
2185
2193
|
value *= scale;
|
2186
2194
|
}
|
2187
2195
|
value = type(value, precision);
|
2188
|
-
var i = value.lastIndexOf("."), before
|
2189
|
-
if (
|
2196
|
+
var i = value.lastIndexOf("."), before, after;
|
2197
|
+
if (i < 0) {
|
2198
|
+
var j = exponent ? value.lastIndexOf("e") : -1;
|
2199
|
+
if (j < 0) before = value, after = ""; else before = value.substring(0, j), after = value.substring(j);
|
2200
|
+
} else {
|
2201
|
+
before = value.substring(0, i);
|
2202
|
+
after = locale_decimal + value.substring(i + 1);
|
2203
|
+
}
|
2204
|
+
if (!zfill && comma) before = formatGroup(before, Infinity);
|
2190
2205
|
var length = prefix.length + before.length + after.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : "";
|
2191
|
-
if (zcomma) before = formatGroup(padding + before);
|
2206
|
+
if (zcomma) before = formatGroup(padding + before, padding.length ? width - after.length : Infinity);
|
2192
2207
|
negative += prefix;
|
2193
2208
|
value = before + after;
|
2194
2209
|
return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + fullSuffix;
|
@@ -2411,14 +2426,14 @@
|
|
2411
2426
|
var string = [], i = -1, j = 0, c, p, f;
|
2412
2427
|
while (++i < n) {
|
2413
2428
|
if (template.charCodeAt(i) === 37) {
|
2414
|
-
string.push(template.
|
2429
|
+
string.push(template.slice(j, i));
|
2415
2430
|
if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i);
|
2416
2431
|
if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p);
|
2417
2432
|
string.push(c);
|
2418
2433
|
j = i + 1;
|
2419
2434
|
}
|
2420
2435
|
}
|
2421
|
-
string.push(template.
|
2436
|
+
string.push(template.slice(j, i));
|
2422
2437
|
return string.join("");
|
2423
2438
|
}
|
2424
2439
|
format.parse = function(string) {
|
@@ -2439,7 +2454,7 @@
|
|
2439
2454
|
date.setFullYear(d.y, 0, 1);
|
2440
2455
|
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);
|
2441
2456
|
} else date.setFullYear(d.y, d.m, d.d);
|
2442
|
-
date.setHours(d.H +
|
2457
|
+
date.setHours(d.H + (d.Z / 100 | 0), d.M + d.Z % 100, d.S, d.L);
|
2443
2458
|
return localZ ? date._ : date;
|
2444
2459
|
};
|
2445
2460
|
format.toString = function() {
|
@@ -2585,22 +2600,22 @@
|
|
2585
2600
|
};
|
2586
2601
|
function d3_time_parseWeekdayAbbrev(date, string, i) {
|
2587
2602
|
d3_time_dayAbbrevRe.lastIndex = 0;
|
2588
|
-
var n = d3_time_dayAbbrevRe.exec(string.
|
2603
|
+
var n = d3_time_dayAbbrevRe.exec(string.slice(i));
|
2589
2604
|
return n ? (date.w = d3_time_dayAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
|
2590
2605
|
}
|
2591
2606
|
function d3_time_parseWeekday(date, string, i) {
|
2592
2607
|
d3_time_dayRe.lastIndex = 0;
|
2593
|
-
var n = d3_time_dayRe.exec(string.
|
2608
|
+
var n = d3_time_dayRe.exec(string.slice(i));
|
2594
2609
|
return n ? (date.w = d3_time_dayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
|
2595
2610
|
}
|
2596
2611
|
function d3_time_parseMonthAbbrev(date, string, i) {
|
2597
2612
|
d3_time_monthAbbrevRe.lastIndex = 0;
|
2598
|
-
var n = d3_time_monthAbbrevRe.exec(string.
|
2613
|
+
var n = d3_time_monthAbbrevRe.exec(string.slice(i));
|
2599
2614
|
return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
|
2600
2615
|
}
|
2601
2616
|
function d3_time_parseMonth(date, string, i) {
|
2602
2617
|
d3_time_monthRe.lastIndex = 0;
|
2603
|
-
var n = d3_time_monthRe.exec(string.
|
2618
|
+
var n = d3_time_monthRe.exec(string.slice(i));
|
2604
2619
|
return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
|
2605
2620
|
}
|
2606
2621
|
function d3_time_parseLocaleFull(date, string, i) {
|
@@ -2613,7 +2628,7 @@
|
|
2613
2628
|
return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
|
2614
2629
|
}
|
2615
2630
|
function d3_time_parseAmPm(date, string, i) {
|
2616
|
-
var n = d3_time_periodLookup.get(string.
|
2631
|
+
var n = d3_time_periodLookup.get(string.slice(i, i += 2).toLowerCase());
|
2617
2632
|
return n == null ? -1 : (date.p = n, i);
|
2618
2633
|
}
|
2619
2634
|
return d3_time_format;
|
@@ -2637,31 +2652,31 @@
|
|
2637
2652
|
}
|
2638
2653
|
function d3_time_parseWeekdayNumber(date, string, i) {
|
2639
2654
|
d3_time_numberRe.lastIndex = 0;
|
2640
|
-
var n = d3_time_numberRe.exec(string.
|
2655
|
+
var n = d3_time_numberRe.exec(string.slice(i, i + 1));
|
2641
2656
|
return n ? (date.w = +n[0], i + n[0].length) : -1;
|
2642
2657
|
}
|
2643
2658
|
function d3_time_parseWeekNumberSunday(date, string, i) {
|
2644
2659
|
d3_time_numberRe.lastIndex = 0;
|
2645
|
-
var n = d3_time_numberRe.exec(string.
|
2660
|
+
var n = d3_time_numberRe.exec(string.slice(i));
|
2646
2661
|
return n ? (date.U = +n[0], i + n[0].length) : -1;
|
2647
2662
|
}
|
2648
2663
|
function d3_time_parseWeekNumberMonday(date, string, i) {
|
2649
2664
|
d3_time_numberRe.lastIndex = 0;
|
2650
|
-
var n = d3_time_numberRe.exec(string.
|
2665
|
+
var n = d3_time_numberRe.exec(string.slice(i));
|
2651
2666
|
return n ? (date.W = +n[0], i + n[0].length) : -1;
|
2652
2667
|
}
|
2653
2668
|
function d3_time_parseFullYear(date, string, i) {
|
2654
2669
|
d3_time_numberRe.lastIndex = 0;
|
2655
|
-
var n = d3_time_numberRe.exec(string.
|
2670
|
+
var n = d3_time_numberRe.exec(string.slice(i, i + 4));
|
2656
2671
|
return n ? (date.y = +n[0], i + n[0].length) : -1;
|
2657
2672
|
}
|
2658
2673
|
function d3_time_parseYear(date, string, i) {
|
2659
2674
|
d3_time_numberRe.lastIndex = 0;
|
2660
|
-
var n = d3_time_numberRe.exec(string.
|
2675
|
+
var n = d3_time_numberRe.exec(string.slice(i, i + 2));
|
2661
2676
|
return n ? (date.y = d3_time_expandYear(+n[0]), i + n[0].length) : -1;
|
2662
2677
|
}
|
2663
2678
|
function d3_time_parseZone(date, string, i) {
|
2664
|
-
return /^[+-]\d{4}$/.test(string = string.
|
2679
|
+
return /^[+-]\d{4}$/.test(string = string.slice(i, i + 5)) ? (date.Z = -string,
|
2665
2680
|
i + 5) : -1;
|
2666
2681
|
}
|
2667
2682
|
function d3_time_expandYear(d) {
|
@@ -2669,46 +2684,46 @@
|
|
2669
2684
|
}
|
2670
2685
|
function d3_time_parseMonthNumber(date, string, i) {
|
2671
2686
|
d3_time_numberRe.lastIndex = 0;
|
2672
|
-
var n = d3_time_numberRe.exec(string.
|
2687
|
+
var n = d3_time_numberRe.exec(string.slice(i, i + 2));
|
2673
2688
|
return n ? (date.m = n[0] - 1, i + n[0].length) : -1;
|
2674
2689
|
}
|
2675
2690
|
function d3_time_parseDay(date, string, i) {
|
2676
2691
|
d3_time_numberRe.lastIndex = 0;
|
2677
|
-
var n = d3_time_numberRe.exec(string.
|
2692
|
+
var n = d3_time_numberRe.exec(string.slice(i, i + 2));
|
2678
2693
|
return n ? (date.d = +n[0], i + n[0].length) : -1;
|
2679
2694
|
}
|
2680
2695
|
function d3_time_parseDayOfYear(date, string, i) {
|
2681
2696
|
d3_time_numberRe.lastIndex = 0;
|
2682
|
-
var n = d3_time_numberRe.exec(string.
|
2697
|
+
var n = d3_time_numberRe.exec(string.slice(i, i + 3));
|
2683
2698
|
return n ? (date.j = +n[0], i + n[0].length) : -1;
|
2684
2699
|
}
|
2685
2700
|
function d3_time_parseHour24(date, string, i) {
|
2686
2701
|
d3_time_numberRe.lastIndex = 0;
|
2687
|
-
var n = d3_time_numberRe.exec(string.
|
2702
|
+
var n = d3_time_numberRe.exec(string.slice(i, i + 2));
|
2688
2703
|
return n ? (date.H = +n[0], i + n[0].length) : -1;
|
2689
2704
|
}
|
2690
2705
|
function d3_time_parseMinutes(date, string, i) {
|
2691
2706
|
d3_time_numberRe.lastIndex = 0;
|
2692
|
-
var n = d3_time_numberRe.exec(string.
|
2707
|
+
var n = d3_time_numberRe.exec(string.slice(i, i + 2));
|
2693
2708
|
return n ? (date.M = +n[0], i + n[0].length) : -1;
|
2694
2709
|
}
|
2695
2710
|
function d3_time_parseSeconds(date, string, i) {
|
2696
2711
|
d3_time_numberRe.lastIndex = 0;
|
2697
|
-
var n = d3_time_numberRe.exec(string.
|
2712
|
+
var n = d3_time_numberRe.exec(string.slice(i, i + 2));
|
2698
2713
|
return n ? (date.S = +n[0], i + n[0].length) : -1;
|
2699
2714
|
}
|
2700
2715
|
function d3_time_parseMilliseconds(date, string, i) {
|
2701
2716
|
d3_time_numberRe.lastIndex = 0;
|
2702
|
-
var n = d3_time_numberRe.exec(string.
|
2717
|
+
var n = d3_time_numberRe.exec(string.slice(i, i + 3));
|
2703
2718
|
return n ? (date.L = +n[0], i + n[0].length) : -1;
|
2704
2719
|
}
|
2705
2720
|
function d3_time_zone(d) {
|
2706
|
-
var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh =
|
2721
|
+
var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = abs(z) / 60 | 0, zm = abs(z) % 60;
|
2707
2722
|
return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2);
|
2708
2723
|
}
|
2709
2724
|
function d3_time_parseLiteralPercent(date, string, i) {
|
2710
2725
|
d3_time_percentRe.lastIndex = 0;
|
2711
|
-
var n = d3_time_percentRe.exec(string.
|
2726
|
+
var n = d3_time_percentRe.exec(string.slice(i, i + 1));
|
2712
2727
|
return n ? i + n[0].length : -1;
|
2713
2728
|
}
|
2714
2729
|
function d3_time_formatMulti(formats) {
|
@@ -3316,35 +3331,6 @@
|
|
3316
3331
|
function d3_geo_clipSort(a, b) {
|
3317
3332
|
return ((a = a.x)[0] < 0 ? a[1] - halfπ - ε : halfπ - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfπ - ε : halfπ - b[1]);
|
3318
3333
|
}
|
3319
|
-
function d3_geo_pointInPolygon(point, polygon) {
|
3320
|
-
var meridian = point[0], parallel = point[1], meridianNormal = [ Math.sin(meridian), -Math.cos(meridian), 0 ], polarAngle = 0, winding = 0;
|
3321
|
-
d3_geo_areaRingSum.reset();
|
3322
|
-
for (var i = 0, n = polygon.length; i < n; ++i) {
|
3323
|
-
var ring = polygon[i], m = ring.length;
|
3324
|
-
if (!m) continue;
|
3325
|
-
var point0 = ring[0], λ0 = point0[0], φ0 = point0[1] / 2 + π / 4, sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), j = 1;
|
3326
|
-
while (true) {
|
3327
|
-
if (j === m) j = 0;
|
3328
|
-
point = ring[j];
|
3329
|
-
var λ = point[0], φ = point[1] / 2 + π / 4, sinφ = Math.sin(φ), cosφ = Math.cos(φ), dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, antimeridian = adλ > π, k = sinφ0 * sinφ;
|
3330
|
-
d3_geo_areaRingSum.add(Math.atan2(k * sdλ * Math.sin(adλ), cosφ0 * cosφ + k * Math.cos(adλ)));
|
3331
|
-
polarAngle += antimeridian ? dλ + sdλ * τ : dλ;
|
3332
|
-
if (antimeridian ^ λ0 >= meridian ^ λ >= meridian) {
|
3333
|
-
var arc = d3_geo_cartesianCross(d3_geo_cartesian(point0), d3_geo_cartesian(point));
|
3334
|
-
d3_geo_cartesianNormalize(arc);
|
3335
|
-
var intersection = d3_geo_cartesianCross(meridianNormal, arc);
|
3336
|
-
d3_geo_cartesianNormalize(intersection);
|
3337
|
-
var φarc = (antimeridian ^ dλ >= 0 ? -1 : 1) * d3_asin(intersection[2]);
|
3338
|
-
if (parallel > φarc || parallel === φarc && (arc[0] || arc[1])) {
|
3339
|
-
winding += antimeridian ^ dλ >= 0 ? 1 : -1;
|
3340
|
-
}
|
3341
|
-
}
|
3342
|
-
if (!j++) break;
|
3343
|
-
λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ, point0 = point;
|
3344
|
-
}
|
3345
|
-
}
|
3346
|
-
return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < 0) ^ winding & 1;
|
3347
|
-
}
|
3348
3334
|
var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate, [ -π, -π / 2 ]);
|
3349
3335
|
function d3_geo_clipAntimeridianLine(listener) {
|
3350
3336
|
var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean;
|
@@ -3412,6 +3398,35 @@
|
|
3412
3398
|
listener.point(to[0], to[1]);
|
3413
3399
|
}
|
3414
3400
|
}
|
3401
|
+
function d3_geo_pointInPolygon(point, polygon) {
|
3402
|
+
var meridian = point[0], parallel = point[1], meridianNormal = [ Math.sin(meridian), -Math.cos(meridian), 0 ], polarAngle = 0, winding = 0;
|
3403
|
+
d3_geo_areaRingSum.reset();
|
3404
|
+
for (var i = 0, n = polygon.length; i < n; ++i) {
|
3405
|
+
var ring = polygon[i], m = ring.length;
|
3406
|
+
if (!m) continue;
|
3407
|
+
var point0 = ring[0], λ0 = point0[0], φ0 = point0[1] / 2 + π / 4, sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), j = 1;
|
3408
|
+
while (true) {
|
3409
|
+
if (j === m) j = 0;
|
3410
|
+
point = ring[j];
|
3411
|
+
var λ = point[0], φ = point[1] / 2 + π / 4, sinφ = Math.sin(φ), cosφ = Math.cos(φ), dλ = λ - λ0, sdλ = dλ >= 0 ? 1 : -1, adλ = sdλ * dλ, antimeridian = adλ > π, k = sinφ0 * sinφ;
|
3412
|
+
d3_geo_areaRingSum.add(Math.atan2(k * sdλ * Math.sin(adλ), cosφ0 * cosφ + k * Math.cos(adλ)));
|
3413
|
+
polarAngle += antimeridian ? dλ + sdλ * τ : dλ;
|
3414
|
+
if (antimeridian ^ λ0 >= meridian ^ λ >= meridian) {
|
3415
|
+
var arc = d3_geo_cartesianCross(d3_geo_cartesian(point0), d3_geo_cartesian(point));
|
3416
|
+
d3_geo_cartesianNormalize(arc);
|
3417
|
+
var intersection = d3_geo_cartesianCross(meridianNormal, arc);
|
3418
|
+
d3_geo_cartesianNormalize(intersection);
|
3419
|
+
var φarc = (antimeridian ^ dλ >= 0 ? -1 : 1) * d3_asin(intersection[2]);
|
3420
|
+
if (parallel > φarc || parallel === φarc && (arc[0] || arc[1])) {
|
3421
|
+
winding += antimeridian ^ dλ >= 0 ? 1 : -1;
|
3422
|
+
}
|
3423
|
+
}
|
3424
|
+
if (!j++) break;
|
3425
|
+
λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ, point0 = point;
|
3426
|
+
}
|
3427
|
+
}
|
3428
|
+
return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < 0) ^ winding & 1;
|
3429
|
+
}
|
3415
3430
|
function d3_geo_clipCircle(radius) {
|
3416
3431
|
var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = abs(cr) > ε, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians);
|
3417
3432
|
return d3_geo_clip(visible, clipLine, interpolate, smallRadius ? [ 0, -radius ] : [ -π, radius - π ]);
|
@@ -5600,9 +5615,9 @@
|
|
5600
5615
|
}
|
5601
5616
|
d3.interpolateNumber = d3_interpolateNumber;
|
5602
5617
|
function d3_interpolateNumber(a, b) {
|
5603
|
-
|
5618
|
+
a = +a, b = +b;
|
5604
5619
|
return function(t) {
|
5605
|
-
return a + b * t;
|
5620
|
+
return a * (1 - t) + b * t;
|
5606
5621
|
};
|
5607
5622
|
}
|
5608
5623
|
d3.interpolateString = d3_interpolateString;
|
@@ -5611,7 +5626,7 @@
|
|
5611
5626
|
a = a + "", b = b + "";
|
5612
5627
|
while ((am = d3_interpolate_numberA.exec(a)) && (bm = d3_interpolate_numberB.exec(b))) {
|
5613
5628
|
if ((bs = bm.index) > bi) {
|
5614
|
-
bs = b.
|
5629
|
+
bs = b.slice(bi, bs);
|
5615
5630
|
if (s[i]) s[i] += bs; else s[++i] = bs;
|
5616
5631
|
}
|
5617
5632
|
if ((am = am[0]) === (bm = bm[0])) {
|
@@ -5626,7 +5641,7 @@
|
|
5626
5641
|
bi = d3_interpolate_numberB.lastIndex;
|
5627
5642
|
}
|
5628
5643
|
if (bi < b.length) {
|
5629
|
-
bs = b.
|
5644
|
+
bs = b.slice(bi);
|
5630
5645
|
if (s[i]) s[i] += bs; else s[++i] = bs;
|
5631
5646
|
}
|
5632
5647
|
return s.length < 2 ? q[0] ? (b = q[0].x, function(t) {
|
@@ -5696,7 +5711,7 @@
|
|
5696
5711
|
}
|
5697
5712
|
});
|
5698
5713
|
d3.ease = function(name) {
|
5699
|
-
var i = name.indexOf("-"), t = i >= 0 ? name.
|
5714
|
+
var i = name.indexOf("-"), t = i >= 0 ? name.slice(0, i) : name, m = i >= 0 ? name.slice(i + 1) : "in";
|
5700
5715
|
t = d3_ease.get(t) || d3_ease_default;
|
5701
5716
|
m = d3_ease_mode.get(m) || d3_identity;
|
5702
5717
|
return d3_ease_clamp(m(t.apply(null, d3_arraySlice.call(arguments, 1))));
|
@@ -5901,15 +5916,15 @@
|
|
5901
5916
|
};
|
5902
5917
|
}
|
5903
5918
|
function d3_uninterpolateNumber(a, b) {
|
5904
|
-
b = b
|
5919
|
+
b = (b -= a = +a) || 1 / b;
|
5905
5920
|
return function(x) {
|
5906
|
-
return (x - a)
|
5921
|
+
return (x - a) / b;
|
5907
5922
|
};
|
5908
5923
|
}
|
5909
5924
|
function d3_uninterpolateClamp(a, b) {
|
5910
|
-
b = b
|
5925
|
+
b = (b -= a = +a) || 1 / b;
|
5911
5926
|
return function(x) {
|
5912
|
-
return Math.max(0, Math.min(1, (x - a)
|
5927
|
+
return Math.max(0, Math.min(1, (x - a) / b));
|
5913
5928
|
};
|
5914
5929
|
}
|
5915
5930
|
d3.layout = {};
|
@@ -6511,6 +6526,7 @@
|
|
6511
6526
|
d3.layout.stack = function() {
|
6512
6527
|
var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
|
6513
6528
|
function stack(data, index) {
|
6529
|
+
if (!(n = data.length)) return data;
|
6514
6530
|
var series = data.map(function(d, i) {
|
6515
6531
|
return values.call(stack, d, i);
|
6516
6532
|
});
|
@@ -6523,7 +6539,7 @@
|
|
6523
6539
|
series = d3.permute(series, orders);
|
6524
6540
|
points = d3.permute(points, orders);
|
6525
6541
|
var offsets = offset.call(stack, points, index);
|
6526
|
-
var
|
6542
|
+
var m = series[0].length, n, i, j, o;
|
6527
6543
|
for (j = 0; j < m; ++j) {
|
6528
6544
|
out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
|
6529
6545
|
for (i = 1; i < n; ++i) {
|
@@ -7678,7 +7694,7 @@
|
|
7678
7694
|
}
|
7679
7695
|
scale.domain = function(x) {
|
7680
7696
|
if (!arguments.length) return domain;
|
7681
|
-
domain = x.
|
7697
|
+
domain = x.map(d3_number).filter(d3_numeric).sort(d3_ascending);
|
7682
7698
|
return rescale();
|
7683
7699
|
};
|
7684
7700
|
scale.range = function(x) {
|
@@ -8627,61 +8643,25 @@
|
|
8627
8643
|
g.each(function() {
|
8628
8644
|
var g = d3.select(this);
|
8629
8645
|
var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy();
|
8630
|
-
var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g.selectAll(".tick").data(ticks, scale1), tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", ε), tickExit = d3.transition(tick.exit()).style("opacity", ε).remove(), tickUpdate = d3.transition(tick.order()).style("opacity", 1), tickTransform;
|
8646
|
+
var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g.selectAll(".tick").data(ticks, scale1), tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", ε), tickExit = d3.transition(tick.exit()).style("opacity", ε).remove(), tickUpdate = d3.transition(tick.order()).style("opacity", 1), tickSpacing = Math.max(innerTickSize, 0) + tickPadding, tickTransform;
|
8631
8647
|
var range = d3_scaleRange(scale1), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"),
|
8632
8648
|
d3.transition(path));
|
8633
8649
|
tickEnter.append("line");
|
8634
8650
|
tickEnter.append("text");
|
8635
|
-
var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
|
8636
|
-
|
8637
|
-
|
8638
|
-
|
8639
|
-
|
8640
|
-
|
8641
|
-
|
8642
|
-
|
8643
|
-
|
8644
|
-
|
8645
|
-
|
8646
|
-
|
8647
|
-
|
8648
|
-
|
8649
|
-
case "top":
|
8650
|
-
{
|
8651
|
-
tickTransform = d3_svg_axisX;
|
8652
|
-
lineEnter.attr("y2", -innerTickSize);
|
8653
|
-
textEnter.attr("y", -(Math.max(innerTickSize, 0) + tickPadding));
|
8654
|
-
lineUpdate.attr("x2", 0).attr("y2", -innerTickSize);
|
8655
|
-
textUpdate.attr("x", 0).attr("y", -(Math.max(innerTickSize, 0) + tickPadding));
|
8656
|
-
text.attr("dy", "0em").style("text-anchor", "middle");
|
8657
|
-
pathUpdate.attr("d", "M" + range[0] + "," + -outerTickSize + "V0H" + range[1] + "V" + -outerTickSize);
|
8658
|
-
break;
|
8659
|
-
}
|
8660
|
-
|
8661
|
-
case "left":
|
8662
|
-
{
|
8663
|
-
tickTransform = d3_svg_axisY;
|
8664
|
-
lineEnter.attr("x2", -innerTickSize);
|
8665
|
-
textEnter.attr("x", -(Math.max(innerTickSize, 0) + tickPadding));
|
8666
|
-
lineUpdate.attr("x2", -innerTickSize).attr("y2", 0);
|
8667
|
-
textUpdate.attr("x", -(Math.max(innerTickSize, 0) + tickPadding)).attr("y", 0);
|
8668
|
-
text.attr("dy", ".32em").style("text-anchor", "end");
|
8669
|
-
pathUpdate.attr("d", "M" + -outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + -outerTickSize);
|
8670
|
-
break;
|
8671
|
-
}
|
8672
|
-
|
8673
|
-
case "right":
|
8674
|
-
{
|
8675
|
-
tickTransform = d3_svg_axisY;
|
8676
|
-
lineEnter.attr("x2", innerTickSize);
|
8677
|
-
textEnter.attr("x", Math.max(innerTickSize, 0) + tickPadding);
|
8678
|
-
lineUpdate.attr("x2", innerTickSize).attr("y2", 0);
|
8679
|
-
textUpdate.attr("x", Math.max(innerTickSize, 0) + tickPadding).attr("y", 0);
|
8680
|
-
text.attr("dy", ".32em").style("text-anchor", "start");
|
8681
|
-
pathUpdate.attr("d", "M" + outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + outerTickSize);
|
8682
|
-
break;
|
8683
|
-
}
|
8684
|
-
}
|
8651
|
+
var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text"), sign = orient === "top" || orient === "left" ? -1 : 1, x1, x2, y1, y2;
|
8652
|
+
if (orient === "bottom" || orient === "top") {
|
8653
|
+
tickTransform = d3_svg_axisX, x1 = "x", y1 = "y", x2 = "x2", y2 = "y2";
|
8654
|
+
text.attr("dy", sign < 0 ? "0em" : ".71em").style("text-anchor", "middle");
|
8655
|
+
pathUpdate.attr("d", "M" + range[0] + "," + sign * outerTickSize + "V0H" + range[1] + "V" + sign * outerTickSize);
|
8656
|
+
} else {
|
8657
|
+
tickTransform = d3_svg_axisY, x1 = "y", y1 = "x", x2 = "y2", y2 = "x2";
|
8658
|
+
text.attr("dy", ".32em").style("text-anchor", sign < 0 ? "end" : "start");
|
8659
|
+
pathUpdate.attr("d", "M" + sign * outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + sign * outerTickSize);
|
8660
|
+
}
|
8661
|
+
lineEnter.attr(y2, sign * innerTickSize);
|
8662
|
+
textEnter.attr(y1, sign * tickSpacing);
|
8663
|
+
lineUpdate.attr(x2, 0).attr(y2, sign * innerTickSize);
|
8664
|
+
textUpdate.attr(x1, 0).attr(y1, sign * tickSpacing);
|
8685
8665
|
if (scale1.rangeBand) {
|
8686
8666
|
var x = scale1, dx = x.rangeBand() / 2;
|
8687
8667
|
scale0 = scale1 = function(d) {
|
@@ -8690,10 +8670,10 @@
|
|
8690
8670
|
} else if (scale0.rangeBand) {
|
8691
8671
|
scale0 = scale1;
|
8692
8672
|
} else {
|
8693
|
-
tickExit.call(tickTransform, scale1);
|
8673
|
+
tickExit.call(tickTransform, scale1, scale0);
|
8694
8674
|
}
|
8695
|
-
tickEnter.call(tickTransform, scale0);
|
8696
|
-
tickUpdate.call(tickTransform, scale1);
|
8675
|
+
tickEnter.call(tickTransform, scale0, scale1);
|
8676
|
+
tickUpdate.call(tickTransform, scale1, scale1);
|
8697
8677
|
});
|
8698
8678
|
}
|
8699
8679
|
axis.scale = function(x) {
|
@@ -8754,14 +8734,16 @@
|
|
8754
8734
|
bottom: 1,
|
8755
8735
|
left: 1
|
8756
8736
|
};
|
8757
|
-
function d3_svg_axisX(selection,
|
8737
|
+
function d3_svg_axisX(selection, x0, x1) {
|
8758
8738
|
selection.attr("transform", function(d) {
|
8759
|
-
|
8739
|
+
var v0 = x0(d);
|
8740
|
+
return "translate(" + (isFinite(v0) ? v0 : x1(d)) + ",0)";
|
8760
8741
|
});
|
8761
8742
|
}
|
8762
|
-
function d3_svg_axisY(selection,
|
8743
|
+
function d3_svg_axisY(selection, y0, y1) {
|
8763
8744
|
selection.attr("transform", function(d) {
|
8764
|
-
|
8745
|
+
var v0 = y0(d);
|
8746
|
+
return "translate(0," + (isFinite(v0) ? v0 : y1(d)) + ")";
|
8765
8747
|
});
|
8766
8748
|
}
|
8767
8749
|
d3.svg.brush = function() {
|