Skip to content

Instantly share code, notes, and snippets.

@mbostock
Last active December 25, 2015 18:38
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mbostock/9bd540de6728a1fb9343 to your computer and use it in GitHub Desktop.
New Splines!
.DS_Store
node_modules
import {category10} from "d3-scale";
import {line} from "d3-shape";
export default {
scale: {
category10: category10
},
shape: {
line: line
}
};
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define("d3",n):t.d3=n()}(this,function(){"use strict";function t(t,n,e){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+n)/6,(t._y0+4*t._y1+e)/6)}function n(t){return new e(t)}function e(t){this._context=t}function i(t){return new s(t)}function s(t){this._context=t}function r(t){return new h(t)}function h(t){this._context=t}function a(t){return function(n){return new o(n,t)}}function o(t,n){this._context=t,this._k=(null==n?1:1-n)/6}function u(t){return function(n){return new c(n,t)}}function c(t,n){this._context=t,this._k=(null==n?1:1-n)/6}function _(t){return function(n){return new l(n,t)}}function l(t,n){this._context=t,this._k=(null==n?1:1-n)/6}function f(t){return function(n){return new g(n,t)}}function g(t,n){this._context=t,this._alpha2=(this._alpha=null==n?0:+n)/2}function y(t){return new x(t)}function x(t){this._context=t}function d(t){var n,e,i=t.length-1,s=new Array(i),r=new Array(i),h=new Array(i);for(s[0]=0,r[0]=2,h[0]=t[0]+2*t[1],n=1;i-1>n;++n)s[n]=1,r[n]=4,h[n]=4*t[n]+2*t[n+1];for(s[i-1]=2,r[i-1]=7,h[i-1]=8*t[i-1]+t[i],n=1;i>n;++n)e=s[n]/r[n-1],r[n]-=e,h[n]-=e*h[n-1];for(s[i-1]=h[i-1]/r[i-1],n=i-2;n>=0;--n)s[n]=(h[n]-s[n+1])/r[n];for(r[i-1]=(t[i]+s[i-1])/2,n=0;i-1>n;++n)r[n]=2*t[n+1]-s[n+1];return[s,r]}function p(t){return new m(t)}function m(t){this._context=t}function b(t){return new v(t)}function v(t){this._context=t}function w(t){return new M(t)}function M(t){this._context=t}function T(t){return new k(t)}function k(t){this._context=t}function C(t){return new N(t)}function N(t){this._context=t}function S(){this.beginPath()}function U(){return new S}function D(t){return t[0]}function A(t){return t[1]}function P(t){return function(){return t}}function H(){return!0}function F(){function t(t){var n,e=!1;x||(d=g(n=U()));for(var i,r=0,h=t.length;h>r;++r)!l(i=t[r],r)===e&&((e=!e)?d.lineStart():d.lineEnd()),e&&d.point(+s(i,r),+o(i,r));return e&&d.lineEnd(),x?void 0:(d=null,n+""||null)}var e=D,s=e,h=A,o=h,c=!0,l=H,g=p,x=null,d=null;return t.x=function(n){return arguments.length?(e=n,s="function"==typeof n?e:P(e),t):e},t.y=function(n){return arguments.length?(h=n,o="function"==typeof n?h:P(h),t):h},t.defined=function(n){return arguments.length?(c=n,l="function"==typeof n?c:P(c),t):c},t.interpolate=function(e,s){if(!arguments.length)return g;if("function"==typeof e)g=e;else switch(e+""){case"linear-closed":g=b;break;case"step":g=w;break;case"step-before":g=C;break;case"step-after":g=T;break;case"basis":g=n;break;case"basis-open":g=r;break;case"basis-closed":g=i;break;case"cardinal":g=a(s);break;case"cardinal-open":g=_(s);break;case"cardinal-closed":g=u(s);break;case"catmull-rom":g=f(s);break;case"cubic":g=y;break;default:g=p}return null!=x&&(d=g(x)),t},t.context=function(n){return arguments.length?(null==n?x=d=null:d=g(x=n),t):x},t}function Y(t,n){return n>t?-1:t>n?1:t>=n?0:NaN}function E(t){return 1===t.length&&(t=L(t)),{left:function(n,e,i,s){for(arguments.length<3&&(i=0),arguments.length<4&&(s=n.length);s>i;){var r=i+s>>>1;t(n[r],e)<0?i=r+1:s=r}return i},right:function(n,e,i,s){for(arguments.length<3&&(i=0),arguments.length<4&&(s=n.length);s>i;){var r=i+s>>>1;t(n[r],e)>0?s=r:i=r+1}return i}}}function L(t){return function(n,e){return Y(t(n),e)}}function z(){}function q(t,n){var e=new z;if(t instanceof z)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var i,s=-1,r=t.length;if(1===arguments.length)for(;++s<r;)e.set(s,t[s]);else for(;++s<r;)e.set(n.call(t,i=t[s],s),i)}else if(t)for(var h in t)e.set(h,t[h]);return e}function j(t,n,e){for(var i=new Array(t),s=-1;++s<t;)i[s]=n+e*s;return i}function I(t,n){function e(e){var r=e+"",h=i.get(r);if(!h){if("range"!==n.t)return;i.set(r,h=t.push(e))}return s[(h-1)%s.length]}var i,s,r;return e.domain=function(s){if(!arguments.length)return t.slice();t=[],i=q();for(var r,h,a=-1,o=s.length;++a<o;)i.has(h=(r=s[a])+"")||i.set(h,t.push(r));return e[n.t].apply(e,n.a)},e.range=function(t){return arguments.length?(s=t.slice(),r=0,n={t:"range",a:arguments},e):s.slice()},e.rangePoints=function(i,h){h=arguments.length<2?0:+h;var a=+i[0],o=+i[1],u=t.length<2?(a=(a+o)/2,0):(o-a)/(t.length-1+h);return s=j(t.length,a+u*h/2,u),r=0,n={t:"rangePoints",a:arguments},e},e.rangeRoundPoints=function(i,h){h=arguments.length<2?0:+h;var a=+i[0],o=+i[1],u=t.length<2?(a=o=Math.round((a+o)/2),0):(o-a)/(t.length-1+h)|0;return s=j(t.length,a+Math.round(u*h/2+(o-a-(t.length-1+h)*u)/2),u),r=0,n={t:"rangeRoundPoints",a:arguments},e},e.rangeBands=function(i,h,a){h=arguments.length<2?0:+h,a=arguments.length<3?h:+a;var o=+i[1]<+i[0],u=+i[o-0],c=+i[1-o],_=(c-u)/(t.length-h+2*a);return s=j(t.length,u+_*a,_),o&&s.reverse(),r=_*(1-h),n={t:"rangeBands",a:arguments},e},e.rangeRoundBands=function(i,h,a){h=arguments.length<2?0:+h,a=arguments.length<3?h:+a;var o=+i[1]<+i[0],u=+i[o-0],c=+i[1-o],_=Math.floor((c-u)/(t.length-h+2*a));return s=j(t.length,u+Math.round((c-u-(t.length-h)*_)/2),_),o&&s.reverse(),r=Math.round(_*(1-h)),n={t:"rangeRoundBands",a:arguments},e},e.rangeBand=function(){return r},e.rangeExtent=function(){var t=n.a[0],e=t[0],i=t[t.length-1];return e>i&&(t=i,i=e,e=t),[e,i]},e.copy=function(){return I(t,n)},e.domain(t)}function Z(){return I([],{t:"range",a:[[]]})}function $(){return Z().range(["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"])}function W(){}function O(t){var n;return t=(t+"").trim().toLowerCase(),(n=Sn.exec(t))?(n=parseInt(n[1],16),X(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n)):(n=Un.exec(t))?B(parseInt(n[1],16)):(n=Dn.exec(t))?X(n[1],n[2],n[3]):(n=An.exec(t))?X(255*n[1]/100,255*n[2]/100,255*n[3]/100):(n=Pn.exec(t))?G(n[1],n[2]/100,n[3]/100):Hn.hasOwnProperty(t)?B(Hn[t]):null}function B(t){return X(t>>16&255,t>>8&255,255&t)}function X(t,n,e){return 1===arguments.length&&(t instanceof W||(t=O(t)),t?(t=t.rgb(),e=t.b,n=t.g,t=t.r):t=n=e=NaN),new J(t,n,e)}function J(t,n,e){this.r=+t,this.g=+n,this.b=+e}function R(t,n,e){return"#"+(isNaN(t)?"00":(t=Math.round(t))<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16))+(isNaN(n)?"00":(n=Math.round(n))<16?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16))+(isNaN(e)?"00":(e=Math.round(e))<16?"0"+Math.max(0,e).toString(16):Math.min(255,e).toString(16))}function G(t,n,e){if(1===arguments.length)if(t instanceof Q)e=t.l,n=t.s,t=t.h;else if(t instanceof W||(t=O(t)),t){if(t instanceof Q)return t;t=t.rgb();var i=t.r/255,s=t.g/255,r=t.b/255,h=Math.min(i,s,r),a=Math.max(i,s,r),o=a-h;e=(a+h)/2,o?(n=.5>e?o/(a+h):o/(2-a-h),t=i===a?(s-r)/o+6*(r>s):s===a?(r-i)/o+2:(i-s)/o+4,t*=60):(t=NaN,n=e>0&&1>e?0:t)}else t=n=e=NaN;return new Q(t,n,e)}function Q(t,n,e){this.h=+t,this.s=+n,this.l=+e}function K(t,n,e){return 255*(60>t?n+(e-n)*t/60:180>t?e:240>t?n+(e-n)*(240-t)/60:n)}function V(t,n,e){if(1===arguments.length)if(t instanceof tt)e=t.b,n=t.a,t=t.l;else if(t instanceof ht){var i=t.h*Xn;e=Math.sin(i)*t.c,n=Math.cos(i)*t.c,t=t.l}else{t instanceof J||(t=X(t));var s=st(t.r),r=st(t.g),e=st(t.b),h=nt((.4124564*s+.3575761*r+.1804375*e)/qn),a=nt((.2126729*s+.7151522*r+.072175*e)/jn),o=nt((.0193339*s+.119192*r+.9503041*e)/In);e=200*(a-o),n=500*(h-a),t=116*a-16}return new tt(t,n,e)}function tt(t,n,e){this.l=+t,this.a=+n,this.b=+e}function nt(t){return t>On?Math.pow(t,1/3):t/Wn+Zn}function et(t){return t>$n?t*t*t:Wn*(t-Zn)}function it(t){return 255*(.0031308>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function st(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function rt(t,n,e){return 1===arguments.length&&(t instanceof ht?(e=t.l,n=t.c,t=t.h):(t instanceof tt||(t=V(t)),e=t.l,n=Math.sqrt(t.a*t.a+t.b*t.b),t=Math.atan2(t.b,t.a)*Jn,0>t&&(t+=360))),new ht(t,n,e)}function ht(t,n,e){this.h=+t,this.c=+n,this.l=+e}function at(t,n,e){if(1===arguments.length)if(t instanceof ot)e=t.l,n=t.s,t=t.h;else{t instanceof J||(t=X(t));var i=t.r/255,s=t.g/255,r=t.b/255;e=(ie*r+ne*i-ee*s)/(ie+ne-ee);var h=r-e,a=(te*(s-e)-Kn*h)/Vn;n=Math.sqrt(a*a+h*h)/(te*e*(1-e)),t=n?Math.atan2(a,h)*Jn-120:NaN,0>t&&(t+=360)}return new ot(t,n,e)}function ot(t,n,e){this.h=+t,this.s=+n,this.l=+e}function ut(t,n){var e=t-n;return e>180||-180>e?e-360*Math.round(e/360):e}function ct(t){return function(n,e){n=at(n),e=at(e);var i=isNaN(n.h)?e.h:n.h,s=isNaN(n.s)?e.s:n.s,r=n.l,h=isNaN(e.h)?0:ut(e.h,i),a=isNaN(e.s)?0:e.s-s,o=e.l-r;return function(e){return n.h=i+h*e,n.s=s+a*e,n.l=r+o*Math.pow(e,t),n+""}}}function _t(t){return function(n,e){n=at(n),e=at(e);var i=isNaN(n.h)?e.h:n.h,s=isNaN(n.s)?e.s:n.s,r=n.l,h=isNaN(e.h)?0:e.h-i,a=isNaN(e.s)?0:e.s-s,o=e.l-r;return function(e){return n.h=i+h*e,n.s=s+a*e,n.l=r+o*Math.pow(e,t),n+""}}}function lt(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,i=t.slice(0,e);return[i.length>1?i[0]+i.slice(2):i,+t.slice(e+1)]}function ft(t){return t=lt(Math.abs(t)),t?t[1]:NaN}function gt(t,n){return function(e,i){for(var s=e.length,r=[],h=0,a=t[0],o=0;s>0&&a>0&&(o+a+1>i&&(a=Math.max(1,i-o)),r.push(e.substring(s-=a,s+a)),!((o+=a+1)>i));)a=t[h=(h+1)%t.length];return r.reverse().join(n)}}function yt(t,n){var e=lt(t,n);if(!e)return t+"";var i=e[0],s=e[1],r=s-(re=3*Math.max(-8,Math.min(8,Math.floor(s/3))))+1,h=i.length;return r===h?i:r>h?i+new Array(r-h+1).join("0"):r>0?i.slice(0,r)+"."+i.slice(r):"0."+new Array(1-r).join("0")+lt(t,Math.max(0,n+r-1))[0]}function xt(t,n){var e=lt(t,n);if(!e)return t+"";var i=e[0],s=e[1];return 0>s?"0."+new Array(-s).join("0")+i:i.length>s+1?i.slice(0,s+1)+"."+i.slice(s+1):i+new Array(s-i.length+2).join("0")}function dt(t,n){t=t.toPrecision(n);t:for(var e,i=t.length,s=1,r=-1;i>s;++s)switch(t[s]){case".":r=e=s;break;case"0":0===r&&(r=s),e=s;break;case"e":break t;default:r>0&&(r=0)}return r>0?t.slice(0,r)+t.slice(e+1):t}function pt(t){return new mt(t)}function mt(t){if(!(n=ue.exec(t)))throw new Error("invalid format: "+t);var n,e=n[1]||" ",i=n[2]||">",s=n[3]||"-",r=n[4]||"",h=!!n[5],a=n[6]&&+n[6],o=!!n[7],u=n[8]&&+n[8].slice(1),c=n[9]||"";"n"===c?(o=!0,c="g"):oe[c]||(c=""),(h||"0"===e&&"="===i)&&(h=!0,e="0",i="="),this.fill=e,this.align=i,this.sign=s,this.symbol=r,this.zero=h,this.width=a,this.comma=o,this.precision=u,this.type=c}function bt(t){return t}function vt(t){function n(t){t=pt(t);var n=t.fill,e=t.align,h=t.sign,a=t.symbol,o=t.zero,u=t.width,c=t.comma,_=t.precision,l=t.type,f="$"===a?s[0]:"#"===a&&/[boxX]/.test(l)?"0"+l.toLowerCase():"",g="$"===a?s[1]:/[%p]/.test(l)?"%":"",y=oe[l],x=!l||/[defgprs%]/.test(l);return _=null==_?l?6:12:/[gprs]/.test(l)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_)),function(t){var s=f,a=g;if("c"===l)a=y(t)+a,t="";else{t=+t;var d=(0>t||0>1/t)&&(t*=-1,!0);if(t=y(t,_),d){var p,m=-1,b=t.length;for(d=!1;++m<b;)if(p=t.charCodeAt(m),p>48&&58>p||"x"===l&&p>96&&103>p||"X"===l&&p>64&&71>p){d=!0;break}}if(s=(d?"("===h?h:"-":"-"===h||"("===h?"":h)+s,a=a+("s"===l?ce[8+re/3]:"")+(d&&"("===h?")":""),x)for(var p,m=-1,b=t.length;++m<b;)if(p=t.charCodeAt(m),48>p||p>57){a=(46===p?r+t.slice(m+1):t.slice(m))+a,t=t.slice(0,m);break}}c&&!o&&(t=i(t,1/0));var v=s.length+t.length+a.length,w=u>v?new Array(u-v+1).join(n):"";switch(c&&o&&(t=i(w+t,w.length?u-a.length:1/0),w=""),e){case"<":return s+t+a+w;case"=":return s+w+t+a;case"^":return w.slice(0,v=w.length>>1)+s+t+a+w.slice(v)}return w+s+t+a}}function e(t,e){var i=n((t=pt(t),t.type="f",t)),s=3*Math.max(-8,Math.min(8,Math.floor(ft(e)/3))),r=Math.pow(10,-s),h=ce[8+s/3];return function(t){return i(r*t)+h}}var i=t.grouping&&t.thousands?gt(t.grouping,t.thousands):bt,s=t.currency,r=t.decimal;return{format:n,formatPrefix:e}}function wt(t,n,e){function i(n){return t(n=new Date(+n)),n}return i.floor=i,i.round=function(e){var i=new Date(+e),s=new Date(e-1);return t(i),t(s),n(s,1),s-e>e-i?i:s},i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,i,s){var r=[];if(e=new Date(e-1),i=new Date(+i),s=null==s?1:Math.floor(s),!(i>e&&s>0))return r;for(n(e,1),t(e),i>e&&r.push(new Date(+e));n(e,s),t(e),i>e;)r.push(new Date(+e));return r},i.filter=function(e){return wt(function(n){for(;t(n),!e(n);)n.setTime(n-1)},function(t,i){for(;--i>=0;)for(;n(t,1),!e(t););})},e&&(i.count=function(n,i){return ge.setTime(+n),ye.setTime(+i),t(ge),t(ye),Math.floor(e(ge,ye))}),i}function Mt(t){return wt(function(n){n.setHours(0,0,0,0),n.setDate(n.getDate()-(n.getDay()+7-t)%7)},function(t,n){t.setDate(t.getDate()+7*n)},function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5})}function Tt(t){return wt(function(n){n.setUTCHours(0,0,0,0),n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7)},function(t,n){t.setUTCDate(t.getUTCDate()+7*n)},function(t,n){return(n-t)/6048e5})}function kt(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Ct(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Nt(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function St(t){function n(t,n){return function(e){for(var i,s,r,h=[],a=-1,o=0,u=t.length;++a<u;)37===t.charCodeAt(a)&&(h.push(t.slice(o,a)),null!=(s=Te[i=t.charAt(++a)])&&(i=t.charAt(++a)),(r=n[i])&&(i=r(e,null==s?"e"===i?" ":"0":s)),h.push(i),o=a+1);return h.push(t.slice(o,a)),h.join("")}}function e(t,n){return function(e){var s=Nt(1900),r=i(s,t,e,0);if(r!=e.length)return null;if("p"in s&&(s.H=s.H%12+12*s.p),"Z"in s){if("w"in s&&("W"in s||"U"in s)){var h=Ct(Nt(s.y)).getUTCDay();"W"in s&&(s.U=s.W,s.w=(s.w+6)%7,--h),s.m=0,s.d=s.w+7*s.U-(h+6)%7}return s.H+=s.Z/100|0,s.M+=s.Z%100,Ct(s)}if("w"in s&&("W"in s||"U"in s)){var h=n(Nt(s.y)).getDay();"W"in s&&(s.U=s.W,s.w=(s.w+6)%7,--h),s.m=0,s.d=s.w+7*s.U-(h+6)%7}return n(s)}}function i(t,n,e,i){for(var s,r,h=0,a=n.length,o=e.length;a>h;){if(i>=o)return-1;if(s=n.charCodeAt(h++),37===s){if(s=n.charAt(h++),r=I[s in Te?n.charAt(h++):s],!r||(i=r(t,e,i))<0)return-1}else if(s!=e.charCodeAt(i++))return-1}return i}function s(t,n,e){var i=H.exec(n.slice(e));return i?(t.w=F[i[0].toLowerCase()],e+i[0].length):-1}function r(t,n,e){var i=A.exec(n.slice(e));return i?(t.w=P[i[0].toLowerCase()],e+i[0].length):-1}function h(t,n,e){var i=L.exec(n.slice(e));return i?(t.m=z[i[0].toLowerCase()],e+i[0].length):-1}function a(t,n,e){var i=Y.exec(n.slice(e));return i?(t.m=E[i[0].toLowerCase()],e+i[0].length):-1}function o(t,n,e){return i(t,w,n,e)}function u(t,n,e){return i(t,M,n,e)}function c(t,n,e){return i(t,T,n,e)}function _(t,n,e){var i=D[n.slice(e,e+=2).toLowerCase()];return null==i?-1:(t.p=i,e)}function l(t){return N[t.getDay()]}function f(t){return C[t.getDay()]}function g(t){return U[t.getMonth()]}function y(t){return S[t.getMonth()]}function x(t){return k[+(t.getHours()>=12)]}function d(t){return N[t.getUTCDay()]}function p(t){return C[t.getUTCDay()]}function m(t){return U[t.getUTCMonth()]}function b(t){return S[t.getUTCMonth()]}function v(t){return k[+(t.getUTCHours()>=12)]}var w=t.dateTime,M=t.date,T=t.time,k=t.periods,C=t.days,N=t.shortDays,S=t.months,U=t.shortMonths,D=Pt(k),A=At(C),P=Pt(C),H=At(N),F=Pt(N),Y=At(S),E=Pt(S),L=At(U),z=Pt(U),q={a:l,A:f,b:g,B:y,c:null,d:Xt,e:Xt,H:Jt,I:Rt,j:Gt,L:Qt,m:Kt,M:Vt,p:x,S:tn,U:nn,w:en,W:sn,x:null,X:null,y:rn,Y:hn,Z:an,"%":wn},j={a:d,A:p,b:m,B:b,c:null,d:on,e:on,H:un,I:cn,j:_n,L:ln,m:fn,M:gn,p:v,S:yn,U:xn,w:dn,W:pn,x:null,X:null,y:mn,Y:bn,Z:vn,"%":wn},I={a:s,A:r,b:h,B:a,c:o,d:jt,e:jt,H:Zt,I:Zt,j:It,L:Ot,m:qt,M:$t,p:_,S:Wt,U:Ft,w:Ht,W:Yt,x:u,X:c,y:Lt,Y:Et,Z:zt,"%":Bt};return q.x=n(M,q),q.X=n(T,q),q.c=n(w,q),j.x=n(M,j),j.X=n(T,j),j.c=n(w,j),{format:function(t){var i=n(t+="",q);return i.parse=e(t,kt),i.toString=function(){return t},i},utcFormat:function(t){var i=n(t+="",j);return i.parse=e(t,Ct),i.toString=function(){return t},i}}}function Ut(t,n,e){var i=0>t?"-":"",s=(i?-t:t)+"",r=s.length;return i+(e>r?new Array(e-r+1).join(n)+s:s)}function Dt(t){return t.replace(Ne,"\\$&")}function At(t){return new RegExp("^(?:"+t.map(Dt).join("|")+")","i")}function Pt(t){for(var n={},e=-1,i=t.length;++e<i;)n[t[e].toLowerCase()]=e;return n}function Ht(t,n,e){var i=ke.exec(n.slice(e,e+1));return i?(t.w=+i[0],e+i[0].length):-1}function Ft(t,n,e){var i=ke.exec(n.slice(e));return i?(t.U=+i[0],e+i[0].length):-1}function Yt(t,n,e){var i=ke.exec(n.slice(e));return i?(t.W=+i[0],e+i[0].length):-1}function Et(t,n,e){var i=ke.exec(n.slice(e,e+4));return i?(t.y=+i[0],e+i[0].length):-1}function Lt(t,n,e){var i=ke.exec(n.slice(e,e+2));return i?(t.y=+i[0]+(+i[0]>68?1900:2e3),e+i[0].length):-1}function zt(t,n,e){var i=/^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(n.slice(e,e+6));return i?(t.Z=i[1]?0:i[3]?-(i[2]+i[3]):100*-i[2],e+i[0].length):-1}function qt(t,n,e){var i=ke.exec(n.slice(e,e+2));return i?(t.m=i[0]-1,e+i[0].length):-1}function jt(t,n,e){var i=ke.exec(n.slice(e,e+2));return i?(t.d=+i[0],e+i[0].length):-1}function It(t,n,e){var i=ke.exec(n.slice(e,e+3));return i?(t.m=0,t.d=+i[0],e+i[0].length):-1}function Zt(t,n,e){var i=ke.exec(n.slice(e,e+2));return i?(t.H=+i[0],e+i[0].length):-1}function $t(t,n,e){var i=ke.exec(n.slice(e,e+2));return i?(t.M=+i[0],e+i[0].length):-1}function Wt(t,n,e){var i=ke.exec(n.slice(e,e+2));return i?(t.S=+i[0],e+i[0].length):-1}function Ot(t,n,e){var i=ke.exec(n.slice(e,e+3));return i?(t.L=+i[0],e+i[0].length):-1}function Bt(t,n,e){var i=Ce.exec(n.slice(e,e+1));return i?e+i[0].length:-1}function Xt(t,n){return Ut(t.getDate(),n,2)}function Jt(t,n){return Ut(t.getHours(),n,2)}function Rt(t,n){return Ut(t.getHours()%12||12,n,2)}function Gt(t,n){return Ut(1+xe.count(me(t),t),n,3)}function Qt(t,n){return Ut(t.getMilliseconds(),n,3)}function Kt(t,n){return Ut(t.getMonth()+1,n,2)}function Vt(t,n){return Ut(t.getMinutes(),n,2)}function tn(t,n){return Ut(t.getSeconds(),n,2)}function nn(t,n){return Ut(de.count(me(t),t),n,2)}function en(t){return t.getDay()}function sn(t,n){return Ut(pe.count(me(t),t),n,2)}function rn(t,n){return Ut(t.getFullYear()%100,n,2)}function hn(t,n){return Ut(t.getFullYear()%1e4,n,4)}function an(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Ut(n/60|0,"0",2)+Ut(n%60,"0",2)}function on(t,n){return Ut(t.getUTCDate(),n,2)}function un(t,n){return Ut(t.getUTCHours(),n,2)}function cn(t,n){return Ut(t.getUTCHours()%12||12,n,2)}function _n(t,n){return Ut(1+be.count(Me(t),t),n,3)}function ln(t,n){return Ut(t.getUTCMilliseconds(),n,3)}function fn(t,n){return Ut(t.getUTCMonth()+1,n,2)}function gn(t,n){return Ut(t.getUTCMinutes(),n,2)}function yn(t,n){return Ut(t.getUTCSeconds(),n,2)}function xn(t,n){return Ut(ve.count(Me(t),t),n,2)}function dn(t){return t.getUTCDay()}function pn(t,n){return Ut(we.count(Me(t),t),n,2)}function mn(t,n){return Ut(t.getUTCFullYear()%100,n,2)}function bn(t,n){return Ut(t.getUTCFullYear()%1e4,n,4)}function vn(){return"+0000"}function wn(){return"%"}function Mn(t){return t.toISOString()}e.prototype={lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._state=0},lineEnd:function(){switch(this._state){case 1:this._context.closePath();break;case 3:t(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}},point:function(n,e){switch(n=+n,e=+e,this._state){case 0:this._state=1,this._context.moveTo(n,e);break;case 1:this._state=2,this._context.lineTo((5*this._x1+n)/6,(5*this._y1+e)/6);break;case 2:this._state=3;default:t(this,n,e)}this._x0=this._x1,this._x1=n,this._y0=this._y1,this._y1=e}},s.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._state=0},lineEnd:function(){switch(this._state){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(n,e){switch(n=+n,e=+e,this._state){case 0:this._state=1,this._x2=n,this._y2=e;break;case 1:this._state=2,this._x3=n,this._y3=e;break;case 2:this._state=3,this._x4=n,this._y4=e,this._context.moveTo((this._x0+4*this._x1+n)/6,(this._y0+4*this._y1+e)/6);break;default:t(this,n,e)}this._x0=this._x1,this._x1=n,this._y0=this._y1,this._y1=e}},h.prototype={lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._state=0},lineEnd:function(){3===this._state&&this._context.closePath()},point:function(n,e){switch(n=+n,e=+e,this._state){case 0:this._state=1;break;case 1:this._state=2;break;case 2:this._state=3,this._context.moveTo((this._x0+4*this._x1+n)/6,(this._y0+4*this._y1+e)/6);break;case 3:this._state=4;default:t(this,n,e)}this._x0=this._x1,this._x1=n,this._y0=this._y1,this._y1=e}},o.prototype={lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._state=0},lineEnd:function(){switch(this._state){case 1:this._context.closePath();break;case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this._context.bezierCurveTo(this._x1+this._k*(this._x2-this._x0),this._y1+this._k*(this._y2-this._y0),this._x2,this._y2,this._x2,this._y2)}},point:function(t,n){switch(t=+t,n=+n,this._state){case 0:this._state=1,this._context.moveTo(t,n);break;case 1:this._state=2;break;case 2:this._state=3,this._context.bezierCurveTo(this._x1,this._y1,this._x2+this._k*(this._x1-t),this._y2+this._k*(this._y1-n),this._x2,this._y2);break;default:this._context.bezierCurveTo(this._x1+this._k*(this._x2-this._x0),this._y1+this._k*(this._y2-this._y0),this._x2+this._k*(this._x1-t),this._y2+this._k*(this._y1-n),this._x2,this._y2)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}},c.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._state=0},lineEnd:function(){switch(this._state){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,n){switch(t=+t,n=+n,this._state){case 0:this._state=1,this._x3=t,this._y3=n;break;case 1:this._state=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._state=3,this._x5=t,this._y5=n;break;default:this._context.bezierCurveTo(this._x1+this._k*(this._x2-this._x0),this._y1+this._k*(this._y2-this._y0),this._x2+this._k*(this._x1-t),this._y2+this._k*(this._y1-n),this._x2,this._y2)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}},l.prototype={lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._state=0},lineEnd:function(){switch(this._state){case 2:case 3:this._context.closePath()}},point:function(t,n){switch(t=+t,n=+n,this._state){case 0:this._state=1;break;case 1:this._state=2,this._context.moveTo(t,n);break;case 2:this._state=3;break;case 3:this._state=4;default:this._context.bezierCurveTo(this._x1+this._k*(this._x2-this._x0),this._y1+this._k*(this._y2-this._y0),this._x2+this._k*(this._x1-t),this._y2+this._k*(this._y1-n),this._x2,this._y2)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}},g.prototype={lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=NaN,this._state=0},lineEnd:function(){switch(this._state){case 1:this._context.closePath();break;case 2:this._context.lineTo(this._x2,this._y2);break;case 3:var t=2*this._l01_2a+3*this._l01_a*this._l12_a+this._l12_2a,n=3*this._l01_a*(this._l01_a+this._l12_a);this._context.bezierCurveTo((this._x1*t-this._x0*this._l12_2a+this._x2*this._l01_2a)/n,(this._y1*t-this._y0*this._l12_2a+this._y2*this._l01_2a)/n,this._x2,this._y2,this._x2,this._y2)}},point:function(t,n){if(t=+t,n=+n,this._state){var e=this._x2-t,i=this._y2-n,s=e*e+i*i;this._l23_a=Math.pow(s,this._alpha2),this._l23_2a=Math.pow(s,this._alpha)}switch(this._state){case 0:this._state=1,this._context.moveTo(t,n);break;case 1:this._state=2;break;case 2:var r=2*this._l23_2a+3*this._l23_a*this._l12_a+this._l12_2a,h=3*this._l23_a*(this._l23_a+this._l12_a);this._state=3,this._context.bezierCurveTo(this._x1,this._y1,(this._x2*r+this._x1*this._l23_2a-t*this._l12_2a)/h,(this._y2*r+this._y1*this._l23_2a-n*this._l12_2a)/h,this._x2,this._y2);break;default:var a=2*this._l01_2a+3*this._l01_a*this._l12_a+this._l12_2a,r=2*this._l23_2a+3*this._l23_a*this._l12_a+this._l12_2a,o=3*this._l01_a*(this._l01_a+this._l12_a),h=3*this._l23_a*(this._l23_a+this._l12_a);this._context.bezierCurveTo((this._x1*a-this._x0*this._l12_2a+this._x2*this._l01_2a)/o,(this._y1*a-this._y0*this._l12_2a+this._y2*this._l01_2a)/o,(this._x2*r+this._x1*this._l23_2a-t*this._l12_2a)/h,(this._y2*r+this._y1*this._l23_2a-n*this._l12_2a)/h,this._x2,this._y2)}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=n}},x.prototype={lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;switch(e){case 0:break;case 1:this._context.moveTo(t[0],n[0]),this._context.closePath();break;case 2:this._context.moveTo(t[0],n[0]),this._context.lineTo(t[1],n[1]);break;default:var i=d(t),s=d(n);this._context.moveTo(t[0],n[0]);for(var r=0,e=t.length;e-1>r;++r)this._context.bezierCurveTo(i[0][r],s[0][r],i[1][r],s[1][r],t[r+1],n[r+1])}this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}},m.prototype={lineStart:function(){this._state=0},lineEnd:function(){1===this._state&&this._context.closePath()},point:function(t,n){switch(t=+t,n=+n,this._state){case 0:this._state=1,this._context.moveTo(t,n);break;case 1:this._state=2;default:this._context.lineTo(t,n)}}},v.prototype={lineStart:function(){this._state=0},lineEnd:function(){this._context.closePath()},point:function(t,n){t=+t,n=+n,this._state?this._context.lineTo(t,n):(this._state=1,this._context.moveTo(t,n))}},M.prototype={lineStart:function(){this._x=this._y=NaN,this._state=0},lineEnd:function(){switch(this._state){case 1:this._context.closePath();break;case 2:this._context.lineTo(this._x,this._y)}},point:function(t,n){switch(t=+t,n=+n,this._state){case 0:this._state=1,this._context.moveTo(t,n);break;case 1:this._state=2;default:var e=(this._x+t)/2;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}this._x=t,this._y=n}},k.prototype={lineStart:function(){this._y=NaN,this._state=0},lineEnd:function(){1===this._state&&this._context.closePath()},point:function(t,n){switch(t=+t,n=+n,this._state){case 0:this._state=1,this._context.moveTo(t,n);break;case 1:this._state=2;default:this._context.lineTo(t,this._y),this._context.lineTo(t,n)}this._y=n}},N.prototype={lineStart:function(){this._x=NaN,this._state=0},lineEnd:function(){1===this._state&&this._context.closePath()},point:function(t,n){switch(t=+t,n=+n,this._state){case 0:this._state=1,this._context.moveTo(t,n);break;case 1:this._state=2;default:this._context.lineTo(this._x,n),this._context.lineTo(t,n)}this._x=t}};var Tn=Math.PI,kn=2*Tn,Cn=1e-6;S.prototype=U.prototype={beginPath:function(){this._x0=this._y0=this._x1=this._y1=null,this._=[]},moveTo:function(t,n){this._.push("M",this._x0=this._x1=+t,",",this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._.push("Z"))},lineTo:function(t,n){this._.push("L",this._x1=+t,",",this._y1=+n)},quadraticCurveTo:function(t,n,e,i){this._.push("Q",+t,",",+n,",",this._x1=+e,",",this._y1=+i)},bezierCurveTo:function(t,n,e,i,s,r){this._.push("C",+t,",",+n,",",+e,",",+i,",",this._x1=+s,",",this._y1=+r)},arcTo:function(t,n,e,i,s){t=+t,n=+n,e=+e,i=+i,s=+s;var r=this._x1,h=this._y1,a=e-t,o=i-n,u=r-t,c=h-n,_=u*u+c*c;if(0>s)throw new Error("negative radius: "+s);if(null===this._x1)this._.push("M",this._x1=t,",",this._y1=n);else if(_>Cn)if(Math.abs(c*a-o*u)>Cn&&s){var l=e-r,f=i-h,g=a*a+o*o,y=l*l+f*f,x=Math.sqrt(g),d=Math.sqrt(_),p=s*Math.tan((Math.PI-Math.acos((g+_-y)/(2*x*d)))/2),m=p/d,b=p/x;Math.abs(m-1)>Cn&&this._.push("L",t+m*u,",",n+m*c),this._.push("A",s,",",s,",0,0,",+(c*l>u*f),",",this._x1=t+b*a,",",this._y1=n+b*o)}else this._.push("L",this._x1=t,",",this._y1=n);else;},arc:function(t,n,e,i,s){t=+t,n=+n,e=+e;var r=e*Math.cos(i),h=e*Math.sin(i),a=t+r,o=n+h,u=Math.abs(s-i);if(0>e)throw new Error("negative radius: "+e);null===this._x1?this._.push("M",a,",",o):(Math.abs(this._x1-a)>Cn||Math.abs(this._y1-o)>Cn)&&this._.push("L",a,",",o),u>=kn-Cn?this._.push("A",e,",",e,",0,1,1,",t-r,",",n-h,"A",e,",",e,",0,1,1,",this._x1=a,",",this._y1=o):this._.push("A",e,",",e,",0,",+(u>=Tn),",1,",this._x1=t+e*Math.cos(s),",",this._y1=n+e*Math.sin(s))},rect:function(t,n,e,i){this._.push("M",this._x0=this._x1=+t,",",this._y0=this._y1=+n,"h",+e,"v",+i,"h",-e,"Z")},toString:function(){return this._.join("")}};var Nn=(E(Y),"$");z.prototype=q.prototype={has:function(t){return Nn+t in this},get:function(t){return this[Nn+t]},set:function(t,n){return this[Nn+t]=n,this},remove:function(t){var n=Nn+t;return n in this&&delete this[n]},clear:function(){for(var t in this)t[0]===Nn&&delete this[t]},keys:function(){var t=[];for(var n in this)n[0]===Nn&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)n[0]===Nn&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)n[0]===Nn&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)n[0]===Nn&&++t;return t},empty:function(){for(var t in this)if(t[0]===Nn)return!1;return!0},each:function(t){for(var n in this)n[0]===Nn&&t.call(this,this[n],n.slice(1))}};var Sn=(q.prototype,/^#([0-9a-f]{3})$/),Un=/^#([0-9a-f]{6})$/,Dn=/^rgb\(\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*,\s*([-+]?\d+)\s*\)$/,An=/^rgb\(\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/,Pn=/^hsl\(\s*([-+]?\d+(?:\.\d+)?)\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*,\s*([-+]?\d+(?:\.\d+)?)%\s*\)$/;O.prototype=W.prototype={displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}};var Hn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,
mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Fn=.7,Yn=1/Fn,En=X.prototype=J.prototype=new W;En.brighter=function(t){return t=null==t?Yn:Math.pow(Yn,t),new J(this.r*t,this.g*t,this.b*t)},En.darker=function(t){return t=null==t?Fn:Math.pow(Fn,t),new J(this.r*t,this.g*t,this.b*t)},En.rgb=function(){return this},En.displayable=function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255},En.toString=function(){return R(this.r,this.g,this.b)};var Ln=G.prototype=Q.prototype=new W;Ln.brighter=function(t){return t=null==t?Yn:Math.pow(Yn,t),new Q(this.h,this.s,this.l*t)},Ln.darker=function(t){return t=null==t?Fn:Math.pow(Fn,t),new Q(this.h,this.s,this.l*t)},Ln.rgb=function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,i=e+(.5>e?e:1-e)*n,s=2*e-i;return new J(K(t>=240?t-240:t+120,s,i),K(t,s,i),K(120>t?t+240:t-120,s,i))},Ln.displayable=function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1};var zn=18,qn=.95047,jn=1,In=1.08883,Zn=4/29,$n=6/29,Wn=3*$n*$n,On=$n*$n*$n,Bn=V.prototype=tt.prototype=new W;Bn.brighter=function(t){return new tt(this.l+zn*(null==t?1:t),this.a,this.b)},Bn.darker=function(t){return new tt(this.l-zn*(null==t?1:t),this.a,this.b)},Bn.rgb=function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return t=jn*et(t),n=qn*et(n),e=In*et(e),new J(it(3.2404542*n-1.5371385*t-.4985314*e),it(-.969266*n+1.8760108*t+.041556*e),it(.0556434*n-.2040259*t+1.0572252*e))};var Xn=Math.PI/180,Jn=180/Math.PI,Rn=rt.prototype=ht.prototype=new W;Rn.brighter=function(t){return new ht(this.h,this.c,this.l+zn*(null==t?1:t))},Rn.darker=function(t){return new ht(this.h,this.c,this.l-zn*(null==t?1:t))},Rn.rgb=function(){return V(this).rgb()};var Gn=-.14861,Qn=1.78277,Kn=-.29227,Vn=-.90649,te=1.97294,ne=te*Vn,ee=te*Qn,ie=Qn*Kn-Vn*Gn,se=at.prototype=ot.prototype=new W;se.brighter=function(t){return t=null==t?Yn:Math.pow(Yn,t),new ot(this.h,this.s,this.l*t)},se.darker=function(t){return t=null==t?Fn:Math.pow(Fn,t),new ot(this.h,this.s,this.l*t)},se.rgb=function(){var t=isNaN(this.h)?0:(this.h+120)*Xn,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),i=Math.cos(t),s=Math.sin(t);return new J(255*(n+e*(Gn*i+Qn*s)),255*(n+e*(Kn*i+Vn*s)),255*(n+e*(te*i)))};var re,he=(ct(1),_t(1),/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g),ae=(new RegExp(he.source,"g"),{decimal:".",thousands:",",grouping:[3],currency:["$",""]}),oe={"":dt,"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return xt(100*t,n)},r:xt,s:yt,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},ue=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;mt.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var ce=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],_e=vt(ae),le=_e.format,fe=(Math.sqrt(50),Math.sqrt(10),Math.sqrt(2),le(".0e"),le(","),{dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),ge=new Date,ye=new Date;wt(function(){},function(t,n){t.setTime(+t+n)},function(t,n){return n-t}),wt(function(t){t.setMilliseconds(0)},function(t,n){t.setTime(+t+1e3*n)},function(t,n){return(n-t)/1e3}),wt(function(t){t.setSeconds(0,0)},function(t,n){t.setTime(+t+6e4*n)},function(t,n){return(n-t)/6e4}),wt(function(t){t.setMinutes(0,0,0)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5});var xe=wt(function(t){t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n)},function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),de=Mt(0),pe=Mt(1);Mt(2),Mt(3),Mt(4),Mt(5),Mt(6);wt(function(t){t.setHours(0,0,0,0),t.setDate(1)},function(t,n){t.setMonth(t.getMonth()+n)},function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())});var me=wt(function(t){t.setHours(0,0,0,0),t.setMonth(0,1)},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t,n){return n.getFullYear()-t.getFullYear()});wt(function(t){t.setUTCMilliseconds(0)},function(t,n){t.setTime(+t+1e3*n)},function(t,n){return(n-t)/1e3}),wt(function(t){t.setUTCSeconds(0,0)},function(t,n){t.setTime(+t+6e4*n)},function(t,n){return(n-t)/6e4}),wt(function(t){t.setUTCMinutes(0,0,0)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5});var be=wt(function(t){t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n)},function(t,n){return(n-t)/864e5}),ve=Tt(0),we=Tt(1);Tt(2),Tt(3),Tt(4),Tt(5),Tt(6);wt(function(t){t.setUTCHours(0,0,0,0),t.setUTCDate(1)},function(t,n){t.setUTCMonth(t.getUTCMonth()+n)},function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())});var Me=wt(function(t){t.setUTCHours(0,0,0,0),t.setUTCMonth(0,1)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)},function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()}),Te={"-":"",_:" ",0:"0"},ke=/^\s*\d+/,Ce=/^%/,Ne=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Se="%Y-%m-%dT%H:%M:%S.%LZ";Mn.parse=function(t){var n=new Date(t);return isNaN(n)?null:n},Mn.toString=function(){return Se};var Ue=(Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Mn:fe.utcFormat(Se),St(fe)),De=Ue.format,Ae=Ue.utcFormat,Pe=(E(function(t){return t[2]}).right,De(".%L"),De(":%S"),De("%I:%M"),De("%I %p"),De("%a %d"),De("%b %d"),De("%B"),De("%Y"),Ae(".%L"),Ae(":%S"),Ae("%I:%M"),Ae("%I %p"),Ae("%a %d"),Ae("%b %d"),Ae("%B"),Ae("%Y"),{scale:{category10:$},shape:{line:F}});return Pe});
<!DOCTYPE html>
<meta charset="utf-8">
<canvas width="960" height="500"></canvas>
<script src="d3.min.js"></script>
<script>
var points = [
[ 0, 0],
[ 90, 0],
[180, 15],
[270, 73],
[360, 293],
[450, 308],
[540, 323],
[630, 367],
[720, 411],
[810, 425],
[900, 425]
];
var canvas = document.querySelector("canvas"),
context = canvas.getContext("2d");
var margin = {top: 30, right: 30, bottom: 30, left: 30},
width = canvas.width - margin.left - margin.right,
height = canvas.height - margin.top - margin.bottom,
radius = 3.5;
var color = d3.scale.category10()
.domain([
"cubic",
"catmull-rom:0.0",
"catmull-rom:0.5",
"catmull-rom:1.0"
]);
var line = d3.shape.line()
.context(context);
context.translate(margin.left, margin.top);
// Axes
context.moveTo(0.5, height + 0.5);
context.lineTo(0.5, 0.5);
context.moveTo(0.5, height + 0.5);
context.lineTo(width + 0.5, height + 0.5);
context.stroke();
// Points
points.forEach(function(d) {
context.beginPath();
context.moveTo(d[0] + radius, d[1]);
context.arc(d[0], d[1], radius, 0, 2 * Math.PI, true);
context.fill();
});
// Splines
color.domain().forEach(function(i) {
var parts = i.split(":"), name = parts[0], value = +parts[1];
context.beginPath();
line.interpolate(name, value)(points);
context.lineWidth = 1.5;
context.strokeStyle = color(i);
context.stroke();
});
</script>
{
"private": true,
"scripts": {
"build": "rollup -c | uglifyjs -c -m > d3.min.js"
},
"dependencies": {
"d3-scale": "^0.1.5",
"d3-shape": "^0.0.2",
"rollup": "^0.20.5",
"rollup-plugin-npm": "^1.0.0",
"uglify-js": "^2.6.0"
}
}
import npm from "rollup-plugin-npm";
export default {
entry: "d3.js",
plugins: [npm({jsnext: true})],
moduleId: "d3",
moduleName: "d3",
format: "umd"
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment