d3_rails 3.5.6 → 3.5.7

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: c4ad301d2f6aaa6d00442cf6b1a87abb159133e1
4
- data.tar.gz: 04ba8e2c3e3a3330e6f7b69fc3ce9220c9d6aa62
3
+ metadata.gz: 33d375458b69e412ba06d8df05d6c26f85b9b8d8
4
+ data.tar.gz: 1be7da73993ac27a0ecbd2c1c562a5d13255ddb0
5
5
  SHA512:
6
- metadata.gz: e1c47104649feb22bfe2c18c67cb87cd34c37fcd7083408cf69373bb96450c96cb054ed55305db72aef6be41fe860345136fd9accaf8ef3617dd2d182dcf527e
7
- data.tar.gz: ed798fc4194277f3e61b8408a8e331787332dd439cec07c788016d6c3d9a96b8c990f6dd88eba88b0a6ab96afdedadb57c728eeb4d8c27fbc457aa1ac27bc0a4
6
+ metadata.gz: a27c77382c45d8dec314d4e447996f7566e6845bea38cba52caef914d071fbdae3d3d8a7f418f990d8c4ebe09edb7af2a08c040c308a52704945e94a85407aae
7
+ data.tar.gz: 93eb6363ec804412f5f62b2c0c4f56e7f83955e9be40e52ab8f5d9f7f6f529321ae2380228f16fa5e5697f7ab77bb55da18c6ce0ad7c558705cdc3fc3005243b
@@ -1,6 +1,6 @@
1
1
  !function() {
2
2
  var d3 = {
3
- version: "3.5.6"
3
+ version: "3.5.7"
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 (nodeByKeyValue.has(keyValue = key.call(node = group[i], node.__data__, i))) {
849
- exitNodes[i] = node;
850
- } else {
851
- nodeByKeyValue.set(keyValue, node);
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 ]);
@@ -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
- var dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, 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), dr = r1 - r0, S = (dr || Math.log(w1 / w0)) / ρ;
1290
- function interpolate(t) {
1291
- var s = t * S;
1292
- if (dr) {
1293
- var coshr0 = d3_cosh(r0), u = w0 / (ρ2 * d1) * (coshr0 * d3_tanh(ρ * s + r0) - d3_sinh(r0));
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
- interpolate.duration = S * 1e3;
1299
- return interpolate;
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
  };
@@ -1698,9 +1702,8 @@
1698
1702
  return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);
1699
1703
  }
1700
1704
  function d3_rgb_parse(format, rgb, hsl) {
1701
- format = format.toLowerCase();
1702
1705
  var r = 0, g = 0, b = 0, m1, m2, color;
1703
- m1 = /([a-z]+)\((.*)\)/.exec(format);
1706
+ m1 = /([a-z]+)\((.*)\)/.exec(format = format.toLowerCase());
1704
1707
  if (m1) {
1705
1708
  m2 = m1[2].split(",");
1706
1709
  switch (m1[1]) {
@@ -2115,17 +2118,19 @@
2115
2118
  };
2116
2119
  d3.csv = d3.dsv(",", "text/csv");
2117
2120
  d3.tsv = d3.dsv(" ", "text/tab-separated-values");
2118
- var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_active, d3_timer_frame = this[d3_vendorSymbol(this, "requestAnimationFrame")] || function(callback) {
2121
+ var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_frame = this[d3_vendorSymbol(this, "requestAnimationFrame")] || function(callback) {
2119
2122
  setTimeout(callback, 17);
2120
2123
  };
2121
- d3.timer = function(callback, delay, then) {
2124
+ d3.timer = function() {
2125
+ d3_timer.apply(this, arguments);
2126
+ };
2127
+ function d3_timer(callback, delay, then) {
2122
2128
  var n = arguments.length;
2123
2129
  if (n < 2) delay = 0;
2124
2130
  if (n < 3) then = Date.now();
2125
2131
  var time = then + delay, timer = {
2126
2132
  c: callback,
2127
2133
  t: time,
2128
- f: false,
2129
2134
  n: null
2130
2135
  };
2131
2136
  if (d3_timer_queueTail) d3_timer_queueTail.n = timer; else d3_timer_queueHead = timer;
@@ -2135,7 +2140,8 @@
2135
2140
  d3_timer_interval = 1;
2136
2141
  d3_timer_frame(d3_timer_step);
2137
2142
  }
2138
- };
2143
+ return timer;
2144
+ }
2139
2145
  function d3_timer_step() {
2140
2146
  var now = d3_timer_mark(), delay = d3_timer_sweep() - now;
2141
2147
  if (delay > 24) {
@@ -2154,22 +2160,21 @@
2154
2160
  d3_timer_sweep();
2155
2161
  };
2156
2162
  function d3_timer_mark() {
2157
- var now = Date.now();
2158
- d3_timer_active = d3_timer_queueHead;
2159
- while (d3_timer_active) {
2160
- if (now >= d3_timer_active.t) d3_timer_active.f = d3_timer_active.c(now - d3_timer_active.t);
2161
- 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;
2162
2167
  }
2163
2168
  return now;
2164
2169
  }
2165
2170
  function d3_timer_sweep() {
2166
2171
  var t0, t1 = d3_timer_queueHead, time = Infinity;
2167
2172
  while (t1) {
2168
- if (t1.f) {
2169
- t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;
2170
- } else {
2173
+ if (t1.c) {
2171
2174
  if (t1.t < time) time = t1.t;
2172
2175
  t1 = (t0 = t1).n;
2176
+ } else {
2177
+ t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;
2173
2178
  }
2174
2179
  }
2175
2180
  d3_timer_queueTail = t0;
@@ -2184,7 +2189,7 @@
2184
2189
  var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
2185
2190
  d3.formatPrefix = function(value, precision) {
2186
2191
  var i = 0;
2187
- if (value) {
2192
+ if (value = +value) {
2188
2193
  if (value < 0) value *= -1;
2189
2194
  if (precision) value = d3.round(value, d3_format_precision(value, precision));
2190
2195
  i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
@@ -2534,7 +2539,8 @@
2534
2539
  if (i != string.length) return null;
2535
2540
  if ("p" in d) d.H = d.H % 12 + d.p * 12;
2536
2541
  var localZ = d.Z != null && d3_date !== d3_date_utc, date = new (localZ ? d3_date_utc : d3_date)();
2537
- if ("j" in d) date.setFullYear(d.y, 0, d.j); else if ("w" in d && ("W" in d || "U" in d)) {
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;
2538
2544
  date.setFullYear(d.y, 0, 1);
2539
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);
2540
2546
  } else date.setFullYear(d.y, d.m, d.d);
@@ -5986,54 +5992,68 @@
5986
5992
  f: 0
5987
5993
  };
5988
5994
  d3.interpolateTransform = d3_interpolateTransform;
5989
- function d3_interpolateTransform(a, b) {
5990
- var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale;
5991
- if (ta[0] != tb[0] || ta[1] != tb[1]) {
5992
- s.push("translate(", null, ",", null, ")");
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, ")");
5993
6001
  q.push({
5994
- i: 1,
6002
+ i: i - 4,
5995
6003
  x: d3_interpolateNumber(ta[0], tb[0])
5996
6004
  }, {
5997
- i: 3,
6005
+ i: i - 2,
5998
6006
  x: d3_interpolateNumber(ta[1], tb[1])
5999
6007
  });
6000
6008
  } else if (tb[0] || tb[1]) {
6001
6009
  s.push("translate(" + tb + ")");
6002
- } else {
6003
- s.push("");
6004
6010
  }
6005
- if (ra != rb) {
6011
+ }
6012
+ function d3_interpolateRotate(ra, rb, s, q) {
6013
+ if (ra !== rb) {
6006
6014
  if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
6007
6015
  q.push({
6008
- i: s.push(s.pop() + "rotate(", null, ")") - 2,
6016
+ i: s.push(d3_interpolateTransformPop(s) + "rotate(", null, ")") - 2,
6009
6017
  x: d3_interpolateNumber(ra, rb)
6010
6018
  });
6011
6019
  } else if (rb) {
6012
- s.push(s.pop() + "rotate(" + rb + ")");
6020
+ s.push(d3_interpolateTransformPop(s) + "rotate(" + rb + ")");
6013
6021
  }
6014
- if (wa != wb) {
6022
+ }
6023
+ function d3_interpolateSkew(wa, wb, s, q) {
6024
+ if (wa !== wb) {
6015
6025
  q.push({
6016
- i: s.push(s.pop() + "skewX(", null, ")") - 2,
6026
+ i: s.push(d3_interpolateTransformPop(s) + "skewX(", null, ")") - 2,
6017
6027
  x: d3_interpolateNumber(wa, wb)
6018
6028
  });
6019
6029
  } else if (wb) {
6020
- s.push(s.pop() + "skewX(" + wb + ")");
6030
+ s.push(d3_interpolateTransformPop(s) + "skewX(" + wb + ")");
6021
6031
  }
6022
- if (ka[0] != kb[0] || ka[1] != kb[1]) {
6023
- n = s.push(s.pop() + "scale(", null, ",", null, ")");
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, ")");
6024
6036
  q.push({
6025
- i: n - 4,
6037
+ i: i - 4,
6026
6038
  x: d3_interpolateNumber(ka[0], kb[0])
6027
6039
  }, {
6028
- i: n - 2,
6040
+ i: i - 2,
6029
6041
  x: d3_interpolateNumber(ka[1], kb[1])
6030
6042
  });
6031
- } else if (kb[0] != 1 || kb[1] != 1) {
6032
- s.push(s.pop() + "scale(" + kb + ")");
6043
+ } else if (kb[0] !== 1 || kb[1] !== 1) {
6044
+ s.push(d3_interpolateTransformPop(s) + "scale(" + kb + ")");
6033
6045
  }
6034
- n = q.length;
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;
6035
6055
  return function(t) {
6036
- var i = -1, o;
6056
+ var i = -1, n = q.length, o;
6037
6057
  while (++i < n) s[(o = q[i]).i] = o.x(t);
6038
6058
  return s.join("");
6039
6059
  };
@@ -6205,7 +6225,7 @@
6205
6225
  return chord;
6206
6226
  };
6207
6227
  d3.layout.force = function() {
6208
- 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;
6209
6229
  function repulse(node) {
6210
6230
  return function(quad, x1, _, x2) {
6211
6231
  if (quad.point !== node) {
@@ -6229,6 +6249,7 @@
6229
6249
  }
6230
6250
  force.tick = function() {
6231
6251
  if ((alpha *= .99) < .005) {
6252
+ timer = null;
6232
6253
  event.end({
6233
6254
  type: "end",
6234
6255
  alpha: alpha = 0
@@ -6246,7 +6267,7 @@
6246
6267
  l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
6247
6268
  x *= l;
6248
6269
  y *= l;
6249
- t.x -= x * (k = s.weight / (t.weight + s.weight));
6270
+ t.x -= x * (k = s.weight + t.weight ? s.weight / (s.weight + t.weight) : .5);
6250
6271
  t.y -= y * k;
6251
6272
  s.x += x * (k = 1 - k);
6252
6273
  s.y += y * k;
@@ -6342,13 +6363,21 @@
6342
6363
  if (!arguments.length) return alpha;
6343
6364
  x = +x;
6344
6365
  if (alpha) {
6345
- if (x > 0) alpha = x; else alpha = 0;
6366
+ if (x > 0) {
6367
+ alpha = x;
6368
+ } else {
6369
+ timer.c = null, timer.t = NaN, timer = null;
6370
+ event.start({
6371
+ type: "end",
6372
+ alpha: alpha = 0
6373
+ });
6374
+ }
6346
6375
  } else if (x > 0) {
6347
6376
  event.start({
6348
6377
  type: "start",
6349
6378
  alpha: alpha = x
6350
6379
  });
6351
- d3.timer(force.tick);
6380
+ timer = d3_timer(force.tick);
6352
6381
  }
6353
6382
  return force;
6354
6383
  };
@@ -6602,7 +6631,7 @@
6602
6631
  function pie(data) {
6603
6632
  var n = data.length, values = data.map(function(d, i) {
6604
6633
  return +value.call(pie, d, i);
6605
- }), 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) / d3.sum(values), index = d3.range(n), arcs = [], v;
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;
6606
6635
  if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
6607
6636
  return values[j] - values[i];
6608
6637
  } : function(i, j) {
@@ -7315,10 +7344,8 @@
7315
7344
  }
7316
7345
  function treemap(d) {
7317
7346
  var nodes = stickies || hierarchy(d), root = nodes[0];
7318
- root.x = 0;
7319
- root.y = 0;
7320
- root.dx = size[0];
7321
- 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;
7322
7349
  if (stickies) hierarchy.revalue(root);
7323
7350
  scale([ root ], root.dx * root.dy / root.value);
7324
7351
  (stickies ? stickify : squarify)(root);
@@ -7982,11 +8009,16 @@
7982
8009
  } else {
7983
8010
  x2 = y2 = 0;
7984
8011
  }
7985
- if ((rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) {
8012
+ if (da > ε && (rc = Math.min(Math.abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments))) > .001) {
7986
8013
  cr = r0 < r1 ^ cw ? 0 : 1;
7987
- 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]);
8014
+ var rc1 = rc, rc0 = rc;
8015
+ if (da < π) {
8016
+ 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]);
8017
+ rc0 = Math.min(rc, (r0 - lc) / (kc - 1));
8018
+ rc1 = Math.min(rc, (r1 - lc) / (kc + 1));
8019
+ }
7988
8020
  if (x1 != null) {
7989
- var rc1 = Math.min(rc, (r1 - lc) / (kc + 1)), 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);
8021
+ 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);
7990
8022
  if (rc === rc1) {
7991
8023
  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]);
7992
8024
  } else {
@@ -7996,7 +8028,7 @@
7996
8028
  path.push("M", x0, ",", y0);
7997
8029
  }
7998
8030
  if (x3 != null) {
7999
- var rc0 = Math.min(rc, (r0 - lc) / (kc - 1)), 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);
8031
+ 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);
8000
8032
  if (rc === rc0) {
8001
8033
  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]);
8002
8034
  } else {
@@ -8078,7 +8110,7 @@
8078
8110
  return (x0 - x1) * y0 - (y0 - y1) * x0 > 0 ? 0 : 1;
8079
8111
  }
8080
8112
  function d3_svg_arcCornerTangents(p0, p1, r1, rc, cw) {
8081
- 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;
8113
+ 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;
8082
8114
  if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
8083
8115
  return [ [ cx0 - ox, cy0 - oy ], [ cx0 * r1 / r, cy0 * r1 / r ] ];
8084
8116
  }
@@ -8150,10 +8182,10 @@
8150
8182
  value.closed = /-closed$/.test(key);
8151
8183
  });
8152
8184
  function d3_svg_lineLinear(points) {
8153
- return points.join("L");
8185
+ return points.length > 1 ? points.join("L") : points + "Z";
8154
8186
  }
8155
8187
  function d3_svg_lineLinearClosed(points) {
8156
- return d3_svg_lineLinear(points) + "Z";
8188
+ return points.join("L") + "Z";
8157
8189
  }
8158
8190
  function d3_svg_lineStep(points) {
8159
8191
  var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
@@ -8175,7 +8207,7 @@
8175
8207
  return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, -1), d3_svg_lineCardinalTangents(points, tension));
8176
8208
  }
8177
8209
  function d3_svg_lineCardinalClosed(points, tension) {
8178
- return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]),
8210
+ return points.length < 3 ? d3_svg_lineLinearClosed(points) : points[0] + d3_svg_lineHermite((points.push(points[0]),
8179
8211
  points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
8180
8212
  }
8181
8213
  function d3_svg_lineCardinal(points, tension) {
@@ -8611,9 +8643,11 @@
8611
8643
  var d3_selection_interrupt = d3_selection_interruptNS(d3_transitionNamespace());
8612
8644
  function d3_selection_interruptNS(ns) {
8613
8645
  return function() {
8614
- var lock, active;
8615
- if ((lock = this[ns]) && (active = lock[lock.active])) {
8616
- if (--lock.count) delete lock[lock.active]; else delete this[ns];
8646
+ var lock, activeId, active;
8647
+ if ((lock = this[ns]) && (active = lock[activeId = lock.active])) {
8648
+ active.timer.c = null;
8649
+ active.timer.t = NaN;
8650
+ if (--lock.count) delete lock[activeId]; else delete this[ns];
8617
8651
  lock.active += .5;
8618
8652
  active.event && active.event.interrupt.call(this, this.__data__, active.index);
8619
8653
  }
@@ -8870,10 +8904,11 @@
8870
8904
  count: 0
8871
8905
  }), transition = lock[id];
8872
8906
  if (!transition) {
8873
- var time = inherit.time;
8907
+ var time = inherit.time, timer = d3_timer(schedule, 0, time);
8874
8908
  transition = lock[id] = {
8875
8909
  tween: new d3_Map(),
8876
8910
  time: time,
8911
+ timer: timer,
8877
8912
  delay: inherit.delay,
8878
8913
  duration: inherit.duration,
8879
8914
  ease: inherit.ease,
@@ -8881,19 +8916,29 @@
8881
8916
  };
8882
8917
  inherit = null;
8883
8918
  ++lock.count;
8884
- d3.timer(function(elapsed) {
8885
- var delay = transition.delay, duration, ease, timer = d3_timer_active, tweened = [];
8919
+ function schedule(elapsed) {
8920
+ var delay = transition.delay, duration, ease, tweened = [];
8886
8921
  timer.t = delay + time;
8887
8922
  if (delay <= elapsed) return start(elapsed - delay);
8888
8923
  timer.c = start;
8889
8924
  function start(elapsed) {
8890
- if (lock.active > id) return stop();
8891
- var active = lock[lock.active];
8925
+ var activeId = lock.active, active = lock[activeId];
8892
8926
  if (active) {
8927
+ active.timer.c = null;
8928
+ active.timer.t = NaN;
8893
8929
  --lock.count;
8894
- delete lock[lock.active];
8930
+ delete lock[activeId];
8895
8931
  active.event && active.event.interrupt.call(node, node.__data__, active.index);
8896
8932
  }
8933
+ for (var cancelId in lock) {
8934
+ if (+cancelId < id) {
8935
+ var cancel = lock[cancelId];
8936
+ cancel.timer.c = null;
8937
+ cancel.timer.t = NaN;
8938
+ --lock.count;
8939
+ delete lock[cancelId];
8940
+ }
8941
+ }
8897
8942
  lock.active = id;
8898
8943
  transition.event && transition.event.start.call(node, node.__data__, i);
8899
8944
  transition.tween.forEach(function(key, value) {
@@ -8903,27 +8948,27 @@
8903
8948
  });
8904
8949
  ease = transition.ease;
8905
8950
  duration = transition.duration;
8906
- d3.timer(function() {
8907
- timer.c = tick(elapsed || 1) ? d3_true : tick;
8951
+ timer.c = tick;
8952
+ d3_timer(function() {
8953
+ if (timer.c && tick(elapsed || 1)) {
8954
+ timer.c = null;
8955
+ timer.t = NaN;
8956
+ }
8908
8957
  return 1;
8909
8958
  }, 0, time);
8910
8959
  }
8911
8960
  function tick(elapsed) {
8912
- if (lock.active !== id) return 1;
8913
8961
  var t = elapsed / duration, e = ease(t), n = tweened.length;
8914
8962
  while (n > 0) {
8915
8963
  tweened[--n].call(node, e);
8916
8964
  }
8917
8965
  if (t >= 1) {
8918
8966
  transition.event && transition.event.end.call(node, node.__data__, i);
8919
- return stop();
8967
+ if (--lock.count) delete lock[id]; else delete node[ns];
8968
+ return 1;
8920
8969
  }
8921
8970
  }
8922
- function stop() {
8923
- if (--lock.count) delete lock[id]; else delete node[ns];
8924
- return 1;
8925
- }
8926
- }, 0, time);
8971
+ }
8927
8972
  }
8928
8973
  }
8929
8974
  d3.svg.axis = function() {
@@ -8977,7 +9022,7 @@
8977
9022
  };
8978
9023
  axis.ticks = function() {
8979
9024
  if (!arguments.length) return tickArguments_;
8980
- tickArguments_ = arguments;
9025
+ tickArguments_ = d3_array(arguments);
8981
9026
  return axis;
8982
9027
  };
8983
9028
  axis.tickValues = function(x) {
@@ -9499,6 +9544,5 @@
9499
9544
  d3.xml = d3_xhrType(function(request) {
9500
9545
  return request.responseXML;
9501
9546
  });
9502
- if (typeof define === "function" && define.amd) define(d3); else if (typeof module === "object" && module.exports) module.exports = d3;
9503
- this.d3 = d3;
9547
+ if (typeof define === "function" && define.amd) define(this.d3 = d3); else if (typeof module === "object" && module.exports) module.exports = d3; else this.d3 = d3;
9504
9548
  }();