vendor/assets/javascripts/d3.v2.js in d3_rails-2.9.2 vs vendor/assets/javascripts/d3.v2.js in d3_rails-2.9.4.rc1

- old
+ new

@@ -8,11 +8,11 @@ d3_style_setProperty = d3_style_prototype.setProperty; d3_style_prototype.setProperty = function(name, value, priority) { d3_style_setProperty.call(this, name, value + "", priority); }; } -d3 = {version: "2.9.2"}; // semver +d3 = {version: "2.9.4"}; // semver function d3_class(ctor, properties) { try { for (var key in properties) { Object.defineProperty(ctor.prototype, key, { value: properties[key], @@ -492,11 +492,11 @@ req.open("GET", url, true); if (mime) req.setRequestHeader("Accept", mime); req.onreadystatechange = function() { if (req.readyState === 4) { var s = req.status; - callback(s >= 200 && s < 300 || s === 304 ? req : null); + callback(!s && req.response || s >= 200 && s < 300 || s === 304 ? req : null); } }; req.send(null); }; d3.text = function(url, mime, callback) { @@ -1513,11 +1513,11 @@ d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) { return d3_selectMatcher.call(n, s); }; // Prefer Sizzle, if available. if (typeof Sizzle === "function") { - d3_select = function(s, n) { return Sizzle(s, n)[0]; }; + d3_select = function(s, n) { return Sizzle(s, n)[0] || null; }; d3_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); }; d3_selectMatches = Sizzle.matchesSelector; } var d3_selectionPrototype = []; @@ -2811,15 +2811,15 @@ }; scale.tickFormat = function(n, format) { if (arguments.length < 2) format = d3_scale_logFormat; if (arguments.length < 1) return format; - var k = n / scale.ticks().length, + var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), e; return function(d) { - return d / pow(f(log(d) + e)) < k ? format(d) : ""; + return d / pow(f(log(d) + e)) <= k ? format(d) : ""; }; }; scale.copy = function() { return d3_scale_log(linear.copy(), log); @@ -3545,23 +3545,25 @@ } return path.join(""); } function d3_svg_lineBundle(points, tension) { - var n = points.length - 1, - x0 = points[0][0], - y0 = points[0][1], - dx = points[n][0] - x0, - dy = points[n][1] - y0, - i = -1, - p, - t; - while (++i <= n) { - p = points[i]; - t = i / n; - p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); - p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); + var n = points.length - 1; + if (n) { + var x0 = points[0][0], + y0 = points[0][1], + dx = points[n][0] - x0, + dy = points[n][1] - y0, + i = -1, + p, + t; + while (++i <= n) { + p = points[i]; + t = i / n; + p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx); + p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy); + } } return d3_svg_lineBasis(points); } // Returns the dot product of the given four-element vectors. @@ -9033,10 +9035,11 @@ function d3_time_formatIsoNative(date) { return date.toISOString(); } d3_time_formatIsoNative.parse = function(string) { - return new Date(string); + var date = new Date(string); + return isNaN(date) ? null : date; }; d3_time_formatIsoNative.toString = d3_time_formatIso.toString; function d3_time_interval(local, step, number) {