d3_rails 3.4.3 → 3.4.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dea335c72ac3e6e540488cea88292068f92e0ae4
4
- data.tar.gz: f3a7232139f074f766f442e9d4ab6b62a036fa92
3
+ metadata.gz: 90d5db463645992a72b726ff6e08bfc57a6e0954
4
+ data.tar.gz: ec5f8dc3e4ebc1b2c589e9a0ddc7c5d1b10d57ae
5
5
  SHA512:
6
- metadata.gz: 675f8d1bb0f712b880f36e4f24639e20ad6dc8053fa4d6781746ad2f2c5029bf97b6f2c1a732993c39dcf1bb299b616c583d72a1688d184b1bbc2b502587c18d
7
- data.tar.gz: 5437d66aaf79e82690932fcd0b45dd712081a9ddcd8a03efad1a04043319c8e5d99cf81de2022da965518bc5c38b0a503e218ae355fd2ed52c842653cf1ab9ec
6
+ metadata.gz: 4c34c18b7070370dd1196816d0cabe55be691344029b9d625cb351b2854dfd0291107996e12057f4382f69bfd4b26f12cacfd0b9a04b5004a309aabac58bdd4a
7
+ data.tar.gz: 16dba626a2e0911cee6bee9ff83e155c116114cb31d26e20df2335f88628e46b8c570d702d0c682d162e74a6fd28be0d6605ab11c4a06183c1a270cd4d7a1104
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- # D3_Rails
2
- ## Version 3.4.3 (of d3 in most current gem)
1
+ # D3_Rails [![Gem Version](https://badge.fury.io/rb/d3_rails.png)](http://badge.fury.io/rb/d3_rails)
3
2
 
4
3
  **D3_Rails** is a small, lightweight gem which allows you to include any
5
4
  and all of D3 Javascripts into your 3.1 Rails application, merely by
@@ -1,6 +1,6 @@
1
1
  !function() {
2
2
  var d3 = {
3
- version: "3.4.3"
3
+ version: "3.4.4"
4
4
  };
5
5
  if (!Date.now) Date.now = function() {
6
6
  return +new Date();
@@ -32,9 +32,10 @@
32
32
  d3_style_setProperty.call(this, name, value + "", priority);
33
33
  };
34
34
  }
35
- d3.ascending = function(a, b) {
35
+ d3.ascending = d3_ascending;
36
+ function d3_ascending(a, b) {
36
37
  return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
37
- };
38
+ }
38
39
  d3.descending = function(a, b) {
39
40
  return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
40
41
  };
@@ -105,16 +106,16 @@
105
106
  d3.median = function(array, f) {
106
107
  if (arguments.length > 1) array = array.map(f);
107
108
  array = array.filter(d3_number);
108
- return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
109
+ return array.length ? d3.quantile(array.sort(d3_ascending), .5) : undefined;
109
110
  };
110
- d3.bisector = function(f) {
111
+ function d3_bisector(compare) {
111
112
  return {
112
113
  left: function(a, x, lo, hi) {
113
114
  if (arguments.length < 3) lo = 0;
114
115
  if (arguments.length < 4) hi = a.length;
115
116
  while (lo < hi) {
116
117
  var mid = lo + hi >>> 1;
117
- if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid;
118
+ if (compare(a[mid], x) < 0) lo = mid + 1; else hi = mid;
118
119
  }
119
120
  return lo;
120
121
  },
@@ -123,17 +124,20 @@
123
124
  if (arguments.length < 4) hi = a.length;
124
125
  while (lo < hi) {
125
126
  var mid = lo + hi >>> 1;
126
- if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1;
127
+ if (compare(a[mid], x) > 0) hi = mid; else lo = mid + 1;
127
128
  }
128
129
  return lo;
129
130
  }
130
131
  };
132
+ }
133
+ var d3_bisect = d3_bisector(d3_ascending);
134
+ d3.bisectLeft = d3_bisect.left;
135
+ d3.bisect = d3.bisectRight = d3_bisect.right;
136
+ d3.bisector = function(f) {
137
+ return d3_bisector(f.length === 1 ? function(d, x) {
138
+ return d3_ascending(f(d), x);
139
+ } : f);
131
140
  };
132
- var d3_bisector = d3.bisector(function(d) {
133
- return d;
134
- });
135
- d3.bisectLeft = d3_bisector.left;
136
- d3.bisect = d3.bisectRight = d3_bisector.right;
137
141
  d3.shuffle = function(array) {
138
142
  var m = array.length, t, i;
139
143
  while (m) {
@@ -495,9 +499,7 @@
495
499
  d3_select = function(s, n) {
496
500
  return Sizzle(s, n)[0] || null;
497
501
  };
498
- d3_selectAll = function(s, n) {
499
- return Sizzle.uniqueSort(Sizzle(s, n));
500
- };
502
+ d3_selectAll = Sizzle;
501
503
  d3_selectMatches = Sizzle.matchesSelector;
502
504
  }
503
505
  d3.selection = function() {
@@ -872,7 +874,7 @@
872
874
  return this.order();
873
875
  };
874
876
  function d3_selection_sortComparator(comparator) {
875
- if (!arguments.length) comparator = d3.ascending;
877
+ if (!arguments.length) comparator = d3_ascending;
876
878
  return function(a, b) {
877
879
  return a && b ? comparator(a.__data__, b.__data__) : !a - !b;
878
880
  };
@@ -1087,27 +1089,12 @@
1087
1089
  d3.mouse = function(container) {
1088
1090
  return d3_mousePoint(container, d3_eventSource());
1089
1091
  };
1090
- var d3_mouse_bug44083 = /WebKit/.test(d3_window.navigator.userAgent) ? -1 : 0;
1091
1092
  function d3_mousePoint(container, e) {
1092
1093
  if (e.changedTouches) e = e.changedTouches[0];
1093
1094
  var svg = container.ownerSVGElement || container;
1094
1095
  if (svg.createSVGPoint) {
1095
1096
  var point = svg.createSVGPoint();
1096
- if (d3_mouse_bug44083 < 0 && (d3_window.scrollX || d3_window.scrollY)) {
1097
- svg = d3.select("body").append("svg").style({
1098
- position: "absolute",
1099
- top: 0,
1100
- left: 0,
1101
- margin: 0,
1102
- padding: 0,
1103
- border: "none"
1104
- }, "important");
1105
- var ctm = svg[0][0].getScreenCTM();
1106
- d3_mouse_bug44083 = !(ctm.f || ctm.e);
1107
- svg.remove();
1108
- }
1109
- if (d3_mouse_bug44083) point.x = e.pageX, point.y = e.pageY; else point.x = e.clientX,
1110
- point.y = e.clientY;
1097
+ point.x = e.clientX, point.y = e.clientY;
1111
1098
  point = point.matrixTransform(container.getScreenCTM().inverse());
1112
1099
  return [ point.x, point.y ];
1113
1100
  }
@@ -1123,46 +1110,42 @@
1123
1110
  }) : [];
1124
1111
  };
1125
1112
  d3.behavior.drag = function() {
1126
- var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null, mousedown = dragstart(d3_noop, d3.mouse, "mousemove", "mouseup"), touchstart = dragstart(touchid, touchposition, "touchmove", "touchend");
1113
+ 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");
1127
1114
  function drag() {
1128
1115
  this.on("mousedown.drag", mousedown).on("touchstart.drag", touchstart);
1129
1116
  }
1130
- function touchid() {
1131
- return d3.event.changedTouches[0].identifier;
1132
- }
1133
- function touchposition(parent, id) {
1134
- return d3.touches(parent).filter(function(p) {
1135
- return p.identifier === id;
1136
- })[0];
1137
- }
1138
- function dragstart(id, position, move, end) {
1117
+ function dragstart(id, position, subject, move, end) {
1139
1118
  return function() {
1140
- var target = this, parent = target.parentNode, event_ = event.of(target, arguments), eventTarget = d3.event.target, eventId = id(), drag = eventId == null ? "drag" : "drag-" + eventId, origin_ = position(parent, eventId), dragged = 0, offset, w = d3.select(d3_window).on(move + "." + drag, moved).on(end + "." + drag, ended), dragRestore = d3_event_dragSuppress();
1119
+ 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()).on(move + dragName, moved).on(end + dragName, ended), dragRestore = d3_event_dragSuppress(), position0 = position(parent, dragId);
1141
1120
  if (origin) {
1142
- offset = origin.apply(target, arguments);
1143
- offset = [ offset.x - origin_[0], offset.y - origin_[1] ];
1121
+ dragOffset = origin.apply(that, arguments);
1122
+ dragOffset = [ dragOffset.x - position0[0], dragOffset.y - position0[1] ];
1144
1123
  } else {
1145
- offset = [ 0, 0 ];
1124
+ dragOffset = [ 0, 0 ];
1146
1125
  }
1147
- event_({
1126
+ dispatch({
1148
1127
  type: "dragstart"
1149
1128
  });
1150
1129
  function moved() {
1151
- var p = position(parent, eventId), dx = p[0] - origin_[0], dy = p[1] - origin_[1];
1130
+ var position1 = position(parent, dragId), dx, dy;
1131
+ if (!position1) return;
1132
+ dx = position1[0] - position0[0];
1133
+ dy = position1[1] - position0[1];
1152
1134
  dragged |= dx | dy;
1153
- origin_ = p;
1154
- event_({
1135
+ position0 = position1;
1136
+ dispatch({
1155
1137
  type: "drag",
1156
- x: p[0] + offset[0],
1157
- y: p[1] + offset[1],
1138
+ x: position1[0] + dragOffset[0],
1139
+ y: position1[1] + dragOffset[1],
1158
1140
  dx: dx,
1159
1141
  dy: dy
1160
1142
  });
1161
1143
  }
1162
1144
  function ended() {
1163
- w.on(move + "." + drag, null).on(end + "." + drag, null);
1164
- dragRestore(dragged && d3.event.target === eventTarget);
1165
- event_({
1145
+ if (!position(parent, dragId)) return;
1146
+ dragSubject.on(move + dragName, null).on(end + dragName, null);
1147
+ dragRestore(dragged && d3.event.target === target);
1148
+ dispatch({
1166
1149
  type: "dragend"
1167
1150
  });
1168
1151
  }
@@ -1175,6 +1158,15 @@
1175
1158
  };
1176
1159
  return d3.rebind(drag, event, "on");
1177
1160
  };
1161
+ function d3_behavior_dragTouchId() {
1162
+ return d3.event.changedTouches[0].identifier;
1163
+ }
1164
+ function d3_behavior_dragTouchSubject() {
1165
+ return d3.event.target;
1166
+ }
1167
+ function d3_behavior_dragMouseSubject() {
1168
+ return d3_window;
1169
+ }
1178
1170
  var π = Math.PI, τ = 2 * π, halfπ = π / 2, ε = 1e-6, ε2 = ε * ε, d3_radians = π / 180, d3_degrees = 180 / π;
1179
1171
  function d3_sgn(x) {
1180
1172
  return x > 0 ? 1 : x < 0 ? -1 : 0;
@@ -1226,7 +1218,7 @@
1226
1218
  }
1227
1219
  zoom.event = function(g) {
1228
1220
  g.each(function() {
1229
- var event_ = event.of(this, arguments), view1 = view;
1221
+ var dispatch = event.of(this, arguments), view1 = view;
1230
1222
  if (d3_transitionInheritId) {
1231
1223
  d3.select(this).transition().each("start.zoom", function() {
1232
1224
  view = this.__chart__ || {
@@ -1234,7 +1226,7 @@
1234
1226
  y: 0,
1235
1227
  k: 1
1236
1228
  };
1237
- zoomstarted(event_);
1229
+ zoomstarted(dispatch);
1238
1230
  }).tween("zoom:zoom", function() {
1239
1231
  var dx = size[0], dy = size[1], cx = dx / 2, cy = dy / 2, i = d3.interpolateZoom([ (cx - view.x) / view.k, (cy - view.y) / view.k, dx / view.k ], [ (cx - view1.x) / view1.k, (cy - view1.y) / view1.k, dx / view1.k ]);
1240
1232
  return function(t) {
@@ -1244,16 +1236,16 @@
1244
1236
  y: cy - l[1] * k,
1245
1237
  k: k
1246
1238
  };
1247
- zoomed(event_);
1239
+ zoomed(dispatch);
1248
1240
  };
1249
1241
  }).each("end.zoom", function() {
1250
- zoomended(event_);
1242
+ zoomended(dispatch);
1251
1243
  });
1252
1244
  } else {
1253
1245
  this.__chart__ = view;
1254
- zoomstarted(event_);
1255
- zoomed(event_);
1256
- zoomended(event_);
1246
+ zoomstarted(dispatch);
1247
+ zoomed(dispatch);
1248
+ zoomended(dispatch);
1257
1249
  }
1258
1250
  });
1259
1251
  };
@@ -1336,46 +1328,46 @@
1336
1328
  return (y - view.y) / view.k;
1337
1329
  }).map(y0.invert));
1338
1330
  }
1339
- function zoomstarted(event) {
1340
- event({
1331
+ function zoomstarted(dispatch) {
1332
+ dispatch({
1341
1333
  type: "zoomstart"
1342
1334
  });
1343
1335
  }
1344
- function zoomed(event) {
1336
+ function zoomed(dispatch) {
1345
1337
  rescale();
1346
- event({
1338
+ dispatch({
1347
1339
  type: "zoom",
1348
1340
  scale: view.k,
1349
1341
  translate: [ view.x, view.y ]
1350
1342
  });
1351
1343
  }
1352
- function zoomended(event) {
1353
- event({
1344
+ function zoomended(dispatch) {
1345
+ dispatch({
1354
1346
  type: "zoomend"
1355
1347
  });
1356
1348
  }
1357
1349
  function mousedowned() {
1358
- var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, dragged = 0, w = d3.select(d3_window).on(mousemove, moved).on(mouseup, ended), l = location(d3.mouse(target)), dragRestore = d3_event_dragSuppress();
1359
- d3_selection_interrupt.call(target);
1360
- zoomstarted(event_);
1350
+ var that = this, target = d3.event.target, dispatch = event.of(that, arguments), dragged = 0, subject = d3.select(d3_window).on(mousemove, moved).on(mouseup, ended), location0 = location(d3.mouse(that)), dragRestore = d3_event_dragSuppress();
1351
+ d3_selection_interrupt.call(that);
1352
+ zoomstarted(dispatch);
1361
1353
  function moved() {
1362
1354
  dragged = 1;
1363
- translateTo(d3.mouse(target), l);
1364
- zoomed(event_);
1355
+ translateTo(d3.mouse(that), location0);
1356
+ zoomed(dispatch);
1365
1357
  }
1366
1358
  function ended() {
1367
- w.on(mousemove, d3_window === target ? mousewheelreset : null).on(mouseup, null);
1368
- dragRestore(dragged && d3.event.target === eventTarget);
1369
- zoomended(event_);
1359
+ subject.on(mousemove, d3_window === that ? mousewheelreset : null).on(mouseup, null);
1360
+ dragRestore(dragged && d3.event.target === target);
1361
+ zoomended(dispatch);
1370
1362
  }
1371
1363
  }
1372
1364
  function touchstarted() {
1373
- var target = this, event_ = event.of(target, arguments), locations0 = {}, distance0 = 0, scale0, eventId = d3.event.changedTouches[0].identifier, touchmove = "touchmove.zoom-" + eventId, touchend = "touchend.zoom-" + eventId, w = d3.select(d3_window).on(touchmove, moved).on(touchend, ended), t = d3.select(target).on(mousedown, null).on(touchstart, started), dragRestore = d3_event_dragSuppress();
1374
- d3_selection_interrupt.call(target);
1365
+ 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, target = d3.select(d3.event.target).on(touchmove, moved).on(touchend, ended), subject = d3.select(that).on(mousedown, null).on(touchstart, started), dragRestore = d3_event_dragSuppress();
1366
+ d3_selection_interrupt.call(that);
1375
1367
  started();
1376
- zoomstarted(event_);
1368
+ zoomstarted(dispatch);
1377
1369
  function relocate() {
1378
- var touches = d3.touches(target);
1370
+ var touches = d3.touches(that);
1379
1371
  scale0 = view.k;
1380
1372
  touches.forEach(function(t) {
1381
1373
  if (t.identifier in locations0) locations0[t.identifier] = location(t);
@@ -1394,7 +1386,7 @@
1394
1386
  scaleTo(view.k * 2);
1395
1387
  translateTo(p, l);
1396
1388
  d3_eventPreventDefault();
1397
- zoomed(event_);
1389
+ zoomed(dispatch);
1398
1390
  }
1399
1391
  touchtime = now;
1400
1392
  } else if (touches.length > 1) {
@@ -1403,7 +1395,7 @@
1403
1395
  }
1404
1396
  }
1405
1397
  function moved() {
1406
- var touches = d3.touches(target), p0, l0, p1, l1;
1398
+ var touches = d3.touches(that), p0, l0, p1, l1;
1407
1399
  for (var i = 0, n = touches.length; i < n; ++i, l1 = null) {
1408
1400
  p1 = touches[i];
1409
1401
  if (l1 = locations0[p1.identifier]) {
@@ -1419,7 +1411,7 @@
1419
1411
  }
1420
1412
  touchtime = null;
1421
1413
  translateTo(p0, l0);
1422
- zoomed(event_);
1414
+ zoomed(dispatch);
1423
1415
  }
1424
1416
  function ended() {
1425
1417
  if (d3.event.touches.length) {
@@ -1431,37 +1423,37 @@
1431
1423
  return void relocate();
1432
1424
  }
1433
1425
  }
1434
- w.on(touchmove, null).on(touchend, null);
1435
- t.on(mousedown, mousedowned).on(touchstart, touchstarted);
1426
+ target.on(zoomName, null);
1427
+ subject.on(mousedown, mousedowned).on(touchstart, touchstarted);
1436
1428
  dragRestore();
1437
- zoomended(event_);
1429
+ zoomended(dispatch);
1438
1430
  }
1439
1431
  }
1440
1432
  function mousewheeled() {
1441
- var event_ = event.of(this, arguments);
1433
+ var dispatch = event.of(this, arguments);
1442
1434
  if (mousewheelTimer) clearTimeout(mousewheelTimer); else d3_selection_interrupt.call(this),
1443
- zoomstarted(event_);
1435
+ zoomstarted(dispatch);
1444
1436
  mousewheelTimer = setTimeout(function() {
1445
1437
  mousewheelTimer = null;
1446
- zoomended(event_);
1438
+ zoomended(dispatch);
1447
1439
  }, 50);
1448
1440
  d3_eventPreventDefault();
1449
1441
  var point = center || d3.mouse(this);
1450
1442
  if (!translate0) translate0 = location(point);
1451
1443
  scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * view.k);
1452
1444
  translateTo(point, translate0);
1453
- zoomed(event_);
1445
+ zoomed(dispatch);
1454
1446
  }
1455
1447
  function mousewheelreset() {
1456
1448
  translate0 = null;
1457
1449
  }
1458
1450
  function dblclicked() {
1459
- var event_ = event.of(this, arguments), p = d3.mouse(this), l = location(p), k = Math.log(view.k) / Math.LN2;
1460
- zoomstarted(event_);
1451
+ var dispatch = event.of(this, arguments), p = d3.mouse(this), l = location(p), k = Math.log(view.k) / Math.LN2;
1452
+ zoomstarted(dispatch);
1461
1453
  scaleTo(Math.pow(2, d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1));
1462
1454
  translateTo(p, l);
1463
- zoomed(event_);
1464
- zoomended(event_);
1455
+ zoomed(dispatch);
1456
+ zoomended(dispatch);
1465
1457
  }
1466
1458
  return d3.rebind(zoom, event, "on");
1467
1459
  };
@@ -1628,7 +1620,7 @@
1628
1620
  return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);
1629
1621
  }
1630
1622
  function d3_rgb_parse(format, rgb, hsl) {
1631
- var r = 0, g = 0, b = 0, m1, m2, name;
1623
+ var r = 0, g = 0, b = 0, m1, m2, color;
1632
1624
  m1 = /([a-z]+)\((.*)\)/i.exec(format);
1633
1625
  if (m1) {
1634
1626
  m2 = m1[2].split(",");
@@ -1644,23 +1636,20 @@
1644
1636
  }
1645
1637
  }
1646
1638
  }
1647
- if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);
1648
- if (format != null && format.charAt(0) === "#") {
1639
+ if (color = d3_rgb_names.get(format)) return rgb(color.r, color.g, color.b);
1640
+ if (format != null && format.charAt(0) === "#" && !isNaN(color = parseInt(format.substring(1), 16))) {
1649
1641
  if (format.length === 4) {
1650
- r = format.charAt(1);
1651
- r += r;
1652
- g = format.charAt(2);
1653
- g += g;
1654
- b = format.charAt(3);
1655
- b += b;
1642
+ r = (color & 3840) >> 4;
1643
+ r = r >> 4 | r;
1644
+ g = color & 240;
1645
+ g = g >> 4 | g;
1646
+ b = color & 15;
1647
+ b = b << 4 | b;
1656
1648
  } else if (format.length === 7) {
1657
- r = format.substring(1, 3);
1658
- g = format.substring(3, 5);
1659
- b = format.substring(5, 7);
1649
+ r = (color & 16711680) >> 16;
1650
+ g = (color & 65280) >> 8;
1651
+ b = color & 255;
1660
1652
  }
1661
- r = parseInt(r, 16);
1662
- g = parseInt(g, 16);
1663
- b = parseInt(b, 16);
1664
1653
  }
1665
1654
  return rgb(r, g, b);
1666
1655
  }
@@ -2043,6 +2032,14 @@
2043
2032
  };
2044
2033
  d3.csv = d3.dsv(",", "text/csv");
2045
2034
  d3.tsv = d3.dsv(" ", "text/tab-separated-values");
2035
+ d3.touch = function(container, touches, identifier) {
2036
+ if (arguments.length < 3) identifier = touches, touches = d3_eventSource().changedTouches;
2037
+ if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) {
2038
+ if ((touch = touches[i]).identifier === identifier) {
2039
+ return d3_mousePoint(container, touch);
2040
+ }
2041
+ }
2042
+ };
2046
2043
  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) {
2047
2044
  setTimeout(callback, 17);
2048
2045
  };
@@ -2116,7 +2113,7 @@
2116
2113
  if (value < 0) value *= -1;
2117
2114
  if (precision) value = d3.round(value, d3_format_precision(value, precision));
2118
2115
  i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
2119
- i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
2116
+ i = Math.max(-24, Math.min(24, Math.floor((i - 1) / 3) * 3));
2120
2117
  }
2121
2118
  return d3_formatPrefixes[8 + i / 3];
2122
2119
  };
@@ -4598,7 +4595,12 @@
4598
4595
  }, n = φ0 === φ1 ? Math.sin(φ0) : Math.log(cosφ0 / Math.cos(φ1)) / Math.log(t(φ1) / t(φ0)), F = cosφ0 * Math.pow(t(φ0), n) / n;
4599
4596
  if (!n) return d3_geo_mercator;
4600
4597
  function forward(λ, φ) {
4601
- var ρ = abs(abs(φ) - halfπ) < ε ? 0 : F / Math.pow(t(φ), n);
4598
+ if (F > 0) {
4599
+ if (φ < -halfπ + ε) φ = -halfπ + ε;
4600
+ } else {
4601
+ if (φ > halfπ - ε) φ = halfπ - ε;
4602
+ }
4603
+ var ρ = F / Math.pow(t(φ), n);
4602
4604
  return [ ρ * Math.sin(n * λ), F - ρ * Math.cos(n * λ) ];
4603
4605
  }
4604
4606
  forward.invert = function(x, y) {
@@ -5688,7 +5690,7 @@
5688
5690
  }
5689
5691
  d3.interpolators = [ function(a, b) {
5690
5692
  var t = typeof b;
5691
- return (t === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) ? d3_interpolateRgb : d3_interpolateString : b instanceof d3_Color ? d3_interpolateRgb : t === "object" ? Array.isArray(b) ? d3_interpolateArray : d3_interpolateObject : d3_interpolateNumber)(a, b);
5693
+ return (t === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) ? d3_interpolateRgb : d3_interpolateString : b instanceof d3_Color ? d3_interpolateRgb : Array.isArray(b) ? d3_interpolateArray : t === "object" && isNaN(b) ? d3_interpolateObject : d3_interpolateNumber)(a, b);
5692
5694
  } ];
5693
5695
  d3.interpolateArray = d3_interpolateArray;
5694
5696
  function d3_interpolateArray(a, b) {
@@ -7466,9 +7468,24 @@
7466
7468
  }
7467
7469
  function d3_scale_linearTickFormat(domain, m, format) {
7468
7470
  var range = d3_scale_linearTickRange(domain, m);
7469
- return d3.format(format ? format.replace(d3_format_re, function(a, b, c, d, e, f, g, h, i, j) {
7470
- return [ b, c, d, e, f, g, h, i || "." + d3_scale_linearFormatPrecision(j, range), j ].join("");
7471
- }) : ",." + d3_scale_linearPrecision(range[2]) + "f");
7471
+ if (format) {
7472
+ var match = d3_format_re.exec(format);
7473
+ match.shift();
7474
+ if (match[8] === "s") {
7475
+ var prefix = d3.formatPrefix(Math.max(abs(range[0]), abs(range[1])));
7476
+ if (!match[7]) match[7] = "." + d3_scale_linearPrecision(prefix.scale(range[2]));
7477
+ match[8] = "f";
7478
+ format = d3.format(match.join(""));
7479
+ return function(d) {
7480
+ return format(prefix.scale(d)) + prefix.symbol;
7481
+ };
7482
+ }
7483
+ if (!match[7]) match[7] = "." + d3_scale_linearFormatPrecision(match[8], range);
7484
+ format = match.join("");
7485
+ } else {
7486
+ format = ",." + d3_scale_linearPrecision(range[2]) + "f";
7487
+ }
7488
+ return d3.format(format);
7472
7489
  }
7473
7490
  var d3_scale_linearFormatSignificant = {
7474
7491
  s: 1,
@@ -7482,7 +7499,7 @@
7482
7499
  }
7483
7500
  function d3_scale_linearFormatPrecision(type, range) {
7484
7501
  var p = d3_scale_linearPrecision(range[2]);
7485
- return type in d3_scale_linearFormatSignificant ? Math.abs(p - d3_scale_linearPrecision(Math.max(Math.abs(range[0]), Math.abs(range[1])))) + +(type !== "e") : p - (type === "%") * 2;
7502
+ return type in d3_scale_linearFormatSignificant ? Math.abs(p - d3_scale_linearPrecision(Math.max(abs(range[0]), abs(range[1])))) + +(type !== "e") : p - (type === "%") * 2;
7486
7503
  }
7487
7504
  d3.scale.log = function() {
7488
7505
  return d3_scale_log(d3.scale.linear().domain([ 0, 1 ]), 10, true, [ 1, 10 ]);
@@ -7610,7 +7627,7 @@
7610
7627
  function d3_scale_ordinal(domain, ranger) {
7611
7628
  var index, range, rangeBand;
7612
7629
  function scale(x) {
7613
- return range[((index.get(x) || ranger.t === "range" && index.set(x, domain.push(x))) - 1) % range.length];
7630
+ return range[((index.get(x) || (ranger.t === "range" ? index.set(x, domain.push(x)) : NaN)) - 1) % range.length];
7614
7631
  }
7615
7632
  function steps(start, step) {
7616
7633
  return d3.range(domain.length).map(function(i) {
@@ -7717,7 +7734,7 @@
7717
7734
  if (!arguments.length) return domain;
7718
7735
  domain = x.filter(function(d) {
7719
7736
  return !isNaN(d);
7720
- }).sort(d3.ascending);
7737
+ }).sort(d3_ascending);
7721
7738
  return rescale();
7722
7739
  };
7723
7740
  scale.range = function(x) {
@@ -8558,6 +8575,7 @@
8558
8575
  };
8559
8576
  d3_transitionPrototype.delay = function(value) {
8560
8577
  var id = this.id;
8578
+ if (arguments.length < 1) return this.node().__transition__[id].delay;
8561
8579
  return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
8562
8580
  node.__transition__[id].delay = +value.call(node, node.__data__, i, j);
8563
8581
  } : (value = +value, function(node) {
@@ -8566,6 +8584,7 @@
8566
8584
  };
8567
8585
  d3_transitionPrototype.duration = function(value) {
8568
8586
  var id = this.id;
8587
+ if (arguments.length < 1) return this.node().__transition__[id].duration;
8569
8588
  return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
8570
8589
  node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j));
8571
8590
  } : (value = Math.max(1, value), function(node) {
@@ -8664,7 +8683,7 @@
8664
8683
  g.each(function() {
8665
8684
  var g = d3.select(this);
8666
8685
  var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy();
8667
- 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).style("opacity", 1), tickTransform;
8686
+ 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;
8668
8687
  var range = d3_scaleRange(scale1), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"),
8669
8688
  d3.transition(path));
8670
8689
  tickEnter.append("line");
@@ -9214,7 +9233,7 @@
9214
9233
  } ], [ "%Y", d3_true ] ]);
9215
9234
  var d3_time_scaleMilliseconds = {
9216
9235
  range: function(start, stop, step) {
9217
- return d3.range(+start, +stop, step).map(d3_time_scaleDate);
9236
+ return d3.range(Math.ceil(start / step) * step, +stop, step).map(d3_time_scaleDate);
9218
9237
  },
9219
9238
  floor: d3_identity,
9220
9239
  ceil: d3_identity