d3-shape.js 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949
  1. // https://d3js.org/d3-shape/ v1.3.7 Copyright 2019 Mike Bostock
  2. (function (global, factory) {
  3. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-path')) :
  4. typeof define === 'function' && define.amd ? define(['exports', 'd3-path'], factory) :
  5. (global = global || self, factory(global.d3 = global.d3 || {}, global.d3));
  6. }(this, function (exports, d3Path) { 'use strict';
  7. function constant(x) {
  8. return function constant() {
  9. return x;
  10. };
  11. }
  12. var abs = Math.abs;
  13. var atan2 = Math.atan2;
  14. var cos = Math.cos;
  15. var max = Math.max;
  16. var min = Math.min;
  17. var sin = Math.sin;
  18. var sqrt = Math.sqrt;
  19. var epsilon = 1e-12;
  20. var pi = Math.PI;
  21. var halfPi = pi / 2;
  22. var tau = 2 * pi;
  23. function acos(x) {
  24. return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
  25. }
  26. function asin(x) {
  27. return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
  28. }
  29. function arcInnerRadius(d) {
  30. return d.innerRadius;
  31. }
  32. function arcOuterRadius(d) {
  33. return d.outerRadius;
  34. }
  35. function arcStartAngle(d) {
  36. return d.startAngle;
  37. }
  38. function arcEndAngle(d) {
  39. return d.endAngle;
  40. }
  41. function arcPadAngle(d) {
  42. return d && d.padAngle; // Note: optional!
  43. }
  44. function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
  45. var x10 = x1 - x0, y10 = y1 - y0,
  46. x32 = x3 - x2, y32 = y3 - y2,
  47. t = y32 * x10 - x32 * y10;
  48. if (t * t < epsilon) return;
  49. t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
  50. return [x0 + t * x10, y0 + t * y10];
  51. }
  52. // Compute perpendicular offset line of length rc.
  53. // http://mathworld.wolfram.com/Circle-LineIntersection.html
  54. function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
  55. var x01 = x0 - x1,
  56. y01 = y0 - y1,
  57. lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),
  58. ox = lo * y01,
  59. oy = -lo * x01,
  60. x11 = x0 + ox,
  61. y11 = y0 + oy,
  62. x10 = x1 + ox,
  63. y10 = y1 + oy,
  64. x00 = (x11 + x10) / 2,
  65. y00 = (y11 + y10) / 2,
  66. dx = x10 - x11,
  67. dy = y10 - y11,
  68. d2 = dx * dx + dy * dy,
  69. r = r1 - rc,
  70. D = x11 * y10 - x10 * y11,
  71. d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),
  72. cx0 = (D * dy - dx * d) / d2,
  73. cy0 = (-D * dx - dy * d) / d2,
  74. cx1 = (D * dy + dx * d) / d2,
  75. cy1 = (-D * dx + dy * d) / d2,
  76. dx0 = cx0 - x00,
  77. dy0 = cy0 - y00,
  78. dx1 = cx1 - x00,
  79. dy1 = cy1 - y00;
  80. // Pick the closer of the two intersection points.
  81. // TODO Is there a faster way to determine which intersection to use?
  82. if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
  83. return {
  84. cx: cx0,
  85. cy: cy0,
  86. x01: -ox,
  87. y01: -oy,
  88. x11: cx0 * (r1 / r - 1),
  89. y11: cy0 * (r1 / r - 1)
  90. };
  91. }
  92. function arc() {
  93. var innerRadius = arcInnerRadius,
  94. outerRadius = arcOuterRadius,
  95. cornerRadius = constant(0),
  96. padRadius = null,
  97. startAngle = arcStartAngle,
  98. endAngle = arcEndAngle,
  99. padAngle = arcPadAngle,
  100. context = null;
  101. function arc() {
  102. var buffer,
  103. r,
  104. r0 = +innerRadius.apply(this, arguments),
  105. r1 = +outerRadius.apply(this, arguments),
  106. a0 = startAngle.apply(this, arguments) - halfPi,
  107. a1 = endAngle.apply(this, arguments) - halfPi,
  108. da = abs(a1 - a0),
  109. cw = a1 > a0;
  110. if (!context) context = buffer = d3Path.path();
  111. // Ensure that the outer radius is always larger than the inner radius.
  112. if (r1 < r0) r = r1, r1 = r0, r0 = r;
  113. // Is it a point?
  114. if (!(r1 > epsilon)) context.moveTo(0, 0);
  115. // Or is it a circle or annulus?
  116. else if (da > tau - epsilon) {
  117. context.moveTo(r1 * cos(a0), r1 * sin(a0));
  118. context.arc(0, 0, r1, a0, a1, !cw);
  119. if (r0 > epsilon) {
  120. context.moveTo(r0 * cos(a1), r0 * sin(a1));
  121. context.arc(0, 0, r0, a1, a0, cw);
  122. }
  123. }
  124. // Or is it a circular or annular sector?
  125. else {
  126. var a01 = a0,
  127. a11 = a1,
  128. a00 = a0,
  129. a10 = a1,
  130. da0 = da,
  131. da1 = da,
  132. ap = padAngle.apply(this, arguments) / 2,
  133. rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),
  134. rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
  135. rc0 = rc,
  136. rc1 = rc,
  137. t0,
  138. t1;
  139. // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.
  140. if (rp > epsilon) {
  141. var p0 = asin(rp / r0 * sin(ap)),
  142. p1 = asin(rp / r1 * sin(ap));
  143. if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;
  144. else da0 = 0, a00 = a10 = (a0 + a1) / 2;
  145. if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;
  146. else da1 = 0, a01 = a11 = (a0 + a1) / 2;
  147. }
  148. var x01 = r1 * cos(a01),
  149. y01 = r1 * sin(a01),
  150. x10 = r0 * cos(a10),
  151. y10 = r0 * sin(a10);
  152. // Apply rounded corners?
  153. if (rc > epsilon) {
  154. var x11 = r1 * cos(a11),
  155. y11 = r1 * sin(a11),
  156. x00 = r0 * cos(a00),
  157. y00 = r0 * sin(a00),
  158. oc;
  159. // Restrict the corner radius according to the sector angle.
  160. if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {
  161. var ax = x01 - oc[0],
  162. ay = y01 - oc[1],
  163. bx = x11 - oc[0],
  164. by = y11 - oc[1],
  165. kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),
  166. lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
  167. rc0 = min(rc, (r0 - lc) / (kc - 1));
  168. rc1 = min(rc, (r1 - lc) / (kc + 1));
  169. }
  170. }
  171. // Is the sector collapsed to a line?
  172. if (!(da1 > epsilon)) context.moveTo(x01, y01);
  173. // Does the sector’s outer ring have rounded corners?
  174. else if (rc1 > epsilon) {
  175. t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
  176. t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
  177. context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
  178. // Have the corners merged?
  179. if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
  180. // Otherwise, draw the two corners and the ring.
  181. else {
  182. context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
  183. context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
  184. context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
  185. }
  186. }
  187. // Or is the outer ring just a circular arc?
  188. else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
  189. // Is there no inner ring, and it’s a circular sector?
  190. // Or perhaps it’s an annular sector collapsed due to padding?
  191. if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);
  192. // Does the sector’s inner ring (or point) have rounded corners?
  193. else if (rc0 > epsilon) {
  194. t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
  195. t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
  196. context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
  197. // Have the corners merged?
  198. if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
  199. // Otherwise, draw the two corners and the ring.
  200. else {
  201. context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
  202. context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
  203. context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
  204. }
  205. }
  206. // Or is the inner ring just a circular arc?
  207. else context.arc(0, 0, r0, a10, a00, cw);
  208. }
  209. context.closePath();
  210. if (buffer) return context = null, buffer + "" || null;
  211. }
  212. arc.centroid = function() {
  213. var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,
  214. a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
  215. return [cos(a) * r, sin(a) * r];
  216. };
  217. arc.innerRadius = function(_) {
  218. return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius;
  219. };
  220. arc.outerRadius = function(_) {
  221. return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius;
  222. };
  223. arc.cornerRadius = function(_) {
  224. return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius;
  225. };
  226. arc.padRadius = function(_) {
  227. return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius;
  228. };
  229. arc.startAngle = function(_) {
  230. return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle;
  231. };
  232. arc.endAngle = function(_) {
  233. return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle;
  234. };
  235. arc.padAngle = function(_) {
  236. return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle;
  237. };
  238. arc.context = function(_) {
  239. return arguments.length ? ((context = _ == null ? null : _), arc) : context;
  240. };
  241. return arc;
  242. }
  243. function Linear(context) {
  244. this._context = context;
  245. }
  246. Linear.prototype = {
  247. areaStart: function() {
  248. this._line = 0;
  249. },
  250. areaEnd: function() {
  251. this._line = NaN;
  252. },
  253. lineStart: function() {
  254. this._point = 0;
  255. },
  256. lineEnd: function() {
  257. if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
  258. this._line = 1 - this._line;
  259. },
  260. point: function(x, y) {
  261. x = +x, y = +y;
  262. switch (this._point) {
  263. case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
  264. case 1: this._point = 2; // proceed
  265. default: this._context.lineTo(x, y); break;
  266. }
  267. }
  268. };
  269. function curveLinear(context) {
  270. return new Linear(context);
  271. }
  272. function x(p) {
  273. return p[0];
  274. }
  275. function y(p) {
  276. return p[1];
  277. }
  278. function line() {
  279. var x$1 = x,
  280. y$1 = y,
  281. defined = constant(true),
  282. context = null,
  283. curve = curveLinear,
  284. output = null;
  285. function line(data) {
  286. var i,
  287. n = data.length,
  288. d,
  289. defined0 = false,
  290. buffer;
  291. if (context == null) output = curve(buffer = d3Path.path());
  292. for (i = 0; i <= n; ++i) {
  293. if (!(i < n && defined(d = data[i], i, data)) === defined0) {
  294. if (defined0 = !defined0) output.lineStart();
  295. else output.lineEnd();
  296. }
  297. if (defined0) output.point(+x$1(d, i, data), +y$1(d, i, data));
  298. }
  299. if (buffer) return output = null, buffer + "" || null;
  300. }
  301. line.x = function(_) {
  302. return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant(+_), line) : x$1;
  303. };
  304. line.y = function(_) {
  305. return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant(+_), line) : y$1;
  306. };
  307. line.defined = function(_) {
  308. return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line) : defined;
  309. };
  310. line.curve = function(_) {
  311. return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;
  312. };
  313. line.context = function(_) {
  314. return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context;
  315. };
  316. return line;
  317. }
  318. function area() {
  319. var x0 = x,
  320. x1 = null,
  321. y0 = constant(0),
  322. y1 = y,
  323. defined = constant(true),
  324. context = null,
  325. curve = curveLinear,
  326. output = null;
  327. function area(data) {
  328. var i,
  329. j,
  330. k,
  331. n = data.length,
  332. d,
  333. defined0 = false,
  334. buffer,
  335. x0z = new Array(n),
  336. y0z = new Array(n);
  337. if (context == null) output = curve(buffer = d3Path.path());
  338. for (i = 0; i <= n; ++i) {
  339. if (!(i < n && defined(d = data[i], i, data)) === defined0) {
  340. if (defined0 = !defined0) {
  341. j = i;
  342. output.areaStart();
  343. output.lineStart();
  344. } else {
  345. output.lineEnd();
  346. output.lineStart();
  347. for (k = i - 1; k >= j; --k) {
  348. output.point(x0z[k], y0z[k]);
  349. }
  350. output.lineEnd();
  351. output.areaEnd();
  352. }
  353. }
  354. if (defined0) {
  355. x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data);
  356. output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]);
  357. }
  358. }
  359. if (buffer) return output = null, buffer + "" || null;
  360. }
  361. function arealine() {
  362. return line().defined(defined).curve(curve).context(context);
  363. }
  364. area.x = function(_) {
  365. return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), x1 = null, area) : x0;
  366. };
  367. area.x0 = function(_) {
  368. return arguments.length ? (x0 = typeof _ === "function" ? _ : constant(+_), area) : x0;
  369. };
  370. area.x1 = function(_) {
  371. return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area) : x1;
  372. };
  373. area.y = function(_) {
  374. return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), y1 = null, area) : y0;
  375. };
  376. area.y0 = function(_) {
  377. return arguments.length ? (y0 = typeof _ === "function" ? _ : constant(+_), area) : y0;
  378. };
  379. area.y1 = function(_) {
  380. return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant(+_), area) : y1;
  381. };
  382. area.lineX0 =
  383. area.lineY0 = function() {
  384. return arealine().x(x0).y(y0);
  385. };
  386. area.lineY1 = function() {
  387. return arealine().x(x0).y(y1);
  388. };
  389. area.lineX1 = function() {
  390. return arealine().x(x1).y(y0);
  391. };
  392. area.defined = function(_) {
  393. return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), area) : defined;
  394. };
  395. area.curve = function(_) {
  396. return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;
  397. };
  398. area.context = function(_) {
  399. return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context;
  400. };
  401. return area;
  402. }
  403. function descending(a, b) {
  404. return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
  405. }
  406. function identity(d) {
  407. return d;
  408. }
  409. function pie() {
  410. var value = identity,
  411. sortValues = descending,
  412. sort = null,
  413. startAngle = constant(0),
  414. endAngle = constant(tau),
  415. padAngle = constant(0);
  416. function pie(data) {
  417. var i,
  418. n = data.length,
  419. j,
  420. k,
  421. sum = 0,
  422. index = new Array(n),
  423. arcs = new Array(n),
  424. a0 = +startAngle.apply(this, arguments),
  425. da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),
  426. a1,
  427. p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),
  428. pa = p * (da < 0 ? -1 : 1),
  429. v;
  430. for (i = 0; i < n; ++i) {
  431. if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {
  432. sum += v;
  433. }
  434. }
  435. // Optionally sort the arcs by previously-computed values or by data.
  436. if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });
  437. else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });
  438. // Compute the arcs! They are stored in the original data's order.
  439. for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {
  440. j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
  441. data: data[j],
  442. index: i,
  443. value: v,
  444. startAngle: a0,
  445. endAngle: a1,
  446. padAngle: p
  447. };
  448. }
  449. return arcs;
  450. }
  451. pie.value = function(_) {
  452. return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie) : value;
  453. };
  454. pie.sortValues = function(_) {
  455. return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
  456. };
  457. pie.sort = function(_) {
  458. return arguments.length ? (sort = _, sortValues = null, pie) : sort;
  459. };
  460. pie.startAngle = function(_) {
  461. return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie) : startAngle;
  462. };
  463. pie.endAngle = function(_) {
  464. return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie) : endAngle;
  465. };
  466. pie.padAngle = function(_) {
  467. return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie) : padAngle;
  468. };
  469. return pie;
  470. }
  471. var curveRadialLinear = curveRadial(curveLinear);
  472. function Radial(curve) {
  473. this._curve = curve;
  474. }
  475. Radial.prototype = {
  476. areaStart: function() {
  477. this._curve.areaStart();
  478. },
  479. areaEnd: function() {
  480. this._curve.areaEnd();
  481. },
  482. lineStart: function() {
  483. this._curve.lineStart();
  484. },
  485. lineEnd: function() {
  486. this._curve.lineEnd();
  487. },
  488. point: function(a, r) {
  489. this._curve.point(r * Math.sin(a), r * -Math.cos(a));
  490. }
  491. };
  492. function curveRadial(curve) {
  493. function radial(context) {
  494. return new Radial(curve(context));
  495. }
  496. radial._curve = curve;
  497. return radial;
  498. }
  499. function lineRadial(l) {
  500. var c = l.curve;
  501. l.angle = l.x, delete l.x;
  502. l.radius = l.y, delete l.y;
  503. l.curve = function(_) {
  504. return arguments.length ? c(curveRadial(_)) : c()._curve;
  505. };
  506. return l;
  507. }
  508. function lineRadial$1() {
  509. return lineRadial(line().curve(curveRadialLinear));
  510. }
  511. function areaRadial() {
  512. var a = area().curve(curveRadialLinear),
  513. c = a.curve,
  514. x0 = a.lineX0,
  515. x1 = a.lineX1,
  516. y0 = a.lineY0,
  517. y1 = a.lineY1;
  518. a.angle = a.x, delete a.x;
  519. a.startAngle = a.x0, delete a.x0;
  520. a.endAngle = a.x1, delete a.x1;
  521. a.radius = a.y, delete a.y;
  522. a.innerRadius = a.y0, delete a.y0;
  523. a.outerRadius = a.y1, delete a.y1;
  524. a.lineStartAngle = function() { return lineRadial(x0()); }, delete a.lineX0;
  525. a.lineEndAngle = function() { return lineRadial(x1()); }, delete a.lineX1;
  526. a.lineInnerRadius = function() { return lineRadial(y0()); }, delete a.lineY0;
  527. a.lineOuterRadius = function() { return lineRadial(y1()); }, delete a.lineY1;
  528. a.curve = function(_) {
  529. return arguments.length ? c(curveRadial(_)) : c()._curve;
  530. };
  531. return a;
  532. }
  533. function pointRadial(x, y) {
  534. return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)];
  535. }
  536. var slice = Array.prototype.slice;
  537. function linkSource(d) {
  538. return d.source;
  539. }
  540. function linkTarget(d) {
  541. return d.target;
  542. }
  543. function link(curve) {
  544. var source = linkSource,
  545. target = linkTarget,
  546. x$1 = x,
  547. y$1 = y,
  548. context = null;
  549. function link() {
  550. var buffer, argv = slice.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);
  551. if (!context) context = buffer = d3Path.path();
  552. curve(context, +x$1.apply(this, (argv[0] = s, argv)), +y$1.apply(this, argv), +x$1.apply(this, (argv[0] = t, argv)), +y$1.apply(this, argv));
  553. if (buffer) return context = null, buffer + "" || null;
  554. }
  555. link.source = function(_) {
  556. return arguments.length ? (source = _, link) : source;
  557. };
  558. link.target = function(_) {
  559. return arguments.length ? (target = _, link) : target;
  560. };
  561. link.x = function(_) {
  562. return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant(+_), link) : x$1;
  563. };
  564. link.y = function(_) {
  565. return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant(+_), link) : y$1;
  566. };
  567. link.context = function(_) {
  568. return arguments.length ? ((context = _ == null ? null : _), link) : context;
  569. };
  570. return link;
  571. }
  572. function curveHorizontal(context, x0, y0, x1, y1) {
  573. context.moveTo(x0, y0);
  574. context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);
  575. }
  576. function curveVertical(context, x0, y0, x1, y1) {
  577. context.moveTo(x0, y0);
  578. context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1);
  579. }
  580. function curveRadial$1(context, x0, y0, x1, y1) {
  581. var p0 = pointRadial(x0, y0),
  582. p1 = pointRadial(x0, y0 = (y0 + y1) / 2),
  583. p2 = pointRadial(x1, y0),
  584. p3 = pointRadial(x1, y1);
  585. context.moveTo(p0[0], p0[1]);
  586. context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);
  587. }
  588. function linkHorizontal() {
  589. return link(curveHorizontal);
  590. }
  591. function linkVertical() {
  592. return link(curveVertical);
  593. }
  594. function linkRadial() {
  595. var l = link(curveRadial$1);
  596. l.angle = l.x, delete l.x;
  597. l.radius = l.y, delete l.y;
  598. return l;
  599. }
  600. var circle = {
  601. draw: function(context, size) {
  602. var r = Math.sqrt(size / pi);
  603. context.moveTo(r, 0);
  604. context.arc(0, 0, r, 0, tau);
  605. }
  606. };
  607. var cross = {
  608. draw: function(context, size) {
  609. var r = Math.sqrt(size / 5) / 2;
  610. context.moveTo(-3 * r, -r);
  611. context.lineTo(-r, -r);
  612. context.lineTo(-r, -3 * r);
  613. context.lineTo(r, -3 * r);
  614. context.lineTo(r, -r);
  615. context.lineTo(3 * r, -r);
  616. context.lineTo(3 * r, r);
  617. context.lineTo(r, r);
  618. context.lineTo(r, 3 * r);
  619. context.lineTo(-r, 3 * r);
  620. context.lineTo(-r, r);
  621. context.lineTo(-3 * r, r);
  622. context.closePath();
  623. }
  624. };
  625. var tan30 = Math.sqrt(1 / 3),
  626. tan30_2 = tan30 * 2;
  627. var diamond = {
  628. draw: function(context, size) {
  629. var y = Math.sqrt(size / tan30_2),
  630. x = y * tan30;
  631. context.moveTo(0, -y);
  632. context.lineTo(x, 0);
  633. context.lineTo(0, y);
  634. context.lineTo(-x, 0);
  635. context.closePath();
  636. }
  637. };
  638. var ka = 0.89081309152928522810,
  639. kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10),
  640. kx = Math.sin(tau / 10) * kr,
  641. ky = -Math.cos(tau / 10) * kr;
  642. var star = {
  643. draw: function(context, size) {
  644. var r = Math.sqrt(size * ka),
  645. x = kx * r,
  646. y = ky * r;
  647. context.moveTo(0, -r);
  648. context.lineTo(x, y);
  649. for (var i = 1; i < 5; ++i) {
  650. var a = tau * i / 5,
  651. c = Math.cos(a),
  652. s = Math.sin(a);
  653. context.lineTo(s * r, -c * r);
  654. context.lineTo(c * x - s * y, s * x + c * y);
  655. }
  656. context.closePath();
  657. }
  658. };
  659. var square = {
  660. draw: function(context, size) {
  661. var w = Math.sqrt(size),
  662. x = -w / 2;
  663. context.rect(x, x, w, w);
  664. }
  665. };
  666. var sqrt3 = Math.sqrt(3);
  667. var triangle = {
  668. draw: function(context, size) {
  669. var y = -Math.sqrt(size / (sqrt3 * 3));
  670. context.moveTo(0, y * 2);
  671. context.lineTo(-sqrt3 * y, -y);
  672. context.lineTo(sqrt3 * y, -y);
  673. context.closePath();
  674. }
  675. };
  676. var c = -0.5,
  677. s = Math.sqrt(3) / 2,
  678. k = 1 / Math.sqrt(12),
  679. a = (k / 2 + 1) * 3;
  680. var wye = {
  681. draw: function(context, size) {
  682. var r = Math.sqrt(size / a),
  683. x0 = r / 2,
  684. y0 = r * k,
  685. x1 = x0,
  686. y1 = r * k + r,
  687. x2 = -x1,
  688. y2 = y1;
  689. context.moveTo(x0, y0);
  690. context.lineTo(x1, y1);
  691. context.lineTo(x2, y2);
  692. context.lineTo(c * x0 - s * y0, s * x0 + c * y0);
  693. context.lineTo(c * x1 - s * y1, s * x1 + c * y1);
  694. context.lineTo(c * x2 - s * y2, s * x2 + c * y2);
  695. context.lineTo(c * x0 + s * y0, c * y0 - s * x0);
  696. context.lineTo(c * x1 + s * y1, c * y1 - s * x1);
  697. context.lineTo(c * x2 + s * y2, c * y2 - s * x2);
  698. context.closePath();
  699. }
  700. };
  701. var symbols = [
  702. circle,
  703. cross,
  704. diamond,
  705. square,
  706. star,
  707. triangle,
  708. wye
  709. ];
  710. function symbol() {
  711. var type = constant(circle),
  712. size = constant(64),
  713. context = null;
  714. function symbol() {
  715. var buffer;
  716. if (!context) context = buffer = d3Path.path();
  717. type.apply(this, arguments).draw(context, +size.apply(this, arguments));
  718. if (buffer) return context = null, buffer + "" || null;
  719. }
  720. symbol.type = function(_) {
  721. return arguments.length ? (type = typeof _ === "function" ? _ : constant(_), symbol) : type;
  722. };
  723. symbol.size = function(_) {
  724. return arguments.length ? (size = typeof _ === "function" ? _ : constant(+_), symbol) : size;
  725. };
  726. symbol.context = function(_) {
  727. return arguments.length ? (context = _ == null ? null : _, symbol) : context;
  728. };
  729. return symbol;
  730. }
  731. function noop() {}
  732. function point(that, x, y) {
  733. that._context.bezierCurveTo(
  734. (2 * that._x0 + that._x1) / 3,
  735. (2 * that._y0 + that._y1) / 3,
  736. (that._x0 + 2 * that._x1) / 3,
  737. (that._y0 + 2 * that._y1) / 3,
  738. (that._x0 + 4 * that._x1 + x) / 6,
  739. (that._y0 + 4 * that._y1 + y) / 6
  740. );
  741. }
  742. function Basis(context) {
  743. this._context = context;
  744. }
  745. Basis.prototype = {
  746. areaStart: function() {
  747. this._line = 0;
  748. },
  749. areaEnd: function() {
  750. this._line = NaN;
  751. },
  752. lineStart: function() {
  753. this._x0 = this._x1 =
  754. this._y0 = this._y1 = NaN;
  755. this._point = 0;
  756. },
  757. lineEnd: function() {
  758. switch (this._point) {
  759. case 3: point(this, this._x1, this._y1); // proceed
  760. case 2: this._context.lineTo(this._x1, this._y1); break;
  761. }
  762. if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
  763. this._line = 1 - this._line;
  764. },
  765. point: function(x, y) {
  766. x = +x, y = +y;
  767. switch (this._point) {
  768. case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
  769. case 1: this._point = 2; break;
  770. case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed
  771. default: point(this, x, y); break;
  772. }
  773. this._x0 = this._x1, this._x1 = x;
  774. this._y0 = this._y1, this._y1 = y;
  775. }
  776. };
  777. function basis(context) {
  778. return new Basis(context);
  779. }
  780. function BasisClosed(context) {
  781. this._context = context;
  782. }
  783. BasisClosed.prototype = {
  784. areaStart: noop,
  785. areaEnd: noop,
  786. lineStart: function() {
  787. this._x0 = this._x1 = this._x2 = this._x3 = this._x4 =
  788. this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;
  789. this._point = 0;
  790. },
  791. lineEnd: function() {
  792. switch (this._point) {
  793. case 1: {
  794. this._context.moveTo(this._x2, this._y2);
  795. this._context.closePath();
  796. break;
  797. }
  798. case 2: {
  799. this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3);
  800. this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3);
  801. this._context.closePath();
  802. break;
  803. }
  804. case 3: {
  805. this.point(this._x2, this._y2);
  806. this.point(this._x3, this._y3);
  807. this.point(this._x4, this._y4);
  808. break;
  809. }
  810. }
  811. },
  812. point: function(x, y) {
  813. x = +x, y = +y;
  814. switch (this._point) {
  815. case 0: this._point = 1; this._x2 = x, this._y2 = y; break;
  816. case 1: this._point = 2; this._x3 = x, this._y3 = y; break;
  817. case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break;
  818. default: point(this, x, y); break;
  819. }
  820. this._x0 = this._x1, this._x1 = x;
  821. this._y0 = this._y1, this._y1 = y;
  822. }
  823. };
  824. function basisClosed(context) {
  825. return new BasisClosed(context);
  826. }
  827. function BasisOpen(context) {
  828. this._context = context;
  829. }
  830. BasisOpen.prototype = {
  831. areaStart: function() {
  832. this._line = 0;
  833. },
  834. areaEnd: function() {
  835. this._line = NaN;
  836. },
  837. lineStart: function() {
  838. this._x0 = this._x1 =
  839. this._y0 = this._y1 = NaN;
  840. this._point = 0;
  841. },
  842. lineEnd: function() {
  843. if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
  844. this._line = 1 - this._line;
  845. },
  846. point: function(x, y) {
  847. x = +x, y = +y;
  848. switch (this._point) {
  849. case 0: this._point = 1; break;
  850. case 1: this._point = 2; break;
  851. case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break;
  852. case 3: this._point = 4; // proceed
  853. default: point(this, x, y); break;
  854. }
  855. this._x0 = this._x1, this._x1 = x;
  856. this._y0 = this._y1, this._y1 = y;
  857. }
  858. };
  859. function basisOpen(context) {
  860. return new BasisOpen(context);
  861. }
  862. function Bundle(context, beta) {
  863. this._basis = new Basis(context);
  864. this._beta = beta;
  865. }
  866. Bundle.prototype = {
  867. lineStart: function() {
  868. this._x = [];
  869. this._y = [];
  870. this._basis.lineStart();
  871. },
  872. lineEnd: function() {
  873. var x = this._x,
  874. y = this._y,
  875. j = x.length - 1;
  876. if (j > 0) {
  877. var x0 = x[0],
  878. y0 = y[0],
  879. dx = x[j] - x0,
  880. dy = y[j] - y0,
  881. i = -1,
  882. t;
  883. while (++i <= j) {
  884. t = i / j;
  885. this._basis.point(
  886. this._beta * x[i] + (1 - this._beta) * (x0 + t * dx),
  887. this._beta * y[i] + (1 - this._beta) * (y0 + t * dy)
  888. );
  889. }
  890. }
  891. this._x = this._y = null;
  892. this._basis.lineEnd();
  893. },
  894. point: function(x, y) {
  895. this._x.push(+x);
  896. this._y.push(+y);
  897. }
  898. };
  899. var bundle = (function custom(beta) {
  900. function bundle(context) {
  901. return beta === 1 ? new Basis(context) : new Bundle(context, beta);
  902. }
  903. bundle.beta = function(beta) {
  904. return custom(+beta);
  905. };
  906. return bundle;
  907. })(0.85);
  908. function point$1(that, x, y) {
  909. that._context.bezierCurveTo(
  910. that._x1 + that._k * (that._x2 - that._x0),
  911. that._y1 + that._k * (that._y2 - that._y0),
  912. that._x2 + that._k * (that._x1 - x),
  913. that._y2 + that._k * (that._y1 - y),
  914. that._x2,
  915. that._y2
  916. );
  917. }
  918. function Cardinal(context, tension) {
  919. this._context = context;
  920. this._k = (1 - tension) / 6;
  921. }
  922. Cardinal.prototype = {
  923. areaStart: function() {
  924. this._line = 0;
  925. },
  926. areaEnd: function() {
  927. this._line = NaN;
  928. },
  929. lineStart: function() {
  930. this._x0 = this._x1 = this._x2 =
  931. this._y0 = this._y1 = this._y2 = NaN;
  932. this._point = 0;
  933. },
  934. lineEnd: function() {
  935. switch (this._point) {
  936. case 2: this._context.lineTo(this._x2, this._y2); break;
  937. case 3: point$1(this, this._x1, this._y1); break;
  938. }
  939. if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
  940. this._line = 1 - this._line;
  941. },
  942. point: function(x, y) {
  943. x = +x, y = +y;
  944. switch (this._point) {
  945. case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
  946. case 1: this._point = 2; this._x1 = x, this._y1 = y; break;
  947. case 2: this._point = 3; // proceed
  948. default: point$1(this, x, y); break;
  949. }
  950. this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
  951. this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
  952. }
  953. };
  954. var cardinal = (function custom(tension) {
  955. function cardinal(context) {
  956. return new Cardinal(context, tension);
  957. }
  958. cardinal.tension = function(tension) {
  959. return custom(+tension);
  960. };
  961. return cardinal;
  962. })(0);
  963. function CardinalClosed(context, tension) {
  964. this._context = context;
  965. this._k = (1 - tension) / 6;
  966. }
  967. CardinalClosed.prototype = {
  968. areaStart: noop,
  969. areaEnd: noop,
  970. lineStart: function() {
  971. this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =
  972. this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
  973. this._point = 0;
  974. },
  975. lineEnd: function() {
  976. switch (this._point) {
  977. case 1: {
  978. this._context.moveTo(this._x3, this._y3);
  979. this._context.closePath();
  980. break;
  981. }
  982. case 2: {
  983. this._context.lineTo(this._x3, this._y3);
  984. this._context.closePath();
  985. break;
  986. }
  987. case 3: {
  988. this.point(this._x3, this._y3);
  989. this.point(this._x4, this._y4);
  990. this.point(this._x5, this._y5);
  991. break;
  992. }
  993. }
  994. },
  995. point: function(x, y) {
  996. x = +x, y = +y;
  997. switch (this._point) {
  998. case 0: this._point = 1; this._x3 = x, this._y3 = y; break;
  999. case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;
  1000. case 2: this._point = 3; this._x5 = x, this._y5 = y; break;
  1001. default: point$1(this, x, y); break;
  1002. }
  1003. this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
  1004. this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
  1005. }
  1006. };
  1007. var cardinalClosed = (function custom(tension) {
  1008. function cardinal(context) {
  1009. return new CardinalClosed(context, tension);
  1010. }
  1011. cardinal.tension = function(tension) {
  1012. return custom(+tension);
  1013. };
  1014. return cardinal;
  1015. })(0);
  1016. function CardinalOpen(context, tension) {
  1017. this._context = context;
  1018. this._k = (1 - tension) / 6;
  1019. }
  1020. CardinalOpen.prototype = {
  1021. areaStart: function() {
  1022. this._line = 0;
  1023. },
  1024. areaEnd: function() {
  1025. this._line = NaN;
  1026. },
  1027. lineStart: function() {
  1028. this._x0 = this._x1 = this._x2 =
  1029. this._y0 = this._y1 = this._y2 = NaN;
  1030. this._point = 0;
  1031. },
  1032. lineEnd: function() {
  1033. if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
  1034. this._line = 1 - this._line;
  1035. },
  1036. point: function(x, y) {
  1037. x = +x, y = +y;
  1038. switch (this._point) {
  1039. case 0: this._point = 1; break;
  1040. case 1: this._point = 2; break;
  1041. case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;
  1042. case 3: this._point = 4; // proceed
  1043. default: point$1(this, x, y); break;
  1044. }
  1045. this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
  1046. this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
  1047. }
  1048. };
  1049. var cardinalOpen = (function custom(tension) {
  1050. function cardinal(context) {
  1051. return new CardinalOpen(context, tension);
  1052. }
  1053. cardinal.tension = function(tension) {
  1054. return custom(+tension);
  1055. };
  1056. return cardinal;
  1057. })(0);
  1058. function point$2(that, x, y) {
  1059. var x1 = that._x1,
  1060. y1 = that._y1,
  1061. x2 = that._x2,
  1062. y2 = that._y2;
  1063. if (that._l01_a > epsilon) {
  1064. var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,
  1065. n = 3 * that._l01_a * (that._l01_a + that._l12_a);
  1066. x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;
  1067. y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;
  1068. }
  1069. if (that._l23_a > epsilon) {
  1070. var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,
  1071. m = 3 * that._l23_a * (that._l23_a + that._l12_a);
  1072. x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;
  1073. y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;
  1074. }
  1075. that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);
  1076. }
  1077. function CatmullRom(context, alpha) {
  1078. this._context = context;
  1079. this._alpha = alpha;
  1080. }
  1081. CatmullRom.prototype = {
  1082. areaStart: function() {
  1083. this._line = 0;
  1084. },
  1085. areaEnd: function() {
  1086. this._line = NaN;
  1087. },
  1088. lineStart: function() {
  1089. this._x0 = this._x1 = this._x2 =
  1090. this._y0 = this._y1 = this._y2 = NaN;
  1091. this._l01_a = this._l12_a = this._l23_a =
  1092. this._l01_2a = this._l12_2a = this._l23_2a =
  1093. this._point = 0;
  1094. },
  1095. lineEnd: function() {
  1096. switch (this._point) {
  1097. case 2: this._context.lineTo(this._x2, this._y2); break;
  1098. case 3: this.point(this._x2, this._y2); break;
  1099. }
  1100. if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
  1101. this._line = 1 - this._line;
  1102. },
  1103. point: function(x, y) {
  1104. x = +x, y = +y;
  1105. if (this._point) {
  1106. var x23 = this._x2 - x,
  1107. y23 = this._y2 - y;
  1108. this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
  1109. }
  1110. switch (this._point) {
  1111. case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
  1112. case 1: this._point = 2; break;
  1113. case 2: this._point = 3; // proceed
  1114. default: point$2(this, x, y); break;
  1115. }
  1116. this._l01_a = this._l12_a, this._l12_a = this._l23_a;
  1117. this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
  1118. this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
  1119. this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
  1120. }
  1121. };
  1122. var catmullRom = (function custom(alpha) {
  1123. function catmullRom(context) {
  1124. return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);
  1125. }
  1126. catmullRom.alpha = function(alpha) {
  1127. return custom(+alpha);
  1128. };
  1129. return catmullRom;
  1130. })(0.5);
  1131. function CatmullRomClosed(context, alpha) {
  1132. this._context = context;
  1133. this._alpha = alpha;
  1134. }
  1135. CatmullRomClosed.prototype = {
  1136. areaStart: noop,
  1137. areaEnd: noop,
  1138. lineStart: function() {
  1139. this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =
  1140. this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
  1141. this._l01_a = this._l12_a = this._l23_a =
  1142. this._l01_2a = this._l12_2a = this._l23_2a =
  1143. this._point = 0;
  1144. },
  1145. lineEnd: function() {
  1146. switch (this._point) {
  1147. case 1: {
  1148. this._context.moveTo(this._x3, this._y3);
  1149. this._context.closePath();
  1150. break;
  1151. }
  1152. case 2: {
  1153. this._context.lineTo(this._x3, this._y3);
  1154. this._context.closePath();
  1155. break;
  1156. }
  1157. case 3: {
  1158. this.point(this._x3, this._y3);
  1159. this.point(this._x4, this._y4);
  1160. this.point(this._x5, this._y5);
  1161. break;
  1162. }
  1163. }
  1164. },
  1165. point: function(x, y) {
  1166. x = +x, y = +y;
  1167. if (this._point) {
  1168. var x23 = this._x2 - x,
  1169. y23 = this._y2 - y;
  1170. this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
  1171. }
  1172. switch (this._point) {
  1173. case 0: this._point = 1; this._x3 = x, this._y3 = y; break;
  1174. case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;
  1175. case 2: this._point = 3; this._x5 = x, this._y5 = y; break;
  1176. default: point$2(this, x, y); break;
  1177. }
  1178. this._l01_a = this._l12_a, this._l12_a = this._l23_a;
  1179. this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
  1180. this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
  1181. this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
  1182. }
  1183. };
  1184. var catmullRomClosed = (function custom(alpha) {
  1185. function catmullRom(context) {
  1186. return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);
  1187. }
  1188. catmullRom.alpha = function(alpha) {
  1189. return custom(+alpha);
  1190. };
  1191. return catmullRom;
  1192. })(0.5);
  1193. function CatmullRomOpen(context, alpha) {
  1194. this._context = context;
  1195. this._alpha = alpha;
  1196. }
  1197. CatmullRomOpen.prototype = {
  1198. areaStart: function() {
  1199. this._line = 0;
  1200. },
  1201. areaEnd: function() {
  1202. this._line = NaN;
  1203. },
  1204. lineStart: function() {
  1205. this._x0 = this._x1 = this._x2 =
  1206. this._y0 = this._y1 = this._y2 = NaN;
  1207. this._l01_a = this._l12_a = this._l23_a =
  1208. this._l01_2a = this._l12_2a = this._l23_2a =
  1209. this._point = 0;
  1210. },
  1211. lineEnd: function() {
  1212. if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath();
  1213. this._line = 1 - this._line;
  1214. },
  1215. point: function(x, y) {
  1216. x = +x, y = +y;
  1217. if (this._point) {
  1218. var x23 = this._x2 - x,
  1219. y23 = this._y2 - y;
  1220. this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
  1221. }
  1222. switch (this._point) {
  1223. case 0: this._point = 1; break;
  1224. case 1: this._point = 2; break;
  1225. case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break;
  1226. case 3: this._point = 4; // proceed
  1227. default: point$2(this, x, y); break;
  1228. }
  1229. this._l01_a = this._l12_a, this._l12_a = this._l23_a;
  1230. this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
  1231. this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
  1232. this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
  1233. }
  1234. };
  1235. var catmullRomOpen = (function custom(alpha) {
  1236. function catmullRom(context) {
  1237. return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);
  1238. }
  1239. catmullRom.alpha = function(alpha) {
  1240. return custom(+alpha);
  1241. };
  1242. return catmullRom;
  1243. })(0.5);
  1244. function LinearClosed(context) {
  1245. this._context = context;
  1246. }
  1247. LinearClosed.prototype = {
  1248. areaStart: noop,
  1249. areaEnd: noop,
  1250. lineStart: function() {
  1251. this._point = 0;
  1252. },
  1253. lineEnd: function() {
  1254. if (this._point) this._context.closePath();
  1255. },
  1256. point: function(x, y) {
  1257. x = +x, y = +y;
  1258. if (this._point) this._context.lineTo(x, y);
  1259. else this._point = 1, this._context.moveTo(x, y);
  1260. }
  1261. };
  1262. function linearClosed(context) {
  1263. return new LinearClosed(context);
  1264. }
  1265. function sign(x) {
  1266. return x < 0 ? -1 : 1;
  1267. }
  1268. // Calculate the slopes of the tangents (Hermite-type interpolation) based on
  1269. // the following paper: Steffen, M. 1990. A Simple Method for Monotonic
  1270. // Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.
  1271. // NOV(II), P. 443, 1990.
  1272. function slope3(that, x2, y2) {
  1273. var h0 = that._x1 - that._x0,
  1274. h1 = x2 - that._x1,
  1275. s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),
  1276. s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),
  1277. p = (s0 * h1 + s1 * h0) / (h0 + h1);
  1278. return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;
  1279. }
  1280. // Calculate a one-sided slope.
  1281. function slope2(that, t) {
  1282. var h = that._x1 - that._x0;
  1283. return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;
  1284. }
  1285. // According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations
  1286. // "you can express cubic Hermite interpolation in terms of cubic Bézier curves
  1287. // with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1".
  1288. function point$3(that, t0, t1) {
  1289. var x0 = that._x0,
  1290. y0 = that._y0,
  1291. x1 = that._x1,
  1292. y1 = that._y1,
  1293. dx = (x1 - x0) / 3;
  1294. that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);
  1295. }
  1296. function MonotoneX(context) {
  1297. this._context = context;
  1298. }
  1299. MonotoneX.prototype = {
  1300. areaStart: function() {
  1301. this._line = 0;
  1302. },
  1303. areaEnd: function() {
  1304. this._line = NaN;
  1305. },
  1306. lineStart: function() {
  1307. this._x0 = this._x1 =
  1308. this._y0 = this._y1 =
  1309. this._t0 = NaN;
  1310. this._point = 0;
  1311. },
  1312. lineEnd: function() {
  1313. switch (this._point) {
  1314. case 2: this._context.lineTo(this._x1, this._y1); break;
  1315. case 3: point$3(this, this._t0, slope2(this, this._t0)); break;
  1316. }
  1317. if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
  1318. this._line = 1 - this._line;
  1319. },
  1320. point: function(x, y) {
  1321. var t1 = NaN;
  1322. x = +x, y = +y;
  1323. if (x === this._x1 && y === this._y1) return; // Ignore coincident points.
  1324. switch (this._point) {
  1325. case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
  1326. case 1: this._point = 2; break;
  1327. case 2: this._point = 3; point$3(this, slope2(this, t1 = slope3(this, x, y)), t1); break;
  1328. default: point$3(this, this._t0, t1 = slope3(this, x, y)); break;
  1329. }
  1330. this._x0 = this._x1, this._x1 = x;
  1331. this._y0 = this._y1, this._y1 = y;
  1332. this._t0 = t1;
  1333. }
  1334. };
  1335. function MonotoneY(context) {
  1336. this._context = new ReflectContext(context);
  1337. }
  1338. (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {
  1339. MonotoneX.prototype.point.call(this, y, x);
  1340. };
  1341. function ReflectContext(context) {
  1342. this._context = context;
  1343. }
  1344. ReflectContext.prototype = {
  1345. moveTo: function(x, y) { this._context.moveTo(y, x); },
  1346. closePath: function() { this._context.closePath(); },
  1347. lineTo: function(x, y) { this._context.lineTo(y, x); },
  1348. bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); }
  1349. };
  1350. function monotoneX(context) {
  1351. return new MonotoneX(context);
  1352. }
  1353. function monotoneY(context) {
  1354. return new MonotoneY(context);
  1355. }
  1356. function Natural(context) {
  1357. this._context = context;
  1358. }
  1359. Natural.prototype = {
  1360. areaStart: function() {
  1361. this._line = 0;
  1362. },
  1363. areaEnd: function() {
  1364. this._line = NaN;
  1365. },
  1366. lineStart: function() {
  1367. this._x = [];
  1368. this._y = [];
  1369. },
  1370. lineEnd: function() {
  1371. var x = this._x,
  1372. y = this._y,
  1373. n = x.length;
  1374. if (n) {
  1375. this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]);
  1376. if (n === 2) {
  1377. this._context.lineTo(x[1], y[1]);
  1378. } else {
  1379. var px = controlPoints(x),
  1380. py = controlPoints(y);
  1381. for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) {
  1382. this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);
  1383. }
  1384. }
  1385. }
  1386. if (this._line || (this._line !== 0 && n === 1)) this._context.closePath();
  1387. this._line = 1 - this._line;
  1388. this._x = this._y = null;
  1389. },
  1390. point: function(x, y) {
  1391. this._x.push(+x);
  1392. this._y.push(+y);
  1393. }
  1394. };
  1395. // See https://www.particleincell.com/2012/bezier-splines/ for derivation.
  1396. function controlPoints(x) {
  1397. var i,
  1398. n = x.length - 1,
  1399. m,
  1400. a = new Array(n),
  1401. b = new Array(n),
  1402. r = new Array(n);
  1403. a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1];
  1404. for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1];
  1405. a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n];
  1406. for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1];
  1407. a[n - 1] = r[n - 1] / b[n - 1];
  1408. for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i];
  1409. b[n - 1] = (x[n] + a[n - 1]) / 2;
  1410. for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];
  1411. return [a, b];
  1412. }
  1413. function natural(context) {
  1414. return new Natural(context);
  1415. }
  1416. function Step(context, t) {
  1417. this._context = context;
  1418. this._t = t;
  1419. }
  1420. Step.prototype = {
  1421. areaStart: function() {
  1422. this._line = 0;
  1423. },
  1424. areaEnd: function() {
  1425. this._line = NaN;
  1426. },
  1427. lineStart: function() {
  1428. this._x = this._y = NaN;
  1429. this._point = 0;
  1430. },
  1431. lineEnd: function() {
  1432. if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y);
  1433. if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
  1434. if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line;
  1435. },
  1436. point: function(x, y) {
  1437. x = +x, y = +y;
  1438. switch (this._point) {
  1439. case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;
  1440. case 1: this._point = 2; // proceed
  1441. default: {
  1442. if (this._t <= 0) {
  1443. this._context.lineTo(this._x, y);
  1444. this._context.lineTo(x, y);
  1445. } else {
  1446. var x1 = this._x * (1 - this._t) + x * this._t;
  1447. this._context.lineTo(x1, this._y);
  1448. this._context.lineTo(x1, y);
  1449. }
  1450. break;
  1451. }
  1452. }
  1453. this._x = x, this._y = y;
  1454. }
  1455. };
  1456. function step(context) {
  1457. return new Step(context, 0.5);
  1458. }
  1459. function stepBefore(context) {
  1460. return new Step(context, 0);
  1461. }
  1462. function stepAfter(context) {
  1463. return new Step(context, 1);
  1464. }
  1465. function none(series, order) {
  1466. if (!((n = series.length) > 1)) return;
  1467. for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) {
  1468. s0 = s1, s1 = series[order[i]];
  1469. for (j = 0; j < m; ++j) {
  1470. s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1];
  1471. }
  1472. }
  1473. }
  1474. function none$1(series) {
  1475. var n = series.length, o = new Array(n);
  1476. while (--n >= 0) o[n] = n;
  1477. return o;
  1478. }
  1479. function stackValue(d, key) {
  1480. return d[key];
  1481. }
  1482. function stack() {
  1483. var keys = constant([]),
  1484. order = none$1,
  1485. offset = none,
  1486. value = stackValue;
  1487. function stack(data) {
  1488. var kz = keys.apply(this, arguments),
  1489. i,
  1490. m = data.length,
  1491. n = kz.length,
  1492. sz = new Array(n),
  1493. oz;
  1494. for (i = 0; i < n; ++i) {
  1495. for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) {
  1496. si[j] = sij = [0, +value(data[j], ki, j, data)];
  1497. sij.data = data[j];
  1498. }
  1499. si.key = ki;
  1500. }
  1501. for (i = 0, oz = order(sz); i < n; ++i) {
  1502. sz[oz[i]].index = i;
  1503. }
  1504. offset(sz, oz);
  1505. return sz;
  1506. }
  1507. stack.keys = function(_) {
  1508. return arguments.length ? (keys = typeof _ === "function" ? _ : constant(slice.call(_)), stack) : keys;
  1509. };
  1510. stack.value = function(_) {
  1511. return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), stack) : value;
  1512. };
  1513. stack.order = function(_) {
  1514. return arguments.length ? (order = _ == null ? none$1 : typeof _ === "function" ? _ : constant(slice.call(_)), stack) : order;
  1515. };
  1516. stack.offset = function(_) {
  1517. return arguments.length ? (offset = _ == null ? none : _, stack) : offset;
  1518. };
  1519. return stack;
  1520. }
  1521. function expand(series, order) {
  1522. if (!((n = series.length) > 0)) return;
  1523. for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) {
  1524. for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0;
  1525. if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y;
  1526. }
  1527. none(series, order);
  1528. }
  1529. function diverging(series, order) {
  1530. if (!((n = series.length) > 0)) return;
  1531. for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) {
  1532. for (yp = yn = 0, i = 0; i < n; ++i) {
  1533. if ((dy = (d = series[order[i]][j])[1] - d[0]) > 0) {
  1534. d[0] = yp, d[1] = yp += dy;
  1535. } else if (dy < 0) {
  1536. d[1] = yn, d[0] = yn += dy;
  1537. } else {
  1538. d[0] = 0, d[1] = dy;
  1539. }
  1540. }
  1541. }
  1542. }
  1543. function silhouette(series, order) {
  1544. if (!((n = series.length) > 0)) return;
  1545. for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) {
  1546. for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0;
  1547. s0[j][1] += s0[j][0] = -y / 2;
  1548. }
  1549. none(series, order);
  1550. }
  1551. function wiggle(series, order) {
  1552. if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return;
  1553. for (var y = 0, j = 1, s0, m, n; j < m; ++j) {
  1554. for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) {
  1555. var si = series[order[i]],
  1556. sij0 = si[j][1] || 0,
  1557. sij1 = si[j - 1][1] || 0,
  1558. s3 = (sij0 - sij1) / 2;
  1559. for (var k = 0; k < i; ++k) {
  1560. var sk = series[order[k]],
  1561. skj0 = sk[j][1] || 0,
  1562. skj1 = sk[j - 1][1] || 0;
  1563. s3 += skj0 - skj1;
  1564. }
  1565. s1 += sij0, s2 += s3 * sij0;
  1566. }
  1567. s0[j - 1][1] += s0[j - 1][0] = y;
  1568. if (s1) y -= s2 / s1;
  1569. }
  1570. s0[j - 1][1] += s0[j - 1][0] = y;
  1571. none(series, order);
  1572. }
  1573. function appearance(series) {
  1574. var peaks = series.map(peak);
  1575. return none$1(series).sort(function(a, b) { return peaks[a] - peaks[b]; });
  1576. }
  1577. function peak(series) {
  1578. var i = -1, j = 0, n = series.length, vi, vj = -Infinity;
  1579. while (++i < n) if ((vi = +series[i][1]) > vj) vj = vi, j = i;
  1580. return j;
  1581. }
  1582. function ascending(series) {
  1583. var sums = series.map(sum);
  1584. return none$1(series).sort(function(a, b) { return sums[a] - sums[b]; });
  1585. }
  1586. function sum(series) {
  1587. var s = 0, i = -1, n = series.length, v;
  1588. while (++i < n) if (v = +series[i][1]) s += v;
  1589. return s;
  1590. }
  1591. function descending$1(series) {
  1592. return ascending(series).reverse();
  1593. }
  1594. function insideOut(series) {
  1595. var n = series.length,
  1596. i,
  1597. j,
  1598. sums = series.map(sum),
  1599. order = appearance(series),
  1600. top = 0,
  1601. bottom = 0,
  1602. tops = [],
  1603. bottoms = [];
  1604. for (i = 0; i < n; ++i) {
  1605. j = order[i];
  1606. if (top < bottom) {
  1607. top += sums[j];
  1608. tops.push(j);
  1609. } else {
  1610. bottom += sums[j];
  1611. bottoms.push(j);
  1612. }
  1613. }
  1614. return bottoms.reverse().concat(tops);
  1615. }
  1616. function reverse(series) {
  1617. return none$1(series).reverse();
  1618. }
  1619. exports.arc = arc;
  1620. exports.area = area;
  1621. exports.areaRadial = areaRadial;
  1622. exports.curveBasis = basis;
  1623. exports.curveBasisClosed = basisClosed;
  1624. exports.curveBasisOpen = basisOpen;
  1625. exports.curveBundle = bundle;
  1626. exports.curveCardinal = cardinal;
  1627. exports.curveCardinalClosed = cardinalClosed;
  1628. exports.curveCardinalOpen = cardinalOpen;
  1629. exports.curveCatmullRom = catmullRom;
  1630. exports.curveCatmullRomClosed = catmullRomClosed;
  1631. exports.curveCatmullRomOpen = catmullRomOpen;
  1632. exports.curveLinear = curveLinear;
  1633. exports.curveLinearClosed = linearClosed;
  1634. exports.curveMonotoneX = monotoneX;
  1635. exports.curveMonotoneY = monotoneY;
  1636. exports.curveNatural = natural;
  1637. exports.curveStep = step;
  1638. exports.curveStepAfter = stepAfter;
  1639. exports.curveStepBefore = stepBefore;
  1640. exports.line = line;
  1641. exports.lineRadial = lineRadial$1;
  1642. exports.linkHorizontal = linkHorizontal;
  1643. exports.linkRadial = linkRadial;
  1644. exports.linkVertical = linkVertical;
  1645. exports.pie = pie;
  1646. exports.pointRadial = pointRadial;
  1647. exports.radialArea = areaRadial;
  1648. exports.radialLine = lineRadial$1;
  1649. exports.stack = stack;
  1650. exports.stackOffsetDiverging = diverging;
  1651. exports.stackOffsetExpand = expand;
  1652. exports.stackOffsetNone = none;
  1653. exports.stackOffsetSilhouette = silhouette;
  1654. exports.stackOffsetWiggle = wiggle;
  1655. exports.stackOrderAppearance = appearance;
  1656. exports.stackOrderAscending = ascending;
  1657. exports.stackOrderDescending = descending$1;
  1658. exports.stackOrderInsideOut = insideOut;
  1659. exports.stackOrderNone = none$1;
  1660. exports.stackOrderReverse = reverse;
  1661. exports.symbol = symbol;
  1662. exports.symbolCircle = circle;
  1663. exports.symbolCross = cross;
  1664. exports.symbolDiamond = diamond;
  1665. exports.symbolSquare = square;
  1666. exports.symbolStar = star;
  1667. exports.symbolTriangle = triangle;
  1668. exports.symbolWye = wye;
  1669. exports.symbols = symbols;
  1670. Object.defineProperty(exports, '__esModule', { value: true });
  1671. }));