[Pkg-javascript-commits] [science.js] 55/87: Fix LOESS example.
bhuvan krishna
bhuvan-guest at moszumanska.debian.org
Thu Dec 8 06:11:59 UTC 2016
This is an automated email from the git hooks/post-receive script.
bhuvan-guest pushed a commit to branch master
in repository science.js.
commit bb0275fda90d6cc7ef953cd2646a09ca0d945037
Author: Jason Davies <jason at jasondavies.com>
Date: Tue Jan 3 13:06:40 2012 +0000
Fix LOESS example.
Fixes #1. Thanks for the report, @gka!
---
examples/loess/loess.html | 7 +-
examples/loess/loess.js | 35 ++--
lib/d3/d3.geo.js | 7 +
lib/d3/d3.geo.min.js | 2 +-
lib/d3/d3.js | 394 ++++++++++++++++++++++++++++------------------
lib/d3/d3.layout.js | 32 ++--
lib/d3/d3.layout.min.js | 2 +-
lib/d3/d3.min.js | 4 +-
lib/d3/d3.time.js | 7 +-
lib/d3/d3.time.min.js | 2 +-
10 files changed, 291 insertions(+), 201 deletions(-)
diff --git a/examples/loess/loess.html b/examples/loess/loess.html
index f019585..064378d 100644
--- a/examples/loess/loess.html
+++ b/examples/loess/loess.html
@@ -6,9 +6,14 @@
<script src="../../science.js"></script>
<script src="../../science.stats.js"></script>
<script src="../../lib/d3/d3.js"></script>
- <script src="../../lib/d3/d3.chart.js"></script>
<style>
+ text { font-family: sans-serif; font-size: 12px; }
path { stroke: #000; fill: none; }
+ .axis line, .axis path {
+ fill: none;
+ stroke: #000;
+ shape-rendering: crispEdges;
+ }
</style>
</head>
<body>
diff --git a/examples/loess/loess.js b/examples/loess/loess.js
index 37c97eb..be90f98 100644
--- a/examples/loess/loess.js
+++ b/examples/loess/loess.js
@@ -1,11 +1,12 @@
var w = 960,
h = 500,
- p = 5.5,
- n = 100;
+ p = 35.5,
+ n = 100,
+ x = d3.scale.linear().range([0, w]),
+ y = d3.scale.linear().domain([-1.5, 1.5]).range([h, 0]);
-var chart = d3.chart.scatter()
- .width(w)
- .height(h);
+var xAxis = d3.svg.axis().scale(x),
+ yAxis = d3.svg.axis().scale(y);
var vis = d3.select("#vis")
.data([{
@@ -16,19 +17,18 @@ var vis = d3.select("#vis")
.attr("width", w + p + p)
.attr("height", h + p + p)
.append("svg:g")
- .attr("transform", "translate(" + p + "," + p + ")")
- .call(chart);
+ .attr("transform", "translate(" + p + "," + p + ")");
-var loess = science.stats.loess()
- .bandwidth(.2),
- x = vis[0][0].__chart__.x,
- y = vis[0][0].__chart__.y,
+var loess = science.stats.loess().bandwidth(.2),
line = d3.svg.line()
.x(function(d) { return x(d[0]); })
.y(function(d) { return y(d[1]); });
-vis.selectAll("g.datum")
- .append("svg:circle")
+vis.selectAll("circle")
+ .data(function(d) { return d3.zip(d.x, d.y); })
+ .enter().append("svg:circle")
+ .attr("cx", function(d) { return x(d[0]); })
+ .attr("cy", function(d) { return y(d[1]); })
.attr("r", 3);
vis.selectAll("path")
@@ -37,3 +37,12 @@ vis.selectAll("path")
})
.enter().append("svg:path")
.attr("d", line);
+
+vis.append("g")
+ .attr("class", "bottom axis")
+ .attr("transform", "translate(0," + h + ")")
+ .call(xAxis.orient("bottom"));
+
+vis.append("g")
+ .attr("class", "left axis")
+ .call(yAxis.orient("left"));
diff --git a/lib/d3/d3.geo.js b/lib/d3/d3.geo.js
index 61dbc56..2b40252 100644
--- a/lib/d3/d3.geo.js
+++ b/lib/d3/d3.geo.js
@@ -652,6 +652,7 @@ function d3_geo_bounds(o, f) {
var d3_geo_boundsTypes = {
Feature: d3_geo_boundsFeature,
FeatureCollection: d3_geo_boundsFeatureCollection,
+ GeometryCollection: d3_geo_boundsGeometryCollection,
LineString: d3_geo_boundsLineString,
MultiLineString: d3_geo_boundsMultiLineString,
MultiPoint: d3_geo_boundsLineString,
@@ -670,6 +671,12 @@ function d3_geo_boundsFeatureCollection(o, f) {
}
}
+function d3_geo_boundsGeometryCollection(o, f) {
+ for (var a = o.geometries, i = 0, n = a.length; i < n; i++) {
+ d3_geo_bounds(a[i], f);
+ }
+}
+
function d3_geo_boundsLineString(o, f) {
for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
f.apply(null, a[i]);
diff --git a/lib/d3/d3.geo.min.js b/lib/d3/d3.geo.min.js
index 1a9eb39..a4fcd24 100644
--- a/lib/d3/d3.geo.min.js
+++ b/lib/d3/d3.geo.min.js
@@ -1 +1 @@
-(function(){function b(a,b){return function(c){return c&&c.type in a?a[c.type](c):b}}function c(a){return"m0,"+a+"a"+a+","+a+" 0 1,1 0,"+ -2*a+"a"+a+","+a+" 0 1,1 0,"+2*a+"z"}function d(a,b){a.type in e&&e[a.type](a,b)}function f(a,b){d(a.geometry,b)}function g(a,b){for(var c=a.features,e=0,f=c.length;e<f;e++)d(c[e].geometry,b)}function h(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)b.apply(null,c[d])}function i(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)for(var f=c[d],g= [...]
\ No newline at end of file
+(function(){function b(a,b){return function(c){return c&&c.type in a?a[c.type](c):b}}function c(a){return"m0,"+a+"a"+a+","+a+" 0 1,1 0,"+ -2*a+"a"+a+","+a+" 0 1,1 0,"+2*a+"z"}function d(a,b){a.type in e&&e[a.type](a,b)}function f(a,b){d(a.geometry,b)}function g(a,b){for(var c=a.features,e=0,f=c.length;e<f;e++)d(c[e].geometry,b)}function h(a,b){for(var c=a.geometries,e=0,f=c.length;e<f;e++)d(c[e],b)}function i(a,b){for(var c=a.coordinates,d=0,e=c.length;d<e;d++)b.apply(null,c[d])}function [...]
\ No newline at end of file
diff --git a/lib/d3/d3.js b/lib/d3/d3.js
index 9f986ce..77ee372 100644
--- a/lib/d3/d3.js
+++ b/lib/d3/d3.js
@@ -10,7 +10,7 @@ try {
d3_style_setProperty.call(this, name, value + "", priority);
};
}
-d3 = {version: "2.5.0"}; // semver
+d3 = {version: "2.7.1"}; // semver
var d3_array = d3_arraySlice; // conversion for NodeLists
function d3_arrayCopy(pseudoarray) {
@@ -46,13 +46,22 @@ function d3_this() {
d3.functor = function(v) {
return typeof v === "function" ? v : function() { return v; };
};
-// A getter-setter method that preserves the appropriate `this` context.
-d3.rebind = function(object, method) {
+// Copies a variable number of methods from source to target.
+d3.rebind = function(target, source) {
+ var i = 1, n = arguments.length, method;
+ while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
+ return target;
+};
+
+// Method is assumed to be a standard D3 getter-setter:
+// If passed with no arguments, gets the value.
+// If passed with arguments, sets the value and returns the target.
+function d3_rebind(target, source, method) {
return function() {
- var x = method.apply(object, arguments);
- return arguments.length ? object : x;
+ var value = method.apply(source, arguments);
+ return arguments.length ? target : value;
};
-};
+}
d3.ascending = function(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
};
@@ -166,6 +175,9 @@ d3.quantile = function(values, p) {
e = H - h;
return e ? v + e * (values[h] - v) : v;
};
+d3.transpose = function(matrix) {
+ return d3.zip.apply(d3, matrix);
+};
d3.zip = function() {
if (!(n = arguments.length)) return [];
for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m;) {
@@ -412,9 +424,10 @@ d3.round = function(x, n) {
};
d3.xhr = function(url, mime, callback) {
var req = new XMLHttpRequest;
- if (arguments.length < 3) callback = mime;
+ if (arguments.length < 3) callback = mime, mime = null;
else if (mime && req.overrideMimeType) req.overrideMimeType(mime);
req.open("GET", url, true);
+ if (mime) req.setRequestHeader("Accept", mime);
req.onreadystatechange = function() {
if (req.readyState === 4) callback(req.status < 300 ? req : null);
};
@@ -455,24 +468,22 @@ d3.xml = function(url, mime, callback) {
}
d3.xhr(url, mime, ready);
};
-d3.ns = {
-
- prefix: {
- svg: "http://www.w3.org/2000/svg",
- xhtml: "http://www.w3.org/1999/xhtml",
- xlink: "http://www.w3.org/1999/xlink",
- xml: "http://www.w3.org/XML/1998/namespace",
- xmlns: "http://www.w3.org/2000/xmlns/"
- },
+var d3_nsPrefix = {
+ svg: "http://www.w3.org/2000/svg",
+ xhtml: "http://www.w3.org/1999/xhtml",
+ xlink: "http://www.w3.org/1999/xlink",
+ xml: "http://www.w3.org/XML/1998/namespace",
+ xmlns: "http://www.w3.org/2000/xmlns/"
+};
+d3.ns = {
+ prefix: d3_nsPrefix,
qualify: function(name) {
var i = name.indexOf(":");
- return i < 0 ? name : {
- space: d3.ns.prefix[name.substring(0, i)],
- local: name.substring(i + 1)
- };
+ return i < 0 ? (name in d3_nsPrefix
+ ? {space: d3_nsPrefix[name], local: name} : name)
+ : {space: d3_nsPrefix[name.substring(0, i)], local: name.substring(i + 1)};
}
-
};
d3.dispatch = function() {
var dispatch = new d3_dispatch(),
@@ -494,7 +505,9 @@ d3_dispatch.prototype.on = function(type, listener) {
type = type.substring(0, i);
}
- this[type].on(name, listener);
+ return arguments.length < 2
+ ? this[type].on(name)
+ : (this[type].on(name, listener), this);
};
function d3_dispatch_event() {
@@ -506,24 +519,25 @@ function d3_dispatch_event() {
i = -1,
n = z.length,
l;
- while (++i < n) if ((l = z[i])._on) l.apply(this, arguments);
+ while (++i < n) if (l = z[i].on) l.apply(this, arguments);
}
dispatch.on = function(name, listener) {
var l, i;
- // remove the old listener, if any
+ // return the current listener, if any
+ if (arguments.length < 2) return (l = listenerByName[name]) && l.on;
+
+ // remove the old listener, if any (with copy-on-write)
if (l = listenerByName[name]) {
- l._on = false;
+ l.on = null;
listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
delete listenerByName[name];
}
// add the new listener, if any
if (listener) {
- listener._on = true;
- listeners.push(listener);
- listenerByName[name] = listener;
+ listeners.push(listenerByName[name] = {on: listener});
}
return dispatch;
@@ -964,9 +978,9 @@ function d3_interpolateByName(n) {
d3.interpolators = [
d3.interpolateObject,
function(a, b) { return (b instanceof Array) && d3.interpolateArray(a, b); },
- function(a, b) { return (typeof b === "string") && d3.interpolateString(a + "", b); },
- function(a, b) { return (typeof b === "string" ? b in d3_rgb_names || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a + "", b); },
- function(a, b) { return (typeof b === "number") && d3.interpolateNumber(+a, b); }
+ function(a, b) { return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + ""); },
+ function(a, b) { return (typeof b === "string" ? b in d3_rgb_names || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Rgb || b instanceof d3_Hsl) && d3.interpolateRgb(a, b); },
+ function(a, b) { return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b); }
];
function d3_uninterpolateNumber(a, b) {
b = b - (a = +a) ? 1 / (b - a) : 0;
@@ -1333,12 +1347,16 @@ function d3_selection(groups) {
}
var d3_select = function(s, n) { return n.querySelector(s); },
- d3_selectAll = function(s, n) { return n.querySelectorAll(s); };
+ d3_selectAll = function(s, n) { return n.querySelectorAll(s); },
+ d3_selectRoot = document.documentElement,
+ 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_selectAll = function(s, n) { return Sizzle.uniqueSort(Sizzle(s, n)); };
+ d3_selectMatches = Sizzle.matchesSelector;
}
var d3_selectionPrototype = [];
@@ -1557,16 +1575,18 @@ d3_selectionPrototype.property = function(name, value) {
? propertyFunction : propertyConstant));
};
d3_selectionPrototype.text = function(value) {
- return arguments.length < 1 ? this.node().textContent
- : (this.each(typeof value === "function"
- ? function() { this.textContent = value.apply(this, arguments); }
- : function() { this.textContent = value; }));
+ return arguments.length < 1
+ ? this.node().textContent : this.each(typeof value === "function"
+ ? function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; } : value == null
+ ? function() { this.textContent = ""; }
+ : function() { this.textContent = value; });
};
d3_selectionPrototype.html = function(value) {
- return arguments.length < 1 ? this.node().innerHTML
- : (this.each(typeof value === "function"
- ? function() { this.innerHTML = value.apply(this, arguments); }
- : function() { this.innerHTML = value; }));
+ return arguments.length < 1
+ ? this.node().innerHTML : this.each(typeof value === "function"
+ ? function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; } : value == null
+ ? function() { this.innerHTML = ""; }
+ : function() { this.innerHTML = value; });
};
// TODO append(node)?
// TODO append(function)?
@@ -1574,7 +1594,7 @@ d3_selectionPrototype.append = function(name) {
name = d3.ns.qualify(name);
function append() {
- return this.appendChild(document.createElement(name));
+ return this.appendChild(document.createElementNS(this.namespaceURI, name));
}
function appendNS() {
@@ -1591,7 +1611,7 @@ d3_selectionPrototype.insert = function(name, before) {
function insert() {
return this.insertBefore(
- document.createElement(name),
+ document.createElementNS(this.namespaceURI, name),
d3_select(before, this));
}
@@ -1722,13 +1742,14 @@ d3_selectionPrototype.data = function(data, join) {
function d3_selection_dataNode(data) {
return {__data__: data};
}
-// TODO preserve null elements to maintain index?
d3_selectionPrototype.filter = function(filter) {
var subgroups = [],
subgroup,
group,
node;
+ if (typeof filter !== "function") filter = d3_selection_filter(filter);
+
for (var j = 0, m = this.length; j < m; j++) {
subgroups.push(subgroup = []);
subgroup.parentNode = (group = this[j]).parentNode;
@@ -1741,24 +1762,33 @@ d3_selectionPrototype.filter = function(filter) {
return d3_selection(subgroups);
};
+
+function d3_selection_filter(selector) {
+ return function() {
+ return d3_selectMatches(this, selector);
+ };
+}
d3_selectionPrototype.map = function(map) {
return this.each(function() {
this.__data__ = map.apply(this, arguments);
});
};
-d3_selectionPrototype.sort = function(comparator) {
- comparator = d3_selection_sortComparator.apply(this, arguments);
- for (var j = 0, m = this.length; j < m; j++) {
- for (var group = this[j].sort(comparator), i = 1, n = group.length, prev = group[0]; i < n; i++) {
- var node = group[i];
- if (node) {
- if (prev) prev.parentNode.insertBefore(node, prev.nextSibling);
- prev = node;
+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);
+ next = node;
}
}
}
return this;
};
+d3_selectionPrototype.sort = function(comparator) {
+ comparator = d3_selection_sortComparator.apply(this, arguments);
+ for (var j = -1, m = this.length; ++j < m;) this[j].sort(comparator);
+ return this.order();
+};
function d3_selection_sortComparator(comparator) {
if (!arguments.length) comparator = d3.ascending;
@@ -1850,7 +1880,7 @@ d3_selectionPrototype.transition = function() {
};
var d3_selectionRoot = d3_selection([[document]]);
-d3_selectionRoot[0].parentNode = document.documentElement;
+d3_selectionRoot[0].parentNode = d3_selectRoot;
// TODO fast singleton implementation!
// TODO select(function)
@@ -2249,8 +2279,13 @@ var d3_timer_frame = window.requestAnimationFrame
|| window.msRequestAnimationFrame
|| function(callback) { setTimeout(callback, 17); };
d3.transform = function(string) {
- d3_transformG.setAttribute("transform", string);
- return new d3_transform(d3_transformG.transform.baseVal.consolidate().matrix);
+ var g = document.createElementNS(d3.ns.prefix.svg, "g"),
+ identity = {a: 1, b: 0, c: 0, d: 1, e: 0, f: 0};
+ return (d3.transform = function(string) {
+ g.setAttribute("transform", string);
+ var t = g.transform.baseVal.consolidate();
+ return new d3_transform(t ? t.matrix : identity);
+ })(string);
};
// Compute x-scale and normalize the first row.
@@ -2262,11 +2297,17 @@ function d3_transform(m) {
r1 = [m.c, m.d],
kx = d3_transformNormalize(r0),
kz = d3_transformDot(r0, r1),
- ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz));
+ ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
+ if (r0[0] * r1[1] < r1[0] * r0[1]) {
+ r0[0] *= -1;
+ r0[1] *= -1;
+ kx *= -1;
+ kz *= -1;
+ }
+ this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees;
this.translate = [m.e, m.f];
- this.rotate = Math.atan2(m.b, m.a) * d3_transformDegrees;
- this.scale = [kx, ky || 0];
- this.skew = ky ? kz / ky * d3_transformDegrees : 0;
+ this.scale = [kx, ky];
+ this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0;
};
d3_transform.prototype.toString = function() {
@@ -2283,8 +2324,10 @@ function d3_transformDot(a, b) {
function d3_transformNormalize(a) {
var k = Math.sqrt(d3_transformDot(a, a));
- a[0] /= k;
- a[1] /= k;
+ if (k) {
+ a[0] /= k;
+ a[1] /= k;
+ }
return k;
}
@@ -2294,8 +2337,7 @@ function d3_transformCombine(a, b, k) {
return a;
}
-var d3_transformG = document.createElementNS(d3.ns.prefix.svg, "g"),
- d3_transformDegrees = 180 / Math.PI;
+var d3_transformDegrees = 180 / Math.PI;
function d3_noop() {}
d3.scale = {};
@@ -2303,6 +2345,10 @@ function d3_scaleExtent(domain) {
var start = domain[0], stop = domain[domain.length - 1];
return start < stop ? [start, stop] : [stop, start];
}
+
+function d3_scaleRange(scale) {
+ return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
+}
function d3_scale_nice(domain, nice) {
var i0 = 0,
i1 = domain.length - 1,
@@ -2401,11 +2447,7 @@ function d3_scale_linear(domain, range, interpolate, clamp) {
};
function d3_scale_linearRebind(scale, linear) {
- scale.range = d3.rebind(scale, linear.range);
- scale.rangeRound = d3.rebind(scale, linear.rangeRound);
- scale.interpolate = d3.rebind(scale, linear.interpolate);
- scale.clamp = d3.rebind(scale, linear.clamp);
- return scale;
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
}
function d3_scale_linearNice(dx) {
@@ -2499,8 +2541,8 @@ function d3_scale_log(linear, log) {
if (extent.every(isFinite)) {
var i = Math.floor(extent[0]),
j = Math.ceil(extent[1]),
- u = Math.round(pow(extent[0])),
- v = Math.round(pow(extent[1]));
+ u = pow(extent[0]),
+ v = pow(extent[1]);
if (log === d3_scale_logn) {
ticks.push(pow(i));
for (; i++ < j;) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
@@ -2519,7 +2561,7 @@ function d3_scale_log(linear, log) {
if (arguments.length < 2) format = d3_scale_logFormat;
if (arguments.length < 1) return format;
var k = n / scale.ticks().length,
- f = log === d3_scale_logn ? (e = -1e-15, Math.floor) : (e = 1e-15, Math.ceil),
+ 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) : "";
@@ -2533,7 +2575,7 @@ function d3_scale_log(linear, log) {
return d3_scale_linearRebind(scale, linear);
};
-var d3_scale_logFormat = d3.format("e");
+var d3_scale_logFormat = d3.format(".0e");
function d3_scale_logp(x) {
return Math.log(x) / Math.LN10;
@@ -2678,6 +2720,10 @@ function d3_scale_ordinal(domain, ranger) {
return rangeBand;
};
+ scale.rangeExtent = function() {
+ return ranger.t === "range" ? d3_scaleExtent(ranger.x) : ranger.x;
+ };
+
scale.copy = function() {
return d3_scale_ordinal(domain, ranger);
};
@@ -3462,10 +3508,10 @@ d3.svg.chord = function() {
var s = subgroup(this, source, d, i),
t = subgroup(this, target, d, i);
return "M" + s.p0
- + arc(s.r, s.p1) + (equals(s, t)
+ + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t)
? curve(s.r, s.p1, s.r, s.p0)
: curve(s.r, s.p1, t.r, t.p0)
- + arc(t.r, t.p1)
+ + arc(t.r, t.p1, t.a1 - t.a0)
+ curve(t.r, t.p1, s.r, s.p0))
+ "Z";
}
@@ -3488,8 +3534,8 @@ d3.svg.chord = function() {
return a.a0 == b.a0 && a.a1 == b.a1;
}
- function arc(r, p) {
- return "A" + r + "," + r + " 0 0,1 " + p;
+ function arc(r, p, a) {
+ return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p;
}
function curve(r0, p0, r1, p1) {
@@ -3619,7 +3665,7 @@ function d3_svg_mousePoint(container, e) {
var point = (container.ownerSVGElement || container).createSVGPoint();
if ((d3_mouse_bug44083 < 0) && (window.scrollX || window.scrollY)) {
var svg = d3.select(document.body)
- .append("svg:svg")
+ .append("svg")
.style("position", "absolute")
.style("top", 0)
.style("left", 0);
@@ -3773,36 +3819,37 @@ d3.svg.axis = function() {
}
} : Object;
- // Ticks.
- var ticks = scale.ticks.apply(scale, tickArguments_),
- tickFormat = tickFormat_ == null ? scale.tickFormat.apply(scale, tickArguments_) : tickFormat_;
+ // Ticks, or domain values for ordinal scales.
+ var ticks = scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain(),
+ tickFormat = tickFormat_ == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String) : tickFormat_;
// Minor ticks.
var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide),
subtick = g.selectAll(".minor").data(subticks, String),
- subtickEnter = subtick.enter().insert("svg:line", "g").attr("class", "tick minor").style("opacity", 1e-6),
+ subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6),
subtickExit = transition(subtick.exit()).style("opacity", 1e-6).remove(),
subtickUpdate = transition(subtick).style("opacity", 1);
// Major ticks.
var tick = g.selectAll("g").data(ticks, String),
- tickEnter = tick.enter().insert("svg:g", "path").style("opacity", 1e-6),
+ tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6),
tickExit = transition(tick.exit()).style("opacity", 1e-6).remove(),
tickUpdate = transition(tick).style("opacity", 1),
tickTransform;
// Domain.
- var range = d3_scaleExtent(scale.range()),
+ var range = d3_scaleRange(scale),
path = g.selectAll(".domain").data([0]),
- pathEnter = path.enter().append("svg:path").attr("class", "domain"),
+ pathEnter = path.enter().append("path").attr("class", "domain"),
pathUpdate = transition(path);
- // Stash the new scale and grab the old scale.
- var scale0 = this.__chart__ || scale;
- this.__chart__ = scale.copy();
+ // Stash a snapshot of the new scale, and retrieve the old snapshot.
+ var scale1 = scale.copy(),
+ scale0 = this.__chart__ || scale1;
+ this.__chart__ = scale1;
- tickEnter.append("svg:line").attr("class", "tick");
- tickEnter.append("svg:text");
+ tickEnter.append("line").attr("class", "tick");
+ tickEnter.append("text");
tickUpdate.select("text").text(tickFormat);
switch (orient) {
@@ -3840,13 +3887,27 @@ d3.svg.axis = function() {
}
}
- tickEnter.call(tickTransform, scale0);
- tickUpdate.call(tickTransform, scale);
- tickExit.call(tickTransform, scale);
+ // For quantitative scales:
+ // - enter new ticks from the old scale
+ // - exit old ticks to the new scale
+ if (scale.ticks) {
+ tickEnter.call(tickTransform, scale0);
+ tickUpdate.call(tickTransform, scale1);
+ tickExit.call(tickTransform, scale1);
+ subtickEnter.call(tickTransform, scale0);
+ subtickUpdate.call(tickTransform, scale1);
+ subtickExit.call(tickTransform, scale1);
+ }
- subtickEnter.call(tickTransform, scale0);
- subtickUpdate.call(tickTransform, scale);
- subtickExit.call(tickTransform, scale);
+ // For ordinal scales:
+ // - any entering ticks are undefined in the old scale
+ // - any exiting ticks are undefined in the new scale
+ // Therefore, we only need to transition updating ticks.
+ else {
+ var dx = scale1.rangeBand() / 2, x = function(d) { return scale1(d) + dx; };
+ tickEnter.call(tickTransform, x);
+ tickUpdate.call(tickTransform, x);
+ }
});
}
@@ -3949,19 +4010,19 @@ d3.svg.brush = function() {
e;
// An invisible, mouseable area for starting a new brush.
- bg.enter().append("svg:rect")
+ bg.enter().append("rect")
.attr("class", "background")
.style("visibility", "hidden")
.style("pointer-events", "all")
.style("cursor", "crosshair");
// The visible brush extent; style this as you like!
- fg.enter().append("svg:rect")
+ fg.enter().append("rect")
.attr("class", "extent")
.style("cursor", "move");
// More invisible rects for resizing the extent.
- tz.enter().append("svg:rect")
+ tz.enter().append("rect")
.attr("class", function(d) { return "resize " + d; })
.attr("width", 6)
.attr("height", 6)
@@ -3975,12 +4036,12 @@ d3.svg.brush = function() {
// Initialize the background to fill the defined range.
// If the range isn't defined, you can post-process.
if (x) {
- e = d3_scaleExtent(x.range());
+ e = d3_scaleRange(x);
bg.attr("x", e[0]).attr("width", e[1] - e[0]);
d3_svg_brushRedrawX(g, extent);
}
if (y) {
- e = d3_scaleExtent(y.range());
+ e = d3_scaleRange(y);
bg.attr("y", e[0]).attr("height", e[1] - e[0]);
d3_svg_brushRedrawY(g, extent);
}
@@ -4057,11 +4118,13 @@ d3.svg.brush = function() {
// Invert the pixel extent to data-space.
if (!arguments.length) {
if (x) {
- x0 = x.invert(extent[0][0]), x1 = x.invert(extent[1][0]);
+ x0 = extent[0][0], x1 = extent[1][0];
+ if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
if (x1 < x0) t = x0, x0 = x1, x1 = t;
}
if (y) {
- y0 = y.invert(extent[0][1]), y1 = y.invert(extent[1][1]);
+ y0 = extent[0][1], y1 = extent[1][1];
+ if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
if (y1 < y0) t = y0, y0 = y1, y1 = t;
}
return x && y ? [[x0, y0], [x1, y1]] : x ? [x0, x1] : y && [y0, y1];
@@ -4071,14 +4134,14 @@ d3.svg.brush = function() {
if (x) {
x0 = z[0], x1 = z[1];
if (y) x0 = x0[0], x1 = x1[0];
- x0 = x(x0), x1 = x(x1);
+ if (x.invert) x0 = x(x0), x1 = x(x1);
if (x1 < x0) t = x0, x0 = x1, x1 = t;
extent[0][0] = x0, extent[1][0] = x1;
}
if (y) {
y0 = z[0], y1 = z[1];
if (x) y0 = y0[1], y1 = y1[1];
- y0 = y(y0), y1 = y(y1);
+ if (y.invert) y0 = y(y0), y1 = y(y1);
if (y1 < y0) t = y0, y0 = y1, y1 = t;
extent[0][1] = y0, extent[1][1] = y1;
}
@@ -4099,18 +4162,13 @@ d3.svg.brush = function() {
|| (y && extent[0][1] === extent[1][1]);
};
- brush.on = function(type, listener) {
- event.on(type, listener);
- return brush;
- };
-
d3.select(window)
.on("mousemove.brush", d3_svg_brushMove)
.on("mouseup.brush", d3_svg_brushUp)
.on("keydown.brush", d3_svg_brushKeydown)
.on("keyup.brush", d3_svg_brushKeyup);
- return brush;
+ return d3.rebind(brush, event, "on");
};
var d3_svg_brush,
@@ -4198,7 +4256,9 @@ function d3_svg_brushMove() {
}
function d3_svg_brushMove1(mouse, scale, i) {
- var range = d3_scaleExtent(scale.range()),
+ var range = d3_scaleRange(scale),
+ r0 = range[0],
+ r1 = range[1],
offset = d3_svg_brushOffset[i],
size = d3_svg_brushExtent[1][i] - d3_svg_brushExtent[0][i],
min,
@@ -4206,12 +4266,12 @@ function d3_svg_brushMove1(mouse, scale, i) {
// When dragging, reduce the range by the extent size and offset.
if (d3_svg_brushDrag) {
- range[0] -= offset;
- range[1] -= size + offset;
+ r0 -= offset;
+ r1 -= size + offset;
}
// Clamp the mouse so that the extent fits within the range extent.
- min = Math.max(range[0], Math.min(range[1], mouse[i]));
+ min = Math.max(r0, Math.min(r1, mouse[i]));
// Compute the new extent bounds.
if (d3_svg_brushDrag) {
@@ -4219,7 +4279,7 @@ function d3_svg_brushMove1(mouse, scale, i) {
} else {
// If the ALT key is pressed, then preserve the center of the extent.
- if (d3_svg_brushCenter) offset = Math.max(range[0], Math.min(range[1], 2 * d3_svg_brushCenter[i] - min));
+ if (d3_svg_brushCenter) offset = Math.max(r0, Math.min(r1, 2 * d3_svg_brushCenter[i] - min));
// Compute the min and max of the offset and mouse.
if (offset < min) {
@@ -4265,8 +4325,11 @@ var d3_svg_brushCursor = {
sw: "nesw-resize"
};
d3.behavior = {};
+// TODO Track touch points by identifier.
+
d3.behavior.drag = function() {
- var event = d3.dispatch("drag", "dragstart", "dragend");
+ var event = d3.dispatch("drag", "dragstart", "dragend"),
+ origin = null;
function drag() {
this
@@ -4285,9 +4348,16 @@ d3.behavior.drag = function() {
function start() {
d3_behavior_dragEvent = event;
d3_behavior_dragEventTarget = d3.event.target;
- d3_behavior_dragOffset = d3_behavior_dragPoint((d3_behavior_dragTarget = this).parentNode);
- d3_behavior_dragMoved = 0;
+ d3_behavior_dragTarget = this;
d3_behavior_dragArguments = arguments;
+ d3_behavior_dragOrigin = d3_behavior_dragPoint();
+ if (origin) {
+ d3_behavior_dragOffset = origin.apply(d3_behavior_dragTarget, d3_behavior_dragArguments);
+ d3_behavior_dragOffset = [d3_behavior_dragOffset.x - d3_behavior_dragOrigin[0], d3_behavior_dragOffset.y - d3_behavior_dragOrigin[1]];
+ } else {
+ d3_behavior_dragOffset = [0, 0];
+ }
+ d3_behavior_dragMoved = 0;
}
function mousedown() {
@@ -4295,12 +4365,13 @@ d3.behavior.drag = function() {
d3_behavior_dragDispatch("dragstart");
}
- drag.on = function(type, listener) {
- event.on(type, listener);
+ drag.origin = function(x) {
+ if (!arguments.length) return origin;
+ origin = x;
return drag;
};
- return drag;
+ return d3.rebind(drag, event, "on");
};
var d3_behavior_dragEvent,
@@ -4308,34 +4379,39 @@ var d3_behavior_dragEvent,
d3_behavior_dragTarget,
d3_behavior_dragArguments,
d3_behavior_dragOffset,
- d3_behavior_dragMoved,
- d3_behavior_dragStopClick;
+ d3_behavior_dragOrigin,
+ d3_behavior_dragMoved;
function d3_behavior_dragDispatch(type) {
- var o = d3.event, p = d3_behavior_dragTarget.parentNode, dx = 0, dy = 0;
+ var p = d3_behavior_dragPoint(),
+ o = d3.event,
+ e = d3.event = {type: type};
if (p) {
- p = d3_behavior_dragPoint(p);
- dx = p[0] - d3_behavior_dragOffset[0];
- dy = p[1] - d3_behavior_dragOffset[1];
- d3_behavior_dragOffset = p;
- d3_behavior_dragMoved |= dx | dy;
+ e.x = p[0] + d3_behavior_dragOffset[0];
+ e.y = p[1] + d3_behavior_dragOffset[1];
+ e.dx = p[0] - d3_behavior_dragOrigin[0];
+ e.dy = p[1] - d3_behavior_dragOrigin[1];
+ d3_behavior_dragMoved |= e.dx | e.dy;
+ d3_behavior_dragOrigin = p;
}
try {
- d3.event = {dx: dx, dy: dy};
d3_behavior_dragEvent[type].apply(d3_behavior_dragTarget, d3_behavior_dragArguments);
} finally {
d3.event = o;
}
+ o.stopPropagation();
o.preventDefault();
}
-function d3_behavior_dragPoint(container, type) {
- // TODO Track touch points by identifier.
- var t = d3.event.changedTouches;
- return t ? d3.svg.touches(container, t)[0] : d3.svg.mouse(container);
+function d3_behavior_dragPoint() {
+ var p = d3_behavior_dragTarget.parentNode,
+ t = d3.event.changedTouches;
+ return p && (t
+ ? d3.svg.touches(p, t)[0]
+ : d3.svg.mouse(p));
}
function d3_behavior_dragMove() {
@@ -4352,21 +4428,26 @@ function d3_behavior_dragMove() {
function d3_behavior_dragUp() {
if (!d3_behavior_dragTarget) return;
d3_behavior_dragDispatch("dragend");
- d3_behavior_dragTarget = null;
// If the node was moved, prevent the mouseup from propagating.
// Also prevent the subsequent click from propagating (e.g., for anchors).
- if (d3_behavior_dragMoved && d3_behavior_dragEventTarget === d3.event.target) {
- d3_behavior_dragStopClick = true;
+ if (d3_behavior_dragMoved) {
d3_eventCancel();
+ d3_behavior_dragMoved = d3.event.target === d3_behavior_dragEventTarget;
}
+
+ d3_behavior_dragEvent =
+ d3_behavior_dragEventTarget =
+ d3_behavior_dragTarget =
+ d3_behavior_dragArguments =
+ d3_behavior_dragOffset =
+ d3_behavior_dragOrigin = null;
}
function d3_behavior_dragClick() {
- if (d3_behavior_dragStopClick && d3_behavior_dragEventTarget === d3.event.target) {
+ if (d3_behavior_dragMoved) {
d3_eventCancel();
- d3_behavior_dragStopClick = false;
- d3_behavior_dragEventTarget = null;
+ d3_behavior_dragMoved = 0;
}
}
// TODO unbind zoom behavior?
@@ -4404,7 +4485,7 @@ d3.behavior.zoom = function() {
function mousedown() {
start.apply(this, arguments);
d3_behavior_zoomPanning = d3_behavior_zoomLocation(d3.svg.mouse(d3_behavior_zoomTarget));
- d3_behavior_zoomMoved = false;
+ d3_behavior_zoomMoved = 0;
d3.event.preventDefault();
window.focus();
}
@@ -4440,12 +4521,7 @@ d3.behavior.zoom = function() {
return zoom;
};
- zoom.on = function(type, listener) {
- event.on(type, listener);
- return zoom;
- };
-
- return zoom;
+ return d3.rebind(zoom, event, "on");
};
var d3_behavior_zoomDiv,
@@ -4459,8 +4535,7 @@ var d3_behavior_zoomDiv,
d3_behavior_zoomEventTarget,
d3_behavior_zoomTarget,
d3_behavior_zoomArguments,
- d3_behavior_zoomMoved,
- d3_behavior_zoomStopClick;
+ d3_behavior_zoomMoved;
function d3_behavior_zoomLocation(point) {
return [
@@ -4540,27 +4615,32 @@ function d3_behavior_zoomTouchmove() {
function d3_behavior_zoomMousemove() {
d3_behavior_zoomZooming = null;
if (d3_behavior_zoomPanning) {
- d3_behavior_zoomMoved = true;
+ d3_behavior_zoomMoved = 1;
d3_behavior_zoomTo(d3_behavior_zoomXyz[2], d3.svg.mouse(d3_behavior_zoomTarget), d3_behavior_zoomPanning);
}
}
function d3_behavior_zoomMouseup() {
if (d3_behavior_zoomPanning) {
- if (d3_behavior_zoomMoved && d3_behavior_zoomEventTarget === d3.event.target) {
- d3_behavior_zoomStopClick = true;
+ if (d3_behavior_zoomMoved) {
+ d3_eventCancel();
+ d3_behavior_zoomMoved = d3_behavior_zoomEventTarget === d3.event.target;
}
- d3_behavior_zoomMousemove();
+
+ d3_behavior_zoomXyz =
+ d3_behavior_zoomExtent =
+ d3_behavior_zoomDispatch =
+ d3_behavior_zoomEventTarget =
+ d3_behavior_zoomTarget =
+ d3_behavior_zoomArguments =
d3_behavior_zoomPanning = null;
}
}
function d3_behavior_zoomClick() {
- if (d3_behavior_zoomStopClick && d3_behavior_zoomEventTarget === d3.event.target) {
- d3.event.stopPropagation();
- d3.event.preventDefault();
- d3_behavior_zoomStopClick = false;
- d3_behavior_zoomEventTarget = null;
+ if (d3_behavior_zoomMoved) {
+ d3_eventCancel();
+ d3_behavior_zoomMoved = 0;
}
}
diff --git a/lib/d3/d3.layout.js b/lib/d3/d3.layout.js
index 7502c5a..24bcc42 100644
--- a/lib/d3/d3.layout.js
+++ b/lib/d3/d3.layout.js
@@ -324,11 +324,6 @@ d3.layout.force = function() {
return (alpha *= .99) < .005;
}
- force.on = function(type, listener) {
- event.on(type, listener);
- return force;
- };
-
force.nodes = function(x) {
if (!arguments.length) return nodes;
nodes = x;
@@ -475,6 +470,7 @@ d3.layout.force = function() {
// use `node.call(force.drag)` to make nodes draggable
force.drag = function() {
if (!drag) drag = d3.behavior.drag()
+ .origin(Object)
.on("dragstart", dragstart)
.on("drag", d3_layout_forceDrag)
.on("dragend", d3_layout_forceDragEnd);
@@ -489,7 +485,7 @@ d3.layout.force = function() {
d3_layout_forceDragForce = force;
}
- return force;
+ return d3.rebind(force, event, "on");
};
var d3_layout_forceDragForce,
@@ -510,8 +506,8 @@ function d3_layout_forceDragEnd() {
}
function d3_layout_forceDrag() {
- d3_layout_forceDragNode.px += d3.event.dx;
- d3_layout_forceDragNode.py += d3.event.dy;
+ d3_layout_forceDragNode.px = d3.event.x;
+ d3_layout_forceDragNode.py = d3.event.y;
d3_layout_forceDragForce.resume(); // restart annealing
}
@@ -632,19 +628,17 @@ d3.layout.pie = function() {
: function(i, j) { return sort(data[i], data[j]); });
// Compute the arcs!
- var arcs = index.map(function(i) {
- return {
+ // They are stored in the original data's order.
+ var arcs = [];
+ index.forEach(function(i) {
+ arcs[i] = {
data: data[i],
value: d = values[i],
startAngle: a,
endAngle: a += d * k
};
});
-
- // Return the arcs in the original data's order.
- return data.map(function(d, i) {
- return arcs[index[i]];
- });
+ return arcs;
}
/**
@@ -1120,10 +1114,10 @@ d3.layout.hierarchy = function() {
// A method assignment helper for hierarchy subclasses.
function d3_layout_hierarchyRebind(object, hierarchy) {
- object.sort = d3.rebind(object, hierarchy.sort);
- object.children = d3.rebind(object, hierarchy.children);
+ d3.rebind(object, hierarchy, "sort", "children", "value");
+
+ // Add an alias for links, for convenience.
object.links = d3_layout_hierarchyLinks;
- object.value = d3.rebind(object, hierarchy.value);
// If the new API is used, enabling inlining.
object.nodes = function(d) {
@@ -1396,7 +1390,7 @@ d3.layout.cluster = function() {
// Second walk, normalizing x & y to the desired size.
d3_layout_treeVisitAfter(root, function(node) {
node.x = (node.x - x0) / (x1 - x0) * size[0];
- node.y = (1 - node.y / root.y) * size[1];
+ node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
});
return nodes;
diff --git a/lib/d3/d3.layout.min.js b/lib/d3/d3.layout.min.js
index 6704ca9..f547ab2 100644
--- a/lib/d3/d3.layout.min.js
+++ b/lib/d3/d3.layout.min.js
@@ -1 +1 @@
-(function(){function a(a){var b=a.source,d=a.target,e=c(b,d),f=[b];while(b!==e)b=b.parent,f.push(b);var g=f.length;while(d!==e)f.splice(g,0,d),d=d.parent;return f}function b(a){var b=[],c=a.parent;while(c!=null)b.push(a),a=c,c=c.parent;return b.push(a),b}function c(a,c){if(a===c)return a;var d=b(a),e=b(c),f=d.pop(),g=e.pop(),h=null;while(f===g)h=f,f=d.pop(),g=e.pop();return h}function g(a){a.fixed|=2}function h(a){a!==f&&(a.fixed&=1)}function i(){j(),f.fixed&=1,e=f=null}function j(){f.px [...]
\ No newline at end of file
+(function(){function a(a){var b=a.source,d=a.target,e=c(b,d),f=[b];while(b!==e)b=b.parent,f.push(b);var g=f.length;while(d!==e)f.splice(g,0,d),d=d.parent;return f}function b(a){var b=[],c=a.parent;while(c!=null)b.push(a),a=c,c=c.parent;return b.push(a),b}function c(a,c){if(a===c)return a;var d=b(a),e=b(c),f=d.pop(),g=e.pop(),h=null;while(f===g)h=f,f=d.pop(),g=e.pop();return h}function g(a){a.fixed|=2}function h(a){a!==f&&(a.fixed&=1)}function i(){j(),f.fixed&=1,e=f=null}function j(){f.px [...]
\ No newline at end of file
diff --git a/lib/d3/d3.min.js b/lib/d3/d3.min.js
index 9a9af75..07c2e57 100644
--- a/lib/d3/d3.min.js
+++ b/lib/d3/d3.min.js
@@ -1,2 +1,2 @@
-(function(){function e(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}function f(a){return Array.prototype.slice.call(a)}function i(){return this}function j(a){return a!=null&&!isNaN(a)}function k(a){return a.length}function l(a){return a==null}function m(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function o(){}function p(){function c(){var b=a,c=-1,d=b.length,e;while(++c<d)(e=b[c])._on&&e.apply(this,arguments)}var a=[],b={};return c.on=function(d,e){var [...]
-,green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",ligh [...]
\ No newline at end of file
+(function(){function e(a){var b=-1,c=a.length,d=[];while(++b<c)d.push(a[b]);return d}function f(a){return Array.prototype.slice.call(a)}function i(){return this}function j(a,b,c){return function(){var d=c.apply(b,arguments);return arguments.length?a:d}}function k(a){return a!=null&&!isNaN(a)}function l(a){return a.length}function m(a){return a==null}function n(a){return a.replace(/(^\s+)|(\s+$)/g,"").replace(/\s+/g," ")}function q(){}function r(){function c(){var b=a,c=-1,d=b.length,e;wh [...]
+,darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",gre [...]
\ No newline at end of file
diff --git a/lib/d3/d3.time.js b/lib/d3/d3.time.js
index e1c0831..4c1cda4 100644
--- a/lib/d3/d3.time.js
+++ b/lib/d3/d3.time.js
@@ -570,12 +570,7 @@ function d3_time_scale(linear, methods, format) {
};
// TOOD expose d3_scale_linear_rebind?
- scale.range = d3.rebind(scale, linear.range);
- scale.rangeRound = d3.rebind(scale, linear.rangeRound);
- scale.interpolate = d3.rebind(scale, linear.interpolate);
- scale.clamp = d3.rebind(scale, linear.clamp);
-
- return scale;
+ return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
}
// TODO expose d3_scaleExtent?
diff --git a/lib/d3/d3.time.min.js b/lib/d3/d3.time.min.js
index 5eb153a..387a50c 100644
--- a/lib/d3/d3.time.min.js
+++ b/lib/d3/d3.time.min.js
@@ -1 +1 @@
-(function(){function b(a,b,c,d){var e,f,g=0,i=b.length,j=c.length;while(g<i){if(d>=j)return-1;e=b.charCodeAt(g++);if(e==37){f=h[b.charAt(g++)];if(!f||(d=f(a,c,d))<0)return-1}else if(e!=c.charCodeAt(d++))return-1}return d}function i(a,b,c){return b.substring(c,c+=3).toLowerCase()in j?c:-1}function k(a,b,c){l.lastIndex=0;var d=l.exec(b.substring(c,c+10));return d?c+=d[0].length:-1}function n(a,b,c){var d=o[b.substring(c,c+=3).toLowerCase()];return d==null?-1:(a.setMonth(d),c)}function p(a, [...]
\ No newline at end of file
+(function(){function b(a,b,c,d){var e,f,g=0,i=b.length,j=c.length;while(g<i){if(d>=j)return-1;e=b.charCodeAt(g++);if(e==37){f=h[b.charAt(g++)];if(!f||(d=f(a,c,d))<0)return-1}else if(e!=c.charCodeAt(d++))return-1}return d}function i(a,b,c){return b.substring(c,c+=3).toLowerCase()in j?c:-1}function k(a,b,c){l.lastIndex=0;var d=l.exec(b.substring(c,c+10));return d?c+=d[0].length:-1}function n(a,b,c){var d=o[b.substring(c,c+=3).toLowerCase()];return d==null?-1:(a.setMonth(d),c)}function p(a, [...]
\ No newline at end of file
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/science.js.git
More information about the Pkg-javascript-commits
mailing list