You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
18 KiB
2 lines
18 KiB
5 years ago
|
// https://d3js.org/d3-scale/ Version 1.0.7. Copyright 2017 Mike Bostock.
|
||
|
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("d3-array"),require("d3-collection"),require("d3-interpolate"),require("d3-format"),require("d3-time"),require("d3-time-format"),require("d3-color")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-collection","d3-interpolate","d3-format","d3-time","d3-time-format","d3-color"],n):n(e.d3=e.d3||{},e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3)}(this,function(e,n,a,f,c,t,r,d){"use strict";function i(e){function n(n){var a=n+"",r=f.get(a);if(!r){if(t!==H)return t;f.set(a,r=c.push(n))}return e[(r-1)%e.length]}var f=a.map(),c=[],t=H;return e=null==e?[]:B.call(e),n.domain=function(e){if(!arguments.length)return c.slice();c=[],f=a.map();for(var t,r,d=-1,i=e.length;++d<i;)f.has(r=(t=e[d])+"")||f.set(r,c.push(t));return n},n.range=function(a){return arguments.length?(e=B.call(a),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return i().domain(c).range(e).unknown(t)},n}function u(){function e(){var e=t().length,c=d[1]<d[0],i=d[c-0],u=d[1-c];a=(u-i)/Math.max(1,e-o+2*l),b&&(a=Math.floor(a)),i+=(u-i-a*(e-o))*h,f=a*(1-o),b&&(i=Math.round(i),f=Math.round(f));var s=n.range(e).map(function(e){return i+a*e});return r(c?s.reverse():s)}var a,f,c=i().unknown(void 0),t=c.domain,r=c.range,d=[0,1],b=!1,o=0,l=0,h=.5;return delete c.unknown,c.domain=function(n){return arguments.length?(t(n),e()):t()},c.range=function(n){return arguments.length?(d=[+n[0],+n[1]],e()):d.slice()},c.rangeRound=function(n){return d=[+n[0],+n[1]],b=!0,e()},c.bandwidth=function(){return f},c.step=function(){return a},c.round=function(n){return arguments.length?(b=!!n,e()):b},c.padding=function(n){return arguments.length?(o=l=Math.max(0,Math.min(1,n)),e()):o},c.paddingInner=function(n){return arguments.length?(o=Math.max(0,Math.min(1,n)),e()):o},c.paddingOuter=function(n){return arguments.length?(l=Math.max(0,Math.min(1,n)),e()):l},c.align=function(n){return arguments.length?(h=Math.max(0,Math.min(1,n)),e()):h},c.copy=function(){return u().domain(t()).range(d).round(b).paddingInner(o).paddingOuter(l).align(h)},e()}function b(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return b(n())},e}function o(){return b(u().paddingInner(1))}function l(e,n){return(n-=e=+e)?function(a){return(a-e)/n}:Q(n)}function h(e){return function(n,a){var f=e(n=+n,a=+a);return function(e){return e<=n?0:e>=a?1:f(e)}}}function s(e){return function(n,a){var f=e(n=+n,a=+a);return function(e){return e<=0?n:e>=1?a:f(e)}}}function m(e,n,a,f){var c=e[0],t=e[1],r=n[0],d=n[1];return t<c?(c=a(t,c),r=f(d,r)):(c=a(c,t),r=f(r,d)),function(e){return r(c(e))}}function g(e,a,f,c){var t=Math.min(e.length,a.length)-1,r=new Array(t),d=new Array(t),i=-1;for(e[t]<e[0]&&(e=e.slice().reverse(),a=a.slice().reverse());++i<t;)r[i]=f(e[i],e[i+1]),d[i]=c(a[i],a[i+1]);return function(a){var f=n.bisect(e,a,1,t)-1;return d[f](r[f](a))}}function p(e,n){return n.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp())}function M(e,n){function a(){return t=Math.min(i.length,u.length)>2?g:m,r=d=null,c}function c(n){return(r||(r=t(i,u,o?h(e):e,b)))(+n)}var t,r,d,i=z,u=z,b=f.interpolate,o=!1;return c.invert=function(e){return(d||(d=t(u,i,l,o?s(n):n)))(+e)},c.domain=function(e){return arguments.length?(i=j.call(e,_),a()):i.slice()},c.range=function(e){return arguments.length?(u=B.call(e),a()):u.slice()},c.rangeRound=function(e){return u=B.call(e),b=f.interpolateRound,a()},c.clamp=function(e){return arguments.length?(o=!!e,a()):o},c.interpolate=function(e){return arguments.length?(b=e,a()):b},a()}function v(e){var a=e.domain;return e.ticks=function(e){var f=a();return n.ticks(f[0],f[f.length-1],null==e?10:e)},e.tickFormat=function(e,n){return V(a(),e,n)},e.nice=function(f){null==f&&(f=10);var c,t=a(),r=0,d=t.length-1,i=t[r],u=t[d];return u<i&&(c=i,i=u,u=c,c=r,r=d,d=c),c=n.tickIncrement(i,u,f),c>0?(i=Math.floor(i/c)*c,u=Math.ceil(u/c)*c,c=n.tickIncrement(i,u,f)):c<0&&(i=Math.ceil(i*c)/c,u=Math.floor(u*c)/c,c=n.ti
|