Comparing version 0.1.0 to 0.2.0
@@ -1,1 +0,1 @@ | ||
var version = "0.1.0"; export * from "../index"; export {version}; | ||
var version = "0.2.0"; export * from "../index"; export {version}; |
@@ -14,4 +14,5 @@ (function (global, factory) { | ||
var pi = Math.PI; | ||
var piHalf = pi / 2; | ||
var halfPi = pi / 2; | ||
var tau = 2 * pi; | ||
function arcInnerRadius(d) { | ||
@@ -38,3 +39,3 @@ return d.innerRadius; | ||
function asin(x) { | ||
return x >= 1 ? piHalf : x <= -1 ? -piHalf : Math.asin(x); | ||
return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x); | ||
} | ||
@@ -108,4 +109,4 @@ | ||
r1 = +outerRadius.apply(this, arguments), | ||
a0 = startAngle.apply(this, arguments) - piHalf, | ||
a1 = endAngle.apply(this, arguments) - piHalf, | ||
a0 = startAngle.apply(this, arguments) - halfPi, | ||
a1 = endAngle.apply(this, arguments) - halfPi, | ||
da = Math.abs(a1 - a0), | ||
@@ -280,3 +281,4 @@ cw = a1 > a0; | ||
function curveBind(interpolate, args) { | ||
function bind(curve, args) { | ||
if (args.length < 2) return curve; | ||
args = slice.call(args); | ||
@@ -286,10 +288,6 @@ args[0] = null; | ||
args[0] = context; | ||
return interpolate.apply(null, args); | ||
return curve.apply(null, args); | ||
}; | ||
}; | ||
function linear(context) { | ||
return new Linear(context); | ||
} | ||
function Linear(context) { | ||
@@ -323,2 +321,6 @@ this._context = context; | ||
function curveLinear(context) { | ||
return new Linear(context); | ||
}; | ||
function x(p) { | ||
@@ -339,3 +341,3 @@ return p[0]; | ||
context = null, | ||
curve = linear, | ||
curve = curveLinear, | ||
output = null; | ||
@@ -382,3 +384,3 @@ | ||
area.x = function(_) { | ||
return arguments.length ? area.x0(_).x1(null) : x0; | ||
return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), x1 = null, area) : x0; | ||
}; | ||
@@ -395,3 +397,3 @@ | ||
area.y = function(_) { | ||
return arguments.length ? area.y0(_).y1(null) : y0; | ||
return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), y1 = null, area) : y0; | ||
}; | ||
@@ -412,4 +414,3 @@ | ||
area.curve = function(_) { | ||
var n = arguments.length; | ||
return n ? (curve = n > 1 ? curveBind(_, arguments) : _, context != null && (output = curve(context)), area) : curve; | ||
return arguments.length ? (curve = bind(_, arguments), context != null && (output = curve(context)), area) : curve; | ||
}; | ||
@@ -424,2 +425,4 @@ | ||
function noop() {}; | ||
function point(that, x, y) { | ||
@@ -436,6 +439,2 @@ that._context.bezierCurveTo( | ||
function basis(context) { | ||
return new Basis(context); | ||
} | ||
function Basis(context) { | ||
@@ -478,5 +477,5 @@ this._context = context; | ||
function basisClosed(context) { | ||
return new BasisClosed(context); | ||
} | ||
function basis(context) { | ||
return new Basis(context); | ||
}; | ||
@@ -488,2 +487,4 @@ function BasisClosed(context) { | ||
BasisClosed.prototype = { | ||
areaStart: noop, | ||
areaEnd: noop, | ||
lineStart: function() { | ||
@@ -528,5 +529,5 @@ this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = | ||
function basisOpen(context) { | ||
return new BasisOpen(context); | ||
} | ||
function basisClosed(context) { | ||
return new BasisClosed(context); | ||
}; | ||
@@ -567,7 +568,5 @@ function BasisOpen(context) { | ||
function bundle(context, beta) { | ||
return beta == null ? new Bundle(context, 0.85) | ||
: (beta = +beta) === 1 ? basis(context) | ||
: new Bundle(context, beta); | ||
} | ||
function basisOpen(context) { | ||
return new BasisOpen(context); | ||
}; | ||
@@ -616,2 +615,8 @@ function Bundle(context, beta) { | ||
function bundle(context, beta) { | ||
return beta == null ? new Bundle(context, 0.85) | ||
: (beta = +beta) === 1 ? basis(context) | ||
: new Bundle(context, beta); | ||
}; | ||
function point$1(that, x, y) { | ||
@@ -628,6 +633,2 @@ that._context.bezierCurveTo( | ||
function cardinal(context, tension) { | ||
return new Cardinal(context, (tension == null ? 1 : 1 - tension) / 6); | ||
} | ||
function Cardinal(context, k) { | ||
@@ -671,5 +672,5 @@ this._context = context; | ||
function cardinalClosed(context, tension) { | ||
return new CardinalClosed(context, (tension == null ? 1 : 1 - tension) / 6); | ||
} | ||
function cardinal(context, tension) { | ||
return new Cardinal(context, (tension == null ? 1 : 1 - tension) / 6); | ||
}; | ||
@@ -682,2 +683,4 @@ function CardinalClosed(context, k) { | ||
CardinalClosed.prototype = { | ||
areaStart: noop, | ||
areaEnd: noop, | ||
lineStart: function() { | ||
@@ -721,5 +724,5 @@ this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = | ||
function cardinalOpen(context, tension) { | ||
return new CardinalOpen(context, (tension == null ? 1 : 1 - tension) / 6); | ||
} | ||
function cardinalClosed(context, tension) { | ||
return new CardinalClosed(context, (tension == null ? 1 : 1 - tension) / 6); | ||
}; | ||
@@ -761,2 +764,6 @@ function CardinalOpen(context, k) { | ||
function cardinalOpen(context, tension) { | ||
return new CardinalOpen(context, (tension == null ? 1 : 1 - tension) / 6); | ||
}; | ||
var epsilon = 1e-6; | ||
@@ -787,8 +794,2 @@ | ||
function catmullRom(context, alpha) { | ||
return (alpha = alpha == null ? 0.5 : +alpha) | ||
? new CatmullRom(context, alpha) | ||
: cardinal(context, 0); | ||
} | ||
function CatmullRom(context, alpha) { | ||
@@ -844,7 +845,7 @@ this._context = context; | ||
function catmullRomClosed(context, alpha) { | ||
function catmullRom(context, alpha) { | ||
return (alpha = alpha == null ? 0.5 : +alpha) | ||
? new CatmullRomClosed(context, alpha) | ||
: cardinalClosed(context, 0); | ||
} | ||
? new CatmullRom(context, alpha) | ||
: cardinal(context, 0); | ||
}; | ||
@@ -857,2 +858,4 @@ function CatmullRomClosed(context, alpha) { | ||
CatmullRomClosed.prototype = { | ||
areaStart: noop, | ||
areaEnd: noop, | ||
lineStart: function() { | ||
@@ -908,7 +911,7 @@ this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = | ||
function catmullRomOpen(context, alpha) { | ||
function catmullRomClosed(context, alpha) { | ||
return (alpha = alpha == null ? 0.5 : +alpha) | ||
? new CatmullRomOpen(context, alpha) | ||
: cardinalOpen(context, 0); | ||
} | ||
? new CatmullRomClosed(context, alpha) | ||
: cardinalClosed(context, 0); | ||
}; | ||
@@ -962,7 +965,13 @@ function CatmullRomOpen(context, alpha) { | ||
function catmullRomOpen(context, alpha) { | ||
return (alpha = alpha == null ? 0.5 : +alpha) | ||
? new CatmullRomOpen(context, alpha) | ||
: cardinalOpen(context, 0); | ||
}; | ||
var circle = { | ||
draw: function(context, size) { | ||
var r = Math.sqrt(size / Math.PI); | ||
var r = Math.sqrt(size / pi); | ||
context.moveTo(r, 0); | ||
context.arc(0, 0, r, 0, 2 * Math.PI); | ||
context.arc(0, 0, r, 0, tau); | ||
} | ||
@@ -1004,6 +1013,2 @@ }; | ||
function linearClosed(context) { | ||
return new LinearClosed(context); | ||
} | ||
function LinearClosed(context) { | ||
@@ -1014,2 +1019,4 @@ this._context = context; | ||
LinearClosed.prototype = { | ||
areaStart: noop, | ||
areaEnd: noop, | ||
lineStart: function() { | ||
@@ -1028,2 +1035,6 @@ this._point = 0; | ||
function linearClosed(context) { | ||
return new LinearClosed(context); | ||
}; | ||
function line() { | ||
@@ -1034,3 +1045,3 @@ var x$$ = x, | ||
context = null, | ||
curve = linear, | ||
curve = curveLinear, | ||
output = null; | ||
@@ -1071,4 +1082,3 @@ | ||
line.curve = function(_) { | ||
var n = arguments.length; | ||
return n ? (curve = n > 1 ? curveBind(_, arguments) : _, context != null && (output = curve(context)), line) : curve; | ||
return arguments.length ? (curve = bind(_, arguments), context != null && (output = curve(context)), line) : curve; | ||
}; | ||
@@ -1118,6 +1128,2 @@ | ||
function monotone(context) { | ||
return new Monotone(context); | ||
} | ||
function Monotone(context) { | ||
@@ -1166,5 +1172,5 @@ this._context = context; | ||
function natural(context) { | ||
return new Natural(context); | ||
} | ||
function monotone(context) { | ||
return new Monotone(context); | ||
}; | ||
@@ -1233,12 +1239,14 @@ function Natural(context) { | ||
var tau$1 = 2 * Math.PI; | ||
function natural(context) { | ||
return new Natural(context); | ||
}; | ||
function descending(a, b) { | ||
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; | ||
}; | ||
function identity(d) { | ||
return d; | ||
} | ||
}; | ||
function descending(a, b) { | ||
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; | ||
} | ||
function pie() { | ||
@@ -1249,3 +1257,3 @@ var value = identity, | ||
startAngle = constant(0), | ||
endAngle = constant(tau$1), | ||
endAngle = constant(tau), | ||
padAngle = constant(0); | ||
@@ -1259,3 +1267,3 @@ | ||
a0 = +startAngle.apply(this, arguments), | ||
da = Math.min(tau$1, Math.max(-tau$1, endAngle.apply(this, arguments) - a0)), | ||
da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), | ||
a1, | ||
@@ -1316,2 +1324,68 @@ p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), | ||
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 = { | ||
@@ -1325,5 +1399,23 @@ draw: function(context, size) { | ||
function stepAfter(context) { | ||
return new StepAfter(context); | ||
} | ||
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(); | ||
} | ||
}; | ||
@@ -1364,5 +1456,5 @@ function StepAfter(context) { | ||
function stepBefore(context) { | ||
return new StepBefore(context); | ||
} | ||
function stepAfter(context) { | ||
return new StepAfter(context); | ||
}; | ||
@@ -1403,5 +1495,5 @@ function StepBefore(context) { | ||
function step(context) { | ||
return new Step(context); | ||
} | ||
function stepBefore(context) { | ||
return new StepBefore(context); | ||
}; | ||
@@ -1444,11 +1536,28 @@ function Step(context) { | ||
var sqrt3 = Math.sqrt(3); | ||
function step(context) { | ||
return new Step(context); | ||
}; | ||
var triangleDown = { | ||
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 x = Math.sqrt(size / sqrt3), | ||
y = x * sqrt3 / 2; | ||
context.moveTo(0, y); | ||
context.lineTo(x, -y); | ||
context.lineTo(-x, -y); | ||
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(); | ||
@@ -1458,9 +1567,10 @@ } | ||
var triangleUp = { | ||
var sqrt3 = Math.sqrt(3); | ||
var triangle = { | ||
draw: function(context, size) { | ||
var x = Math.sqrt(size / sqrt3), | ||
y = x * sqrt3 / 2; | ||
context.moveTo(0, -y); | ||
context.lineTo(x, y); | ||
context.lineTo(-x, y); | ||
var y = -Math.sqrt(size / (sqrt3 * 3)); | ||
context.moveTo(0, y * 2); | ||
context.lineTo(-sqrt3 * y, -y); | ||
context.lineTo(sqrt3 * y, -y); | ||
context.closePath(); | ||
@@ -1475,4 +1585,5 @@ } | ||
square, | ||
triangleDown, | ||
triangleUp | ||
star, | ||
triangle, | ||
wye | ||
]; | ||
@@ -1507,3 +1618,3 @@ | ||
var version = "0.1.0"; | ||
var version = "0.2.0"; | ||
@@ -1527,3 +1638,3 @@ exports.version = version; | ||
exports.linearClosed = linearClosed; | ||
exports.linear = linear; | ||
exports.linear = curveLinear; | ||
exports.line = line; | ||
@@ -1533,3 +1644,6 @@ exports.monotone = monotone; | ||
exports.pie = pie; | ||
exports.radialArea = radialArea; | ||
exports.radialLine = radialLine; | ||
exports.square = square; | ||
exports.star = star; | ||
exports.stepAfter = stepAfter; | ||
@@ -1540,5 +1654,5 @@ exports.stepBefore = stepBefore; | ||
exports.symbols = symbols; | ||
exports.triangleDown = triangleDown; | ||
exports.triangleUp = triangleUp; | ||
exports.triangle = triangle; | ||
exports.wye = wye; | ||
})); |
@@ -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 h(t){return t.outerRadius}function e(t){return t.startAngle}function _(t){return t.endAngle}function o(t){return t&&t.padAngle}function a(t){return t>=1?rt:-1>=t?-rt:Math.asin(t)}function l(t,i,n,s,h,e,_,o){var a=n-t,l=s-i,r=_-h,c=o-e,u=(r*(i-e)-c*(t-h))/(c*a-r*l);return[t+u*a,i+u*l]}function r(t,i,n,s,h,e,_){var o=t-n,a=i-s,l=(_?e:-e)/Math.sqrt(o*o+a*a),r=l*a,c=-l*o,u=t+r,x=i+c,f=n+r,y=s+c,p=(u+f)/2,d=(x+y)/2,g=f-u,m=y-x,v=g*g+m*m,T=h-e,M=u*y-f*x,b=(0>m?-1:1)*Math.sqrt(Math.max(0,T*T*v-M*M)),w=(M*m-g*b)/v,N=(-M*g-m*b)/v,k=(M*m+g*b)/v,E=(-M*g+m*b)/v,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:-r,y01:-c,x11:w*(h/T-1),y11:N*(h/T-1)}}function c(){function t(){var t,n,s=+c.apply(this,arguments),h=+u.apply(this,arguments),e=y.apply(this,arguments)-rt,_=p.apply(this,arguments)-rt,o=Math.abs(_-e),m=_>e;if(g||(g=t=i.path()),s>h&&(n=h,h=s,s=n),h>0)if(o>=ct)g.moveTo(h*Math.cos(e),h*Math.sin(e)),g.arc(0,0,h,e,_,!m),s>0&&(g.moveTo(s*Math.cos(_),s*Math.sin(_)),g.arc(0,0,s,_,e,m));else{var v=e,T=_,M=e,b=_,w=o,N=o,k=d.apply(this,arguments)/2,E=k>0&&(f?+f.apply(this,arguments):Math.sqrt(s*s+h*h)),S=Math.min(Math.abs(h-s)/2,+x.apply(this,arguments)),P=S,A=S;if(E>0){var q=a(E/s*Math.sin(k)),C=a(E/h*Math.sin(k));(w-=2*q)>0?(q*=m?1:-1,M+=q,b-=q):(w=0,M=b=(e+_)/2),(N-=2*C)>0?(C*=m?1:-1,v+=C,T-=C):(N=0,v=T=(e+_)/2)}var R=h*Math.cos(v),z=h*Math.sin(v),I=s*Math.cos(b),O=s*Math.sin(b);if(S>0){var j=h*Math.cos(T),B=h*Math.sin(T),D=s*Math.cos(M),U=s*Math.sin(M);if(lt>o){var V=w>0?l(R,z,D,U,j,B,I,O):[I,O],F=R-V[0],G=z-V[1],H=j-V[0],J=B-V[1],K=1/Math.sin(Math.acos((F*H+G*J)/(Math.sqrt(F*F+G*G)*Math.sqrt(H*H+J*J)))/2),L=Math.sqrt(V[0]*V[0]+V[1]*V[1]);P=Math.min(S,(s-L)/(K-1)),A=Math.min(S,(h-L)/(K+1))}}if(N>0)if(A>0){var Q=r(D,U,R,z,h,A,m),W=r(j,B,I,O,h,A,m);g.moveTo(Q.cx+Q.x01,Q.cy+Q.y01),S>A?g.arc(Q.cx,Q.cy,A,Math.atan2(Q.y01,Q.x01),Math.atan2(W.y01,W.x01),!m):(g.arc(Q.cx,Q.cy,A,Math.atan2(Q.y01,Q.x01),Math.atan2(Q.y11,Q.x11),!m),g.arc(0,0,h,Math.atan2(Q.cy+Q.y11,Q.cx+Q.x11),Math.atan2(W.cy+W.y11,W.cx+W.x11),!m),g.arc(W.cx,W.cy,A,Math.atan2(W.y11,W.x11),Math.atan2(W.y01,W.x01),!m))}else g.moveTo(R,z),g.arc(0,0,h,v,T,!m);else g.moveTo(R,z);if(s>0&&w>0)if(P>0){var Q=r(I,O,j,B,s,-P,m),W=r(R,z,D,U,s,-P,m);g.lineTo(Q.cx+Q.x01,Q.cy+Q.y01),S>P?g.arc(Q.cx,Q.cy,P,Math.atan2(Q.y01,Q.x01),Math.atan2(W.y01,W.x01),!m):(g.arc(Q.cx,Q.cy,P,Math.atan2(Q.y01,Q.x01),Math.atan2(Q.y11,Q.x11),!m),g.arc(0,0,s,Math.atan2(Q.cy+Q.y11,Q.cx+Q.x11),Math.atan2(W.cy+W.y11,W.cx+W.x11),m),g.arc(W.cx,W.cy,P,Math.atan2(W.y11,W.x11),Math.atan2(W.y01,W.x01),!m))}else g.arc(0,0,s,b,M,m);else g.lineTo(I,O)}else g.moveTo(0,0);return g.closePath(),t?(g=null,t+""||null):void 0}var c=s,u=h,x=n(0),f=null,y=e,p=_,d=o,g=null,m=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-lt/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?(g=m=null==i?null:i,t):g},t}function u(t,i){return i=ut.call(i),i[0]=null,function(n){return i[0]=n,t.apply(null,i)}}function x(t){return new f(t)}function f(t){this._context=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),g=new Array(y);for(a||(r=l(f=i.path())),n=0;y>=n;++n){if(!(y>n&&o(x=t[n],n,t))===p)if(p=!p)c=n,r.areaStart(),r.lineStart();else{for(r.lineEnd(),r.lineStart(),u=n-1;u>=c;--u)r.point(d[u],g[u]);r.lineEnd(),r.areaEnd()}p&&(d[n]=+s(x,n,t),g[n]=+e(x,n,t),r.point(h?+h(x,n,t):d[n],_?+_(x,n,t):g[n]))}return f?(r=null,f+""||null):void 0}var s=y,h=null,e=n(0),_=p,o=n(!0),a=null,l=x,r=null;return t.x=function(i){return arguments.length?t.x0(i).x1(null):s},t.x0=function(i){return arguments.length?(s="function"==typeof i?i:n(+i),t):s},t.x1=function(i){return arguments.length?(h=null==i?null:"function"==typeof i?i:n(+i),t):h},t.y=function(i){return arguments.length?t.y0(i).y1(null):e},t.y0=function(i){return arguments.length?(e="function"==typeof i?i:n(+i),t):e},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){var n=arguments.length;return n?(l=n>1?u(i,arguments):i,null!=a&&(r=l(a)),t):l},t.context=function(i){return arguments.length?(null==i?a=r=null:r=l(a=i),t):a},t}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){return new v(t)}function v(t){this._context=t}function T(t){return new M(t)}function M(t){this._context=t}function b(t){return new w(t)}function w(t){this._context=t}function N(t,i){return null==i?new k(t,.85):1===(i=+i)?m(t):new k(t,i)}function k(t,i){this._basis=m(t),this._beta=i}function E(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 S(t,i){return new P(t,(null==i?1:1-i)/6)}function P(t,i){this._context=t,this._k=i}function A(t,i){return new q(t,(null==i?1:1-i)/6)}function q(t,i){this._context=t,this._k=i}function C(t,i){return new R(t,(null==i?1:1-i)/6)}function R(t,i){this._context=t,this._k=i}function z(t,i,n){var s=t._x1,h=t._y1,e=t._x2,_=t._y2;if(t._l01_a>xt){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,h=(h*o-t._y0*t._l12_2a+t._y2*t._l01_2a)/a}if(t._l23_a>xt){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,r=3*t._l23_a*(t._l23_a+t._l12_a);e=(e*l+t._x1*t._l23_2a-i*t._l12_2a)/r,_=(_*l+t._y1*t._l23_2a-n*t._l12_2a)/r}t._context.bezierCurveTo(s,h,e,_,t._x2,t._y2)}function I(t,i){return(i=null==i?.5:+i)?new O(t,i):S(t,0)}function O(t,i){this._context=t,this._alpha=i}function j(t,i){return(i=null==i?.5:+i)?new B(t,i):A(t,0)}function B(t,i){this._context=t,this._alpha=i}function D(t,i){return(i=null==i?.5:+i)?new U(t,i):C(t,0)}function U(t,i){this._context=t,this._alpha=i}function V(t){return new F(t)}function F(t){this._context=t}function G(){function t(t){var n,l,r,c=t.length,u=!1;for(_||(a=o(r=i.path())),n=0;c>=n;++n)!(c>n&&e(l=t[n],n,t))===u&&((u=!u)?a.lineStart():a.lineEnd()),u&&a.point(+s(l,n,t),+h(l,n,t));return r?(a=null,r+""||null):void 0}var s=y,h=p,e=n(!0),_=null,o=x,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?(h="function"==typeof i?i:n(+i),t):h},t.defined=function(i){return arguments.length?(e="function"==typeof i?i:n(!!i),t):e},t.curve=function(i){var n=arguments.length;return n?(o=n>1?u(i,arguments):i,null!=_&&(a=o(_)),t):o},t.context=function(i){return arguments.length?(null==i?_=a=null:a=o(_=i),t):_},t}function H(t){return 0>t?-1:1}function J(t,i,n){var s=t._x1-t._x0,h=i-t._x1,e=(t._y1-t._y0)/s,_=(n-t._y1)/h,o=(e*h+_*s)/(s+h);return(H(e)+H(_))*Math.min(Math.abs(e),Math.abs(_),.5*Math.abs(o))||0}function K(t,i){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-i)/2:i}function L(t,i,n){var s=t._x0,h=t._y0,e=t._x1,_=t._y1,o=(e-s)/3;t._context.bezierCurveTo(s+o,h+o*i,e-o,_-o*n,e,_)}function Q(t){return new W(t)}function W(t){this._context=t}function X(t){return new Y(t)}function Y(t){this._context=t}function Z(t){var i,n,s=t.length-1,h=new Array(s),e=new Array(s),_=new Array(s);for(h[0]=0,e[0]=2,_[0]=t[0]+2*t[1],i=1;s-1>i;++i)h[i]=1,e[i]=4,_[i]=4*t[i]+2*t[i+1];for(h[s-1]=2,e[s-1]=7,_[s-1]=8*t[s-1]+t[s],i=1;s>i;++i)n=h[i]/e[i-1],e[i]-=n,_[i]-=n*_[i-1];for(h[s-1]=_[s-1]/e[s-1],i=s-2;i>=0;--i)h[i]=(_[i]-h[i+1])/e[i];for(e[s-1]=(t[s]+h[s-1])/2,i=0;s-1>i;++i)e[i]=2*t[i+1]-h[i+1];return[h,e]}function $(t){return t}function tt(t,i){return t>i?-1:i>t?1:i>=t?0:NaN}function it(){function t(t){for(var n,a,l=t.length,r=0,c=new Array(l),u=new Array(l),x=+e.apply(this,arguments),f=Math.min(mt,Math.max(-mt,_.apply(this,arguments)-x)),y=Math.min(Math.abs(f)/l,o.apply(this,arguments)),p=y*(0>f?-1:1),d=0;l>d;++d)(a=u[c[d]=d]=+i(t[d],d,t))>0&&(r+=a);null!=s?c.sort(function(t,i){return s(u[t],u[i])}):null!==h&&c.sort(function(i,n){return h(t[i],t[n])});for(var g,d=0,m=r?(f-l*p)/r:0;l>d;++d,x=n)g=c[d],a=u[g],n=x+(a>0?a*m:0)+p,u[g]={data:t[g],value:a,startAngle:x,endAngle:n,padAngle:y};return u}var i=$,s=tt,h=null,e=n(0),_=n(mt),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,h=null,t):s},t.sort=function(i){return arguments.length?(h=i,s=null,t):h},t.startAngle=function(i){return arguments.length?(e="function"==typeof i?i:n(+i),t):e},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 nt(t){return new st(t)}function st(t){this._context=t}function ht(t){return new et(t)}function et(t){this._context=t}function _t(t){return new ot(t)}function ot(t){this._context=t}function at(){function t(){var t;return e||(e=t=i.path()),s.apply(this,arguments).draw(e,+h.apply(this,arguments)),t?(e=null,t+""||null):void 0}var s=n(ft),h=n(64),e=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?(h="function"==typeof i?i:n(+i),t):h},t.context=function(i){return arguments.length?(e=null==i?null:i,t):e},t}var lt=Math.PI,rt=lt/2,ct=2*lt,ut=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)}}},v.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={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,h=t[0],e=i[0],_=t[n]-h,o=i[n]-e,a=-1;++a<=n;)s=a/n,this._basis.point(this._beta*t[a]+(1-this._beta)*(h+s*_),this._beta*i[a]+(1-this._beta)*(e+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:E(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:E(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={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:E(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}},R.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:E(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}};var xt=1e-6;O.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:z(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}},B.prototype={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:z(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}},U.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:z(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 ft={draw:function(t,i){var n=Math.sqrt(i/Math.PI);t.moveTo(n,0),t.arc(0,0,n,0,2*Math.PI)}},yt={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()}},pt=Math.sqrt(1/3),dt=2*pt,gt={draw:function(t,i){var n=Math.sqrt(i/dt),s=n*pt;t.moveTo(0,-n),t.lineTo(s,0),t.lineTo(0,n),t.lineTo(-s,0),t.closePath()}};F.prototype={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:L(this,this._t0,K(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,L(this,K(this,n=J(this,t,i)),n);break;default:L(this,this._t0,n=J(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),h=Z(i),e=0,_=1;n>_;++e,++_)this._context.bezierCurveTo(s[0][e],h[0][e],s[1][e],h[1][e],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)}};var mt=2*Math.PI,vt={draw:function(t,i){var n=Math.sqrt(i),s=-n/2;t.rect(s,s,n,n)}};st.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}},et.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}},ot.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 Tt=Math.sqrt(3),Mt={draw:function(t,i){var n=Math.sqrt(i/Tt),s=n*Tt/2;t.moveTo(0,s),t.lineTo(n,-s),t.lineTo(-n,-s),t.closePath()}},bt={draw:function(t,i){var n=Math.sqrt(i/Tt),s=n*Tt/2;t.moveTo(0,-s),t.lineTo(n,s),t.lineTo(-n,s),t.closePath()}},wt=[ft,yt,gt,vt,Mt,bt],Nt="0.1.0";t.version=Nt,t.arc=c,t.area=d,t.basisClosed=T,t.basisOpen=b,t.basis=m,t.bundle=N,t.cardinalClosed=A,t.cardinalOpen=C,t.cardinal=S,t.catmullRomClosed=j,t.catmullRomOpen=D,t.catmullRom=I,t.circle=ft,t.cross=yt,t.diamond=gt,t.linearClosed=V,t.linear=x,t.line=G,t.monotone=Q,t.natural=X,t.pie=it,t.square=vt,t.stepAfter=nt,t.stepBefore=ht,t.step=_t,t.symbol=at,t.symbols=wt,t.triangleDown=Mt,t.triangleUp=bt}); | ||
!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?yt:-1>=t?-yt: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)-yt,_=p.apply(this,arguments)-yt,o=Math.abs(_-h),g=_>h;if(v||(v=t=i.path()),s>e&&(n=e,e=s,s=n),e>0)if(o>=pt)v.moveTo(e*Math.cos(h),e*Math.sin(h)),v.arc(0,0,e,h,_,!g),s>0&&(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>0&&(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>0){var q=a(E/s*Math.sin(k)),R=a(E/e*Math.sin(k));(w-=2*q)>0?(q*=g?1:-1,M+=q,b-=q):(w=0,M=b=(h+_)/2),(N-=2*R)>0?(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>0){var B=e*Math.cos(T),I=e*Math.sin(T),L=s*Math.cos(M),V=s*Math.sin(M);if(ft>o){var D=w>0?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>0)if(A>0){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>0&&w>0)if(P>0){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-ft/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=dt.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>vt){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>vt){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(pt,Math.max(-pt,_.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(pt),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=Math.PI,yt=ft/2,pt=2*ft,dt=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}};var vt=1e-6;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/ft);t.moveTo(n,0),t.arc(0,0,n,0,pt)}},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-=yt,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(ft/10)/Math.sin(7*ft/10),Et=Math.sin(pt/10)*kt,St=-Math.cos(pt/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 _=pt*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.0";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}); |
@@ -22,3 +22,6 @@ export {default as arc} from "./src/arc"; | ||
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"; | ||
@@ -28,2 +31,3 @@ export {default as stepBefore} from "./src/curve/stepBefore"; | ||
export {default as symbol, symbols} from "./src/symbol"; | ||
export {triangleDown, triangleUp} from "./src/symbol/triangle"; | ||
export {default as triangle} from "./src/symbol/triangle"; | ||
export {default as wye} from "./src/symbol/wye"; |
{ | ||
"name": "d3-shape", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Graphical primitives for visualization, such as lines and areas.", | ||
@@ -33,2 +33,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"d3-polygon": "~0.0.3", | ||
"faucet": "0.0", | ||
@@ -35,0 +36,0 @@ "rollup": "0.20.5", |
@@ -408,2 +408,28 @@ # d3-shape | ||
<a name="radialLine" href="#radialLine">#</a> <b>radialLine</b>() | ||
<img alt="Radial Line" width="250" height="250" src="https://raw.githubusercontent.com/d3/d3-shape/master/img/line-radial.png"> | ||
Constructs a new radial line generator with the default settings. A radial line generator is equivalent to the standard Cartesian [line generator](#line), except the [x](#line_x) and [y](#line_y) accessors are replaced with [angle](#radialLine_angle) and [radius](#radialLine_radius) accessors. Radial lines are always positioned relative to ⟨0,0⟩; use a transform (see: [SVG](http://www.w3.org/TR/SVG/coords.html#TransformAttribute), [Canvas](http://www.w3.org/TR/2dcontext/#transformations)) to change the origin. | ||
<a name="radialLine_angle" href="#radialLine_angle">#</a> <i>radialLine</i>.<b>angle</b>([<i>angle</i>]) | ||
Equivalent to [*line*.x](#line_x), except the accessor returns the angle in radians, with 0 at -*y* (12 o’clock). | ||
<a name="radialLine_radius" href="#radialLine_radius">#</a> <i>radialLine</i>.<b>radius</b>([<i>radius</i>]) | ||
Equivalent to [*line*.y](#line_y), except the accessor returns the radius: the distance from the origin ⟨0,0⟩. | ||
<a name="radialLine_defined" href="#radialLine_defined">#</a> <i>radialLine</i>.<b>defined</b>([<i>defined</i>]) | ||
Equivalent to [*line*.defined](#line_defined). | ||
<a name="radialLine_curve" href="#radialLine_curve">#</a> <i>radialLine</i>.<b>curve</b>([<i>curve</i>[, <i>parameters…</i>]]) | ||
Equivalent to [*line*.curve](#line_curve). Note that the [monotone](#monotone) curve is not recommended for radial lines because it assumes that the data is monotonic in *x*, which is typically untrue of radial lines. | ||
<a name="radialLine_context" href="#radialLine_context">#</a> <i>radialLine</i>.<b>context</b>([<i>context</i>]) | ||
Equivalent to [*line*.context](#line_context). | ||
### Areas | ||
@@ -510,4 +536,2 @@ | ||
Unlike [*line*.curve](#line_curve), this method **requires** that the curve implement [*curve*.areaStart](#curve_areaStart) and [*curve*.areaEnd](#curve_areaEnd); you cannot use closed curves such as [cardinalClosed](#cardinalClosed) with an area generator. Instead, a closed shape is produced by first rendering the topline and then rendering the baseline. | ||
<a name="area_context" href="#area_context">#</a> <i>area</i>.<b>context</b>([<i>context</i>]) | ||
@@ -517,2 +541,44 @@ | ||
<a name="radialArea" href="#radialArea">#</a> <b>radialArea</b>() | ||
<img alt="Radial Area" width="250" height="250" src="https://raw.githubusercontent.com/d3/d3-shape/master/img/area-radial.png"> | ||
Constructs a new radial area generator with the default settings. A radial area generator is equivalent to the standard Cartesian [area generator](#area), except the [x](#area_x) and [y](#area_y) accessors are replaced with [angle](#radialArea_angle) and [radius](#radialArea_radius) accessors. Radial areas are always positioned relative to ⟨0,0⟩; use a transform (see: [SVG](http://www.w3.org/TR/SVG/coords.html#TransformAttribute), [Canvas](http://www.w3.org/TR/2dcontext/#transformations)) to change the origin. | ||
<a name="radialArea_angle" href="#radialArea_angle">#</a> <i>radialArea</i>.<b>angle</b>([<i>angle</i>]) | ||
Equivalent to [*area*.x](#area_x), except the accessor returns the angle in radians, with 0 at -*y* (12 o’clock). | ||
<a name="radialArea_startAngle" href="#radialArea_startAngle">#</a> <i>radialArea</i>.<b>startAngle</b>([<i>angle</i>]) | ||
Equivalent to [*area*.x0](#area_x0), except the accessor returns the angle in radians, with 0 at -*y* (12 o’clock). Note: typically [angle](#radialArea_angle) is used instead of setting separate start and end angles. | ||
<a name="radialArea_endAngle" href="#radialArea_endAngle">#</a> <i>radialArea</i>.<b>endAngle</b>([<i>angle</i>]) | ||
Equivalent to [*area*.x1](#area_x1), except the accessor returns the angle in radians, with 0 at -*y* (12 o’clock). Note: typically [angle](#radialArea_angle) is used instead of setting separate start and end angles. | ||
<a name="radialArea_radius" href="#radialArea_radius">#</a> <i>radialArea</i>.<b>radius</b>([<i>radius</i>]) | ||
Equivalent to [*area*.y](#area_y), except the accessor returns the radius: the distance from the origin ⟨0,0⟩. | ||
<a name="radialArea_innerRadius" href="#radialArea_innerRadius">#</a> <i>radialArea</i>.<b>innerRadius</b>([<i>radius</i>]) | ||
Equivalent to [*area*.y0](#area_y0), except the accessor returns the radius: the distance from the origin ⟨0,0⟩. | ||
<a name="radialArea_outerRadius" href="#radialArea_outerRadius">#</a> <i>radialArea</i>.<b>outerRadius</b>([<i>radius</i>]) | ||
Equivalent to [*area*.y1](#area_y1), except the accessor returns the radius: the distance from the origin ⟨0,0⟩. | ||
<a name="radialArea_defined" href="#radialArea_defined">#</a> <i>radialArea</i>.<b>defined</b>([<i>defined</i>]) | ||
Equivalent to [*area*.defined](#area_defined). | ||
<a name="radialArea_curve" href="#radialArea_curve">#</a> <i>radialArea</i>.<b>curve</b>([<i>curve</i>[, <i>parameters…</i>]]) | ||
Equivalent to [*area*.curve](#area_curve). Note that the [monotone](#monotone) curve is not recommended for radial areas because it assumes that the data is monotonic in *x*, which is typically untrue of radial areas. | ||
<a name="radialArea_context" href="#radialArea_context">#</a> <i>radialArea</i>.<b>context</b>([<i>context</i>]) | ||
Equivalent to [*line*.context](#line_context). | ||
### Curves | ||
@@ -632,7 +698,7 @@ | ||
Indicates the start of a new area segment. Each area segment consists of exactly two [line segments](#curve_lineStart): the topline, followed by the baseline, with the baseline points in reverse order. Note: this method need not be implemented by closed curves, such as <a href="#linearClosed">linearClosed</a>. | ||
Indicates the start of a new area segment. Each area segment consists of exactly two [line segments](#curve_lineStart): the topline, followed by the baseline, with the baseline points in reverse order. | ||
<a name="curve_areaEnd" href="#curve_areaEnd">#</a> <i>curve</i>.<b>areaEnd</b>() | ||
Indicates the end of the current area segment. Note: this method need not be implemented by closed curves, such as <a href="#linearClosed">linearClosed</a>. | ||
Indicates the end of the current area segment. | ||
@@ -653,2 +719,4 @@ <a name="curve_lineStart" href="#curve_lineStart">#</a> <i>curve</i>.<b>lineStart</b>() | ||
<a href="#circle"><img src="https://raw.githubusercontent.com/d3/d3-shape/master/img/circle.png" width="100" height="100"></a><a href="#cross"><img src="https://raw.githubusercontent.com/d3/d3-shape/master/img/cross.png" width="100" height="100"></a><a href="#diamond"><img src="https://raw.githubusercontent.com/d3/d3-shape/master/img/diamond.png" width="100" height="100"></a><a href="#square"><img src="https://raw.githubusercontent.com/d3/d3-shape/master/img/square.png" width="100" height="100"></a><a href="#star"><img src="https://raw.githubusercontent.com/d3/d3-shape/master/img/star.png" width="100" height="100"></a><a href="#triangle"><img src="https://raw.githubusercontent.com/d3/d3-shape/master/img/triangle.png" width="100" height="100"><a href="#wye"><img src="https://raw.githubusercontent.com/d3/d3-shape/master/img/wye.png" width="100" height="100"></a> | ||
Symbols provide a categorical shape encoding as is commonly used in scatterplots. Symbols are always centered at ⟨0,0⟩; use a transform (see: [SVG](http://www.w3.org/TR/SVG/coords.html#TransformAttribute), [Canvas](http://www.w3.org/TR/2dcontext/#transformations)) to move the arc to a different position. | ||
@@ -686,8 +754,6 @@ | ||
An array containing the set of all built-in symbol types: [circle](#circle), [cross](#cross), [diamond](#diamond), [square](#square), [downwards triangle](#triangleDown), and [upwards triangle](#triangleUp). Useful for constructing the range of an [ordinal scale](https://github.com/d3/d3-scale#ordinal-scales) should you wish to use a shape encoding for categorical data. | ||
An array containing the set of all built-in symbol types: [circle](#circle), [cross](#cross), [diamond](#diamond), [square](#square), [star](#star), [triangle](#triangle), and [wye](#wye). Useful for constructing the range of an [ordinal scale](https://github.com/d3/d3-scale#ordinal-scales) should you wish to use a shape encoding for categorical data. | ||
<a name="circle" href="#circle">#</a> <b>circle</b> | ||
<img src="https://raw.githubusercontent.com/d3/d3-shape/master/img/circle.png" width="100" height="100"> | ||
A circle. | ||
@@ -697,4 +763,2 @@ | ||
<img src="https://raw.githubusercontent.com/d3/d3-shape/master/img/cross.png" width="100" height="100"> | ||
A Greek cross with arms of equal length. | ||
@@ -704,4 +768,2 @@ | ||
<img src="https://raw.githubusercontent.com/d3/d3-shape/master/img/diamond.png" width="100" height="100"> | ||
A rhombus. | ||
@@ -711,17 +773,15 @@ | ||
<img src="https://raw.githubusercontent.com/d3/d3-shape/master/img/square.png" width="100" height="100"> | ||
A square. | ||
<a name="triangleDown" href="#triangleDown">#</a> <b>triangleDown</b> | ||
<a name="star" href="#star">#</a> <b>star</b> | ||
<img src="https://raw.githubusercontent.com/d3/d3-shape/master/img/triangleDown.png" width="100" height="100"> | ||
A pentagonal star (pentagram). | ||
A down-pointing triangle. | ||
<a name="triangle" href="#triangle">#</a> <b>triangle</b> | ||
<a name="triangleUp" href="#triangleUp">#</a> <b>triangleUp</b> | ||
An up-pointing triangle. | ||
<img src="https://raw.githubusercontent.com/d3/d3-shape/master/img/triangleUp.png" width="100" height="100"> | ||
<a name="wye" href="#wye">#</a> <b>wye</b> | ||
An up-pointing triangle. | ||
A Y-shape. | ||
@@ -728,0 +788,0 @@ ### Custom Symbol Types |
import {path} from "d3-path"; | ||
import constant from "./constant"; | ||
import {pi, halfPi, tau} from "./math"; | ||
var pi = Math.PI, | ||
piHalf = pi / 2, | ||
tau = 2 * pi; | ||
function arcInnerRadius(d) { | ||
@@ -29,3 +26,3 @@ return d.innerRadius; | ||
function asin(x) { | ||
return x >= 1 ? piHalf : x <= -1 ? -piHalf : Math.asin(x); | ||
return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x); | ||
} | ||
@@ -99,4 +96,4 @@ | ||
r1 = +outerRadius.apply(this, arguments), | ||
a0 = startAngle.apply(this, arguments) - piHalf, | ||
a1 = endAngle.apply(this, arguments) - piHalf, | ||
a0 = startAngle.apply(this, arguments) - halfPi, | ||
a1 = endAngle.apply(this, arguments) - halfPi, | ||
da = Math.abs(a1 - a0), | ||
@@ -103,0 +100,0 @@ cw = a1 > a0; |
@@ -56,3 +56,3 @@ import {path} from "d3-path"; | ||
area.x = function(_) { | ||
return arguments.length ? area.x0(_).x1(null) : x0; | ||
return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), x1 = null, area) : x0; | ||
}; | ||
@@ -69,3 +69,3 @@ | ||
area.y = function(_) { | ||
return arguments.length ? area.y0(_).y1(null) : y0; | ||
return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), y1 = null, area) : y0; | ||
}; | ||
@@ -86,4 +86,3 @@ | ||
area.curve = function(_) { | ||
var n = arguments.length; | ||
return n ? (curve = n > 1 ? curveBind(_, arguments) : _, context != null && (output = curve(context)), area) : curve; | ||
return arguments.length ? (curve = curveBind(_, arguments), context != null && (output = curve(context)), area) : curve; | ||
}; | ||
@@ -90,0 +89,0 @@ |
@@ -12,6 +12,2 @@ export function point(that, x, y) { | ||
function basis(context) { | ||
return new Basis(context); | ||
} | ||
function Basis(context) { | ||
@@ -54,2 +50,4 @@ this._context = context; | ||
export default basis; | ||
export default function(context) { | ||
return new Basis(context); | ||
}; |
@@ -0,7 +1,4 @@ | ||
import noop from "../noop"; | ||
import {point} from "./basis"; | ||
function basisClosed(context) { | ||
return new BasisClosed(context); | ||
} | ||
function BasisClosed(context) { | ||
@@ -12,2 +9,4 @@ this._context = context; | ||
BasisClosed.prototype = { | ||
areaStart: noop, | ||
areaEnd: noop, | ||
lineStart: function() { | ||
@@ -52,2 +51,4 @@ this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = | ||
export default basisClosed; | ||
export default function(context) { | ||
return new BasisClosed(context); | ||
}; |
import {point} from "./basis"; | ||
function basisOpen(context) { | ||
return new BasisOpen(context); | ||
} | ||
function BasisOpen(context) { | ||
@@ -41,2 +37,4 @@ this._context = context; | ||
export default basisOpen; | ||
export default function(context) { | ||
return new BasisOpen(context); | ||
}; |
var slice = Array.prototype.slice; | ||
export default function(interpolate, args) { | ||
export default function(curve, args) { | ||
if (args.length < 2) return curve; | ||
args = slice.call(args); | ||
@@ -8,4 +9,4 @@ args[0] = null; | ||
args[0] = context; | ||
return interpolate.apply(null, args); | ||
return curve.apply(null, args); | ||
}; | ||
}; |
import basis from "./basis"; | ||
function bundle(context, beta) { | ||
return beta == null ? new Bundle(context, 0.85) | ||
: (beta = +beta) === 1 ? basis(context) | ||
: new Bundle(context, beta); | ||
} | ||
function Bundle(context, beta) { | ||
@@ -51,2 +45,6 @@ this._basis = basis(context); | ||
export default bundle; | ||
export default function(context, beta) { | ||
return beta == null ? new Bundle(context, 0.85) | ||
: (beta = +beta) === 1 ? basis(context) | ||
: new Bundle(context, beta); | ||
}; |
@@ -12,6 +12,2 @@ export function point(that, x, y) { | ||
function cardinal(context, tension) { | ||
return new Cardinal(context, (tension == null ? 1 : 1 - tension) / 6); | ||
} | ||
function Cardinal(context, k) { | ||
@@ -55,2 +51,4 @@ this._context = context; | ||
export default cardinal; | ||
export default function(context, tension) { | ||
return new Cardinal(context, (tension == null ? 1 : 1 - tension) / 6); | ||
}; |
@@ -0,7 +1,4 @@ | ||
import noop from "../noop"; | ||
import {point} from "./cardinal"; | ||
function cardinalClosed(context, tension) { | ||
return new CardinalClosed(context, (tension == null ? 1 : 1 - tension) / 6); | ||
} | ||
function CardinalClosed(context, k) { | ||
@@ -13,2 +10,4 @@ this._context = context; | ||
CardinalClosed.prototype = { | ||
areaStart: noop, | ||
areaEnd: noop, | ||
lineStart: function() { | ||
@@ -52,2 +51,4 @@ this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = | ||
export default cardinalClosed; | ||
export default function(context, tension) { | ||
return new CardinalClosed(context, (tension == null ? 1 : 1 - tension) / 6); | ||
}; |
import {point} from "./cardinal"; | ||
function cardinalOpen(context, tension) { | ||
return new CardinalOpen(context, (tension == null ? 1 : 1 - tension) / 6); | ||
} | ||
function CardinalOpen(context, k) { | ||
@@ -42,2 +38,4 @@ this._context = context; | ||
export default cardinalOpen; | ||
export default function(context, tension) { | ||
return new CardinalOpen(context, (tension == null ? 1 : 1 - tension) / 6); | ||
}; |
@@ -28,8 +28,2 @@ import cardinal from "./cardinal"; | ||
function catmullRom(context, alpha) { | ||
return (alpha = alpha == null ? 0.5 : +alpha) | ||
? new CatmullRom(context, alpha) | ||
: cardinal(context, 0); | ||
} | ||
function CatmullRom(context, alpha) { | ||
@@ -85,2 +79,6 @@ this._context = context; | ||
export default catmullRom; | ||
export default function(context, alpha) { | ||
return (alpha = alpha == null ? 0.5 : +alpha) | ||
? new CatmullRom(context, alpha) | ||
: cardinal(context, 0); | ||
}; |
import cardinalClosed from "./cardinalClosed"; | ||
import noop from "../noop"; | ||
import {point} from "./catmullRom"; | ||
function catmullRomClosed(context, alpha) { | ||
return (alpha = alpha == null ? 0.5 : +alpha) | ||
? new CatmullRomClosed(context, alpha) | ||
: cardinalClosed(context, 0); | ||
} | ||
function CatmullRomClosed(context, alpha) { | ||
@@ -16,2 +11,4 @@ this._context = context; | ||
CatmullRomClosed.prototype = { | ||
areaStart: noop, | ||
areaEnd: noop, | ||
lineStart: function() { | ||
@@ -67,2 +64,6 @@ this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = | ||
export default catmullRomClosed; | ||
export default function(context, alpha) { | ||
return (alpha = alpha == null ? 0.5 : +alpha) | ||
? new CatmullRomClosed(context, alpha) | ||
: cardinalClosed(context, 0); | ||
}; |
import cardinalOpen from "./cardinalOpen"; | ||
import {point} from "./catmullRom"; | ||
function catmullRomOpen(context, alpha) { | ||
return (alpha = alpha == null ? 0.5 : +alpha) | ||
? new CatmullRomOpen(context, alpha) | ||
: cardinalOpen(context, 0); | ||
} | ||
function CatmullRomOpen(context, alpha) { | ||
@@ -57,2 +51,6 @@ this._context = context; | ||
export default catmullRomOpen; | ||
export default function(context, alpha) { | ||
return (alpha = alpha == null ? 0.5 : +alpha) | ||
? new CatmullRomOpen(context, alpha) | ||
: cardinalOpen(context, 0); | ||
}; |
@@ -1,5 +0,1 @@ | ||
function linear(context) { | ||
return new Linear(context); | ||
} | ||
function Linear(context) { | ||
@@ -33,2 +29,4 @@ this._context = context; | ||
export default linear; | ||
export default function(context) { | ||
return new Linear(context); | ||
}; |
@@ -1,4 +0,2 @@ | ||
function linearClosed(context) { | ||
return new LinearClosed(context); | ||
} | ||
import noop from "../noop"; | ||
@@ -10,2 +8,4 @@ function LinearClosed(context) { | ||
LinearClosed.prototype = { | ||
areaStart: noop, | ||
areaEnd: noop, | ||
lineStart: function() { | ||
@@ -24,2 +24,4 @@ this._point = 0; | ||
export default linearClosed; | ||
export default function(context) { | ||
return new LinearClosed(context); | ||
}; |
@@ -36,6 +36,2 @@ function sign(x) { | ||
function monotone(context) { | ||
return new Monotone(context); | ||
} | ||
function Monotone(context) { | ||
@@ -84,2 +80,4 @@ this._context = context; | ||
export default monotone; | ||
export default function(context) { | ||
return new Monotone(context); | ||
}; |
@@ -1,5 +0,1 @@ | ||
function natural(context) { | ||
return new Natural(context); | ||
} | ||
function Natural(context) { | ||
@@ -67,2 +63,4 @@ this._context = context; | ||
export default natural; | ||
export default function(context) { | ||
return new Natural(context); | ||
}; |
@@ -1,5 +0,1 @@ | ||
function step(context) { | ||
return new Step(context); | ||
} | ||
function Step(context) { | ||
@@ -41,2 +37,4 @@ this._context = context; | ||
export default step; | ||
export default function(context) { | ||
return new Step(context); | ||
}; |
@@ -1,5 +0,1 @@ | ||
function stepAfter(context) { | ||
return new StepAfter(context); | ||
} | ||
function StepAfter(context) { | ||
@@ -39,2 +35,4 @@ this._context = context; | ||
export default stepAfter; | ||
export default function(context) { | ||
return new StepAfter(context); | ||
}; |
@@ -1,5 +0,1 @@ | ||
function stepBefore(context) { | ||
return new StepBefore(context); | ||
} | ||
function StepBefore(context) { | ||
@@ -39,2 +35,4 @@ this._context = context; | ||
export default stepBefore; | ||
export default function(context) { | ||
return new StepBefore(context); | ||
}; |
@@ -48,4 +48,3 @@ import {path} from "d3-path"; | ||
line.curve = function(_) { | ||
var n = arguments.length; | ||
return n ? (curve = n > 1 ? curveBind(_, arguments) : _, context != null && (output = curve(context)), line) : curve; | ||
return arguments.length ? (curve = curveBind(_, arguments), context != null && (output = curve(context)), line) : curve; | ||
}; | ||
@@ -52,0 +51,0 @@ |
import constant from "./constant"; | ||
import descending from "./descending"; | ||
import identity from "./identity"; | ||
import {tau} from "./math"; | ||
var tau = 2 * Math.PI; | ||
function identity(d) { | ||
return d; | ||
} | ||
function descending(a, b) { | ||
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; | ||
} | ||
export default function() { | ||
@@ -14,0 +7,0 @@ var value = identity, |
@@ -5,4 +5,6 @@ import {path} from "d3-path"; | ||
import diamond from "./symbol/diamond"; | ||
import star from "./symbol/star"; | ||
import square from "./symbol/square"; | ||
import {triangleDown, triangleUp} from "./symbol/triangle"; | ||
import triangle from "./symbol/triangle"; | ||
import wye from "./symbol/wye"; | ||
import constant from "./constant"; | ||
@@ -15,4 +17,5 @@ | ||
square, | ||
triangleDown, | ||
triangleUp | ||
star, | ||
triangle, | ||
wye | ||
]; | ||
@@ -19,0 +22,0 @@ |
@@ -0,7 +1,9 @@ | ||
import {pi, tau} from "../math"; | ||
export default { | ||
draw: function(context, size) { | ||
var r = Math.sqrt(size / Math.PI); | ||
var r = Math.sqrt(size / pi); | ||
context.moveTo(r, 0); | ||
context.arc(0, 0, r, 0, 2 * Math.PI); | ||
context.arc(0, 0, r, 0, tau); | ||
} | ||
}; |
var sqrt3 = Math.sqrt(3); | ||
export var triangleDown = { | ||
export default { | ||
draw: function(context, size) { | ||
var x = Math.sqrt(size / sqrt3), | ||
y = x * sqrt3 / 2; | ||
context.moveTo(0, y); | ||
context.lineTo(x, -y); | ||
context.lineTo(-x, -y); | ||
var y = -Math.sqrt(size / (sqrt3 * 3)); | ||
context.moveTo(0, y * 2); | ||
context.lineTo(-sqrt3 * y, -y); | ||
context.lineTo(sqrt3 * y, -y); | ||
context.closePath(); | ||
} | ||
}; | ||
export var triangleUp = { | ||
draw: function(context, size) { | ||
var x = Math.sqrt(size / sqrt3), | ||
y = x * sqrt3 / 2; | ||
context.moveTo(0, -y); | ||
context.lineTo(x, y); | ||
context.lineTo(-x, y); | ||
context.closePath(); | ||
} | ||
}; |
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
978709
89
2855
804
5