d3_rails 3.2.2 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTA3YWM5ZjVjY2FlYmRmYWQ1NzZmMzg5YTZkYzJjNDBmNGJjZjA2MA==
4
+ MzY5MDIwNDA1NTczZDNkMjU2N2JlNmY1ODE0ZDg0YjhjMDU1NGEzMA==
5
5
  data.tar.gz: !binary |-
6
- ZTA1N2JmN2E3YzkyM2U5ZDNkMzFjNmUwZTJmMjk5M2I4ZGI4MDE4ZQ==
6
+ OTUyNDQ2ZTQ3YWQ0OWY5ZGIxMTg2NjNmYzRjOGVmOWIzMzM0OWQ2OA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- N2NjMzA5ZTY2NDNjY2FhMDJjMzkzMzhmNmQ1YTE5NmQxYWVhOWRkYjU0Mjk3
10
- ZjFiNDlkYmYyNTY4MmVlN2NlMzkwOGYwNzlmMGQ4ZjRmNmU0ODAwNzVhMjg0
11
- NWRjNzEzNmEwMDEwNTJiYjk1OTZiMzI4NWZkM2VhZTQ4OTdiMGI=
9
+ YWQxMjJkNGVlYTdmY2JkODgwNjJmNzJjOGNlN2EzZGRjNTY1ZGVmNTQ4Mjdi
10
+ NmY5YWUxYzQ0OThlMDc4ZWMzYTJmNGEwZDYyZjFlNWM4OGRmODViYWE4NjY4
11
+ MTRkMmQyMmYwMGIzMGE2Mzk5YjI1ZTFmNWU2ODQ3OWZkODMwZDE=
12
12
  data.tar.gz: !binary |-
13
- YWMwODEzNTU0MTE0MjY2ZjBjMGM1NmNmNzViMGE0YWQwMTkwNzE4ODE2ZjAw
14
- YWZkODA0ZWM3ZDJjMGVkMjgxYmZjNzdjMDRmNTAwMTkwYTg1ZWU0ZjVmMjZk
15
- MGRlYTNlYzYwN2Y2ZDJlZTJlMTkyNGViYThhM2I2OGQ5ZGZmYzc=
13
+ NzNiNDNkNGY0YmUzNGQyMmRjM2Q1NmFjYTdhYjkzNzFmNGFiZjZmOTdmNTA3
14
+ OGUzMTNlNWQzNDk3YTFkMmM2OWUxMzlkNTdhNjQyY2UyZTU5ZTQzOTA5N2Qz
15
+ ZGY4NjFhMDZjM2Q0NmQ0ZGM2Yjc2ZWI0YjZlNjcyY2UxNTA4ZGU=
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # D3_Rails
2
- ## Version 3.2.1 (of d3 in most current gem)
2
+ ## Version 3.2.2 (of d3 in most current gem)
3
3
 
4
4
  **D3_Rails** is a small, lightweight gem which allows you to include any
5
5
  and all of D3 Javascripts into your 3.1 Rails application, merely by
@@ -1,3 +1,3 @@
1
1
  module D3Rails
2
- VERSION = "3.2.2"
2
+ VERSION = "3.2.3"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  d3 = function() {
2
2
  var d3 = {
3
- version: "3.2.2"
3
+ version: "3.2.3"
4
4
  };
5
5
  if (!Date.now) Date.now = function() {
6
6
  return +new Date();
@@ -380,11 +380,6 @@ d3 = function() {
380
380
  } catch (e) {
381
381
  d3_array = d3_arrayCopy;
382
382
  }
383
- var d3_arraySubclass = [].__proto__ ? function(array, prototype) {
384
- array.__proto__ = prototype;
385
- } : function(array, prototype) {
386
- for (var property in prototype) array[property] = prototype[property];
387
- };
388
383
  function d3_noop() {}
389
384
  d3.dispatch = function() {
390
385
  var dispatch = new d3_dispatch(), i = -1, n = arguments.length;
@@ -458,8 +453,13 @@ d3 = function() {
458
453
  return s.replace(d3_requote_re, "\\$&");
459
454
  };
460
455
  var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
456
+ var d3_subclass = {}.__proto__ ? function(object, prototype) {
457
+ object.__proto__ = prototype;
458
+ } : function(object, prototype) {
459
+ for (var property in prototype) object[property] = prototype[property];
460
+ };
461
461
  function d3_selection(groups) {
462
- d3_arraySubclass(groups, d3_selectionPrototype);
462
+ d3_subclass(groups, d3_selectionPrototype);
463
463
  return groups;
464
464
  }
465
465
  var d3_select = function(s, n) {
@@ -484,7 +484,7 @@ d3 = function() {
484
484
  var d3_selectionPrototype = d3.selection.prototype = [];
485
485
  d3_selectionPrototype.select = function(selector) {
486
486
  var subgroups = [], subgroup, subnode, group, node;
487
- if (typeof selector !== "function") selector = d3_selection_selector(selector);
487
+ selector = d3_selection_selector(selector);
488
488
  for (var j = -1, m = this.length; ++j < m; ) {
489
489
  subgroups.push(subgroup = []);
490
490
  subgroup.parentNode = (group = this[j]).parentNode;
@@ -500,13 +500,13 @@ d3 = function() {
500
500
  return d3_selection(subgroups);
501
501
  };
502
502
  function d3_selection_selector(selector) {
503
- return function() {
503
+ return typeof selector === "function" ? selector : function() {
504
504
  return d3_select(selector, this);
505
505
  };
506
506
  }
507
507
  d3_selectionPrototype.selectAll = function(selector) {
508
508
  var subgroups = [], subgroup, node;
509
- if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
509
+ selector = d3_selection_selectorAll(selector);
510
510
  for (var j = -1, m = this.length; ++j < m; ) {
511
511
  for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
512
512
  if (node = group[i]) {
@@ -518,7 +518,7 @@ d3 = function() {
518
518
  return d3_selection(subgroups);
519
519
  };
520
520
  function d3_selection_selectorAll(selector) {
521
- return function() {
521
+ return typeof selector === "function" ? selector : function() {
522
522
  return d3_selectAll(selector, this);
523
523
  };
524
524
  }
@@ -696,25 +696,24 @@ d3 = function() {
696
696
  }) : this.node().innerHTML;
697
697
  };
698
698
  d3_selectionPrototype.append = function(name) {
699
- name = d3.ns.qualify(name);
700
- function append() {
701
- return this.appendChild(d3_document.createElementNS(this.namespaceURI, name));
702
- }
703
- function appendNS() {
704
- return this.appendChild(d3_document.createElementNS(name.space, name.local));
705
- }
706
- return this.select(name.local ? appendNS : append);
699
+ name = d3_selection_creator(name);
700
+ return this.select(function() {
701
+ return this.appendChild(name.apply(this, arguments));
702
+ });
707
703
  };
704
+ function d3_selection_creator(name) {
705
+ return typeof name === "function" ? name : (name = d3.ns.qualify(name)).local ? function() {
706
+ return d3_document.createElementNS(name.space, name.local);
707
+ } : function() {
708
+ return d3_document.createElementNS(this.namespaceURI, name);
709
+ };
710
+ }
708
711
  d3_selectionPrototype.insert = function(name, before) {
709
- name = d3.ns.qualify(name);
710
- if (typeof before !== "function") before = d3_selection_selector(before);
711
- function insert(d, i) {
712
- return this.insertBefore(d3_document.createElementNS(this.namespaceURI, name), before.call(this, d, i));
713
- }
714
- function insertNS(d, i) {
715
- return this.insertBefore(d3_document.createElementNS(name.space, name.local), before.call(this, d, i));
716
- }
717
- return this.select(name.local ? insertNS : insert);
712
+ name = d3_selection_creator(name);
713
+ before = d3_selection_selector(before);
714
+ return this.select(function() {
715
+ return this.insertBefore(name.apply(this, arguments), before.apply(this, arguments));
716
+ });
718
717
  };
719
718
  d3_selectionPrototype.remove = function() {
720
719
  return this.each(function() {
@@ -891,7 +890,7 @@ d3 = function() {
891
890
  return n;
892
891
  };
893
892
  function d3_selection_enter(selection) {
894
- d3_arraySubclass(selection, d3_selection_enterPrototype);
893
+ d3_subclass(selection, d3_selection_enterPrototype);
895
894
  return selection;
896
895
  }
897
896
  var d3_selection_enterPrototype = [];
@@ -4284,50 +4283,55 @@ d3 = function() {
4284
4283
  return (f - b) * (c - a) - (d - b) * (e - a) > 0;
4285
4284
  }
4286
4285
  d3.geom.polygon = function(coordinates) {
4287
- coordinates.area = function() {
4288
- var i = 0, n = coordinates.length, area = coordinates[n - 1][1] * coordinates[0][0] - coordinates[n - 1][0] * coordinates[0][1];
4289
- while (++i < n) {
4290
- area += coordinates[i - 1][1] * coordinates[i][0] - coordinates[i - 1][0] * coordinates[i][1];
4291
- }
4292
- return area * .5;
4293
- };
4294
- coordinates.centroid = function(k) {
4295
- var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c;
4296
- if (!arguments.length) k = -1 / (6 * coordinates.area());
4297
- while (++i < n) {
4298
- a = b;
4299
- b = coordinates[i];
4300
- c = a[0] * b[1] - b[0] * a[1];
4301
- x += (a[0] + b[0]) * c;
4302
- y += (a[1] + b[1]) * c;
4303
- }
4304
- return [ x * k, y * k ];
4305
- };
4306
- coordinates.clip = function(subject) {
4307
- var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d;
4308
- while (++i < n) {
4309
- input = subject.slice();
4310
- subject.length = 0;
4311
- b = coordinates[i];
4312
- c = input[(m = input.length) - 1];
4313
- j = -1;
4314
- while (++j < m) {
4315
- d = input[j];
4316
- if (d3_geom_polygonInside(d, a, b)) {
4317
- if (!d3_geom_polygonInside(c, a, b)) {
4318
- subject.push(d3_geom_polygonIntersect(c, d, a, b));
4319
- }
4320
- subject.push(d);
4321
- } else if (d3_geom_polygonInside(c, a, b)) {
4286
+ d3_subclass(coordinates, d3_geom_polygonPrototype);
4287
+ return coordinates;
4288
+ };
4289
+ var d3_geom_polygonPrototype = d3.geom.polygon.prototype = [];
4290
+ d3_geom_polygonPrototype.area = function() {
4291
+ var i = -1, n = this.length, a, b = this[n - 1], area = 0;
4292
+ while (++i < n) {
4293
+ a = b;
4294
+ b = this[i];
4295
+ area += a[1] * b[0] - a[0] * b[1];
4296
+ }
4297
+ return area * .5;
4298
+ };
4299
+ d3_geom_polygonPrototype.centroid = function(k) {
4300
+ var i = -1, n = this.length, x = 0, y = 0, a, b = this[n - 1], c;
4301
+ if (!arguments.length) k = -1 / (6 * this.area());
4302
+ while (++i < n) {
4303
+ a = b;
4304
+ b = this[i];
4305
+ c = a[0] * b[1] - b[0] * a[1];
4306
+ x += (a[0] + b[0]) * c;
4307
+ y += (a[1] + b[1]) * c;
4308
+ }
4309
+ return [ x * k, y * k ];
4310
+ };
4311
+ d3_geom_polygonPrototype.clip = function(subject) {
4312
+ var input, closed = d3_geom_polygonClosed(subject), i = -1, n = this.length - d3_geom_polygonClosed(this), j, m, a = this[n - 1], b, c, d;
4313
+ while (++i < n) {
4314
+ input = subject.slice();
4315
+ subject.length = 0;
4316
+ b = this[i];
4317
+ c = input[(m = input.length - closed) - 1];
4318
+ j = -1;
4319
+ while (++j < m) {
4320
+ d = input[j];
4321
+ if (d3_geom_polygonInside(d, a, b)) {
4322
+ if (!d3_geom_polygonInside(c, a, b)) {
4322
4323
  subject.push(d3_geom_polygonIntersect(c, d, a, b));
4323
4324
  }
4324
- c = d;
4325
+ subject.push(d);
4326
+ } else if (d3_geom_polygonInside(c, a, b)) {
4327
+ subject.push(d3_geom_polygonIntersect(c, d, a, b));
4325
4328
  }
4326
- a = b;
4329
+ c = d;
4327
4330
  }
4328
- return subject;
4329
- };
4330
- return coordinates;
4331
+ if (closed) subject.push(subject[0]);
4332
+ a = b;
4333
+ }
4334
+ return subject;
4331
4335
  };
4332
4336
  function d3_geom_polygonInside(p, a, b) {
4333
4337
  return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
@@ -4336,6 +4340,10 @@ d3 = function() {
4336
4340
  var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21);
4337
4341
  return [ x1 + ua * x21, y1 + ua * y21 ];
4338
4342
  }
4343
+ function d3_geom_polygonClosed(coordinates) {
4344
+ var a = coordinates[0], b = coordinates[coordinates.length - 1];
4345
+ return !(a[0] - b[0] || a[1] - b[1]);
4346
+ }
4339
4347
  d3.geom.delaunay = function(vertices) {
4340
4348
  var edges = vertices.map(function() {
4341
4349
  return [];
@@ -4891,122 +4899,12 @@ d3 = function() {
4891
4899
  return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));
4892
4900
  };
4893
4901
  }
4894
- d3.transform = function(string) {
4895
- var g = d3_document.createElementNS(d3.ns.prefix.svg, "g");
4896
- return (d3.transform = function(string) {
4897
- if (string != null) {
4898
- g.setAttribute("transform", string);
4899
- var t = g.transform.baseVal.consolidate();
4900
- }
4901
- return new d3_transform(t ? t.matrix : d3_transformIdentity);
4902
- })(string);
4903
- };
4904
- function d3_transform(m) {
4905
- var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
4906
- if (r0[0] * r1[1] < r1[0] * r0[1]) {
4907
- r0[0] *= -1;
4908
- r0[1] *= -1;
4909
- kx *= -1;
4910
- kz *= -1;
4911
- }
4912
- this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees;
4913
- this.translate = [ m.e, m.f ];
4914
- this.scale = [ kx, ky ];
4915
- this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0;
4916
- }
4917
- d3_transform.prototype.toString = function() {
4918
- return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
4919
- };
4920
- function d3_transformDot(a, b) {
4921
- return a[0] * b[0] + a[1] * b[1];
4922
- }
4923
- function d3_transformNormalize(a) {
4924
- var k = Math.sqrt(d3_transformDot(a, a));
4925
- if (k) {
4926
- a[0] /= k;
4927
- a[1] /= k;
4928
- }
4929
- return k;
4930
- }
4931
- function d3_transformCombine(a, b, k) {
4932
- a[0] += k * b[0];
4933
- a[1] += k * b[1];
4934
- return a;
4935
- }
4936
- var d3_transformIdentity = {
4937
- a: 1,
4938
- b: 0,
4939
- c: 0,
4940
- d: 1,
4941
- e: 0,
4942
- f: 0
4943
- };
4944
- d3.interpolateNumber = d3_interpolateNumber;
4945
- function d3_interpolateNumber(a, b) {
4946
- b -= a = +a;
4947
- return function(t) {
4948
- return a + b * t;
4949
- };
4950
- }
4951
- d3.interpolateTransform = d3_interpolateTransform;
4952
- function d3_interpolateTransform(a, b) {
4953
- 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;
4954
- if (ta[0] != tb[0] || ta[1] != tb[1]) {
4955
- s.push("translate(", null, ",", null, ")");
4956
- q.push({
4957
- i: 1,
4958
- x: d3_interpolateNumber(ta[0], tb[0])
4959
- }, {
4960
- i: 3,
4961
- x: d3_interpolateNumber(ta[1], tb[1])
4962
- });
4963
- } else if (tb[0] || tb[1]) {
4964
- s.push("translate(" + tb + ")");
4965
- } else {
4966
- s.push("");
4967
- }
4968
- if (ra != rb) {
4969
- if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
4970
- q.push({
4971
- i: s.push(s.pop() + "rotate(", null, ")") - 2,
4972
- x: d3_interpolateNumber(ra, rb)
4973
- });
4974
- } else if (rb) {
4975
- s.push(s.pop() + "rotate(" + rb + ")");
4976
- }
4977
- if (wa != wb) {
4978
- q.push({
4979
- i: s.push(s.pop() + "skewX(", null, ")") - 2,
4980
- x: d3_interpolateNumber(wa, wb)
4981
- });
4982
- } else if (wb) {
4983
- s.push(s.pop() + "skewX(" + wb + ")");
4984
- }
4985
- if (ka[0] != kb[0] || ka[1] != kb[1]) {
4986
- n = s.push(s.pop() + "scale(", null, ",", null, ")");
4987
- q.push({
4988
- i: n - 4,
4989
- x: d3_interpolateNumber(ka[0], kb[0])
4990
- }, {
4991
- i: n - 2,
4992
- x: d3_interpolateNumber(ka[1], kb[1])
4993
- });
4994
- } else if (kb[0] != 1 || kb[1] != 1) {
4995
- s.push(s.pop() + "scale(" + kb + ")");
4996
- }
4997
- n = q.length;
4998
- return function(t) {
4999
- var i = -1, o;
5000
- while (++i < n) s[(o = q[i]).i] = o.x(t);
5001
- return s.join("");
5002
- };
5003
- }
5004
4902
  d3.interpolateObject = d3_interpolateObject;
5005
4903
  function d3_interpolateObject(a, b) {
5006
4904
  var i = {}, c = {}, k;
5007
4905
  for (k in a) {
5008
4906
  if (k in b) {
5009
- i[k] = d3_interpolateByName(k)(a[k], b[k]);
4907
+ i[k] = d3_interpolate(a[k], b[k]);
5010
4908
  } else {
5011
4909
  c[k] = a[k];
5012
4910
  }
@@ -5021,6 +4919,13 @@ d3 = function() {
5021
4919
  return c;
5022
4920
  };
5023
4921
  }
4922
+ d3.interpolateNumber = d3_interpolateNumber;
4923
+ function d3_interpolateNumber(a, b) {
4924
+ b -= a = +a;
4925
+ return function(t) {
4926
+ return a + b * t;
4927
+ };
4928
+ }
5024
4929
  d3.interpolateString = d3_interpolateString;
5025
4930
  function d3_interpolateString(a, b) {
5026
4931
  var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o;
@@ -5094,9 +4999,6 @@ d3 = function() {
5094
4999
  while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;
5095
5000
  return f;
5096
5001
  }
5097
- function d3_interpolateByName(name) {
5098
- return name == "transform" ? d3_interpolateTransform : d3_interpolate;
5099
- }
5100
5002
  d3.interpolators = [ function(a, b) {
5101
5003
  var t = typeof b;
5102
5004
  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);
@@ -5249,6 +5151,109 @@ d3 = function() {
5249
5151
  return Math.round(a + b * t);
5250
5152
  };
5251
5153
  }
5154
+ d3.transform = function(string) {
5155
+ var g = d3_document.createElementNS(d3.ns.prefix.svg, "g");
5156
+ return (d3.transform = function(string) {
5157
+ if (string != null) {
5158
+ g.setAttribute("transform", string);
5159
+ var t = g.transform.baseVal.consolidate();
5160
+ }
5161
+ return new d3_transform(t ? t.matrix : d3_transformIdentity);
5162
+ })(string);
5163
+ };
5164
+ function d3_transform(m) {
5165
+ var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
5166
+ if (r0[0] * r1[1] < r1[0] * r0[1]) {
5167
+ r0[0] *= -1;
5168
+ r0[1] *= -1;
5169
+ kx *= -1;
5170
+ kz *= -1;
5171
+ }
5172
+ this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees;
5173
+ this.translate = [ m.e, m.f ];
5174
+ this.scale = [ kx, ky ];
5175
+ this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0;
5176
+ }
5177
+ d3_transform.prototype.toString = function() {
5178
+ return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
5179
+ };
5180
+ function d3_transformDot(a, b) {
5181
+ return a[0] * b[0] + a[1] * b[1];
5182
+ }
5183
+ function d3_transformNormalize(a) {
5184
+ var k = Math.sqrt(d3_transformDot(a, a));
5185
+ if (k) {
5186
+ a[0] /= k;
5187
+ a[1] /= k;
5188
+ }
5189
+ return k;
5190
+ }
5191
+ function d3_transformCombine(a, b, k) {
5192
+ a[0] += k * b[0];
5193
+ a[1] += k * b[1];
5194
+ return a;
5195
+ }
5196
+ var d3_transformIdentity = {
5197
+ a: 1,
5198
+ b: 0,
5199
+ c: 0,
5200
+ d: 1,
5201
+ e: 0,
5202
+ f: 0
5203
+ };
5204
+ d3.interpolateTransform = d3_interpolateTransform;
5205
+ function d3_interpolateTransform(a, b) {
5206
+ 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;
5207
+ if (ta[0] != tb[0] || ta[1] != tb[1]) {
5208
+ s.push("translate(", null, ",", null, ")");
5209
+ q.push({
5210
+ i: 1,
5211
+ x: d3_interpolateNumber(ta[0], tb[0])
5212
+ }, {
5213
+ i: 3,
5214
+ x: d3_interpolateNumber(ta[1], tb[1])
5215
+ });
5216
+ } else if (tb[0] || tb[1]) {
5217
+ s.push("translate(" + tb + ")");
5218
+ } else {
5219
+ s.push("");
5220
+ }
5221
+ if (ra != rb) {
5222
+ if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
5223
+ q.push({
5224
+ i: s.push(s.pop() + "rotate(", null, ")") - 2,
5225
+ x: d3_interpolateNumber(ra, rb)
5226
+ });
5227
+ } else if (rb) {
5228
+ s.push(s.pop() + "rotate(" + rb + ")");
5229
+ }
5230
+ if (wa != wb) {
5231
+ q.push({
5232
+ i: s.push(s.pop() + "skewX(", null, ")") - 2,
5233
+ x: d3_interpolateNumber(wa, wb)
5234
+ });
5235
+ } else if (wb) {
5236
+ s.push(s.pop() + "skewX(" + wb + ")");
5237
+ }
5238
+ if (ka[0] != kb[0] || ka[1] != kb[1]) {
5239
+ n = s.push(s.pop() + "scale(", null, ",", null, ")");
5240
+ q.push({
5241
+ i: n - 4,
5242
+ x: d3_interpolateNumber(ka[0], kb[0])
5243
+ }, {
5244
+ i: n - 2,
5245
+ x: d3_interpolateNumber(ka[1], kb[1])
5246
+ });
5247
+ } else if (kb[0] != 1 || kb[1] != 1) {
5248
+ s.push(s.pop() + "scale(" + kb + ")");
5249
+ }
5250
+ n = q.length;
5251
+ return function(t) {
5252
+ var i = -1, o;
5253
+ while (++i < n) s[(o = q[i]).i] = o.x(t);
5254
+ return s.join("");
5255
+ };
5256
+ }
5252
5257
  function d3_uninterpolateNumber(a, b) {
5253
5258
  b = b - (a = +a) ? 1 / (b - a) : 0;
5254
5259
  return function(x) {
@@ -6222,10 +6227,12 @@ d3 = function() {
6222
6227
  d3.layout.pack = function() {
6223
6228
  var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ], radius;
6224
6229
  function pack(d, i) {
6225
- var nodes = hierarchy.call(this, d, i), root = nodes[0], w = size[0], h = size[1], r = radius || Math.sqrt;
6230
+ var nodes = hierarchy.call(this, d, i), root = nodes[0], w = size[0], h = size[1], r = radius == null ? Math.sqrt : typeof radius === "function" ? radius : function() {
6231
+ return radius;
6232
+ };
6226
6233
  root.x = root.y = 0;
6227
6234
  d3_layout_treeVisitAfter(root, function(d) {
6228
- d.r = r(d.value);
6235
+ d.r = +r(d.value);
6229
6236
  });
6230
6237
  d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
6231
6238
  if (padding) {
@@ -6248,7 +6255,7 @@ d3 = function() {
6248
6255
  };
6249
6256
  pack.radius = function(_) {
6250
6257
  if (!arguments.length) return radius;
6251
- radius = _;
6258
+ radius = _ == null || typeof _ === "function" ? _ : +_;
6252
6259
  return pack;
6253
6260
  };
6254
6261
  pack.padding = function(_) {
@@ -7419,7 +7426,7 @@ d3 = function() {
7419
7426
  d3.svg.symbolTypes = d3_svg_symbols.keys();
7420
7427
  var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians);
7421
7428
  function d3_transition(groups, id) {
7422
- d3_arraySubclass(groups, d3_transitionPrototype);
7429
+ d3_subclass(groups, d3_transitionPrototype);
7423
7430
  groups.id = id;
7424
7431
  return groups;
7425
7432
  }
@@ -7438,7 +7445,7 @@ d3 = function() {
7438
7445
  d3.transition.prototype = d3_transitionPrototype;
7439
7446
  d3_transitionPrototype.select = function(selector) {
7440
7447
  var id = this.id, subgroups = [], subgroup, subnode, node;
7441
- if (typeof selector !== "function") selector = d3_selection_selector(selector);
7448
+ selector = d3_selection_selector(selector);
7442
7449
  for (var j = -1, m = this.length; ++j < m; ) {
7443
7450
  subgroups.push(subgroup = []);
7444
7451
  for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
@@ -7455,7 +7462,7 @@ d3 = function() {
7455
7462
  };
7456
7463
  d3_transitionPrototype.selectAll = function(selector) {
7457
7464
  var id = this.id, subgroups = [], subgroup, subnodes, node, subnode, transition;
7458
- if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
7465
+ selector = d3_selection_selectorAll(selector);
7459
7466
  for (var j = -1, m = this.length; ++j < m; ) {
7460
7467
  for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
7461
7468
  if (node = group[i]) {
@@ -7506,7 +7513,7 @@ d3 = function() {
7506
7513
  for (value in nameNS) this.attr(value, nameNS[value]);
7507
7514
  return this;
7508
7515
  }
7509
- var interpolate = d3_interpolateByName(nameNS), name = d3.ns.qualify(nameNS);
7516
+ var interpolate = nameNS == "transform" ? d3_interpolateTransform : d3_interpolate, name = d3.ns.qualify(nameNS);
7510
7517
  function attrNull() {
7511
7518
  this.removeAttribute(name);
7512
7519
  }
@@ -7557,14 +7564,13 @@ d3 = function() {
7557
7564
  }
7558
7565
  priority = "";
7559
7566
  }
7560
- var interpolate = d3_interpolateByName(name);
7561
7567
  function styleNull() {
7562
7568
  this.style.removeProperty(name);
7563
7569
  }
7564
7570
  function styleString(b) {
7565
7571
  return b == null ? styleNull : (b += "", function() {
7566
7572
  var a = d3_window.getComputedStyle(this, null).getPropertyValue(name), i;
7567
- return a !== b && (i = interpolate(a, b), function(t) {
7573
+ return a !== b && (i = d3_interpolate(a, b), function(t) {
7568
7574
  this.style.setProperty(name, i(t), priority);
7569
7575
  });
7570
7576
  });