Permalink
Browse files

upgraded to 2.7.2 d3 version

  • Loading branch information...
1 parent 184ada8 commit 1bedb1f090a7550133a691d5ded071b91a1968c7 @logical42 committed Jan 19, 2012
Showing with 25 additions and 21 deletions.
  1. +2 −2 README.md
  2. +1 −1 lib/d3_rails/version.rb
  3. +16 −4 vendor/assets/javascripts/d3.js
  4. +6 −14 vendor/assets/javascripts/d3.layout.js
View
@@ -14,8 +14,8 @@ or you can use it to build dynamic pages (like jQuery).
# D3 Version
-The current release of this gem is using **D3 v=2.7.1**
-**Last Updated 12-30-2011**
+The current release of this gem is using **D3 v=2.7.2**
+**Last Updated 1-19-2012**
# Included Javascripts
**minified js files are not included, since the rails asset pipeline sorta necessitates the compiling (and likely minifying) your js files for production**
View
@@ -1,3 +1,3 @@
module D3Rails
- VERSION = "0.1.5"
+ VERSION = "0.1.6"
end
@@ -10,7 +10,7 @@ try {
d3_style_setProperty.call(this, name, value + "", priority);
};
}
-d3 = {version: "2.7.1"}; // semver
+d3 = {version: "2.7.2"}; // semver
var d3_array = d3_arraySlice; // conversion for NodeLists
function d3_arrayCopy(pseudoarray) {
@@ -1777,7 +1777,7 @@ d3_selectionPrototype.order = function() {
for (var j = -1, m = this.length; ++j < m;) {
for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0;) {
if (node = group[i]) {
- if (next) next.parentNode.insertBefore(node, next);
+ if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
next = node;
}
}
@@ -2578,11 +2578,11 @@ function d3_scale_log(linear, log) {
var d3_scale_logFormat = d3.format(".0e");
function d3_scale_logp(x) {
- return Math.log(x) / Math.LN10;
+ return Math.log(x < 0 ? 0 : x) / Math.LN10;
}
function d3_scale_logn(x) {
- return -Math.log(-x) / Math.LN10;
+ return -Math.log(x > 0 ? 0 : -x) / Math.LN10;
}
d3_scale_logp.pow = function(x) {
@@ -3855,31 +3855,43 @@ d3.svg.axis = function() {
switch (orient) {
case "bottom": {
tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", tickMinorSize);
subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
+ tickEnter.select("line").attr("y2", tickMajorSize);
+ tickEnter.select("text").attr("y", Math.max(tickMajorSize, 0) + tickPadding);
tickUpdate.select("line").attr("x2", 0).attr("y2", tickMajorSize);
tickUpdate.select("text").attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding).attr("dy", ".71em").attr("text-anchor", "middle");
pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
break;
}
case "top": {
tickTransform = d3_svg_axisX;
+ subtickEnter.attr("y2", -tickMinorSize);
subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
+ tickEnter.select("line").attr("y2", -tickMajorSize);
+ tickEnter.select("text").attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
tickUpdate.select("line").attr("x2", 0).attr("y2", -tickMajorSize);
tickUpdate.select("text").attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("dy", "0em").attr("text-anchor", "middle");
pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
break;
}
case "left": {
tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", -tickMinorSize);
subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
+ tickEnter.select("line").attr("x2", -tickMajorSize);
+ tickEnter.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
tickUpdate.select("line").attr("x2", -tickMajorSize).attr("y2", 0);
tickUpdate.select("text").attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "end");
pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
break;
}
case "right": {
tickTransform = d3_svg_axisY;
+ subtickEnter.attr("x2", tickMinorSize);
subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
+ tickEnter.select("line").attr("x2", tickMajorSize);
+ tickEnter.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding);
tickUpdate.select("line").attr("x2", tickMajorSize).attr("y2", 0);
tickUpdate.select("text").attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0).attr("dy", ".32em").attr("text-anchor", "start");
pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
@@ -1203,7 +1203,7 @@ function d3_layout_packIntersects(a, b) {
var dx = b.x - a.x,
dy = b.y - a.y,
dr = a.r + b.r;
- return (dr * dr - dx * dx - dy * dy) > .001; // within epsilon
+ return dr * dr - dx * dx - dy * dy > .001; // within epsilon
}
function d3_layout_packCircle(nodes) {
@@ -1262,28 +1262,20 @@ function d3_layout_packCircle(nodes) {
if (isect == 1) {
for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
if (d3_layout_packIntersects(k, c)) {
- if (s2 < s1) {
- isect = -1;
- j = k;
- }
break;
}
}
}
// Update node chain.
- if (isect == 0) {
+ if (isect) {
+ if (s1 < s2 || (s1 == s2 && b.r < a.r)) d3_layout_packSplice(a, b = j);
+ else d3_layout_packSplice(a = k, b);
+ i--;
+ } else {
d3_layout_packInsert(a, c);
b = c;
bound(c);
- } else if (isect > 0) {
- d3_layout_packSplice(a, j);
- b = j;
- i--;
- } else { // isect < 0
- d3_layout_packSplice(j, b);
- a = j;
- i--;
}
}
}

0 comments on commit 1bedb1f

Please sign in to comment.