d3_rails 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -14,8 +14,8 @@ or you can use it to build dynamic pages (like jQuery).
14
14
 
15
15
  # D3 Version
16
16
 
17
- The current release of this gem is using **D3 v=2.7.0**
18
- **Last Updated 12-13-2011**
17
+ The current release of this gem is using **D3 v=2.7.1**
18
+ **Last Updated 12-30-2011**
19
19
 
20
20
  # Included Javascripts
21
21
  **minified js files are not included, since the rails asset pipeline sorta necessitates the compiling (and likely minifying) your js files for production**
@@ -1,3 +1,3 @@
1
1
  module D3Rails
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
File without changes
File without changes
File without changes
@@ -10,7 +10,7 @@ try {
10
10
  d3_style_setProperty.call(this, name, value + "", priority);
11
11
  };
12
12
  }
13
- d3 = {version: "2.7.0"}; // semver
13
+ d3 = {version: "2.7.1"}; // semver
14
14
  var d3_array = d3_arraySlice; // conversion for NodeLists
15
15
 
16
16
  function d3_arrayCopy(pseudoarray) {
@@ -424,9 +424,10 @@ d3.round = function(x, n) {
424
424
  };
425
425
  d3.xhr = function(url, mime, callback) {
426
426
  var req = new XMLHttpRequest;
427
- if (arguments.length < 3) callback = mime;
427
+ if (arguments.length < 3) callback = mime, mime = null;
428
428
  else if (mime && req.overrideMimeType) req.overrideMimeType(mime);
429
429
  req.open("GET", url, true);
430
+ if (mime) req.setRequestHeader("Accept", mime);
430
431
  req.onreadystatechange = function() {
431
432
  if (req.readyState === 4) callback(req.status < 300 ? req : null);
432
433
  };
@@ -1574,16 +1575,18 @@ d3_selectionPrototype.property = function(name, value) {
1574
1575
  ? propertyFunction : propertyConstant));
1575
1576
  };
1576
1577
  d3_selectionPrototype.text = function(value) {
1577
- return arguments.length < 1 ? this.node().textContent
1578
- : (this.each(typeof value === "function"
1579
- ? function() { this.textContent = value.apply(this, arguments); }
1580
- : function() { this.textContent = value; }));
1578
+ return arguments.length < 1
1579
+ ? this.node().textContent : this.each(typeof value === "function"
1580
+ ? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null
1581
+ ? function() { this.textContent = ""; }
1582
+ : function() { this.textContent = value; });
1581
1583
  };
1582
1584
  d3_selectionPrototype.html = function(value) {
1583
- return arguments.length < 1 ? this.node().innerHTML
1584
- : (this.each(typeof value === "function"
1585
- ? function() { this.innerHTML = value.apply(this, arguments); }
1586
- : function() { this.innerHTML = value; }));
1585
+ return arguments.length < 1
1586
+ ? this.node().innerHTML : this.each(typeof value === "function"
1587
+ ? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null
1588
+ ? function() { this.innerHTML = ""; }
1589
+ : function() { this.innerHTML = value; });
1587
1590
  };
1588
1591
  // TODO append(node)?
1589
1592
  // TODO append(function)?
@@ -2276,9 +2279,13 @@ var d3_timer_frame = window.requestAnimationFrame
2276
2279
  || window.msRequestAnimationFrame
2277
2280
  || function(callback) { setTimeout(callback, 17); };
2278
2281
  d3.transform = function(string) {
2279
- d3_transformG.setAttribute("transform", string);
2280
- var t = d3_transformG.transform.baseVal.consolidate();
2281
- return new d3_transform(t ? t.matrix : d3_transformIdentity);
2282
+ var g = document.createElementNS(d3.ns.prefix.svg, "g"),
2283
+ identity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0};
2284
+ return (d3.transform = function(string) {
2285
+ g.setAttribute("transform", string);
2286
+ var t = g.transform.baseVal.consolidate();
2287
+ return new d3_transform(t ? t.matrix : identity);
2288
+ })(string);
2282
2289
  };
2283
2290
 
2284
2291
  // Compute x-scale and normalize the first row.
@@ -2330,9 +2337,7 @@ function d3_transformCombine(a, b, k) {
2330
2337
  return a;
2331
2338
  }
2332
2339
 
2333
- var d3_transformG = document.createElementNS(d3.ns.prefix.svg, "g"),
2334
- d3_transformIdentity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0},
2335
- d3_transformDegrees = 180 / Math.PI;
2340
+ var d3_transformDegrees = 180 / Math.PI;
2336
2341
  function d3_noop() {}
2337
2342
  d3.scale = {};
2338
2343
 
@@ -2716,7 +2721,7 @@ function d3_scale_ordinal(domain, ranger) {
2716
2721
  };
2717
2722
 
2718
2723
  scale.rangeExtent = function() {
2719
- return ranger.x;
2724
+ return ranger.t === "range" ? d3_scaleExtent(ranger.x) : ranger.x;
2720
2725
  };
2721
2726
 
2722
2727
  scale.copy = function() {
@@ -3503,10 +3508,10 @@ d3.svg.chord = function() {
3503
3508
  var s = subgroup(this, source, d, i),
3504
3509
  t = subgroup(this, target, d, i);
3505
3510
  return "M" + s.p0
3506
- + arc(s.r, s.p1) + (equals(s, t)
3511
+ + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t)
3507
3512
  ? curve(s.r, s.p1, s.r, s.p0)
3508
3513
  : curve(s.r, s.p1, t.r, t.p0)
3509
- + arc(t.r, t.p1)
3514
+ + arc(t.r, t.p1, t.a1 - t.a0)
3510
3515
  + curve(t.r, t.p1, s.r, s.p0))
3511
3516
  + "Z";
3512
3517
  }
@@ -3529,8 +3534,8 @@ d3.svg.chord = function() {
3529
3534
  return a.a0 == b.a0 && a.a1 == b.a1;
3530
3535
  }
3531
3536
 
3532
- function arc(r, p) {
3533
- return "A" + r + "," + r + " 0 0,1 " + p;
3537
+ function arc(r, p, a) {
3538
+ return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p;
3534
3539
  }
3535
3540
 
3536
3541
  function curve(r0, p0, r1, p1) {
@@ -628,19 +628,17 @@ d3.layout.pie = function() {
628
628
  : function(i, j) { return sort(data[i], data[j]); });
629
629
 
630
630
  // Compute the arcs!
631
- var arcs = index.map(function(i) {
632
- return {
631
+ // They are stored in the original data's order.
632
+ var arcs = [];
633
+ index.forEach(function(i) {
634
+ arcs[i] = {
633
635
  data: data[i],
634
636
  value: d = values[i],
635
637
  startAngle: a,
636
638
  endAngle: a += d * k
637
639
  };
638
640
  });
639
-
640
- // Return the arcs in the original data's order.
641
- return data.map(function(d, i) {
642
- return arcs[index[i]];
643
- });
641
+ return arcs;
644
642
  }
645
643
 
646
644
  /**
@@ -1392,7 +1390,7 @@ d3.layout.cluster = function() {
1392
1390
  // Second walk, normalizing x & y to the desired size.
1393
1391
  d3_layout_treeVisitAfter(root, function(node) {
1394
1392
  node.x = (node.x - x0) / (x1 - x0) * size[0];
1395
- node.y = (1 - node.y / root.y) * size[1];
1393
+ node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
1396
1394
  });
1397
1395
 
1398
1396
  return nodes;
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: d3_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-14 00:00:00.000000000Z
12
+ date: 2011-12-31 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &70119188597360 !ruby/object:Gem::Requirement
16
+ requirement: &70246086718880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70119188597360
24
+ version_requirements: *70246086718880
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &70119188596860 !ruby/object:Gem::Requirement
27
+ requirement: &70246086718200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70119188596860
35
+ version_requirements: *70246086718200
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rails
38
- requirement: &70119188596400 !ruby/object:Gem::Requirement
38
+ requirement: &70246086717400 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '3.1'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70119188596400
46
+ version_requirements: *70246086717400
47
47
  description: Gem installation of javascript framework for data visualization, D3
48
48
  email:
49
49
  - han@logicallsat.com