Comparing version 2.2.0 to 2.2.1
@@ -1,7 +0,7 @@ | ||
// https://d3js.org/d3-scale/ v2.2.0 Copyright 2019 Mike Bostock | ||
// https://d3js.org/d3-scale/ v2.2.1 Copyright 2019 Mike Bostock | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-array'), require('d3-interpolate'), require('d3-format'), require('d3-time'), require('d3-time-format')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-array', 'd3-interpolate', 'd3-format', 'd3-time', 'd3-time-format'], factory) : | ||
(factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3,global.d3)); | ||
}(this, (function (exports,d3Array,d3Interpolate,d3Format,d3Time,d3TimeFormat) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-collection'), require('d3-array'), require('d3-interpolate'), require('d3-format'), require('d3-time'), require('d3-time-format')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-collection', 'd3-array', 'd3-interpolate', 'd3-format', 'd3-time', 'd3-time-format'], factory) : | ||
(factory((global.d3 = global.d3 || {}),global.d3,global.d3,global.d3,global.d3,global.d3,global.d3)); | ||
}(this, (function (exports,d3Collection,d3Array,d3Interpolate,d3Format,d3Time,d3TimeFormat) { 'use strict'; | ||
@@ -34,3 +34,3 @@ function initRange(domain, range) { | ||
function ordinal() { | ||
var index = new Map, | ||
var index = d3Collection.map(), | ||
domain = [], | ||
@@ -51,3 +51,3 @@ range = [], | ||
if (!arguments.length) return domain.slice(); | ||
domain = [], index = new Map(); | ||
domain = [], index = d3Collection.map(); | ||
var i = -1, n = _.length, d, key; | ||
@@ -54,0 +54,0 @@ while (++i < n) if (!index.has(key = (d = _[i]) + "")) index.set(key, domain.push(d)); |
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-scale/ v2.2.0 Copyright 2019 Mike Bostock | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-interpolate"),require("d3-format"),require("d3-time"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-interpolate","d3-format","d3-time","d3-time-format"],t):t(n.d3=n.d3||{},n.d3,n.d3,n.d3,n.d3,n.d3)}(this,function(n,t,e,r,u,i){"use strict";function a(n,t){switch(arguments.length){case 0:break;case 1:this.range(n);break;default:this.range(t).domain(n)}return this}function o(n,t){switch(arguments.length){case 0:break;case 1:this.interpolator(n);break;default:this.interpolator(t).domain(n)}return this}var c=Array.prototype,l=c.map,f=c.slice,p={name:"implicit"};function h(){var n=new Map,t=[],e=[],r=p;function u(u){var i=u+"",a=n.get(i);if(!a){if(r!==p)return r;n.set(i,a=t.push(u))}return e[(a-1)%e.length]}return u.domain=function(e){if(!arguments.length)return t.slice();t=[],n=new Map;for(var r,i,a=-1,o=e.length;++a<o;)n.has(i=(r=e[a])+"")||n.set(i,t.push(r));return u},u.range=function(n){return arguments.length?(e=f.call(n),u):e.slice()},u.unknown=function(n){return arguments.length?(r=n,u):r},u.copy=function(){return h(t,e).unknown(r)},a.apply(u,arguments),u}function s(){var n,e,r=h().unknown(void 0),u=r.domain,i=r.range,o=[0,1],c=!1,l=0,f=0,p=.5;function g(){var r=u().length,a=o[1]<o[0],h=o[a-0],s=o[1-a];n=(s-h)/Math.max(1,r-l+2*f),c&&(n=Math.floor(n)),h+=(s-h-n*(r-l))*p,e=n*(1-l),c&&(h=Math.round(h),e=Math.round(e));var g=t.range(r).map(function(t){return h+n*t});return i(a?g.reverse():g)}return delete r.unknown,r.domain=function(n){return arguments.length?(u(n),g()):u()},r.range=function(n){return arguments.length?(o=[+n[0],+n[1]],g()):o.slice()},r.rangeRound=function(n){return o=[+n[0],+n[1]],c=!0,g()},r.bandwidth=function(){return e},r.step=function(){return n},r.round=function(n){return arguments.length?(c=!!n,g()):c},r.padding=function(n){return arguments.length?(l=Math.min(1,f=+n),g()):l},r.paddingInner=function(n){return arguments.length?(l=Math.min(1,n),g()):l},r.paddingOuter=function(n){return arguments.length?(f=+n,g()):f},r.align=function(n){return arguments.length?(p=Math.max(0,Math.min(1,n)),g()):p},r.copy=function(){return s(u(),o).round(c).paddingInner(l).paddingOuter(f).align(p)},a.apply(g(),arguments)}function g(n){return+n}var d=[0,1];function m(n){return n}function v(n,t){return(t-=n=+n)?function(e){return(e-n)/t}:(e=isNaN(t)?NaN:.5,function(){return e});var e}function M(n){var t,e=n[0],r=n[n.length-1];return e>r&&(t=e,e=r,r=t),function(n){return Math.max(e,Math.min(r,n))}}function y(n,t,e){var r=n[0],u=n[1],i=t[0],a=t[1];return u<r?(r=v(u,r),i=e(a,i)):(r=v(r,u),i=e(i,a)),function(n){return i(r(n))}}function k(n,e,r){var u=Math.min(n.length,e.length)-1,i=new Array(u),a=new Array(u),o=-1;for(n[u]<n[0]&&(n=n.slice().reverse(),e=e.slice().reverse());++o<u;)i[o]=v(n[o],n[o+1]),a[o]=r(e[o],e[o+1]);return function(e){var r=t.bisect(n,e,1,u)-1;return a[r](i[r](e))}}function w(n,t){return t.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function x(){var n,t,r,u,i,a,o=d,c=d,p=e.interpolate,h=m;function s(){return u=Math.min(o.length,c.length)>2?k:y,i=a=null,v}function v(t){return isNaN(t=+t)?r:(i||(i=u(o.map(n),c,p)))(n(h(t)))}return v.invert=function(r){return h(t((a||(a=u(c,o.map(n),e.interpolateNumber)))(r)))},v.domain=function(n){return arguments.length?(o=l.call(n,g),h===m||(h=M(o)),s()):o.slice()},v.range=function(n){return arguments.length?(c=f.call(n),s()):c.slice()},v.rangeRound=function(n){return c=f.call(n),p=e.interpolateRound,s()},v.clamp=function(n){return arguments.length?(h=n?M(o):m,v):h!==m},v.interpolate=function(n){return arguments.length?(p=n,s()):p},v.unknown=function(n){return arguments.length?(r=n,v):r},function(e,r){return n=e,t=r,s()}}function N(n,t){return x()(n,t)}function b(n,e,u,i){var a,o=t.tickStep(n,e,u);switch((i=r.formatSpecifier(null==i?",f":i)).type){case"s":var c=Math.max(Math.abs(n),Math.abs(e));return null!=i.precision||isNaN(a=r.precisionPrefix(o,c))||(i.precision=a),r.formatPrefix(i,c);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(a=r.precisionRound(o,Math.max(Math.abs(n),Math.abs(e))))||(i.precision=a-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(a=r.precisionFixed(o))||(i.precision=a-2*("%"===i.type))}return r.format(i)}function q(n){var e=n.domain;return n.ticks=function(n){var r=e();return t.ticks(r[0],r[r.length-1],null==n?10:n)},n.tickFormat=function(n,t){var r=e();return b(r[0],r[r.length-1],null==n?10:n,t)},n.nice=function(r){null==r&&(r=10);var u,i=e(),a=0,o=i.length-1,c=i[a],l=i[o];return l<c&&(u=c,c=l,l=u,u=a,a=o,o=u),(u=t.tickIncrement(c,l,r))>0?(c=Math.floor(c/u)*u,l=Math.ceil(l/u)*u,u=t.tickIncrement(c,l,r)):u<0&&(c=Math.ceil(c*u)/u,l=Math.floor(l*u)/u,u=t.tickIncrement(c,l,r)),u>0?(i[a]=Math.floor(c/u)*u,i[o]=Math.ceil(l/u)*u,e(i)):u<0&&(i[a]=Math.ceil(c*u)/u,i[o]=Math.floor(l*u)/u,e(i)),n},n}function S(n,t){var e,r=0,u=(n=n.slice()).length-1,i=n[r],a=n[u];return a<i&&(e=r,r=u,u=e,e=i,i=a,a=e),n[r]=t.floor(i),n[u]=t.ceil(a),n}function D(n){return Math.log(n)}function I(n){return Math.exp(n)}function O(n){return-Math.log(-n)}function F(n){return-Math.exp(-n)}function P(n){return isFinite(n)?+("1e"+n):n<0?0:n}function A(n){return function(t){return-n(-t)}}function E(n){var e,u,i=n(D,I),a=i.domain,o=10;function c(){return e=function(n){return n===Math.E?Math.log:10===n&&Math.log10||2===n&&Math.log2||(n=Math.log(n),function(t){return Math.log(t)/n})}(o),u=function(n){return 10===n?P:n===Math.E?Math.exp:function(t){return Math.pow(n,t)}}(o),a()[0]<0?(e=A(e),u=A(u),n(O,F)):n(D,I),i}return i.base=function(n){return arguments.length?(o=+n,c()):o},i.domain=function(n){return arguments.length?(a(n),c()):a()},i.ticks=function(n){var r,i=a(),c=i[0],l=i[i.length-1];(r=l<c)&&(s=c,c=l,l=s);var f,p,h,s=e(c),g=e(l),d=null==n?10:+n,m=[];if(!(o%1)&&g-s<d){if(s=Math.round(s)-1,g=Math.round(g)+1,c>0){for(;s<g;++s)for(p=1,f=u(s);p<o;++p)if(!((h=f*p)<c)){if(h>l)break;m.push(h)}}else for(;s<g;++s)for(p=o-1,f=u(s);p>=1;--p)if(!((h=f*p)<c)){if(h>l)break;m.push(h)}}else m=t.ticks(s,g,Math.min(g-s,d)).map(u);return r?m.reverse():m},i.tickFormat=function(n,t){if(null==t&&(t=10===o?".0e":","),"function"!=typeof t&&(t=r.format(t)),n===1/0)return t;null==n&&(n=10);var a=Math.max(1,o*n/i.ticks().length);return function(n){var r=n/u(Math.round(e(n)));return r*o<o-.5&&(r*=o),r<=a?t(n):""}},i.nice=function(){return a(S(a(),{floor:function(n){return u(Math.floor(e(n)))},ceil:function(n){return u(Math.ceil(e(n)))}}))},i}function L(n){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/n))}}function R(n){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*n}}function T(n){var t=1,e=n(L(t),R(t));return e.constant=function(e){return arguments.length?n(L(t=+e),R(t)):t},q(e)}function Q(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function U(n){return n<0?-Math.sqrt(-n):Math.sqrt(n)}function Y(n){return n<0?-n*n:n*n}function j(n){var t=n(m,m),e=1;return t.exponent=function(t){return arguments.length?1===(e=+t)?n(m,m):.5===e?n(U,Y):n(Q(e),Q(1/e)):e},q(t)}function B(){var n=j(x());return n.copy=function(){return w(n,B()).exponent(n.exponent())},a.apply(n,arguments),n}var C=1e3,H=60*C,W=60*H,_=24*W,z=7*_,G=30*_,J=365*_;function K(n){return new Date(n)}function V(n){return n instanceof Date?+n:+new Date(+n)}function X(n,e,r,u,i,a,o,c,f){var p=N(m,m),h=p.invert,s=p.domain,g=f(".%L"),d=f(":%S"),v=f("%I:%M"),M=f("%I %p"),y=f("%a %d"),k=f("%b %d"),x=f("%B"),b=f("%Y"),q=[[o,1,C],[o,5,5*C],[o,15,15*C],[o,30,30*C],[a,1,H],[a,5,5*H],[a,15,15*H],[a,30,30*H],[i,1,W],[i,3,3*W],[i,6,6*W],[i,12,12*W],[u,1,_],[u,2,2*_],[r,1,z],[e,1,G],[e,3,3*G],[n,1,J]];function D(t){return(o(t)<t?g:a(t)<t?d:i(t)<t?v:u(t)<t?M:e(t)<t?r(t)<t?y:k:n(t)<t?x:b)(t)}function I(e,r,u,i){if(null==e&&(e=10),"number"==typeof e){var a=Math.abs(u-r)/e,o=t.bisector(function(n){return n[2]}).right(q,a);o===q.length?(i=t.tickStep(r/J,u/J,e),e=n):o?(i=(o=q[a/q[o-1][2]<q[o][2]/a?o-1:o])[1],e=o[0]):(i=Math.max(t.tickStep(r,u,e),1),e=c)}return null==i?e:e.every(i)}return p.invert=function(n){return new Date(h(n))},p.domain=function(n){return arguments.length?s(l.call(n,V)):s().map(K)},p.ticks=function(n,t){var e,r=s(),u=r[0],i=r[r.length-1],a=i<u;return a&&(e=u,u=i,i=e),e=(e=I(n,u,i,t))?e.range(u,i+1):[],a?e.reverse():e},p.tickFormat=function(n,t){return null==t?D:f(t)},p.nice=function(n,t){var e=s();return(n=I(n,e[0],e[e.length-1],t))?s(S(e,n)):p},p.copy=function(){return w(p,X(n,e,r,u,i,a,o,c,f))},p}function Z(){var n,t,e,r,u,i=0,a=1,o=m,c=!1;function l(t){return isNaN(t=+t)?u:o(0===e?.5:(t=(r(t)-n)*e,c?Math.max(0,Math.min(1,t)):t))}return l.domain=function(u){return arguments.length?(n=r(i=+u[0]),t=r(a=+u[1]),e=n===t?0:1/(t-n),l):[i,a]},l.clamp=function(n){return arguments.length?(c=!!n,l):c},l.interpolator=function(n){return arguments.length?(o=n,l):o},l.unknown=function(n){return arguments.length?(u=n,l):u},function(u){return r=u,n=u(i),t=u(a),e=n===t?0:1/(t-n),l}}function $(n,t){return t.domain(n.domain()).interpolator(n.interpolator()).clamp(n.clamp()).unknown(n.unknown())}function nn(){var n=j(Z());return n.copy=function(){return $(n,nn()).exponent(n.exponent())},o.apply(n,arguments)}function tn(){var n,t,e,r,u,i,a,o=0,c=.5,l=1,f=m,p=!1;function h(n){return isNaN(n=+n)?a:(n=.5+((n=+i(n))-t)*(n<t?r:u),f(p?Math.max(0,Math.min(1,n)):n))}return h.domain=function(a){return arguments.length?(n=i(o=+a[0]),t=i(c=+a[1]),e=i(l=+a[2]),r=n===t?0:.5/(t-n),u=t===e?0:.5/(e-t),h):[o,c,l]},h.clamp=function(n){return arguments.length?(p=!!n,h):p},h.interpolator=function(n){return arguments.length?(f=n,h):f},h.unknown=function(n){return arguments.length?(a=n,h):a},function(a){return i=a,n=a(o),t=a(c),e=a(l),r=n===t?0:.5/(t-n),u=t===e?0:.5/(e-t),h}}function en(){var n=j(tn());return n.copy=function(){return $(n,en()).exponent(n.exponent())},o.apply(n,arguments)}n.scaleBand=s,n.scalePoint=function(){return function n(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return n(e())},t}(s.apply(null,arguments).paddingInner(1))},n.scaleIdentity=function n(t){var e;function r(n){return isNaN(n=+n)?e:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(t=l.call(n,g),r):t.slice()},r.unknown=function(n){return arguments.length?(e=n,r):e},r.copy=function(){return n(t).unknown(e)},t=arguments.length?l.call(t,g):[0,1],q(r)},n.scaleLinear=function n(){var t=N(m,m);return t.copy=function(){return w(t,n())},a.apply(t,arguments),q(t)},n.scaleLog=function n(){var t=E(x()).domain([1,10]);return t.copy=function(){return w(t,n()).base(t.base())},a.apply(t,arguments),t},n.scaleSymlog=function n(){var t=T(x());return t.copy=function(){return w(t,n()).constant(t.constant())},a.apply(t,arguments)},n.scaleOrdinal=h,n.scaleImplicit=p,n.scalePow=B,n.scaleSqrt=function(){return B.apply(null,arguments).exponent(.5)},n.scaleQuantile=function n(){var e,r=[],u=[],i=[];function o(){var n=0,e=Math.max(1,u.length);for(i=new Array(e-1);++n<e;)i[n-1]=t.quantile(r,n/e);return c}function c(n){return isNaN(n=+n)?e:u[t.bisect(i,n)]}return c.invertExtent=function(n){var t=u.indexOf(n);return t<0?[NaN,NaN]:[t>0?i[t-1]:r[0],t<i.length?i[t]:r[r.length-1]]},c.domain=function(n){if(!arguments.length)return r.slice();r=[];for(var e,u=0,i=n.length;u<i;++u)null==(e=n[u])||isNaN(e=+e)||r.push(e);return r.sort(t.ascending),o()},c.range=function(n){return arguments.length?(u=f.call(n),o()):u.slice()},c.unknown=function(n){return arguments.length?(e=n,c):e},c.quantiles=function(){return i.slice()},c.copy=function(){return n().domain(r).range(u).unknown(e)},a.apply(c,arguments)},n.scaleQuantize=function n(){var e,r=0,u=1,i=1,o=[.5],c=[0,1];function l(n){return n<=n?c[t.bisect(o,n,0,i)]:e}function p(){var n=-1;for(o=new Array(i);++n<i;)o[n]=((n+1)*u-(n-i)*r)/(i+1);return l}return l.domain=function(n){return arguments.length?(r=+n[0],u=+n[1],p()):[r,u]},l.range=function(n){return arguments.length?(i=(c=f.call(n)).length-1,p()):c.slice()},l.invertExtent=function(n){var t=c.indexOf(n);return t<0?[NaN,NaN]:t<1?[r,o[0]]:t>=i?[o[i-1],u]:[o[t-1],o[t]]},l.unknown=function(n){return arguments.length?(e=n,l):l},l.thresholds=function(){return o.slice()},l.copy=function(){return n().domain([r,u]).range(c).unknown(e)},a.apply(q(l),arguments)},n.scaleThreshold=function n(){var e,r=[.5],u=[0,1],i=1;function o(n){return n<=n?u[t.bisect(r,n,0,i)]:e}return o.domain=function(n){return arguments.length?(r=f.call(n),i=Math.min(r.length,u.length-1),o):r.slice()},o.range=function(n){return arguments.length?(u=f.call(n),i=Math.min(r.length,u.length-1),o):u.slice()},o.invertExtent=function(n){var t=u.indexOf(n);return[r[t-1],r[t]]},o.unknown=function(n){return arguments.length?(e=n,o):e},o.copy=function(){return n().domain(r).range(u).unknown(e)},a.apply(o,arguments)},n.scaleTime=function(){return a.apply(X(u.timeYear,u.timeMonth,u.timeWeek,u.timeDay,u.timeHour,u.timeMinute,u.timeSecond,u.timeMillisecond,i.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},n.scaleUtc=function(){return a.apply(X(u.utcYear,u.utcMonth,u.utcWeek,u.utcDay,u.utcHour,u.utcMinute,u.utcSecond,u.utcMillisecond,i.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},n.scaleSequential=function n(){var t=q(Z()(m));return t.copy=function(){return $(t,n())},o.apply(t,arguments)},n.scaleSequentialLog=function n(){var t=E(Z()).domain([1,10]);return t.copy=function(){return $(t,n()).base(t.base())},o.apply(t,arguments)},n.scaleSequentialPow=nn,n.scaleSequentialSqrt=function(){return nn.apply(null,arguments).exponent(.5)},n.scaleSequentialSymlog=function n(){var t=T(Z());return t.copy=function(){return $(t,n()).constant(t.constant())},o.apply(t,arguments)},n.scaleSequentialQuantile=function n(){var e=[],r=m;function u(n){if(!isNaN(n=+n))return r((t.bisect(e,n)-1)/(e.length-1))}return u.domain=function(n){if(!arguments.length)return e.slice();e=[];for(var r,i=0,a=n.length;i<a;++i)null==(r=n[i])||isNaN(r=+r)||e.push(r);return e.sort(t.ascending),u},u.interpolator=function(n){return arguments.length?(r=n,u):r},u.copy=function(){return n(r).domain(e)},o.apply(u,arguments)},n.scaleDiverging=function n(){var t=q(tn()(m));return t.copy=function(){return $(t,n())},o.apply(t,arguments)},n.scaleDivergingLog=function n(){var t=E(tn()).domain([.1,1,10]);return t.copy=function(){return $(t,n()).base(t.base())},o.apply(t,arguments)},n.scaleDivergingPow=en,n.scaleDivergingSqrt=function(){return en.apply(null,arguments).exponent(.5)},n.tickFormat=b,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
// https://d3js.org/d3-scale/ v2.2.1 Copyright 2019 Mike Bostock | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-collection"),require("d3-array"),require("d3-interpolate"),require("d3-format"),require("d3-time"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","d3-collection","d3-array","d3-interpolate","d3-format","d3-time","d3-time-format"],t):t(n.d3=n.d3||{},n.d3,n.d3,n.d3,n.d3,n.d3,n.d3)}(this,function(n,t,e,r,u,i,o){"use strict";function a(n,t){switch(arguments.length){case 0:break;case 1:this.range(n);break;default:this.range(t).domain(n)}return this}function c(n,t){switch(arguments.length){case 0:break;case 1:this.interpolator(n);break;default:this.interpolator(t).domain(n)}return this}var l=Array.prototype,f=l.map,p=l.slice,h={name:"implicit"};function s(){var n=t.map(),e=[],r=[],u=h;function i(t){var i=t+"",o=n.get(i);if(!o){if(u!==h)return u;n.set(i,o=e.push(t))}return r[(o-1)%r.length]}return i.domain=function(r){if(!arguments.length)return e.slice();e=[],n=t.map();for(var u,o,a=-1,c=r.length;++a<c;)n.has(o=(u=r[a])+"")||n.set(o,e.push(u));return i},i.range=function(n){return arguments.length?(r=p.call(n),i):r.slice()},i.unknown=function(n){return arguments.length?(u=n,i):u},i.copy=function(){return s(e,r).unknown(u)},a.apply(i,arguments),i}function g(){var n,t,r=s().unknown(void 0),u=r.domain,i=r.range,o=[0,1],c=!1,l=0,f=0,p=.5;function h(){var r=u().length,a=o[1]<o[0],h=o[a-0],s=o[1-a];n=(s-h)/Math.max(1,r-l+2*f),c&&(n=Math.floor(n)),h+=(s-h-n*(r-l))*p,t=n*(1-l),c&&(h=Math.round(h),t=Math.round(t));var g=e.range(r).map(function(t){return h+n*t});return i(a?g.reverse():g)}return delete r.unknown,r.domain=function(n){return arguments.length?(u(n),h()):u()},r.range=function(n){return arguments.length?(o=[+n[0],+n[1]],h()):o.slice()},r.rangeRound=function(n){return o=[+n[0],+n[1]],c=!0,h()},r.bandwidth=function(){return t},r.step=function(){return n},r.round=function(n){return arguments.length?(c=!!n,h()):c},r.padding=function(n){return arguments.length?(l=Math.min(1,f=+n),h()):l},r.paddingInner=function(n){return arguments.length?(l=Math.min(1,n),h()):l},r.paddingOuter=function(n){return arguments.length?(f=+n,h()):f},r.align=function(n){return arguments.length?(p=Math.max(0,Math.min(1,n)),h()):p},r.copy=function(){return g(u(),o).round(c).paddingInner(l).paddingOuter(f).align(p)},a.apply(h(),arguments)}function d(n){return+n}var m=[0,1];function v(n){return n}function M(n,t){return(t-=n=+n)?function(e){return(e-n)/t}:(e=isNaN(t)?NaN:.5,function(){return e});var e}function y(n){var t,e=n[0],r=n[n.length-1];return e>r&&(t=e,e=r,r=t),function(n){return Math.max(e,Math.min(r,n))}}function k(n,t,e){var r=n[0],u=n[1],i=t[0],o=t[1];return u<r?(r=M(u,r),i=e(o,i)):(r=M(r,u),i=e(i,o)),function(n){return i(r(n))}}function w(n,t,r){var u=Math.min(n.length,t.length)-1,i=new Array(u),o=new Array(u),a=-1;for(n[u]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++a<u;)i[a]=M(n[a],n[a+1]),o[a]=r(t[a],t[a+1]);return function(t){var r=e.bisect(n,t,1,u)-1;return o[r](i[r](t))}}function x(n,t){return t.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function N(){var n,t,e,u,i,o,a=m,c=m,l=r.interpolate,h=v;function s(){return u=Math.min(a.length,c.length)>2?w:k,i=o=null,g}function g(t){return isNaN(t=+t)?e:(i||(i=u(a.map(n),c,l)))(n(h(t)))}return g.invert=function(e){return h(t((o||(o=u(c,a.map(n),r.interpolateNumber)))(e)))},g.domain=function(n){return arguments.length?(a=f.call(n,d),h===v||(h=y(a)),s()):a.slice()},g.range=function(n){return arguments.length?(c=p.call(n),s()):c.slice()},g.rangeRound=function(n){return c=p.call(n),l=r.interpolateRound,s()},g.clamp=function(n){return arguments.length?(h=n?y(a):v,g):h!==v},g.interpolate=function(n){return arguments.length?(l=n,s()):l},g.unknown=function(n){return arguments.length?(e=n,g):e},function(e,r){return n=e,t=r,s()}}function b(n,t){return N()(n,t)}function q(n,t,r,i){var o,a=e.tickStep(n,t,r);switch((i=u.formatSpecifier(null==i?",f":i)).type){case"s":var c=Math.max(Math.abs(n),Math.abs(t));return null!=i.precision||isNaN(o=u.precisionPrefix(a,c))||(i.precision=o),u.formatPrefix(i,c);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(o=u.precisionRound(a,Math.max(Math.abs(n),Math.abs(t))))||(i.precision=o-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(o=u.precisionFixed(a))||(i.precision=o-2*("%"===i.type))}return u.format(i)}function S(n){var t=n.domain;return n.ticks=function(n){var r=t();return e.ticks(r[0],r[r.length-1],null==n?10:n)},n.tickFormat=function(n,e){var r=t();return q(r[0],r[r.length-1],null==n?10:n,e)},n.nice=function(r){null==r&&(r=10);var u,i=t(),o=0,a=i.length-1,c=i[o],l=i[a];return l<c&&(u=c,c=l,l=u,u=o,o=a,a=u),(u=e.tickIncrement(c,l,r))>0?(c=Math.floor(c/u)*u,l=Math.ceil(l/u)*u,u=e.tickIncrement(c,l,r)):u<0&&(c=Math.ceil(c*u)/u,l=Math.floor(l*u)/u,u=e.tickIncrement(c,l,r)),u>0?(i[o]=Math.floor(c/u)*u,i[a]=Math.ceil(l/u)*u,t(i)):u<0&&(i[o]=Math.ceil(c*u)/u,i[a]=Math.floor(l*u)/u,t(i)),n},n}function D(n,t){var e,r=0,u=(n=n.slice()).length-1,i=n[r],o=n[u];return o<i&&(e=r,r=u,u=e,e=i,i=o,o=e),n[r]=t.floor(i),n[u]=t.ceil(o),n}function I(n){return Math.log(n)}function O(n){return Math.exp(n)}function F(n){return-Math.log(-n)}function P(n){return-Math.exp(-n)}function A(n){return isFinite(n)?+("1e"+n):n<0?0:n}function E(n){return function(t){return-n(-t)}}function L(n){var t,r,i=n(I,O),o=i.domain,a=10;function c(){return t=function(n){return n===Math.E?Math.log:10===n&&Math.log10||2===n&&Math.log2||(n=Math.log(n),function(t){return Math.log(t)/n})}(a),r=function(n){return 10===n?A:n===Math.E?Math.exp:function(t){return Math.pow(n,t)}}(a),o()[0]<0?(t=E(t),r=E(r),n(F,P)):n(I,O),i}return i.base=function(n){return arguments.length?(a=+n,c()):a},i.domain=function(n){return arguments.length?(o(n),c()):o()},i.ticks=function(n){var u,i=o(),c=i[0],l=i[i.length-1];(u=l<c)&&(s=c,c=l,l=s);var f,p,h,s=t(c),g=t(l),d=null==n?10:+n,m=[];if(!(a%1)&&g-s<d){if(s=Math.round(s)-1,g=Math.round(g)+1,c>0){for(;s<g;++s)for(p=1,f=r(s);p<a;++p)if(!((h=f*p)<c)){if(h>l)break;m.push(h)}}else for(;s<g;++s)for(p=a-1,f=r(s);p>=1;--p)if(!((h=f*p)<c)){if(h>l)break;m.push(h)}}else m=e.ticks(s,g,Math.min(g-s,d)).map(r);return u?m.reverse():m},i.tickFormat=function(n,e){if(null==e&&(e=10===a?".0e":","),"function"!=typeof e&&(e=u.format(e)),n===1/0)return e;null==n&&(n=10);var o=Math.max(1,a*n/i.ticks().length);return function(n){var u=n/r(Math.round(t(n)));return u*a<a-.5&&(u*=a),u<=o?e(n):""}},i.nice=function(){return o(D(o(),{floor:function(n){return r(Math.floor(t(n)))},ceil:function(n){return r(Math.ceil(t(n)))}}))},i}function R(n){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/n))}}function T(n){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*n}}function Q(n){var t=1,e=n(R(t),T(t));return e.constant=function(e){return arguments.length?n(R(t=+e),T(t)):t},S(e)}function U(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function Y(n){return n<0?-Math.sqrt(-n):Math.sqrt(n)}function j(n){return n<0?-n*n:n*n}function B(n){var t=n(v,v),e=1;return t.exponent=function(t){return arguments.length?1===(e=+t)?n(v,v):.5===e?n(Y,j):n(U(e),U(1/e)):e},S(t)}function C(){var n=B(N());return n.copy=function(){return x(n,C()).exponent(n.exponent())},a.apply(n,arguments),n}var H=1e3,W=60*H,_=60*W,z=24*_,G=7*z,J=30*z,K=365*z;function V(n){return new Date(n)}function X(n){return n instanceof Date?+n:+new Date(+n)}function Z(n,t,r,u,i,o,a,c,l){var p=b(v,v),h=p.invert,s=p.domain,g=l(".%L"),d=l(":%S"),m=l("%I:%M"),M=l("%I %p"),y=l("%a %d"),k=l("%b %d"),w=l("%B"),N=l("%Y"),q=[[a,1,H],[a,5,5*H],[a,15,15*H],[a,30,30*H],[o,1,W],[o,5,5*W],[o,15,15*W],[o,30,30*W],[i,1,_],[i,3,3*_],[i,6,6*_],[i,12,12*_],[u,1,z],[u,2,2*z],[r,1,G],[t,1,J],[t,3,3*J],[n,1,K]];function S(e){return(a(e)<e?g:o(e)<e?d:i(e)<e?m:u(e)<e?M:t(e)<e?r(e)<e?y:k:n(e)<e?w:N)(e)}function I(t,r,u,i){if(null==t&&(t=10),"number"==typeof t){var o=Math.abs(u-r)/t,a=e.bisector(function(n){return n[2]}).right(q,o);a===q.length?(i=e.tickStep(r/K,u/K,t),t=n):a?(i=(a=q[o/q[a-1][2]<q[a][2]/o?a-1:a])[1],t=a[0]):(i=Math.max(e.tickStep(r,u,t),1),t=c)}return null==i?t:t.every(i)}return p.invert=function(n){return new Date(h(n))},p.domain=function(n){return arguments.length?s(f.call(n,X)):s().map(V)},p.ticks=function(n,t){var e,r=s(),u=r[0],i=r[r.length-1],o=i<u;return o&&(e=u,u=i,i=e),e=(e=I(n,u,i,t))?e.range(u,i+1):[],o?e.reverse():e},p.tickFormat=function(n,t){return null==t?S:l(t)},p.nice=function(n,t){var e=s();return(n=I(n,e[0],e[e.length-1],t))?s(D(e,n)):p},p.copy=function(){return x(p,Z(n,t,r,u,i,o,a,c,l))},p}function $(){var n,t,e,r,u,i=0,o=1,a=v,c=!1;function l(t){return isNaN(t=+t)?u:a(0===e?.5:(t=(r(t)-n)*e,c?Math.max(0,Math.min(1,t)):t))}return l.domain=function(u){return arguments.length?(n=r(i=+u[0]),t=r(o=+u[1]),e=n===t?0:1/(t-n),l):[i,o]},l.clamp=function(n){return arguments.length?(c=!!n,l):c},l.interpolator=function(n){return arguments.length?(a=n,l):a},l.unknown=function(n){return arguments.length?(u=n,l):u},function(u){return r=u,n=u(i),t=u(o),e=n===t?0:1/(t-n),l}}function nn(n,t){return t.domain(n.domain()).interpolator(n.interpolator()).clamp(n.clamp()).unknown(n.unknown())}function tn(){var n=B($());return n.copy=function(){return nn(n,tn()).exponent(n.exponent())},c.apply(n,arguments)}function en(){var n,t,e,r,u,i,o,a=0,c=.5,l=1,f=v,p=!1;function h(n){return isNaN(n=+n)?o:(n=.5+((n=+i(n))-t)*(n<t?r:u),f(p?Math.max(0,Math.min(1,n)):n))}return h.domain=function(o){return arguments.length?(n=i(a=+o[0]),t=i(c=+o[1]),e=i(l=+o[2]),r=n===t?0:.5/(t-n),u=t===e?0:.5/(e-t),h):[a,c,l]},h.clamp=function(n){return arguments.length?(p=!!n,h):p},h.interpolator=function(n){return arguments.length?(f=n,h):f},h.unknown=function(n){return arguments.length?(o=n,h):o},function(o){return i=o,n=o(a),t=o(c),e=o(l),r=n===t?0:.5/(t-n),u=t===e?0:.5/(e-t),h}}function rn(){var n=B(en());return n.copy=function(){return nn(n,rn()).exponent(n.exponent())},c.apply(n,arguments)}n.scaleBand=g,n.scalePoint=function(){return function n(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return n(e())},t}(g.apply(null,arguments).paddingInner(1))},n.scaleIdentity=function n(t){var e;function r(n){return isNaN(n=+n)?e:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(t=f.call(n,d),r):t.slice()},r.unknown=function(n){return arguments.length?(e=n,r):e},r.copy=function(){return n(t).unknown(e)},t=arguments.length?f.call(t,d):[0,1],S(r)},n.scaleLinear=function n(){var t=b(v,v);return t.copy=function(){return x(t,n())},a.apply(t,arguments),S(t)},n.scaleLog=function n(){var t=L(N()).domain([1,10]);return t.copy=function(){return x(t,n()).base(t.base())},a.apply(t,arguments),t},n.scaleSymlog=function n(){var t=Q(N());return t.copy=function(){return x(t,n()).constant(t.constant())},a.apply(t,arguments)},n.scaleOrdinal=s,n.scaleImplicit=h,n.scalePow=C,n.scaleSqrt=function(){return C.apply(null,arguments).exponent(.5)},n.scaleQuantile=function n(){var t,r=[],u=[],i=[];function o(){var n=0,t=Math.max(1,u.length);for(i=new Array(t-1);++n<t;)i[n-1]=e.quantile(r,n/t);return c}function c(n){return isNaN(n=+n)?t:u[e.bisect(i,n)]}return c.invertExtent=function(n){var t=u.indexOf(n);return t<0?[NaN,NaN]:[t>0?i[t-1]:r[0],t<i.length?i[t]:r[r.length-1]]},c.domain=function(n){if(!arguments.length)return r.slice();r=[];for(var t,u=0,i=n.length;u<i;++u)null==(t=n[u])||isNaN(t=+t)||r.push(t);return r.sort(e.ascending),o()},c.range=function(n){return arguments.length?(u=p.call(n),o()):u.slice()},c.unknown=function(n){return arguments.length?(t=n,c):t},c.quantiles=function(){return i.slice()},c.copy=function(){return n().domain(r).range(u).unknown(t)},a.apply(c,arguments)},n.scaleQuantize=function n(){var t,r=0,u=1,i=1,o=[.5],c=[0,1];function l(n){return n<=n?c[e.bisect(o,n,0,i)]:t}function f(){var n=-1;for(o=new Array(i);++n<i;)o[n]=((n+1)*u-(n-i)*r)/(i+1);return l}return l.domain=function(n){return arguments.length?(r=+n[0],u=+n[1],f()):[r,u]},l.range=function(n){return arguments.length?(i=(c=p.call(n)).length-1,f()):c.slice()},l.invertExtent=function(n){var t=c.indexOf(n);return t<0?[NaN,NaN]:t<1?[r,o[0]]:t>=i?[o[i-1],u]:[o[t-1],o[t]]},l.unknown=function(n){return arguments.length?(t=n,l):l},l.thresholds=function(){return o.slice()},l.copy=function(){return n().domain([r,u]).range(c).unknown(t)},a.apply(S(l),arguments)},n.scaleThreshold=function n(){var t,r=[.5],u=[0,1],i=1;function o(n){return n<=n?u[e.bisect(r,n,0,i)]:t}return o.domain=function(n){return arguments.length?(r=p.call(n),i=Math.min(r.length,u.length-1),o):r.slice()},o.range=function(n){return arguments.length?(u=p.call(n),i=Math.min(r.length,u.length-1),o):u.slice()},o.invertExtent=function(n){var t=u.indexOf(n);return[r[t-1],r[t]]},o.unknown=function(n){return arguments.length?(t=n,o):t},o.copy=function(){return n().domain(r).range(u).unknown(t)},a.apply(o,arguments)},n.scaleTime=function(){return a.apply(Z(i.timeYear,i.timeMonth,i.timeWeek,i.timeDay,i.timeHour,i.timeMinute,i.timeSecond,i.timeMillisecond,o.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},n.scaleUtc=function(){return a.apply(Z(i.utcYear,i.utcMonth,i.utcWeek,i.utcDay,i.utcHour,i.utcMinute,i.utcSecond,i.utcMillisecond,o.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},n.scaleSequential=function n(){var t=S($()(v));return t.copy=function(){return nn(t,n())},c.apply(t,arguments)},n.scaleSequentialLog=function n(){var t=L($()).domain([1,10]);return t.copy=function(){return nn(t,n()).base(t.base())},c.apply(t,arguments)},n.scaleSequentialPow=tn,n.scaleSequentialSqrt=function(){return tn.apply(null,arguments).exponent(.5)},n.scaleSequentialSymlog=function n(){var t=Q($());return t.copy=function(){return nn(t,n()).constant(t.constant())},c.apply(t,arguments)},n.scaleSequentialQuantile=function n(){var t=[],r=v;function u(n){if(!isNaN(n=+n))return r((e.bisect(t,n)-1)/(t.length-1))}return u.domain=function(n){if(!arguments.length)return t.slice();t=[];for(var r,i=0,o=n.length;i<o;++i)null==(r=n[i])||isNaN(r=+r)||t.push(r);return t.sort(e.ascending),u},u.interpolator=function(n){return arguments.length?(r=n,u):r},u.copy=function(){return n(r).domain(t)},c.apply(u,arguments)},n.scaleDiverging=function n(){var t=S(en()(v));return t.copy=function(){return nn(t,n())},c.apply(t,arguments)},n.scaleDivergingLog=function n(){var t=L(en()).domain([.1,1,10]);return t.copy=function(){return nn(t,n()).base(t.base())},c.apply(t,arguments)},n.scaleDivergingPow=rn,n.scaleDivergingSqrt=function(){return rn.apply(null,arguments).exponent(.5)},n.tickFormat=q,Object.defineProperty(n,"__esModule",{value:!0})}); |
{ | ||
"name": "d3-scale", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "Encodings that map abstract data to visual representation.", | ||
@@ -33,2 +33,3 @@ "keywords": [ | ||
"d3-array": "^1.2.0", | ||
"d3-collection": "1", | ||
"d3-format": "1", | ||
@@ -35,0 +36,0 @@ "d3-interpolate": "1", |
@@ -0,1 +1,2 @@ | ||
import {map} from "d3-collection"; | ||
import {slice} from "./array"; | ||
@@ -7,3 +8,3 @@ import {initRange} from "./init"; | ||
export default function ordinal() { | ||
var index = new Map, | ||
var index = map(), | ||
domain = [], | ||
@@ -24,3 +25,3 @@ range = [], | ||
if (!arguments.length) return domain.slice(); | ||
domain = [], index = new Map(); | ||
domain = [], index = map(); | ||
var i = -1, n = _.length, d, key; | ||
@@ -27,0 +28,0 @@ while (++i < n) if (!index.has(key = (d = _[i]) + "")) index.set(key, domain.push(d)); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
194080
2073
953
6
+ Addedd3-collection@1
+ Addedd3-collection@1.0.7(transitive)