Comparing version 0.2.2 to 0.3.0
@@ -1,1 +0,1 @@ | ||
var version = "0.2.2"; export * from "../index"; export {version}; | ||
var version = "0.3.0"; export * from "../index"; export {version}; |
@@ -416,2 +416,344 @@ (function (global, factory) { | ||
function line() { | ||
var x$$ = x, | ||
y$$ = y, | ||
defined = constant(true), | ||
context = null, | ||
curve = curveLinear, | ||
output = null; | ||
function line(data) { | ||
var i, | ||
n = data.length, | ||
d, | ||
defined0 = false, | ||
buffer; | ||
if (!context) output = curve(buffer = d3Path.path()); | ||
for (i = 0; i <= n; ++i) { | ||
if (!(i < n && defined(d = data[i], i, data)) === defined0) { | ||
if (defined0 = !defined0) output.lineStart(); | ||
else output.lineEnd(); | ||
} | ||
if (defined0) output.point(+x$$(d, i, data), +y$$(d, i, data)); | ||
} | ||
if (buffer) return output = null, buffer + "" || null; | ||
} | ||
line.x = function(_) { | ||
return arguments.length ? (x$$ = typeof _ === "function" ? _ : constant(+_), line) : x$$; | ||
}; | ||
line.y = function(_) { | ||
return arguments.length ? (y$$ = typeof _ === "function" ? _ : constant(+_), line) : y$$; | ||
}; | ||
line.defined = function(_) { | ||
return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line) : defined; | ||
}; | ||
line.curve = function(_) { | ||
return arguments.length ? (curve = bind(_, arguments), context != null && (output = curve(context)), line) : curve; | ||
}; | ||
line.context = function(_) { | ||
return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; | ||
}; | ||
return line; | ||
}; | ||
function descending$1(a, b) { | ||
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; | ||
}; | ||
function identity(d) { | ||
return d; | ||
}; | ||
function pie() { | ||
var value = identity, | ||
sortValues = descending$1, | ||
sort = null, | ||
startAngle = constant(0), | ||
endAngle = constant(tau), | ||
padAngle = constant(0); | ||
function pie(data) { | ||
var n = data.length, | ||
sum = 0, | ||
index = new Array(n), | ||
arcs = new Array(n), | ||
a0 = +startAngle.apply(this, arguments), | ||
da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), | ||
a1, | ||
p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), | ||
pa = p * (da < 0 ? -1 : 1); | ||
for (var i = 0, v; i < n; ++i) { | ||
if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) { | ||
sum += v; | ||
} | ||
} | ||
// Optionally sort the arcs by previously-computed values or by data. | ||
if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); }); | ||
else if (sort !== null) index.sort(function(i, j) { return sort(data[i], data[j]); }); | ||
// Compute the arcs! They are stored in the original data's order. | ||
for (var i = 0, j, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) { | ||
j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = { | ||
data: data[j], | ||
index: i, | ||
value: v, | ||
startAngle: a0, | ||
endAngle: a1, | ||
padAngle: p | ||
}; | ||
} | ||
return arcs; | ||
} | ||
pie.value = function(_) { | ||
return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie) : value; | ||
}; | ||
pie.sortValues = function(_) { | ||
return arguments.length ? (sortValues = _, sort = null, pie) : sortValues; | ||
}; | ||
pie.sort = function(_) { | ||
return arguments.length ? (sort = _, sortValues = null, pie) : sort; | ||
}; | ||
pie.startAngle = function(_) { | ||
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie) : startAngle; | ||
}; | ||
pie.endAngle = function(_) { | ||
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie) : endAngle; | ||
}; | ||
pie.padAngle = function(_) { | ||
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie) : padAngle; | ||
}; | ||
return pie; | ||
}; | ||
function Radial(curve) { | ||
this._curve = curve; | ||
} | ||
Radial.prototype = { | ||
areaStart: function() { | ||
this._curve.areaStart(); | ||
}, | ||
areaEnd: function() { | ||
this._curve.areaEnd(); | ||
}, | ||
lineStart: function() { | ||
this._curve.lineStart(); | ||
}, | ||
lineEnd: function() { | ||
this._curve.lineEnd(); | ||
}, | ||
point: function(a, r) { | ||
a -= halfPi, this._curve.point(r * Math.cos(a), r * Math.sin(a)); | ||
} | ||
}; | ||
function curveRadial(curve, args) { | ||
curve = bind(curve, args); | ||
function radial(context) { | ||
return new Radial(curve(context)); | ||
} | ||
radial._curve = curve; | ||
return radial; | ||
}; | ||
function radialArea() { | ||
var a = area(), | ||
c = a.curve; | ||
a.angle = a.x, delete a.x; | ||
a.startAngle = a.x0, delete a.x0; | ||
a.endAngle = a.x1, delete a.x1; | ||
a.radius = a.y, delete a.y; | ||
a.innerRadius = a.y0, delete a.y0; | ||
a.outerRadius = a.y1, delete a.y1; | ||
a.curve = function(_) { | ||
return arguments.length ? c(curveRadial(_, arguments)) : c()._curve; | ||
}; | ||
return a.curve(curveLinear); | ||
}; | ||
function radialLine() { | ||
var l = line(), | ||
c = l.curve; | ||
l.angle = l.x, delete l.x; | ||
l.radius = l.y, delete l.y; | ||
l.curve = function(_) { | ||
return arguments.length ? c(curveRadial(_, arguments)) : c()._curve; | ||
}; | ||
return l.curve(curveLinear); | ||
}; | ||
var c = -0.5; | ||
var s = Math.sqrt(3) / 2; | ||
var k = 1 / Math.sqrt(12); | ||
var a = (k / 2 + 1) * 3; | ||
var wye = { | ||
draw: function(context, size) { | ||
var r = Math.sqrt(size / a), | ||
x0 = r / 2, | ||
y0 = r * k, | ||
x1 = x0, | ||
y1 = r * k + r, | ||
x2 = -x1, | ||
y2 = y1; | ||
context.moveTo(x0, y0); | ||
context.lineTo(x1, y1); | ||
context.lineTo(x2, y2); | ||
context.lineTo(c * x0 - s * y0, s * x0 + c * y0); | ||
context.lineTo(c * x1 - s * y1, s * x1 + c * y1); | ||
context.lineTo(c * x2 - s * y2, s * x2 + c * y2); | ||
context.lineTo(c * x0 + s * y0, c * y0 - s * x0); | ||
context.lineTo(c * x1 + s * y1, c * y1 - s * x1); | ||
context.lineTo(c * x2 + s * y2, c * y2 - s * x2); | ||
context.closePath(); | ||
} | ||
}; | ||
var sqrt3 = Math.sqrt(3); | ||
var triangle = { | ||
draw: function(context, size) { | ||
var y = -Math.sqrt(size / (sqrt3 * 3)); | ||
context.moveTo(0, y * 2); | ||
context.lineTo(-sqrt3 * y, -y); | ||
context.lineTo(sqrt3 * y, -y); | ||
context.closePath(); | ||
} | ||
}; | ||
var ka = 0.89081309152928522810; | ||
var kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10); | ||
var kx = Math.sin(tau / 10) * kr; | ||
var ky = -Math.cos(tau / 10) * kr; | ||
var star = { | ||
draw: function(context, size) { | ||
var r = Math.sqrt(size * ka), | ||
x = kx * r, | ||
y = ky * r; | ||
context.moveTo(0, -r); | ||
context.lineTo(x, y); | ||
for (var i = 1; i < 5; ++i) { | ||
var a = tau * i / 5, | ||
c = Math.cos(a), | ||
s = Math.sin(a); | ||
context.lineTo(s * r, -c * r); | ||
context.lineTo(c * x - s * y, s * x + c * y); | ||
} | ||
context.closePath(); | ||
} | ||
}; | ||
var square = { | ||
draw: function(context, size) { | ||
var w = Math.sqrt(size), | ||
x = -w / 2; | ||
context.rect(x, x, w, w); | ||
} | ||
}; | ||
var tan30 = Math.sqrt(1 / 3); | ||
var tan30_2 = tan30 * 2; | ||
var diamond = { | ||
draw: function(context, size) { | ||
var y = Math.sqrt(size / tan30_2), | ||
x = y * tan30; | ||
context.moveTo(0, -y); | ||
context.lineTo(x, 0); | ||
context.lineTo(0, y); | ||
context.lineTo(-x, 0); | ||
context.closePath(); | ||
} | ||
}; | ||
var cross = { | ||
draw: function(context, size) { | ||
var r = Math.sqrt(size / 5) / 2; | ||
context.moveTo(-3 * r, -r); | ||
context.lineTo(-r, -r); | ||
context.lineTo(-r, -3 * r); | ||
context.lineTo(r, -3 * r); | ||
context.lineTo(r, -r); | ||
context.lineTo(3 * r, -r); | ||
context.lineTo(3 * r, r); | ||
context.lineTo(r, r); | ||
context.lineTo(r, 3 * r); | ||
context.lineTo(-r, 3 * r); | ||
context.lineTo(-r, r); | ||
context.lineTo(-3 * r, r); | ||
context.closePath(); | ||
} | ||
}; | ||
var circle = { | ||
draw: function(context, size) { | ||
var r = Math.sqrt(size / pi); | ||
context.moveTo(r, 0); | ||
context.arc(0, 0, r, 0, tau); | ||
} | ||
}; | ||
var symbols = [ | ||
circle, | ||
cross, | ||
diamond, | ||
square, | ||
star, | ||
triangle, | ||
wye | ||
]; | ||
function symbol() { | ||
var type = constant(circle), | ||
size = constant(64), | ||
context = null; | ||
function symbol() { | ||
var buffer; | ||
if (!context) context = buffer = d3Path.path(); | ||
type.apply(this, arguments).draw(context, +size.apply(this, arguments)); | ||
if (buffer) return context = null, buffer + "" || null; | ||
} | ||
symbol.type = function(_) { | ||
return arguments.length ? (type = typeof _ === "function" ? _ : constant(_), symbol) : type; | ||
}; | ||
symbol.size = function(_) { | ||
return arguments.length ? (size = typeof _ === "function" ? _ : constant(+_), symbol) : size; | ||
}; | ||
symbol.context = function(_) { | ||
return arguments.length ? (context = _ == null ? null : _, symbol) : context; | ||
}; | ||
return symbol; | ||
}; | ||
function noop() {}; | ||
@@ -945,43 +1287,2 @@ | ||
var circle = { | ||
draw: function(context, size) { | ||
var r = Math.sqrt(size / pi); | ||
context.moveTo(r, 0); | ||
context.arc(0, 0, r, 0, tau); | ||
} | ||
}; | ||
var cross = { | ||
draw: function(context, size) { | ||
var r = Math.sqrt(size / 5) / 2; | ||
context.moveTo(-3 * r, -r); | ||
context.lineTo(-r, -r); | ||
context.lineTo(-r, -3 * r); | ||
context.lineTo(r, -3 * r); | ||
context.lineTo(r, -r); | ||
context.lineTo(3 * r, -r); | ||
context.lineTo(3 * r, r); | ||
context.lineTo(r, r); | ||
context.lineTo(r, 3 * r); | ||
context.lineTo(-r, 3 * r); | ||
context.lineTo(-r, r); | ||
context.lineTo(-3 * r, r); | ||
context.closePath(); | ||
} | ||
}; | ||
var tan30 = Math.sqrt(1 / 3); | ||
var tan30_2 = tan30 * 2; | ||
var diamond = { | ||
draw: function(context, size) { | ||
var y = Math.sqrt(size / tan30_2), | ||
x = y * tan30; | ||
context.moveTo(0, -y); | ||
context.lineTo(x, 0); | ||
context.lineTo(0, y); | ||
context.lineTo(-x, 0); | ||
context.closePath(); | ||
} | ||
}; | ||
function LinearClosed(context) { | ||
@@ -1011,53 +1312,2 @@ this._context = context; | ||
function line() { | ||
var x$$ = x, | ||
y$$ = y, | ||
defined = constant(true), | ||
context = null, | ||
curve = curveLinear, | ||
output = null; | ||
function line(data) { | ||
var i, | ||
n = data.length, | ||
d, | ||
defined0 = false, | ||
buffer; | ||
if (!context) output = curve(buffer = d3Path.path()); | ||
for (i = 0; i <= n; ++i) { | ||
if (!(i < n && defined(d = data[i], i, data)) === defined0) { | ||
if (defined0 = !defined0) output.lineStart(); | ||
else output.lineEnd(); | ||
} | ||
if (defined0) output.point(+x$$(d, i, data), +y$$(d, i, data)); | ||
} | ||
if (buffer) return output = null, buffer + "" || null; | ||
} | ||
line.x = function(_) { | ||
return arguments.length ? (x$$ = typeof _ === "function" ? _ : constant(+_), line) : x$$; | ||
}; | ||
line.y = function(_) { | ||
return arguments.length ? (y$$ = typeof _ === "function" ? _ : constant(+_), line) : y$$; | ||
}; | ||
line.defined = function(_) { | ||
return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line) : defined; | ||
}; | ||
line.curve = function(_) { | ||
return arguments.length ? (curve = bind(_, arguments), context != null && (output = curve(context)), line) : curve; | ||
}; | ||
line.context = function(_) { | ||
return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; | ||
}; | ||
return line; | ||
}; | ||
function sign(x) { | ||
@@ -1211,181 +1461,8 @@ return x < 0 ? -1 : 1; | ||
function descending(a, b) { | ||
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; | ||
}; | ||
function identity(d) { | ||
return d; | ||
}; | ||
function pie() { | ||
var value = identity, | ||
sortValues = descending, | ||
sort = null, | ||
startAngle = constant(0), | ||
endAngle = constant(tau), | ||
padAngle = constant(0); | ||
function pie(data) { | ||
var n = data.length, | ||
sum = 0, | ||
index = new Array(n), | ||
arcs = new Array(n), | ||
a0 = +startAngle.apply(this, arguments), | ||
da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), | ||
a1, | ||
p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), | ||
pa = p * (da < 0 ? -1 : 1); | ||
for (var i = 0, v; i < n; ++i) { | ||
if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) { | ||
sum += v; | ||
} | ||
} | ||
// Optionally sort the arcs by previously-computed values or by data. | ||
if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); }); | ||
else if (sort !== null) index.sort(function(i, j) { return sort(data[i], data[j]); }); | ||
// Compute the arcs! They are stored in the original data's order. | ||
for (var i = 0, j, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) { | ||
j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = { | ||
data: data[j], | ||
value: v, | ||
startAngle: a0, | ||
endAngle: a1, | ||
padAngle: p | ||
}; | ||
} | ||
return arcs; | ||
} | ||
pie.value = function(_) { | ||
return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie) : value; | ||
}; | ||
pie.sortValues = function(_) { | ||
return arguments.length ? (sortValues = _, sort = null, pie) : sortValues; | ||
}; | ||
pie.sort = function(_) { | ||
return arguments.length ? (sort = _, sortValues = null, pie) : sort; | ||
}; | ||
pie.startAngle = function(_) { | ||
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie) : startAngle; | ||
}; | ||
pie.endAngle = function(_) { | ||
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie) : endAngle; | ||
}; | ||
pie.padAngle = function(_) { | ||
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie) : padAngle; | ||
}; | ||
return pie; | ||
}; | ||
function Radial(curve) { | ||
this._curve = curve; | ||
} | ||
Radial.prototype = { | ||
areaStart: function() { | ||
this._curve.areaStart(); | ||
}, | ||
areaEnd: function() { | ||
this._curve.areaEnd(); | ||
}, | ||
lineStart: function() { | ||
this._curve.lineStart(); | ||
}, | ||
lineEnd: function() { | ||
this._curve.lineEnd(); | ||
}, | ||
point: function(a, r) { | ||
a -= halfPi, this._curve.point(r * Math.cos(a), r * Math.sin(a)); | ||
} | ||
}; | ||
function curveRadial(curve, args) { | ||
curve = bind(curve, args); | ||
function radial(context) { | ||
return new Radial(curve(context)); | ||
} | ||
radial._curve = curve; | ||
return radial; | ||
}; | ||
function radialArea() { | ||
var a = area(), | ||
c = a.curve; | ||
a.angle = a.x, delete a.x; | ||
a.startAngle = a.x0, delete a.x0; | ||
a.endAngle = a.x1, delete a.x1; | ||
a.radius = a.y, delete a.y; | ||
a.innerRadius = a.y0, delete a.y0; | ||
a.outerRadius = a.y1, delete a.y1; | ||
a.curve = function(_) { | ||
return arguments.length ? c(curveRadial(_, arguments)) : c()._curve; | ||
}; | ||
return a.curve(curveLinear); | ||
}; | ||
function radialLine() { | ||
var l = line(), | ||
c = l.curve; | ||
l.angle = l.x, delete l.x; | ||
l.radius = l.y, delete l.y; | ||
l.curve = function(_) { | ||
return arguments.length ? c(curveRadial(_, arguments)) : c()._curve; | ||
}; | ||
return l.curve(curveLinear); | ||
}; | ||
var square = { | ||
draw: function(context, size) { | ||
var w = Math.sqrt(size), | ||
x = -w / 2; | ||
context.rect(x, x, w, w); | ||
} | ||
}; | ||
var ka = 0.89081309152928522810; | ||
var kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10); | ||
var kx = Math.sin(tau / 10) * kr; | ||
var ky = -Math.cos(tau / 10) * kr; | ||
var star = { | ||
draw: function(context, size) { | ||
var r = Math.sqrt(size * ka), | ||
x = kx * r, | ||
y = ky * r; | ||
context.moveTo(0, -r); | ||
context.lineTo(x, y); | ||
for (var i = 1; i < 5; ++i) { | ||
var a = tau * i / 5, | ||
c = Math.cos(a), | ||
s = Math.sin(a); | ||
context.lineTo(s * r, -c * r); | ||
context.lineTo(c * x - s * y, s * x + c * y); | ||
} | ||
context.closePath(); | ||
} | ||
}; | ||
function StepAfter(context) { | ||
function Step(context, t) { | ||
this._context = context; | ||
this._t = t; | ||
} | ||
StepAfter.prototype = { | ||
Step.prototype = { | ||
areaStart: function() { | ||
@@ -1398,6 +1475,7 @@ this._line = 0; | ||
lineStart: function() { | ||
this._y = NaN; | ||
this._x = this._y = NaN; | ||
this._point = 0; | ||
}, | ||
lineEnd: function() { | ||
if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); | ||
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); | ||
@@ -1412,173 +1490,199 @@ this._line = 1 - this._line; | ||
default: { | ||
this._context.lineTo(x, this._y); | ||
this._context.lineTo(x, y); | ||
var t = x > this._x ? this._t : 1 - this._t; | ||
if (t <= 0) { | ||
this._context.lineTo(this._x, y); | ||
this._context.lineTo(x, y); | ||
} else if (t >= 1) { | ||
this._context.lineTo(x, this._y); | ||
this._context.lineTo(x, y); | ||
} else { | ||
var x1 = (this._x + x) * t; | ||
this._context.lineTo(x1, this._y); | ||
this._context.lineTo(x1, y); | ||
} | ||
break; | ||
} | ||
} | ||
this._y = y; | ||
this._x = x, this._y = y; | ||
} | ||
}; | ||
function step(context) { | ||
return new Step(context, 0.5); | ||
}; | ||
function stepBefore(context) { | ||
return new Step(context, 0); | ||
}; | ||
function stepAfter(context) { | ||
return new StepAfter(context); | ||
return new Step(context, 1); | ||
}; | ||
function StepBefore(context) { | ||
this._context = context; | ||
} | ||
var slice$1 = Array.prototype.slice; | ||
StepBefore.prototype = { | ||
areaStart: function() { | ||
this._line = 0; | ||
}, | ||
areaEnd: function() { | ||
this._line = NaN; | ||
}, | ||
lineStart: function() { | ||
this._x = NaN; | ||
this._point = 0; | ||
}, | ||
lineEnd: function() { | ||
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); | ||
this._line = 1 - this._line; | ||
}, | ||
point: function(x, y) { | ||
x = +x, y = +y; | ||
switch (this._point) { | ||
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; | ||
case 1: this._point = 2; // proceed | ||
default: { | ||
this._context.lineTo(this._x, y); | ||
this._context.lineTo(x, y); | ||
break; | ||
} | ||
function none(series, order) { | ||
if (!((n = series.length) > 1)) return; | ||
for (var i = 1, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) { | ||
s0 = s1, s1 = series[order[i]]; | ||
for (var j = 0; j < m; ++j) { | ||
s1[j][1] += s1[j][0] = s0[j][1]; | ||
} | ||
this._x = x; | ||
} | ||
}; | ||
function stepBefore(context) { | ||
return new StepBefore(context); | ||
function none$1(series) { | ||
var n = series.length, o = new Array(n); | ||
while (--n >= 0) o[n] = n; | ||
return o; | ||
}; | ||
function Step(context) { | ||
this._context = context; | ||
function stackValue(d, key) { | ||
return d[key]; | ||
} | ||
Step.prototype = { | ||
areaStart: function() { | ||
this._line = 0; | ||
}, | ||
areaEnd: function() { | ||
this._line = NaN; | ||
}, | ||
lineStart: function() { | ||
this._x = this._y = NaN; | ||
this._point = 0; | ||
}, | ||
lineEnd: function() { | ||
if (this._point === 2) this._context.lineTo(this._x, this._y); | ||
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); | ||
this._line = 1 - this._line; | ||
}, | ||
point: function(x, y) { | ||
x = +x, y = +y; | ||
switch (this._point) { | ||
case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; | ||
case 1: this._point = 2; // proceed | ||
default: { | ||
var x1 = (this._x + x) / 2; | ||
this._context.lineTo(x1, this._y); | ||
this._context.lineTo(x1, y); | ||
break; | ||
function stack() { | ||
var keys = constant([]), | ||
order = none$1, | ||
offset = none, | ||
value = stackValue; | ||
function stack(data) { | ||
var kz = keys.apply(this, arguments), | ||
m = data.length, | ||
n = kz.length, | ||
sz = new Array(n); | ||
for (var i = 0; i < n; ++i) { | ||
for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) { | ||
si[j] = sij = [0, +value(data[j], ki, j, data)]; | ||
sij.data = data[j]; | ||
} | ||
si.key = ki; | ||
} | ||
this._x = x, this._y = y; | ||
for (var i = 0, oz = order(sz); i < n; ++i) { | ||
sz[oz[i]].index = i; | ||
} | ||
offset(sz, oz); | ||
return sz; | ||
} | ||
stack.keys = function(_) { | ||
return arguments.length ? (keys = typeof _ === "function" ? _ : constant(slice$1.call(_)), stack) : keys; | ||
}; | ||
stack.value = function(_) { | ||
return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), stack) : value; | ||
}; | ||
stack.order = function(_) { | ||
return arguments.length ? (order = _ == null ? orderDefault : typeof _ === "function" ? _ : constant(slice$1.call(_)), stack) : order; | ||
}; | ||
stack.offset = function(_) { | ||
return arguments.length ? (offset = _ == null ? offsetZero : _, stack) : offset; | ||
}; | ||
return stack; | ||
}; | ||
function step(context) { | ||
return new Step(context); | ||
function expand(series, order) { | ||
if (!((n = series.length) > 0)) return; | ||
for (var j = 0, n, m = series[0].length; j < m; ++j) { | ||
for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1]; | ||
for (var i = 0; i < n; ++i) series[i][j][1] /= y; | ||
} | ||
none(series, order); | ||
}; | ||
var c = -0.5; | ||
var s = Math.sqrt(3) / 2; | ||
var k = 1 / Math.sqrt(12); | ||
var a = (k / 2 + 1) * 3; | ||
var wye = { | ||
draw: function(context, size) { | ||
var r = Math.sqrt(size / a), | ||
x0 = r / 2, | ||
y0 = r * k, | ||
x1 = x0, | ||
y1 = r * k + r, | ||
x2 = -x1, | ||
y2 = y1; | ||
context.moveTo(x0, y0); | ||
context.lineTo(x1, y1); | ||
context.lineTo(x2, y2); | ||
context.lineTo(c * x0 - s * y0, s * x0 + c * y0); | ||
context.lineTo(c * x1 - s * y1, s * x1 + c * y1); | ||
context.lineTo(c * x2 - s * y2, s * x2 + c * y2); | ||
context.lineTo(c * x0 + s * y0, c * y0 - s * x0); | ||
context.lineTo(c * x1 + s * y1, c * y1 - s * x1); | ||
context.lineTo(c * x2 + s * y2, c * y2 - s * x2); | ||
context.closePath(); | ||
function silhouette(series, order) { | ||
if (!((n = series.length) > 0)) return; | ||
for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) { | ||
for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1]; | ||
s0[j][1] += s0[j][0] = -y / 2; | ||
} | ||
none(series, order); | ||
}; | ||
var sqrt3 = Math.sqrt(3); | ||
var triangle = { | ||
draw: function(context, size) { | ||
var y = -Math.sqrt(size / (sqrt3 * 3)); | ||
context.moveTo(0, y * 2); | ||
context.lineTo(-sqrt3 * y, -y); | ||
context.lineTo(sqrt3 * y, -y); | ||
context.closePath(); | ||
function wiggle(series, order) { | ||
if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return; | ||
for (var y = 0, j = 1, s0, m, n; j < m; ++j) { | ||
for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) { | ||
var si = series[order[i]], s3 = (si[j][1] - si[j - 1][1]) / 2; | ||
for (var k = 0, sk; k < i; ++k) sk = series[order[k]], s3 += (sk[j][1] - sk[j - 1][1]); | ||
s1 += si[j][1], s2 += s3 * si[j][1]; | ||
} | ||
s0[j - 1][1] += s0[j - 1][0] = y; | ||
if (s1) y -= s2 / s1; | ||
} | ||
s0[j - 1][1] += s0[j - 1][0] = y; | ||
none(series, order); | ||
}; | ||
var symbols = [ | ||
circle, | ||
cross, | ||
diamond, | ||
square, | ||
star, | ||
triangle, | ||
wye | ||
]; | ||
function ascending(series) { | ||
var sums = series.map(sum); | ||
return none$1(series).sort(function(a, b) { return sums[a] - sums[b]; }); | ||
}; | ||
function symbol() { | ||
var type = constant(circle), | ||
size = constant(64), | ||
context = null; | ||
function sum(series) { | ||
return series.reduce(add, 0); | ||
}; | ||
function symbol() { | ||
var buffer; | ||
if (!context) context = buffer = d3Path.path(); | ||
type.apply(this, arguments).draw(context, +size.apply(this, arguments)); | ||
if (buffer) return context = null, buffer + "" || null; | ||
} | ||
function add(p, d) { | ||
return p + d[1]; | ||
} | ||
symbol.type = function(_) { | ||
return arguments.length ? (type = typeof _ === "function" ? _ : constant(_), symbol) : type; | ||
}; | ||
function descending(series) { | ||
return ascending(series).reverse(); | ||
}; | ||
symbol.size = function(_) { | ||
return arguments.length ? (size = typeof _ === "function" ? _ : constant(+_), symbol) : size; | ||
}; | ||
function insideOut(series) { | ||
var n = series.length, | ||
i, | ||
j, | ||
sums = series.map(sum), | ||
order = none$1(series).sort(function(a, b) { return sums[b] - sums[a]; }), | ||
top = 0, | ||
bottom = 0, | ||
tops = [], | ||
bottoms = []; | ||
symbol.context = function(_) { | ||
return arguments.length ? (context = _ == null ? null : _, symbol) : context; | ||
}; | ||
for (i = 0; i < n; ++i) { | ||
j = order[i]; | ||
if (top < bottom) { | ||
top += sums[j]; | ||
tops.push(j); | ||
} else { | ||
bottom += sums[j]; | ||
bottoms.push(j); | ||
} | ||
} | ||
return symbol; | ||
return bottoms.reverse().concat(tops); | ||
}; | ||
var version = "0.2.2"; | ||
function reverse(series) { | ||
return none$1(series).reverse(); | ||
}; | ||
var version = "0.3.0"; | ||
exports.version = version; | ||
exports.arc = arc; | ||
exports.area = area; | ||
exports.line = line; | ||
exports.pie = pie; | ||
exports.radialArea = radialArea; | ||
exports.radialLine = radialLine; | ||
exports.symbol = symbol; | ||
exports.symbols = symbols; | ||
exports.circle = circle; | ||
exports.cross = cross; | ||
exports.diamond = diamond; | ||
exports.square = square; | ||
exports.star = star; | ||
exports.triangle = triangle; | ||
exports.wye = wye; | ||
exports.basisClosed = basisClosed; | ||
@@ -1594,23 +1698,20 @@ exports.basisOpen = basisOpen; | ||
exports.catmullRom = catmullRom; | ||
exports.circle = circle; | ||
exports.cross = cross; | ||
exports.diamond = diamond; | ||
exports.linearClosed = linearClosed; | ||
exports.linear = curveLinear; | ||
exports.line = line; | ||
exports.monotone = monotone; | ||
exports.natural = natural; | ||
exports.pie = pie; | ||
exports.radialArea = radialArea; | ||
exports.radialLine = radialLine; | ||
exports.square = square; | ||
exports.star = star; | ||
exports.step = step; | ||
exports.stepAfter = stepAfter; | ||
exports.stepBefore = stepBefore; | ||
exports.step = step; | ||
exports.symbol = symbol; | ||
exports.symbols = symbols; | ||
exports.triangle = triangle; | ||
exports.wye = wye; | ||
exports.stack = stack; | ||
exports.offsetExpand = expand; | ||
exports.offsetNone = none; | ||
exports.offsetSilhouette = silhouette; | ||
exports.offsetWiggle = wiggle; | ||
exports.orderAscending = ascending; | ||
exports.orderDescending = descending; | ||
exports.orderInsideOut = insideOut; | ||
exports.orderNone = none$1; | ||
exports.orderReverse = reverse; | ||
})); |
@@ -1,1 +0,1 @@ | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("d3-path")):"function"==typeof define&&define.amd?define("d3-shape",["exports","d3-path"],i):i(t.d3_shape={},t.d3_path)}(this,function(t,i){"use strict";function n(t){return function(){return t}}function s(t){return t.innerRadius}function e(t){return t.outerRadius}function h(t){return t.startAngle}function _(t){return t.endAngle}function o(t){return t&&t.padAngle}function a(t){return t>=1?pt:-1>=t?-pt:Math.asin(t)}function r(t,i,n,s,e,h,_,o){var a=n-t,r=s-i,l=_-e,c=o-h,u=(l*(i-h)-c*(t-e))/(c*a-l*r);return[t+u*a,i+u*r]}function l(t,i,n,s,e,h,_){var o=t-n,a=i-s,r=(_?h:-h)/Math.sqrt(o*o+a*a),l=r*a,c=-r*o,u=t+l,x=i+c,f=n+l,y=s+c,p=(u+f)/2,d=(x+y)/2,v=f-u,g=y-x,m=v*v+g*g,T=e-h,M=u*y-f*x,b=(0>g?-1:1)*Math.sqrt(Math.max(0,T*T*m-M*M)),w=(M*g-v*b)/m,N=(-M*v-g*b)/m,k=(M*g+v*b)/m,E=(-M*v+g*b)/m,S=w-p,P=N-d,A=k-p,q=E-d;return S*S+P*P>A*A+q*q&&(w=k,N=E),{cx:w,cy:N,x01:-l,y01:-c,x11:w*(e/T-1),y11:N*(e/T-1)}}function c(){function t(){var t,n,s=+c.apply(this,arguments),e=+u.apply(this,arguments),h=y.apply(this,arguments)-pt,_=p.apply(this,arguments)-pt,o=Math.abs(_-h),g=_>h;if(v||(v=t=i.path()),s>e&&(n=e,e=s,s=n),e>ft)if(o>dt-ft)v.moveTo(e*Math.cos(h),e*Math.sin(h)),v.arc(0,0,e,h,_,!g),s>ft&&(v.moveTo(s*Math.cos(_),s*Math.sin(_)),v.arc(0,0,s,_,h,g));else{var m=h,T=_,M=h,b=_,w=o,N=o,k=d.apply(this,arguments)/2,E=k>ft&&(f?+f.apply(this,arguments):Math.sqrt(s*s+e*e)),S=Math.min(Math.abs(e-s)/2,+x.apply(this,arguments)),P=S,A=S;if(E>ft){var q=a(E/s*Math.sin(k)),R=a(E/e*Math.sin(k));(w-=2*q)>ft?(q*=g?1:-1,M+=q,b-=q):(w=0,M=b=(h+_)/2),(N-=2*R)>ft?(R*=g?1:-1,m+=R,T-=R):(N=0,m=T=(h+_)/2)}var C=e*Math.cos(m),z=e*Math.sin(m),O=s*Math.cos(b),j=s*Math.sin(b);if(S>ft){var B=e*Math.cos(T),I=e*Math.sin(T),L=s*Math.cos(M),V=s*Math.sin(M);if(yt>o){var D=w>ft?r(C,z,L,V,B,I,O,j):[O,j],F=C-D[0],G=z-D[1],H=B-D[0],J=I-D[1],K=1/Math.sin(Math.acos((F*H+G*J)/(Math.sqrt(F*F+G*G)*Math.sqrt(H*H+J*J)))/2),Q=Math.sqrt(D[0]*D[0]+D[1]*D[1]);P=Math.min(S,(s-Q)/(K-1)),A=Math.min(S,(e-Q)/(K+1))}}if(N>ft)if(A>ft){var U=l(L,V,C,z,e,A,g),W=l(B,I,O,j,e,A,g);v.moveTo(U.cx+U.x01,U.cy+U.y01),S>A?v.arc(U.cx,U.cy,A,Math.atan2(U.y01,U.x01),Math.atan2(W.y01,W.x01),!g):(v.arc(U.cx,U.cy,A,Math.atan2(U.y01,U.x01),Math.atan2(U.y11,U.x11),!g),v.arc(0,0,e,Math.atan2(U.cy+U.y11,U.cx+U.x11),Math.atan2(W.cy+W.y11,W.cx+W.x11),!g),v.arc(W.cx,W.cy,A,Math.atan2(W.y11,W.x11),Math.atan2(W.y01,W.x01),!g))}else v.moveTo(C,z),v.arc(0,0,e,m,T,!g);else v.moveTo(C,z);if(s>ft&&w>ft)if(P>ft){var U=l(O,j,B,I,s,-P,g),W=l(C,z,L,V,s,-P,g);v.lineTo(U.cx+U.x01,U.cy+U.y01),S>P?v.arc(U.cx,U.cy,P,Math.atan2(U.y01,U.x01),Math.atan2(W.y01,W.x01),!g):(v.arc(U.cx,U.cy,P,Math.atan2(U.y01,U.x01),Math.atan2(U.y11,U.x11),!g),v.arc(0,0,s,Math.atan2(U.cy+U.y11,U.cx+U.x11),Math.atan2(W.cy+W.y11,W.cx+W.x11),g),v.arc(W.cx,W.cy,P,Math.atan2(W.y11,W.x11),Math.atan2(W.y01,W.x01),!g))}else v.arc(0,0,s,b,M,g);else v.lineTo(O,j)}else v.moveTo(0,0);return v.closePath(),t?(v=null,t+""||null):void 0}var c=s,u=e,x=n(0),f=null,y=h,p=_,d=o,v=null,g=null;return t.centroid=function(){var t=(+c.apply(this,arguments)+ +u.apply(this,arguments))/2,i=(+y.apply(this,arguments)+ +p.apply(this,arguments))/2-yt/2;return[Math.cos(i)*t,Math.sin(i)*t]},t.innerRadius=function(i){return arguments.length?(c="function"==typeof i?i:n(+i),t):c},t.outerRadius=function(i){return arguments.length?(u="function"==typeof i?i:n(+i),t):u},t.cornerRadius=function(i){return arguments.length?(x="function"==typeof i?i:n(+i),t):x},t.padRadius=function(i){return arguments.length?(f=null==i?null:"function"==typeof i?i:n(+i),t):f},t.startAngle=function(i){return arguments.length?(y="function"==typeof i?i:n(+i),t):y},t.endAngle=function(i){return arguments.length?(p="function"==typeof i?i:n(+i),t):p},t.padAngle=function(i){return arguments.length?(d="function"==typeof i?i:n(+i),t):d},t.context=function(i){return arguments.length?(v=g=null==i?null:i,t):v},t}function u(t,i){return i.length<2?t:(i=vt.call(i),i[0]=null,function(n){return i[0]=n,t.apply(null,i)})}function x(t){this._context=t}function f(t){return new x(t)}function y(t){return t[0]}function p(t){return t[1]}function d(){function t(t){var n,c,u,x,f,y=t.length,p=!1,d=new Array(y),v=new Array(y);for(a||(l=r(f=i.path())),n=0;y>=n;++n){if(!(y>n&&o(x=t[n],n,t))===p)if(p=!p)c=n,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),u=n-1;u>=c;--u)l.point(d[u],v[u]);l.lineEnd(),l.areaEnd()}p&&(d[n]=+s(x,n,t),v[n]=+h(x,n,t),l.point(e?+e(x,n,t):d[n],_?+_(x,n,t):v[n]))}return f?(l=null,f+""||null):void 0}var s=y,e=null,h=n(0),_=p,o=n(!0),a=null,r=f,l=null;return t.x=function(i){return arguments.length?(s="function"==typeof i?i:n(+i),e=null,t):s},t.x0=function(i){return arguments.length?(s="function"==typeof i?i:n(+i),t):s},t.x1=function(i){return arguments.length?(e=null==i?null:"function"==typeof i?i:n(+i),t):e},t.y=function(i){return arguments.length?(h="function"==typeof i?i:n(+i),_=null,t):h},t.y0=function(i){return arguments.length?(h="function"==typeof i?i:n(+i),t):h},t.y1=function(i){return arguments.length?(_=null==i?null:"function"==typeof i?i:n(+i),t):_},t.defined=function(i){return arguments.length?(o="function"==typeof i?i:n(!!i),t):o},t.curve=function(i){return arguments.length?(r=u(i,arguments),null!=a&&(l=r(a)),t):r},t.context=function(i){return arguments.length?(null==i?a=l=null:l=r(a=i),t):a},t}function v(){}function g(t,i,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+i)/6,(t._y0+4*t._y1+n)/6)}function m(t){this._context=t}function T(t){return new m(t)}function M(t){this._context=t}function b(t){return new M(t)}function w(t){this._context=t}function N(t){return new w(t)}function k(t,i){this._basis=T(t),this._beta=i}function E(t,i){return null==i?new k(t,.85):1===(i=+i)?T(t):new k(t,i)}function S(t,i,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-i),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function P(t,i){this._context=t,this._k=i}function A(t,i){return new P(t,(null==i?1:1-i)/6)}function q(t,i){this._context=t,this._k=i}function R(t,i){return new q(t,(null==i?1:1-i)/6)}function C(t,i){this._context=t,this._k=i}function z(t,i){return new C(t,(null==i?1:1-i)/6)}function O(t,i,n){var s=t._x1,e=t._y1,h=t._x2,_=t._y2;if(t._l01_a>ft){var o=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,a=3*t._l01_a*(t._l01_a+t._l12_a);s=(s*o-t._x0*t._l12_2a+t._x2*t._l01_2a)/a,e=(e*o-t._y0*t._l12_2a+t._y2*t._l01_2a)/a}if(t._l23_a>ft){var r=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,l=3*t._l23_a*(t._l23_a+t._l12_a);h=(h*r+t._x1*t._l23_2a-i*t._l12_2a)/l,_=(_*r+t._y1*t._l23_2a-n*t._l12_2a)/l}t._context.bezierCurveTo(s,e,h,_,t._x2,t._y2)}function j(t,i){this._context=t,this._alpha=i}function B(t,i){return(i=null==i?.5:+i)?new j(t,i):A(t,0)}function I(t,i){this._context=t,this._alpha=i}function L(t,i){return(i=null==i?.5:+i)?new I(t,i):R(t,0)}function V(t,i){this._context=t,this._alpha=i}function D(t,i){return(i=null==i?.5:+i)?new V(t,i):z(t,0)}function F(t){this._context=t}function G(t){return new F(t)}function H(){function t(t){var n,r,l,c=t.length,u=!1;for(_||(a=o(l=i.path())),n=0;c>=n;++n)!(c>n&&h(r=t[n],n,t))===u&&((u=!u)?a.lineStart():a.lineEnd()),u&&a.point(+s(r,n,t),+e(r,n,t));return l?(a=null,l+""||null):void 0}var s=y,e=p,h=n(!0),_=null,o=f,a=null;return t.x=function(i){return arguments.length?(s="function"==typeof i?i:n(+i),t):s},t.y=function(i){return arguments.length?(e="function"==typeof i?i:n(+i),t):e},t.defined=function(i){return arguments.length?(h="function"==typeof i?i:n(!!i),t):h},t.curve=function(i){return arguments.length?(o=u(i,arguments),null!=_&&(a=o(_)),t):o},t.context=function(i){return arguments.length?(null==i?_=a=null:a=o(_=i),t):_},t}function J(t){return 0>t?-1:1}function K(t,i,n){var s=t._x1-t._x0,e=i-t._x1,h=(t._y1-t._y0)/s,_=(n-t._y1)/e,o=(h*e+_*s)/(s+e);return(J(h)+J(_))*Math.min(Math.abs(h),Math.abs(_),.5*Math.abs(o))||0}function Q(t,i){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-i)/2:i}function U(t,i,n){var s=t._x0,e=t._y0,h=t._x1,_=t._y1,o=(h-s)/3;t._context.bezierCurveTo(s+o,e+o*i,h-o,_-o*n,h,_)}function W(t){this._context=t}function X(t){return new W(t)}function Y(t){this._context=t}function Z(t){var i,n,s=t.length-1,e=new Array(s),h=new Array(s),_=new Array(s);for(e[0]=0,h[0]=2,_[0]=t[0]+2*t[1],i=1;s-1>i;++i)e[i]=1,h[i]=4,_[i]=4*t[i]+2*t[i+1];for(e[s-1]=2,h[s-1]=7,_[s-1]=8*t[s-1]+t[s],i=1;s>i;++i)n=e[i]/h[i-1],h[i]-=n,_[i]-=n*_[i-1];for(e[s-1]=_[s-1]/h[s-1],i=s-2;i>=0;--i)e[i]=(_[i]-e[i+1])/h[i];for(h[s-1]=(t[s]+e[s-1])/2,i=0;s-1>i;++i)h[i]=2*t[i+1]-e[i+1];return[e,h]}function $(t){return new Y(t)}function tt(t,i){return t>i?-1:i>t?1:i>=t?0:NaN}function it(t){return t}function nt(){function t(t){for(var n,a,r=t.length,l=0,c=new Array(r),u=new Array(r),x=+h.apply(this,arguments),f=Math.min(dt,Math.max(-dt,_.apply(this,arguments)-x)),y=Math.min(Math.abs(f)/r,o.apply(this,arguments)),p=y*(0>f?-1:1),d=0;r>d;++d)(a=u[c[d]=d]=+i(t[d],d,t))>0&&(l+=a);null!=s?c.sort(function(t,i){return s(u[t],u[i])}):null!==e&&c.sort(function(i,n){return e(t[i],t[n])});for(var v,d=0,g=l?(f-r*p)/l:0;r>d;++d,x=n)v=c[d],a=u[v],n=x+(a>0?a*g:0)+p,u[v]={data:t[v],value:a,startAngle:x,endAngle:n,padAngle:y};return u}var i=it,s=tt,e=null,h=n(0),_=n(dt),o=n(0);return t.value=function(s){return arguments.length?(i="function"==typeof s?s:n(+s),t):i},t.sortValues=function(i){return arguments.length?(s=i,e=null,t):s},t.sort=function(i){return arguments.length?(e=i,s=null,t):e},t.startAngle=function(i){return arguments.length?(h="function"==typeof i?i:n(+i),t):h},t.endAngle=function(i){return arguments.length?(_="function"==typeof i?i:n(+i),t):_},t.padAngle=function(i){return arguments.length?(o="function"==typeof i?i:n(+i),t):o},t}function st(t){this._curve=t}function et(t,i){function n(i){return new st(t(i))}return t=u(t,i),n._curve=t,n}function ht(){var t=d(),i=t.curve;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.curve=function(t){return arguments.length?i(et(t,arguments)):i()._curve},t.curve(f)}function _t(){var t=H(),i=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?i(et(t,arguments)):i()._curve},t.curve(f)}function ot(t){this._context=t}function at(t){return new ot(t)}function rt(t){this._context=t}function lt(t){return new rt(t)}function ct(t){this._context=t}function ut(t){return new ct(t)}function xt(){function t(){var t;return h||(h=t=i.path()),s.apply(this,arguments).draw(h,+e.apply(this,arguments)),t?(h=null,t+""||null):void 0}var s=n(gt),e=n(64),h=null;return t.type=function(i){return arguments.length?(s="function"==typeof i?i:n(i),t):s},t.size=function(i){return arguments.length?(e="function"==typeof i?i:n(+i),t):e},t.context=function(i){return arguments.length?(h=null==i?null:i,t):h},t}var ft=1e-12,yt=Math.PI,pt=yt/2,dt=2*yt,vt=Array.prototype.slice;x.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;default:this._context.lineTo(t,i)}}},m.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:g(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:g(this,t,i)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}},M.prototype={areaStart:v,areaEnd:v,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._x2=t,this._y2=i;break;case 1:this._point=2,this._x3=t,this._y3=i;break;case 2:this._point=3,this._x4=t,this._y4=i,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+i)/6);break;default:g(this,t,i)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}},w.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,s=(this._y0+4*this._y1+i)/6;this._line?this._context.lineTo(n,s):this._context.moveTo(n,s);break;case 3:this._point=4;default:g(this,t,i)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}},k.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,i=this._y,n=t.length-1;if(n>0)for(var s,e=t[0],h=i[0],_=t[n]-e,o=i[n]-h,a=-1;++a<=n;)s=a/n,this._basis.point(this._beta*t[a]+(1-this._beta)*(e+s*_),this._beta*i[a]+(1-this._beta)*(h+s*o));this._x=this._y=null,this._basis.lineEnd()},point:function(t,i){this._x.push(+t),this._y.push(+i)}},P.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:S(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2,this._x1=t,this._y1=i;break;case 2:this._point=3;default:S(this,t,i)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}},q.prototype={areaStart:v,areaEnd:v,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._x3=t,this._y3=i;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=i);break;case 2:this._point=3,this._x5=t,this._y5=i;break;default:S(this,t,i)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}},C.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:S(this,t,i)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}},j.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this,this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3;default:O(this,t,i)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}},I.prototype={areaStart:v,areaEnd:v,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=i;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=i);break;case 2:this._point=3,this._x5=t,this._y5=i;break;default:O(this,t,i)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}},V.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+s*s,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:O(this,t,i)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}};var gt={draw:function(t,i){var n=Math.sqrt(i/yt);t.moveTo(n,0),t.arc(0,0,n,0,dt)}},mt={draw:function(t,i){var n=Math.sqrt(i/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},Tt=Math.sqrt(1/3),Mt=2*Tt,bt={draw:function(t,i){var n=Math.sqrt(i/Mt),s=n*Tt;t.moveTo(0,-n),t.lineTo(s,0),t.lineTo(0,n),t.lineTo(-s,0),t.closePath()}};F.prototype={areaStart:v,areaEnd:v,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,i){t=+t,i=+i,this._point?this._context.lineTo(t,i):(this._point=1,this._context.moveTo(t,i))}},W.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:U(this,this._t0,Q(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){var n=NaN;if(t=+t,i=+i,t!==this._x1||i!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3,U(this,Q(this,n=K(this,t,i)),n);break;default:U(this,this._t0,n=K(this,t,i))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i,this._t0=n}}},Y.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,i=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],i[0]):this._context.moveTo(t[0],i[0]),2===n)this._context.lineTo(t[1],i[1]);else for(var s=Z(t),e=Z(i),h=0,_=1;n>_;++h,++_)this._context.bezierCurveTo(s[0][h],e[0][h],s[1][h],e[1][h],t[_],i[_]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,i){this._x.push(+t),this._y.push(+i)}},st.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,i){t-=pt,this._curve.point(i*Math.cos(t),i*Math.sin(t))}};var wt={draw:function(t,i){var n=Math.sqrt(i),s=-n/2;t.rect(s,s,n,n)}},Nt=.8908130915292852,kt=Math.sin(yt/10)/Math.sin(7*yt/10),Et=Math.sin(dt/10)*kt,St=-Math.cos(dt/10)*kt,Pt={draw:function(t,i){var n=Math.sqrt(i*Nt),s=Et*n,e=St*n;t.moveTo(0,-n),t.lineTo(s,e);for(var h=1;5>h;++h){var _=dt*h/5,o=Math.cos(_),a=Math.sin(_);t.lineTo(a*n,-o*n),t.lineTo(o*s-a*e,a*s+o*e)}t.closePath()}};ot.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._y=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;default:this._context.lineTo(t,this._y),this._context.lineTo(t,i)}this._y=i}},rt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;default:this._context.lineTo(this._x,i),this._context.lineTo(t,i)}this._x=t}},ct.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;default:var n=(this._x+t)/2;this._context.lineTo(n,this._y),this._context.lineTo(n,i)}this._x=t,this._y=i}};var At=-.5,qt=Math.sqrt(3)/2,Rt=1/Math.sqrt(12),Ct=3*(Rt/2+1),zt={draw:function(t,i){var n=Math.sqrt(i/Ct),s=n/2,e=n*Rt,h=s,_=n*Rt+n,o=-h,a=_;t.moveTo(s,e),t.lineTo(h,_),t.lineTo(o,a),t.lineTo(At*s-qt*e,qt*s+At*e),t.lineTo(At*h-qt*_,qt*h+At*_),t.lineTo(At*o-qt*a,qt*o+At*a),t.lineTo(At*s+qt*e,At*e-qt*s),t.lineTo(At*h+qt*_,At*_-qt*h),t.lineTo(At*o+qt*a,At*a-qt*o),t.closePath()}},Ot=Math.sqrt(3),jt={draw:function(t,i){var n=-Math.sqrt(i/(3*Ot));t.moveTo(0,2*n),t.lineTo(-Ot*n,-n),t.lineTo(Ot*n,-n),t.closePath()}},Bt=[gt,mt,bt,wt,Pt,jt,zt],It="0.2.2";t.version=It,t.arc=c,t.area=d,t.basisClosed=b,t.basisOpen=N,t.basis=T,t.bundle=E,t.cardinalClosed=R,t.cardinalOpen=z,t.cardinal=A,t.catmullRomClosed=L,t.catmullRomOpen=D,t.catmullRom=B,t.circle=gt,t.cross=mt,t.diamond=bt,t.linearClosed=G,t.linear=f,t.line=H,t.monotone=X,t.natural=$,t.pie=nt,t.radialArea=ht,t.radialLine=_t,t.square=wt,t.star=Pt,t.stepAfter=at,t.stepBefore=lt,t.step=ut,t.symbol=xt,t.symbols=Bt,t.triangle=jt,t.wye=zt}); | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("d3-path")):"function"==typeof define&&define.amd?define("d3-shape",["exports","d3-path"],i):i(t.d3_shape={},t.d3_path)}(this,function(t,i){"use strict";function n(t){return function(){return t}}function e(t){return t.innerRadius}function s(t){return t.outerRadius}function h(t){return t.startAngle}function _(t){return t.endAngle}function o(t){return t&&t.padAngle}function a(t){return t>=1?Et:-1>=t?-Et:Math.asin(t)}function r(t,i,n,e,s,h,_,o){var a=n-t,r=e-i,l=_-s,u=o-h,c=(l*(i-h)-u*(t-s))/(u*a-l*r);return[t+c*a,i+c*r]}function l(t,i,n,e,s,h,_){var o=t-n,a=i-e,r=(_?h:-h)/Math.sqrt(o*o+a*a),l=r*a,u=-r*o,c=t+l,f=i+u,x=n+l,y=e+u,p=(c+x)/2,d=(f+y)/2,g=x-c,v=y-f,m=g*g+v*v,T=s-h,M=c*y-x*f,b=(0>v?-1:1)*Math.sqrt(Math.max(0,T*T*m-M*M)),w=(M*v-g*b)/m,k=(-M*g-v*b)/m,N=(M*v+g*b)/m,E=(-M*g+v*b)/m,S=w-p,A=k-d,P=N-p,q=E-d;return S*S+A*A>P*P+q*q&&(w=N,k=E),{cx:w,cy:k,x01:-l,y01:-u,x11:w*(s/T-1),y11:k*(s/T-1)}}function u(){function t(){var t,n,e=+u.apply(this,arguments),s=+c.apply(this,arguments),h=y.apply(this,arguments)-Et,_=p.apply(this,arguments)-Et,o=Math.abs(_-h),v=_>h;if(g||(g=t=i.path()),e>s&&(n=s,s=e,e=n),s>kt)if(o>St-kt)g.moveTo(s*Math.cos(h),s*Math.sin(h)),g.arc(0,0,s,h,_,!v),e>kt&&(g.moveTo(e*Math.cos(_),e*Math.sin(_)),g.arc(0,0,e,_,h,v));else{var m=h,T=_,M=h,b=_,w=o,k=o,N=d.apply(this,arguments)/2,E=N>kt&&(x?+x.apply(this,arguments):Math.sqrt(e*e+s*s)),S=Math.min(Math.abs(s-e)/2,+f.apply(this,arguments)),A=S,P=S;if(E>kt){var q=a(E/e*Math.sin(N)),R=a(E/s*Math.sin(N));(w-=2*q)>kt?(q*=v?1:-1,M+=q,b-=q):(w=0,M=b=(h+_)/2),(k-=2*R)>kt?(R*=v?1:-1,m+=R,T-=R):(k=0,m=T=(h+_)/2)}var C=s*Math.cos(m),z=s*Math.sin(m),O=e*Math.cos(b),D=e*Math.sin(b);if(S>kt){var I=s*Math.cos(T),j=s*Math.sin(T),B=e*Math.cos(M),L=e*Math.sin(M);if(Nt>o){var V=w>kt?r(C,z,B,L,I,j,O,D):[O,D],W=C-V[0],Z=z-V[1],F=I-V[0],G=j-V[1],H=1/Math.sin(Math.acos((W*F+Z*G)/(Math.sqrt(W*W+Z*Z)*Math.sqrt(F*F+G*G)))/2),J=Math.sqrt(V[0]*V[0]+V[1]*V[1]);A=Math.min(S,(e-J)/(H-1)),P=Math.min(S,(s-J)/(H+1))}}if(k>kt)if(P>kt){var K=l(B,L,C,z,s,P,v),Q=l(I,j,O,D,s,P,v);g.moveTo(K.cx+K.x01,K.cy+K.y01),S>P?g.arc(K.cx,K.cy,P,Math.atan2(K.y01,K.x01),Math.atan2(Q.y01,Q.x01),!v):(g.arc(K.cx,K.cy,P,Math.atan2(K.y01,K.x01),Math.atan2(K.y11,K.x11),!v),g.arc(0,0,s,Math.atan2(K.cy+K.y11,K.cx+K.x11),Math.atan2(Q.cy+Q.y11,Q.cx+Q.x11),!v),g.arc(Q.cx,Q.cy,P,Math.atan2(Q.y11,Q.x11),Math.atan2(Q.y01,Q.x01),!v))}else g.moveTo(C,z),g.arc(0,0,s,m,T,!v);else g.moveTo(C,z);if(e>kt&&w>kt)if(A>kt){var K=l(O,D,I,j,e,-A,v),Q=l(C,z,B,L,e,-A,v);g.lineTo(K.cx+K.x01,K.cy+K.y01),S>A?g.arc(K.cx,K.cy,A,Math.atan2(K.y01,K.x01),Math.atan2(Q.y01,Q.x01),!v):(g.arc(K.cx,K.cy,A,Math.atan2(K.y01,K.x01),Math.atan2(K.y11,K.x11),!v),g.arc(0,0,e,Math.atan2(K.cy+K.y11,K.cx+K.x11),Math.atan2(Q.cy+Q.y11,Q.cx+Q.x11),v),g.arc(Q.cx,Q.cy,A,Math.atan2(Q.y11,Q.x11),Math.atan2(Q.y01,Q.x01),!v))}else g.arc(0,0,e,b,M,v);else g.lineTo(O,D)}else g.moveTo(0,0);return g.closePath(),t?(g=null,t+""||null):void 0}var u=e,c=s,f=n(0),x=null,y=h,p=_,d=o,g=null,v=null;return t.centroid=function(){var t=(+u.apply(this,arguments)+ +c.apply(this,arguments))/2,i=(+y.apply(this,arguments)+ +p.apply(this,arguments))/2-Nt/2;return[Math.cos(i)*t,Math.sin(i)*t]},t.innerRadius=function(i){return arguments.length?(u="function"==typeof i?i:n(+i),t):u},t.outerRadius=function(i){return arguments.length?(c="function"==typeof i?i:n(+i),t):c},t.cornerRadius=function(i){return arguments.length?(f="function"==typeof i?i:n(+i),t):f},t.padRadius=function(i){return arguments.length?(x=null==i?null:"function"==typeof i?i:n(+i),t):x},t.startAngle=function(i){return arguments.length?(y="function"==typeof i?i:n(+i),t):y},t.endAngle=function(i){return arguments.length?(p="function"==typeof i?i:n(+i),t):p},t.padAngle=function(i){return arguments.length?(d="function"==typeof i?i:n(+i),t):d},t.context=function(i){return arguments.length?(g=v=null==i?null:i,t):g},t}function c(t,i){return i.length<2?t:(i=At.call(i),i[0]=null,function(n){return i[0]=n,t.apply(null,i)})}function f(t){this._context=t}function x(t){return new f(t)}function y(t){return t[0]}function p(t){return t[1]}function d(){function t(t){var n,u,c,f,x,y=t.length,p=!1,d=new Array(y),g=new Array(y);for(a||(l=r(x=i.path())),n=0;y>=n;++n){if(!(y>n&&o(f=t[n],n,t))===p)if(p=!p)u=n,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),c=n-1;c>=u;--c)l.point(d[c],g[c]);l.lineEnd(),l.areaEnd()}p&&(d[n]=+e(f,n,t),g[n]=+h(f,n,t),l.point(s?+s(f,n,t):d[n],_?+_(f,n,t):g[n]))}return x?(l=null,x+""||null):void 0}var e=y,s=null,h=n(0),_=p,o=n(!0),a=null,r=x,l=null;return t.x=function(i){return arguments.length?(e="function"==typeof i?i:n(+i),s=null,t):e},t.x0=function(i){return arguments.length?(e="function"==typeof i?i:n(+i),t):e},t.x1=function(i){return arguments.length?(s=null==i?null:"function"==typeof i?i:n(+i),t):s},t.y=function(i){return arguments.length?(h="function"==typeof i?i:n(+i),_=null,t):h},t.y0=function(i){return arguments.length?(h="function"==typeof i?i:n(+i),t):h},t.y1=function(i){return arguments.length?(_=null==i?null:"function"==typeof i?i:n(+i),t):_},t.defined=function(i){return arguments.length?(o="function"==typeof i?i:n(!!i),t):o},t.curve=function(i){return arguments.length?(r=c(i,arguments),null!=a&&(l=r(a)),t):r},t.context=function(i){return arguments.length?(null==i?a=l=null:l=r(a=i),t):a},t}function g(){function t(t){var n,r,l,u=t.length,c=!1;for(_||(a=o(l=i.path())),n=0;u>=n;++n)!(u>n&&h(r=t[n],n,t))===c&&((c=!c)?a.lineStart():a.lineEnd()),c&&a.point(+e(r,n,t),+s(r,n,t));return l?(a=null,l+""||null):void 0}var e=y,s=p,h=n(!0),_=null,o=x,a=null;return t.x=function(i){return arguments.length?(e="function"==typeof i?i:n(+i),t):e},t.y=function(i){return arguments.length?(s="function"==typeof i?i:n(+i),t):s},t.defined=function(i){return arguments.length?(h="function"==typeof i?i:n(!!i),t):h},t.curve=function(i){return arguments.length?(o=c(i,arguments),null!=_&&(a=o(_)),t):o},t.context=function(i){return arguments.length?(null==i?_=a=null:a=o(_=i),t):_},t}function v(t,i){return t>i?-1:i>t?1:i>=t?0:NaN}function m(t){return t}function T(){function t(t){for(var n,a,r=t.length,l=0,u=new Array(r),c=new Array(r),f=+h.apply(this,arguments),x=Math.min(St,Math.max(-St,_.apply(this,arguments)-f)),y=Math.min(Math.abs(x)/r,o.apply(this,arguments)),p=y*(0>x?-1:1),d=0;r>d;++d)(a=c[u[d]=d]=+i(t[d],d,t))>0&&(l+=a);null!=e?u.sort(function(t,i){return e(c[t],c[i])}):null!==s&&u.sort(function(i,n){return s(t[i],t[n])});for(var g,d=0,v=l?(x-r*p)/l:0;r>d;++d,f=n)g=u[d],a=c[g],n=f+(a>0?a*v:0)+p,c[g]={data:t[g],index:d,value:a,startAngle:f,endAngle:n,padAngle:y};return c}var i=m,e=v,s=null,h=n(0),_=n(St),o=n(0);return t.value=function(e){return arguments.length?(i="function"==typeof e?e:n(+e),t):i},t.sortValues=function(i){return arguments.length?(e=i,s=null,t):e},t.sort=function(i){return arguments.length?(s=i,e=null,t):s},t.startAngle=function(i){return arguments.length?(h="function"==typeof i?i:n(+i),t):h},t.endAngle=function(i){return arguments.length?(_="function"==typeof i?i:n(+i),t):_},t.padAngle=function(i){return arguments.length?(o="function"==typeof i?i:n(+i),t):o},t}function M(t){this._curve=t}function b(t,i){function n(i){return new M(t(i))}return t=c(t,i),n._curve=t,n}function w(){var t=d(),i=t.curve;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.curve=function(t){return arguments.length?i(b(t,arguments)):i()._curve},t.curve(x)}function k(){var t=g(),i=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?i(b(t,arguments)):i()._curve},t.curve(x)}function N(){function t(){var t;return h||(h=t=i.path()),e.apply(this,arguments).draw(h,+s.apply(this,arguments)),t?(h=null,t+""||null):void 0}var e=n(Jt),s=n(64),h=null;return t.type=function(i){return arguments.length?(e="function"==typeof i?i:n(i),t):e},t.size=function(i){return arguments.length?(s="function"==typeof i?i:n(+i),t):s},t.context=function(i){return arguments.length?(h=null==i?null:i,t):h},t}function E(){}function S(t,i,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+i)/6,(t._y0+4*t._y1+n)/6)}function A(t){this._context=t}function P(t){return new A(t)}function q(t){this._context=t}function R(t){return new q(t)}function C(t){this._context=t}function z(t){return new C(t)}function O(t,i){this._basis=P(t),this._beta=i}function D(t,i){return null==i?new O(t,.85):1===(i=+i)?P(t):new O(t,i)}function I(t,i,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-i),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function j(t,i){this._context=t,this._k=i}function B(t,i){return new j(t,(null==i?1:1-i)/6)}function L(t,i){this._context=t,this._k=i}function V(t,i){return new L(t,(null==i?1:1-i)/6)}function W(t,i){this._context=t,this._k=i}function Z(t,i){return new W(t,(null==i?1:1-i)/6)}function F(t,i,n){var e=t._x1,s=t._y1,h=t._x2,_=t._y2;if(t._l01_a>kt){var o=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,a=3*t._l01_a*(t._l01_a+t._l12_a);e=(e*o-t._x0*t._l12_2a+t._x2*t._l01_2a)/a,s=(s*o-t._y0*t._l12_2a+t._y2*t._l01_2a)/a}if(t._l23_a>kt){var r=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,l=3*t._l23_a*(t._l23_a+t._l12_a);h=(h*r+t._x1*t._l23_2a-i*t._l12_2a)/l,_=(_*r+t._y1*t._l23_2a-n*t._l12_2a)/l}t._context.bezierCurveTo(e,s,h,_,t._x2,t._y2)}function G(t,i){this._context=t,this._alpha=i}function H(t,i){return(i=null==i?.5:+i)?new G(t,i):B(t,0)}function J(t,i){this._context=t,this._alpha=i}function K(t,i){return(i=null==i?.5:+i)?new J(t,i):V(t,0)}function Q(t,i){this._context=t,this._alpha=i}function U(t,i){return(i=null==i?.5:+i)?new Q(t,i):Z(t,0)}function X(t){this._context=t}function Y(t){return new X(t)}function $(t){return 0>t?-1:1}function tt(t,i,n){var e=t._x1-t._x0,s=i-t._x1,h=(t._y1-t._y0)/e,_=(n-t._y1)/s,o=(h*s+_*e)/(e+s);return($(h)+$(_))*Math.min(Math.abs(h),Math.abs(_),.5*Math.abs(o))||0}function it(t,i){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-i)/2:i}function nt(t,i,n){var e=t._x0,s=t._y0,h=t._x1,_=t._y1,o=(h-e)/3;t._context.bezierCurveTo(e+o,s+o*i,h-o,_-o*n,h,_)}function et(t){this._context=t}function st(t){return new et(t)}function ht(t){this._context=t}function _t(t){var i,n,e=t.length-1,s=new Array(e),h=new Array(e),_=new Array(e);for(s[0]=0,h[0]=2,_[0]=t[0]+2*t[1],i=1;e-1>i;++i)s[i]=1,h[i]=4,_[i]=4*t[i]+2*t[i+1];for(s[e-1]=2,h[e-1]=7,_[e-1]=8*t[e-1]+t[e],i=1;e>i;++i)n=s[i]/h[i-1],h[i]-=n,_[i]-=n*_[i-1];for(s[e-1]=_[e-1]/h[e-1],i=e-2;i>=0;--i)s[i]=(_[i]-s[i+1])/h[i];for(h[e-1]=(t[e]+s[e-1])/2,i=0;e-1>i;++i)h[i]=2*t[i+1]-s[i+1];return[s,h]}function ot(t){return new ht(t)}function at(t,i){this._context=t,this._t=i}function rt(t){return new at(t,.5)}function lt(t){return new at(t,0)}function ut(t){return new at(t,1)}function ct(t,i){if((e=t.length)>1)for(var n,e,s=1,h=t[i[0]],_=h.length;e>s;++s){n=h,h=t[i[s]];for(var o=0;_>o;++o)h[o][1]+=h[o][0]=n[o][1]}}function ft(t){for(var i=t.length,n=new Array(i);--i>=0;)n[i]=i;return n}function xt(t,i){return t[i]}function yt(){function t(t){for(var n=i.apply(this,arguments),_=t.length,o=n.length,a=new Array(o),r=0;o>r;++r){for(var l,u=n[r],c=a[r]=new Array(_),f=0;_>f;++f)c[f]=l=[0,+h(t[f],u,f,t)],l.data=t[f];c.key=u}for(var r=0,x=e(a);o>r;++r)a[x[r]].index=r;return s(a,x),a}var i=n([]),e=ft,s=ct,h=xt;return t.keys=function(e){return arguments.length?(i="function"==typeof e?e:n(Qt.call(e)),t):i},t.value=function(i){return arguments.length?(h="function"==typeof i?i:n(+i),t):h},t.order=function(i){return arguments.length?(e=null==i?orderDefault:"function"==typeof i?i:n(Qt.call(i)),t):e},t.offset=function(i){return arguments.length?(s=null==i?offsetZero:i,t):s},t}function pt(t,i){if((n=t.length)>0){for(var n,e=0,s=t[0].length;s>e;++e){for(var h=0,_=0;n>h;++h)_+=t[h][e][1];for(var h=0;n>h;++h)t[h][e][1]/=_}ct(t,i)}}function dt(t,i){if((n=t.length)>0){for(var n,e=0,s=t[i[0]],h=s.length;h>e;++e){for(var _=0,o=0;n>_;++_)o+=t[_][e][1];s[e][1]+=s[e][0]=-o/2}ct(t,i)}}function gt(t,i){if((s=t.length)>0&&(e=(n=t[i[0]]).length)>0){for(var n,e,s,h=0,_=1;e>_;++_){for(var o=0,a=0,r=0;s>o;++o){for(var l,u=t[i[o]],c=(u[_][1]-u[_-1][1])/2,f=0;o>f;++f)l=t[i[f]],c+=l[_][1]-l[_-1][1];a+=u[_][1],r+=c*u[_][1]}n[_-1][1]+=n[_-1][0]=h,a&&(h-=r/a)}n[_-1][1]+=n[_-1][0]=h,ct(t,i)}}function vt(t){var i=t.map(mt);return ft(t).sort(function(t,n){return i[t]-i[n]})}function mt(t){return t.reduce(Tt,0)}function Tt(t,i){return t+i[1]}function Mt(t){return vt(t).reverse()}function bt(t){var i,n,e=t.length,s=t.map(mt),h=ft(t).sort(function(t,i){return s[i]-s[t]}),_=0,o=0,a=[],r=[];for(i=0;e>i;++i)n=h[i],o>_?(_+=s[n],a.push(n)):(o+=s[n],r.push(n));return r.reverse().concat(a)}function wt(t){return ft(t).reverse()}var kt=1e-12,Nt=Math.PI,Et=Nt/2,St=2*Nt,At=Array.prototype.slice;f.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;default:this._context.lineTo(t,i)}}},M.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,i){t-=Et,this._curve.point(i*Math.cos(t),i*Math.sin(t))}};var Pt=-.5,qt=Math.sqrt(3)/2,Rt=1/Math.sqrt(12),Ct=3*(Rt/2+1),zt={draw:function(t,i){var n=Math.sqrt(i/Ct),e=n/2,s=n*Rt,h=e,_=n*Rt+n,o=-h,a=_;t.moveTo(e,s),t.lineTo(h,_),t.lineTo(o,a),t.lineTo(Pt*e-qt*s,qt*e+Pt*s),t.lineTo(Pt*h-qt*_,qt*h+Pt*_),t.lineTo(Pt*o-qt*a,qt*o+Pt*a),t.lineTo(Pt*e+qt*s,Pt*s-qt*e),t.lineTo(Pt*h+qt*_,Pt*_-qt*h),t.lineTo(Pt*o+qt*a,Pt*a-qt*o),t.closePath()}},Ot=Math.sqrt(3),Dt={draw:function(t,i){var n=-Math.sqrt(i/(3*Ot));t.moveTo(0,2*n),t.lineTo(-Ot*n,-n),t.lineTo(Ot*n,-n),t.closePath()}},It=.8908130915292852,jt=Math.sin(Nt/10)/Math.sin(7*Nt/10),Bt=Math.sin(St/10)*jt,Lt=-Math.cos(St/10)*jt,Vt={draw:function(t,i){var n=Math.sqrt(i*It),e=Bt*n,s=Lt*n;t.moveTo(0,-n),t.lineTo(e,s);for(var h=1;5>h;++h){var _=St*h/5,o=Math.cos(_),a=Math.sin(_);t.lineTo(a*n,-o*n),t.lineTo(o*e-a*s,a*e+o*s)}t.closePath()}},Wt={draw:function(t,i){var n=Math.sqrt(i),e=-n/2;t.rect(e,e,n,n)}},Zt=Math.sqrt(1/3),Ft=2*Zt,Gt={draw:function(t,i){var n=Math.sqrt(i/Ft),e=n*Zt;t.moveTo(0,-n),t.lineTo(e,0),t.lineTo(0,n),t.lineTo(-e,0),t.closePath()}},Ht={draw:function(t,i){var n=Math.sqrt(i/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},Jt={draw:function(t,i){var n=Math.sqrt(i/Nt);t.moveTo(n,0),t.arc(0,0,n,0,St)}},Kt=[Jt,Ht,Gt,Wt,Vt,Dt,zt];A.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:S(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:S(this,t,i)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}},q.prototype={areaStart:E,areaEnd:E,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._x2=t,this._y2=i;break;case 1:this._point=2,this._x3=t,this._y3=i;break;case 2:this._point=3,this._x4=t,this._y4=i,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+i)/6);break;default:S(this,t,i)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}},C.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,e=(this._y0+4*this._y1+i)/6;this._line?this._context.lineTo(n,e):this._context.moveTo(n,e);break;case 3:this._point=4;default:S(this,t,i)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i}},O.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,i=this._y,n=t.length-1;if(n>0)for(var e,s=t[0],h=i[0],_=t[n]-s,o=i[n]-h,a=-1;++a<=n;)e=a/n,this._basis.point(this._beta*t[a]+(1-this._beta)*(s+e*_),this._beta*i[a]+(1-this._beta)*(h+e*o));this._x=this._y=null,this._basis.lineEnd()},point:function(t,i){this._x.push(+t),this._y.push(+i)}},j.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:I(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2,this._x1=t,this._y1=i;break;case 2:this._point=3;default:I(this,t,i)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}},L.prototype={areaStart:E,areaEnd:E,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._x3=t,this._y3=i;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=i);break;case 2:this._point=3,this._x5=t,this._y5=i;break;default:I(this,t,i)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}},W.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:I(this,t,i)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}},G.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this,this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,e=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+e*e,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3;default:F(this,t,i)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}},J.prototype={areaStart:E,areaEnd:E,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,e=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+e*e,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=i;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=i);break;case 2:this._point=3,this._x5=t,this._y5=i;break;default:F(this,t,i)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}},Q.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){if(t=+t,i=+i,this._point){var n=this._x2-t,e=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+e*e,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:F(this,t,i)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=i}},X.prototype={areaStart:E,areaEnd:E,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,i){t=+t,i=+i,this._point?this._context.lineTo(t,i):(this._point=1,this._context.moveTo(t,i))}},et.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:nt(this,this._t0,it(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){var n=NaN;if(t=+t,i=+i,t!==this._x1||i!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;break;case 2:this._point=3,nt(this,it(this,n=tt(this,t,i)),n);break;default:nt(this,this._t0,n=tt(this,t,i))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=i,this._t0=n}}},ht.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,i=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],i[0]):this._context.moveTo(t[0],i[0]),2===n)this._context.lineTo(t[1],i[1]);else for(var e=_t(t),s=_t(i),h=0,_=1;n>_;++h,++_)this._context.bezierCurveTo(e[0][h],s[0][h],e[1][h],s[1][h],t[_],i[_]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,i){this._x.push(+t),this._y.push(+i)}},at.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,i){switch(t=+t,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,i):this._context.moveTo(t,i);break;case 1:this._point=2;default:var n=t>this._x?this._t:1-this._t;if(0>=n)this._context.lineTo(this._x,i),this._context.lineTo(t,i);else if(n>=1)this._context.lineTo(t,this._y),this._context.lineTo(t,i);else{var e=(this._x+t)*n;this._context.lineTo(e,this._y),this._context.lineTo(e,i)}}this._x=t,this._y=i}};var Qt=Array.prototype.slice,Ut="0.3.0";t.version=Ut,t.arc=u,t.area=d,t.line=g,t.pie=T,t.radialArea=w,t.radialLine=k,t.symbol=N,t.symbols=Kt,t.circle=Jt,t.cross=Ht,t.diamond=Gt,t.square=Wt,t.star=Vt,t.triangle=Dt,t.wye=zt,t.basisClosed=R,t.basisOpen=z,t.basis=P,t.bundle=D,t.cardinalClosed=V,t.cardinalOpen=Z,t.cardinal=B,t.catmullRomClosed=K,t.catmullRomOpen=U,t.catmullRom=H,t.linearClosed=Y,t.linear=x,t.monotone=st,t.natural=ot,t.step=rt,t.stepAfter=ut,t.stepBefore=lt,t.stack=yt,t.offsetExpand=pt,t.offsetNone=ct,t.offsetSilhouette=dt,t.offsetWiggle=gt,t.orderAscending=vt,t.orderDescending=Mt,t.orderInsideOut=bt,t.orderNone=ft,t.orderReverse=wt}); |
41
index.js
export {default as arc} from "./src/arc"; | ||
export {default as area} from "./src/area"; | ||
export {default as line} from "./src/line"; | ||
export {default as pie} from "./src/pie"; | ||
export {default as radialArea} from "./src/radialArea"; | ||
export {default as radialLine} from "./src/radialLine"; | ||
export {default as symbol, symbols} from "./src/symbol"; | ||
export {default as circle} from "./src/symbol/circle"; | ||
export {default as cross} from "./src/symbol/cross"; | ||
export {default as diamond} from "./src/symbol/diamond"; | ||
export {default as square} from "./src/symbol/square"; | ||
export {default as star} from "./src/symbol/star"; | ||
export {default as triangle} from "./src/symbol/triangle"; | ||
export {default as wye} from "./src/symbol/wye"; | ||
export {default as basisClosed} from "./src/curve/basisClosed"; | ||
@@ -13,20 +27,17 @@ export {default as basisOpen} from "./src/curve/basisOpen"; | ||
export {default as catmullRom} from "./src/curve/catmullRom"; | ||
export {default as circle} from "./src/symbol/circle"; | ||
export {default as cross} from "./src/symbol/cross"; | ||
export {default as diamond} from "./src/symbol/diamond"; | ||
export {default as linearClosed} from "./src/curve/linearClosed"; | ||
export {default as linear} from "./src/curve/linear"; | ||
export {default as line} from "./src/line"; | ||
export {default as monotone} from "./src/curve/monotone"; | ||
export {default as natural} from "./src/curve/natural"; | ||
export {default as pie} from "./src/pie"; | ||
export {default as radialArea} from "./src/radialArea"; | ||
export {default as radialLine} from "./src/radialLine"; | ||
export {default as square} from "./src/symbol/square"; | ||
export {default as star} from "./src/symbol/star"; | ||
export {default as stepAfter} from "./src/curve/stepAfter"; | ||
export {default as stepBefore} from "./src/curve/stepBefore"; | ||
export {default as step} from "./src/curve/step"; | ||
export {default as symbol, symbols} from "./src/symbol"; | ||
export {default as triangle} from "./src/symbol/triangle"; | ||
export {default as wye} from "./src/symbol/wye"; | ||
export {default as step, stepAfter, stepBefore} from "./src/curve/step"; | ||
export {default as stack} from "./src/stack"; | ||
export {default as offsetExpand} from "./src/offset/expand"; | ||
export {default as offsetNone} from "./src/offset/none"; | ||
export {default as offsetSilhouette} from "./src/offset/silhouette"; | ||
export {default as offsetWiggle} from "./src/offset/wiggle"; | ||
export {default as orderAscending} from "./src/order/ascending"; | ||
export {default as orderDescending} from "./src/order/descending"; | ||
export {default as orderInsideOut} from "./src/order/insideOut"; | ||
export {default as orderNone} from "./src/order/none"; | ||
export {default as orderReverse} from "./src/order/reverse"; |
{ | ||
"name": "d3-shape", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Graphical primitives for visualization, such as lines and areas.", | ||
@@ -30,3 +30,3 @@ "keywords": [ | ||
"dependencies": { | ||
"d3-path": "~0.1.2" | ||
"d3-path": "~0.1.3" | ||
}, | ||
@@ -33,0 +33,0 @@ "devDependencies": { |
@@ -1,3 +0,4 @@ | ||
function Step(context) { | ||
function Step(context, t) { | ||
this._context = context; | ||
this._t = t; | ||
} | ||
@@ -17,3 +18,3 @@ | ||
lineEnd: function() { | ||
if (this._point === 2) this._context.lineTo(this._x, this._y); | ||
if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); | ||
if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); | ||
@@ -28,5 +29,14 @@ this._line = 1 - this._line; | ||
default: { | ||
var x1 = (this._x + x) / 2; | ||
this._context.lineTo(x1, this._y); | ||
this._context.lineTo(x1, y); | ||
var t = x > this._x ? this._t : 1 - this._t; | ||
if (t <= 0) { | ||
this._context.lineTo(this._x, y); | ||
this._context.lineTo(x, y); | ||
} else if (t >= 1) { | ||
this._context.lineTo(x, this._y); | ||
this._context.lineTo(x, y); | ||
} else { | ||
var x1 = (this._x + x) * t; | ||
this._context.lineTo(x1, this._y); | ||
this._context.lineTo(x1, y); | ||
} | ||
break; | ||
@@ -40,3 +50,11 @@ } | ||
export default function(context) { | ||
return new Step(context); | ||
return new Step(context, 0.5); | ||
}; | ||
export function stepBefore(context) { | ||
return new Step(context, 0); | ||
}; | ||
export function stepAfter(context) { | ||
return new Step(context, 1); | ||
}; |
@@ -39,2 +39,3 @@ import constant from "./constant"; | ||
data: data[j], | ||
index: i, | ||
value: v, | ||
@@ -41,0 +42,0 @@ startAngle: a0, |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1056561
100
3027
962
Updatedd3-path@~0.1.3