Comparing version 3.3.0-rc.3 to 3.3.0
@@ -1,7 +0,7 @@ | ||
// https://d3js.org/d3-scale/ v3.3.0-rc.3 Copyright 2020 Mike Bostock | ||
// https://d3js.org/d3-scale/ v3.3.0 Copyright 2021 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) : | ||
(global = global || self, 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'; | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, 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'; | ||
@@ -178,3 +178,3 @@ function initRange(domain, range) { | ||
function constant(x) { | ||
function constants(x) { | ||
return function() { | ||
@@ -185,3 +185,3 @@ return x; | ||
function number(x) { | ||
function number$1(x) { | ||
return +x; | ||
@@ -192,3 +192,3 @@ } | ||
function identity(x) { | ||
function identity$1(x) { | ||
return x; | ||
@@ -200,3 +200,3 @@ } | ||
? function(x) { return (x - a) / b; } | ||
: constant(isNaN(b) ? NaN : 0.5); | ||
: constants(isNaN(b) ? NaN : 0.5); | ||
} | ||
@@ -242,3 +242,3 @@ | ||
function copy(source, target) { | ||
function copy$1(source, target) { | ||
return target | ||
@@ -252,3 +252,3 @@ .domain(source.domain()) | ||
function transformer() { | ||
function transformer$2() { | ||
var domain = unit, | ||
@@ -260,3 +260,3 @@ range = unit, | ||
unknown, | ||
clamp = identity, | ||
clamp = identity$1, | ||
piecewise, | ||
@@ -268,3 +268,3 @@ output, | ||
var n = Math.min(domain.length, range.length); | ||
if (clamp !== identity) clamp = clamper(domain[0], domain[n - 1]); | ||
if (clamp !== identity$1) clamp = clamper(domain[0], domain[n - 1]); | ||
piecewise = n > 2 ? polymap : bimap; | ||
@@ -276,3 +276,3 @@ output = input = null; | ||
function scale(x) { | ||
return isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); | ||
return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); | ||
} | ||
@@ -285,3 +285,3 @@ | ||
scale.domain = function(_) { | ||
return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice(); | ||
return arguments.length ? (domain = Array.from(_, number$1), rescale()) : domain.slice(); | ||
}; | ||
@@ -298,3 +298,3 @@ | ||
scale.clamp = function(_) { | ||
return arguments.length ? (clamp = _ ? true : identity, rescale()) : clamp !== identity; | ||
return arguments.length ? (clamp = _ ? true : identity$1, rescale()) : clamp !== identity$1; | ||
}; | ||
@@ -317,3 +317,3 @@ | ||
function continuous() { | ||
return transformer()(identity, identity); | ||
return transformer$2()(identity$1, identity$1); | ||
} | ||
@@ -406,3 +406,3 @@ | ||
scale.copy = function() { | ||
return copy(scale, linear()); | ||
return copy$1(scale, linear()); | ||
}; | ||
@@ -415,7 +415,7 @@ | ||
function identity$1(domain) { | ||
function identity(domain) { | ||
var unknown; | ||
function scale(x) { | ||
return isNaN(x = +x) ? unknown : x; | ||
return x == null || isNaN(x = +x) ? unknown : x; | ||
} | ||
@@ -426,3 +426,3 @@ | ||
scale.domain = scale.range = function(_) { | ||
return arguments.length ? (domain = Array.from(_, number), scale) : domain.slice(); | ||
return arguments.length ? (domain = Array.from(_, number$1), scale) : domain.slice(); | ||
}; | ||
@@ -435,6 +435,6 @@ | ||
scale.copy = function() { | ||
return identity$1(domain).unknown(unknown); | ||
return identity(domain).unknown(unknown); | ||
}; | ||
domain = arguments.length ? Array.from(domain, number) : [0, 1]; | ||
domain = arguments.length ? Array.from(domain, number$1) : [0, 1]; | ||
@@ -593,6 +593,6 @@ return linearish(scale); | ||
function log() { | ||
var scale = loggish(transformer()).domain([1, 10]); | ||
var scale = loggish(transformer$2()).domain([1, 10]); | ||
scale.copy = function() { | ||
return copy(scale, log()).base(scale.base()); | ||
return copy$1(scale, log()).base(scale.base()); | ||
}; | ||
@@ -628,6 +628,6 @@ | ||
function symlog() { | ||
var scale = symlogish(transformer()); | ||
var scale = symlogish(transformer$2()); | ||
scale.copy = function() { | ||
return copy(scale, symlog()).constant(scale.constant()); | ||
return copy$1(scale, symlog()).constant(scale.constant()); | ||
}; | ||
@@ -653,7 +653,7 @@ | ||
function powish(transform) { | ||
var scale = transform(identity, identity), | ||
var scale = transform(identity$1, identity$1), | ||
exponent = 1; | ||
function rescale() { | ||
return exponent === 1 ? transform(identity, identity) | ||
return exponent === 1 ? transform(identity$1, identity$1) | ||
: exponent === 0.5 ? transform(transformSqrt, transformSquare) | ||
@@ -671,6 +671,6 @@ : transform(transformPow(exponent), transformPow(1 / exponent)); | ||
function pow() { | ||
var scale = powish(transformer()); | ||
var scale = powish(transformer$2()); | ||
scale.copy = function() { | ||
return copy(scale, pow()).exponent(scale.exponent()); | ||
return copy$1(scale, pow()).exponent(scale.exponent()); | ||
}; | ||
@@ -715,3 +715,3 @@ | ||
scale.range = function(_) { | ||
return arguments.length ? (squared.range((range = Array.from(_, number)).map(square)), scale) : range.slice(); | ||
return arguments.length ? (squared.range((range = Array.from(_, number$1)).map(square)), scale) : range.slice(); | ||
}; | ||
@@ -756,3 +756,3 @@ | ||
thresholds = new Array(n - 1); | ||
while (++i < n) thresholds[i - 1] = d3Array.quantile(domain, i / n); | ||
while (++i < n) thresholds[i - 1] = d3Array.quantileSorted(domain, i / n); | ||
return scale; | ||
@@ -762,3 +762,3 @@ } | ||
function scale(x) { | ||
return isNaN(x = +x) ? unknown : range[d3Array.bisect(thresholds, x)]; | ||
return x == null || isNaN(x = +x) ? unknown : range[d3Array.bisect(thresholds, x)]; | ||
} | ||
@@ -813,3 +813,3 @@ | ||
function scale(x) { | ||
return x <= x ? range[d3Array.bisect(domain, x, 0, n)] : unknown; | ||
return x != null && x <= x ? range[d3Array.bisect(domain, x, 0, n)] : unknown; | ||
} | ||
@@ -865,3 +865,3 @@ | ||
function scale(x) { | ||
return x <= x ? range[d3Array.bisect(domain, x, 0, n)] : unknown; | ||
return x != null && x <= x ? range[d3Array.bisect(domain, x, 0, n)] : unknown; | ||
} | ||
@@ -896,10 +896,2 @@ | ||
var durationSecond = 1000, | ||
durationMinute = durationSecond * 60, | ||
durationHour = durationMinute * 60, | ||
durationDay = durationHour * 24, | ||
durationWeek = durationDay * 7, | ||
durationMonth = durationDay * 30, | ||
durationYear = durationDay * 365; | ||
function date(t) { | ||
@@ -909,7 +901,7 @@ return new Date(t); | ||
function number$1(t) { | ||
function number(t) { | ||
return t instanceof Date ? +t : +new Date(+t); | ||
} | ||
function calendar(year, month, week, day, hour, minute, second, millisecond, format) { | ||
function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) { | ||
var scale = continuous(), | ||
@@ -928,23 +920,2 @@ invert = scale.invert, | ||
var tickIntervals = [ | ||
[second, 1, durationSecond], | ||
[second, 5, 5 * durationSecond], | ||
[second, 15, 15 * durationSecond], | ||
[second, 30, 30 * durationSecond], | ||
[minute, 1, durationMinute], | ||
[minute, 5, 5 * durationMinute], | ||
[minute, 15, 15 * durationMinute], | ||
[minute, 30, 30 * durationMinute], | ||
[ hour, 1, durationHour ], | ||
[ hour, 3, 3 * durationHour ], | ||
[ hour, 6, 6 * durationHour ], | ||
[ hour, 12, 12 * durationHour ], | ||
[ day, 1, durationDay ], | ||
[ day, 2, 2 * durationDay ], | ||
[ week, 1, durationWeek ], | ||
[ month, 1, durationMonth ], | ||
[ month, 3, 3 * durationMonth ], | ||
[ year, 1, durationYear ] | ||
]; | ||
function tickFormat(date) { | ||
@@ -960,29 +931,2 @@ return (second(date) < date ? formatMillisecond | ||
function tickInterval(interval, start, stop) { | ||
if (interval == null) interval = 10; | ||
// If a desired tick count is specified, pick a reasonable tick interval | ||
// based on the extent of the domain and a rough estimate of tick size. | ||
// Otherwise, assume interval is already a time interval and use it. | ||
if (typeof interval === "number") { | ||
var target = Math.abs(stop - start) / interval, | ||
i = d3Array.bisector(function(i) { return i[2]; }).right(tickIntervals, target), | ||
step; | ||
if (i === tickIntervals.length) { | ||
step = d3Array.tickStep(start / durationYear, stop / durationYear, interval); | ||
interval = year; | ||
} else if (i) { | ||
i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; | ||
step = i[1]; | ||
interval = i[0]; | ||
} else { | ||
step = Math.max(d3Array.tickStep(start, stop, interval), 1); | ||
interval = millisecond; | ||
} | ||
return interval.every(step); | ||
} | ||
return interval; | ||
} | ||
scale.invert = function(y) { | ||
@@ -993,15 +937,8 @@ return new Date(invert(y)); | ||
scale.domain = function(_) { | ||
return arguments.length ? domain(Array.from(_, number$1)) : domain().map(date); | ||
return arguments.length ? domain(Array.from(_, number)) : domain().map(date); | ||
}; | ||
scale.ticks = function(interval) { | ||
var d = domain(), | ||
t0 = d[0], | ||
t1 = d[d.length - 1], | ||
r = t1 < t0, | ||
t; | ||
if (r) t = t0, t0 = t1, t1 = t; | ||
t = tickInterval(interval, t0, t1); | ||
t = t ? t.range(t0, t1 + 1) : []; // inclusive stop | ||
return r ? t.reverse() : t; | ||
var d = domain(); | ||
return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval); | ||
}; | ||
@@ -1015,9 +952,8 @@ | ||
var d = domain(); | ||
return (interval = tickInterval(interval, d[0], d[d.length - 1])) | ||
? domain(nice(d, interval)) | ||
: scale; | ||
if (!interval || typeof interval.range !== "function") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval); | ||
return interval ? domain(nice(d, interval)) : scale; | ||
}; | ||
scale.copy = function() { | ||
return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format)); | ||
return copy$1(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format)); | ||
}; | ||
@@ -1029,7 +965,7 @@ | ||
function time() { | ||
return initRange.apply(calendar(d3Time.timeYear, d3Time.timeMonth, d3Time.timeWeek, d3Time.timeDay, d3Time.timeHour, d3Time.timeMinute, d3Time.timeSecond, d3Time.timeMillisecond, d3TimeFormat.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments); | ||
return initRange.apply(calendar(d3Time.timeTicks, d3Time.timeTickInterval, d3Time.timeYear, d3Time.timeMonth, d3Time.timeWeek, d3Time.timeDay, d3Time.timeHour, d3Time.timeMinute, d3Time.timeSecond, d3TimeFormat.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments); | ||
} | ||
function utcTime() { | ||
return initRange.apply(calendar(d3Time.utcYear, d3Time.utcMonth, d3Time.utcWeek, d3Time.utcDay, d3Time.utcHour, d3Time.utcMinute, d3Time.utcSecond, d3Time.utcMillisecond, d3TimeFormat.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments); | ||
return initRange.apply(calendar(d3Time.utcTicks, d3Time.utcTickInterval, d3Time.utcYear, d3Time.utcMonth, d3Time.utcWeek, d3Time.utcDay, d3Time.utcHour, d3Time.utcMinute, d3Time.utcSecond, d3TimeFormat.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments); | ||
} | ||
@@ -1044,3 +980,3 @@ | ||
transform, | ||
interpolator = identity, | ||
interpolator = identity$1, | ||
clamp = false, | ||
@@ -1050,3 +986,3 @@ unknown; | ||
function scale(x) { | ||
return isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); | ||
return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); | ||
} | ||
@@ -1087,3 +1023,3 @@ | ||
function copy$1(source, target) { | ||
function copy(source, target) { | ||
return target | ||
@@ -1097,6 +1033,6 @@ .domain(source.domain()) | ||
function sequential() { | ||
var scale = linearish(transformer$1()(identity)); | ||
var scale = linearish(transformer$1()(identity$1)); | ||
scale.copy = function() { | ||
return copy$1(scale, sequential()); | ||
return copy(scale, sequential()); | ||
}; | ||
@@ -1111,3 +1047,3 @@ | ||
scale.copy = function() { | ||
return copy$1(scale, sequentialLog()).base(scale.base()); | ||
return copy(scale, sequentialLog()).base(scale.base()); | ||
}; | ||
@@ -1122,3 +1058,3 @@ | ||
scale.copy = function() { | ||
return copy$1(scale, sequentialSymlog()).constant(scale.constant()); | ||
return copy(scale, sequentialSymlog()).constant(scale.constant()); | ||
}; | ||
@@ -1133,3 +1069,3 @@ | ||
scale.copy = function() { | ||
return copy$1(scale, sequentialPow()).exponent(scale.exponent()); | ||
return copy(scale, sequentialPow()).exponent(scale.exponent()); | ||
}; | ||
@@ -1146,6 +1082,6 @@ | ||
var domain = [], | ||
interpolator = identity; | ||
interpolator = identity$1; | ||
function scale(x) { | ||
if (!isNaN(x = +x)) return interpolator((d3Array.bisect(domain, x, 1) - 1) / (domain.length - 1)); | ||
if (x != null && !isNaN(x = +x)) return interpolator((d3Array.bisect(domain, x, 1) - 1) / (domain.length - 1)); | ||
} | ||
@@ -1180,3 +1116,3 @@ | ||
function transformer$2() { | ||
function transformer() { | ||
var x0 = 0, | ||
@@ -1191,3 +1127,3 @@ x1 = 0.5, | ||
k21, | ||
interpolator = identity, | ||
interpolator = identity$1, | ||
transform, | ||
@@ -1235,6 +1171,6 @@ clamp = false, | ||
function diverging() { | ||
var scale = linearish(transformer$2()(identity)); | ||
var scale = linearish(transformer()(identity$1)); | ||
scale.copy = function() { | ||
return copy$1(scale, diverging()); | ||
return copy(scale, diverging()); | ||
}; | ||
@@ -1246,6 +1182,6 @@ | ||
function divergingLog() { | ||
var scale = loggish(transformer$2()).domain([0.1, 1, 10]); | ||
var scale = loggish(transformer()).domain([0.1, 1, 10]); | ||
scale.copy = function() { | ||
return copy$1(scale, divergingLog()).base(scale.base()); | ||
return copy(scale, divergingLog()).base(scale.base()); | ||
}; | ||
@@ -1257,6 +1193,6 @@ | ||
function divergingSymlog() { | ||
var scale = symlogish(transformer$2()); | ||
var scale = symlogish(transformer()); | ||
scale.copy = function() { | ||
return copy$1(scale, divergingSymlog()).constant(scale.constant()); | ||
return copy(scale, divergingSymlog()).constant(scale.constant()); | ||
}; | ||
@@ -1268,6 +1204,6 @@ | ||
function divergingPow() { | ||
var scale = powish(transformer$2()); | ||
var scale = powish(transformer()); | ||
scale.copy = function() { | ||
return copy$1(scale, divergingPow()).exponent(scale.exponent()); | ||
return copy(scale, divergingPow()).exponent(scale.exponent()); | ||
}; | ||
@@ -1288,3 +1224,3 @@ | ||
exports.scaleDivergingSymlog = divergingSymlog; | ||
exports.scaleIdentity = identity$1; | ||
exports.scaleIdentity = identity; | ||
exports.scaleImplicit = implicit; | ||
@@ -1314,2 +1250,2 @@ exports.scaleLinear = linear; | ||
})); | ||
}))); |
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-scale/ v3.3.0-rc.3 Copyright 2020 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=n||self).d3=n.d3||{},n.d3,n.d3,n.d3,n.d3,n.d3)}(this,function(n,t,r,e,u,i){"use strict";function o(n,t){switch(arguments.length){case 0:break;case 1:this.range(n);break;default:this.range(t).domain(n)}return this}function a(n,t){switch(arguments.length){case 0:break;case 1:"function"==typeof n?this.interpolator(n):this.range(n);break;default:this.domain(n),"function"==typeof t?this.interpolator(t):this.range(t)}return this}const c=Symbol("implicit");function f(){var n=new Map,t=[],r=[],e=c;function u(u){var i=u+"",o=n.get(i);if(!o){if(e!==c)return e;n.set(i,o=t.push(u))}return r[(o-1)%r.length]}return u.domain=function(r){if(!arguments.length)return t.slice();t=[],n=new Map;for(const e of r){const r=e+"";n.has(r)||n.set(r,t.push(e))}return u},u.range=function(n){return arguments.length?(r=Array.from(n),u):r.slice()},u.unknown=function(n){return arguments.length?(e=n,u):e},u.copy=function(){return f(t,r).unknown(e)},o.apply(u,arguments),u}function l(){var n,r,e=f().unknown(void 0),u=e.domain,i=e.range,a=0,c=1,p=!1,s=0,h=0,g=.5;function m(){var e=u().length,o=c<a,f=o?c:a,l=o?a:c;n=(l-f)/Math.max(1,e-s+2*h),p&&(n=Math.floor(n)),f+=(l-f-n*(e-s))*g,r=n*(1-s),p&&(f=Math.round(f),r=Math.round(r));var m=t.range(e).map(function(t){return f+n*t});return i(o?m.reverse():m)}return delete e.unknown,e.domain=function(n){return arguments.length?(u(n),m()):u()},e.range=function(n){return arguments.length?([a,c]=n,a=+a,c=+c,m()):[a,c]},e.rangeRound=function(n){return[a,c]=n,a=+a,c=+c,p=!0,m()},e.bandwidth=function(){return r},e.step=function(){return n},e.round=function(n){return arguments.length?(p=!!n,m()):p},e.padding=function(n){return arguments.length?(s=Math.min(1,h=+n),m()):s},e.paddingInner=function(n){return arguments.length?(s=Math.min(1,n),m()):s},e.paddingOuter=function(n){return arguments.length?(h=+n,m()):h},e.align=function(n){return arguments.length?(g=Math.max(0,Math.min(1,n)),m()):g},e.copy=function(){return l(u(),[a,c]).round(p).paddingInner(s).paddingOuter(h).align(g)},o.apply(m(),arguments)}function p(n){return+n}var s=[0,1];function h(n){return n}function g(n,t){return(t-=n=+n)?function(r){return(r-n)/t}:(r=isNaN(t)?NaN:.5,function(){return r});var r}function m(n,t,r){var e=n[0],u=n[1],i=t[0],o=t[1];return u<e?(e=g(u,e),i=r(o,i)):(e=g(e,u),i=r(i,o)),function(n){return i(e(n))}}function d(n,r,e){var u=Math.min(n.length,r.length)-1,i=new Array(u),o=new Array(u),a=-1;for(n[u]<n[0]&&(n=n.slice().reverse(),r=r.slice().reverse());++a<u;)i[a]=g(n[a],n[a+1]),o[a]=e(r[a],r[a+1]);return function(r){var e=t.bisect(n,r,1,u)-1;return o[e](i[e](r))}}function y(n,t){return t.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function v(){var n,t,e,u,i,o,a=s,c=s,f=r.interpolate,l=h;function g(){var n,t,r,e=Math.min(a.length,c.length);return l!==h&&(n=a[0],t=a[e-1],n>t&&(r=n,n=t,t=r),l=function(r){return Math.max(n,Math.min(t,r))}),u=e>2?d:m,i=o=null,y}function y(t){return isNaN(t=+t)?e:(i||(i=u(a.map(n),c,f)))(n(l(t)))}return y.invert=function(e){return l(t((o||(o=u(c,a.map(n),r.interpolateNumber)))(e)))},y.domain=function(n){return arguments.length?(a=Array.from(n,p),g()):a.slice()},y.range=function(n){return arguments.length?(c=Array.from(n),g()):c.slice()},y.rangeRound=function(n){return c=Array.from(n),f=r.interpolateRound,g()},y.clamp=function(n){return arguments.length?(l=!!n||h,g()):l!==h},y.interpolate=function(n){return arguments.length?(f=n,g()):f},y.unknown=function(n){return arguments.length?(e=n,y):e},function(r,e){return n=r,t=e,g()}}function M(){return v()(h,h)}function k(n,r,u,i){var o,a=t.tickStep(n,r,u);switch((i=e.formatSpecifier(null==i?",f":i)).type){case"s":var c=Math.max(Math.abs(n),Math.abs(r));return null!=i.precision||isNaN(o=e.precisionPrefix(a,c))||(i.precision=o),e.formatPrefix(i,c);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(o=e.precisionRound(a,Math.max(Math.abs(n),Math.abs(r))))||(i.precision=o-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(o=e.precisionFixed(a))||(i.precision=o-2*("%"===i.type))}return e.format(i)}function w(n){var r=n.domain;return n.ticks=function(n){var e=r();return t.ticks(e[0],e[e.length-1],null==n?10:n)},n.tickFormat=function(n,t){var e=r();return k(e[0],e[e.length-1],null==n?10:n,t)},n.nice=function(e){null==e&&(e=10);var u,i,o=r(),a=0,c=o.length-1,f=o[a],l=o[c],p=10;for(l<f&&(i=f,f=l,l=i,i=a,a=c,c=i);p-- >0;){if((i=t.tickIncrement(f,l,e))===u)return o[a]=f,o[c]=l,r(o);if(i>0)f=Math.floor(f/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;f=Math.ceil(f*i)/i,l=Math.floor(l*i)/i}u=i}return n},n}function N(n,t){var r,e=0,u=(n=n.slice()).length-1,i=n[e],o=n[u];return o<i&&(r=e,e=u,u=r,r=i,i=o,o=r),n[e]=t.floor(i),n[u]=t.ceil(o),n}function b(n){return Math.log(n)}function x(n){return Math.exp(n)}function q(n){return-Math.log(-n)}function S(n){return-Math.exp(-n)}function A(n){return isFinite(n)?+("1e"+n):n<0?0:n}function D(n){return function(t){return-n(-t)}}function R(n){var r,u,i=n(b,x),o=i.domain,a=10;function c(){return r=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),u=function(n){return 10===n?A:n===Math.E?Math.exp:function(t){return Math.pow(n,t)}}(a),o()[0]<0?(r=D(r),u=D(u),n(q,S)):n(b,x),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 e,i=o(),c=i[0],f=i[i.length-1];(e=f<c)&&(h=c,c=f,f=h);var l,p,s,h=r(c),g=r(f),m=null==n?10:+n,d=[];if(!(a%1)&&g-h<m){if(h=Math.floor(h),g=Math.ceil(g),c>0){for(;h<=g;++h)for(p=1,l=u(h);p<a;++p)if(!((s=l*p)<c)){if(s>f)break;d.push(s)}}else for(;h<=g;++h)for(p=a-1,l=u(h);p>=1;--p)if(!((s=l*p)<c)){if(s>f)break;d.push(s)}2*d.length<m&&(d=t.ticks(c,f,m))}else d=t.ticks(h,g,Math.min(g-h,m)).map(u);return e?d.reverse():d},i.tickFormat=function(n,t){if(null==t&&(t=10===a?".0e":","),"function"!=typeof t&&(t=e.format(t)),n===1/0)return t;null==n&&(n=10);var o=Math.max(1,a*n/i.ticks().length);return function(n){var e=n/u(Math.round(r(n)));return e*a<a-.5&&(e*=a),e<=o?t(n):""}},i.nice=function(){return o(N(o(),{floor:function(n){return u(Math.floor(r(n)))},ceil:function(n){return u(Math.ceil(r(n)))}}))},i}function I(n){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/n))}}function O(n){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*n}}function F(n){var t=1,r=n(I(t),O(t));return r.constant=function(r){return arguments.length?n(I(t=+r),O(t)):t},w(r)}function P(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function E(n){return n<0?-Math.sqrt(-n):Math.sqrt(n)}function L(n){return n<0?-n*n:n*n}function T(n){var t=n(h,h),r=1;function e(){return 1===r?n(h,h):.5===r?n(E,L):n(P(r),P(1/r))}return t.exponent=function(n){return arguments.length?(r=+n,e()):r},w(t)}function Q(){var n=T(v());return n.copy=function(){return y(n,Q()).exponent(n.exponent())},o.apply(n,arguments),n}function U(n){return Math.sign(n)*n*n}var Y=1e3,j=60*Y,B=60*j,C=24*B,H=7*C,W=30*C,_=365*C;function z(n){return new Date(n)}function G(n){return n instanceof Date?+n:+new Date(+n)}function J(n,r,e,u,i,o,a,c,f){var l=M(),p=l.invert,s=l.domain,h=f(".%L"),g=f(":%S"),m=f("%I:%M"),d=f("%I %p"),v=f("%a %d"),k=f("%b %d"),w=f("%B"),b=f("%Y"),x=[[a,1,Y],[a,5,5*Y],[a,15,15*Y],[a,30,30*Y],[o,1,j],[o,5,5*j],[o,15,15*j],[o,30,30*j],[i,1,B],[i,3,3*B],[i,6,6*B],[i,12,12*B],[u,1,C],[u,2,2*C],[e,1,H],[r,1,W],[r,3,3*W],[n,1,_]];function q(t){return(a(t)<t?h:o(t)<t?g:i(t)<t?m:u(t)<t?d:r(t)<t?e(t)<t?v:k:n(t)<t?w:b)(t)}function S(r,e,u){if(null==r&&(r=10),"number"==typeof r){var i,o=Math.abs(u-e)/r,a=t.bisector(function(n){return n[2]}).right(x,o);return a===x.length?(i=t.tickStep(e/_,u/_,r),r=n):a?(i=(a=x[o/x[a-1][2]<x[a][2]/o?a-1:a])[1],r=a[0]):(i=Math.max(t.tickStep(e,u,r),1),r=c),r.every(i)}return r}return l.invert=function(n){return new Date(p(n))},l.domain=function(n){return arguments.length?s(Array.from(n,G)):s().map(z)},l.ticks=function(n){var t,r=s(),e=r[0],u=r[r.length-1],i=u<e;return i&&(t=e,e=u,u=t),t=(t=S(n,e,u))?t.range(e,u+1):[],i?t.reverse():t},l.tickFormat=function(n,t){return null==t?q:f(t)},l.nice=function(n){var t=s();return(n=S(n,t[0],t[t.length-1]))?s(N(t,n)):l},l.copy=function(){return y(l,J(n,r,e,u,i,o,a,c,f))},l}function K(){var n,t,e,u,i,o=0,a=1,c=h,f=!1;function l(t){return isNaN(t=+t)?i:c(0===e?.5:(t=(u(t)-n)*e,f?Math.max(0,Math.min(1,t)):t))}function p(n){return function(t){var r,e;return arguments.length?([r,e]=t,c=n(r,e),l):[c(0),c(1)]}}return l.domain=function(r){return arguments.length?([o,a]=r,n=u(o=+o),t=u(a=+a),e=n===t?0:1/(t-n),l):[o,a]},l.clamp=function(n){return arguments.length?(f=!!n,l):f},l.interpolator=function(n){return arguments.length?(c=n,l):c},l.range=p(r.interpolate),l.rangeRound=p(r.interpolateRound),l.unknown=function(n){return arguments.length?(i=n,l):i},function(r){return u=r,n=r(o),t=r(a),e=n===t?0:1/(t-n),l}}function V(n,t){return t.domain(n.domain()).interpolator(n.interpolator()).clamp(n.clamp()).unknown(n.unknown())}function X(){var n=T(K());return n.copy=function(){return V(n,X()).exponent(n.exponent())},a.apply(n,arguments)}function Z(){var n,t,e,u,i,o,a,c=0,f=.5,l=1,p=1,s=h,g=!1;function m(n){return isNaN(n=+n)?a:(n=.5+((n=+o(n))-t)*(p*n<p*t?u:i),s(g?Math.max(0,Math.min(1,n)):n))}function d(n){return function(t){var e,u,i;return arguments.length?([e,u,i]=t,s=r.piecewise(n,[e,u,i]),m):[s(0),s(.5),s(1)]}}return m.domain=function(r){return arguments.length?([c,f,l]=r,n=o(c=+c),t=o(f=+f),e=o(l=+l),u=n===t?0:.5/(t-n),i=t===e?0:.5/(e-t),p=t<n?-1:1,m):[c,f,l]},m.clamp=function(n){return arguments.length?(g=!!n,m):g},m.interpolator=function(n){return arguments.length?(s=n,m):s},m.range=d(r.interpolate),m.rangeRound=d(r.interpolateRound),m.unknown=function(n){return arguments.length?(a=n,m):a},function(r){return o=r,n=r(c),t=r(f),e=r(l),u=n===t?0:.5/(t-n),i=t===e?0:.5/(e-t),p=t<n?-1:1,m}}function $(){var n=T(Z());return n.copy=function(){return V(n,$()).exponent(n.exponent())},a.apply(n,arguments)}n.scaleBand=l,n.scaleDiverging=function n(){var t=w(Z()(h));return t.copy=function(){return V(t,n())},a.apply(t,arguments)},n.scaleDivergingLog=function n(){var t=R(Z()).domain([.1,1,10]);return t.copy=function(){return V(t,n()).base(t.base())},a.apply(t,arguments)},n.scaleDivergingPow=$,n.scaleDivergingSqrt=function(){return $.apply(null,arguments).exponent(.5)},n.scaleDivergingSymlog=function n(){var t=F(Z());return t.copy=function(){return V(t,n()).constant(t.constant())},a.apply(t,arguments)},n.scaleIdentity=function n(t){var r;function e(n){return isNaN(n=+n)?r:n}return e.invert=e,e.domain=e.range=function(n){return arguments.length?(t=Array.from(n,p),e):t.slice()},e.unknown=function(n){return arguments.length?(r=n,e):r},e.copy=function(){return n(t).unknown(r)},t=arguments.length?Array.from(t,p):[0,1],w(e)},n.scaleImplicit=c,n.scaleLinear=function n(){var t=M();return t.copy=function(){return y(t,n())},o.apply(t,arguments),w(t)},n.scaleLog=function n(){var t=R(v()).domain([1,10]);return t.copy=function(){return y(t,n()).base(t.base())},o.apply(t,arguments),t},n.scaleOrdinal=f,n.scalePoint=function(){return function n(t){var r=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return n(r())},t}(l.apply(null,arguments).paddingInner(1))},n.scalePow=Q,n.scaleQuantile=function n(){var r,e=[],u=[],i=[];function a(){var n=0,r=Math.max(1,u.length);for(i=new Array(r-1);++n<r;)i[n-1]=t.quantile(e,n/r);return c}function c(n){return isNaN(n=+n)?r: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]:e[0],t<i.length?i[t]:e[e.length-1]]},c.domain=function(n){if(!arguments.length)return e.slice();e=[];for(let t of n)null==t||isNaN(t=+t)||e.push(t);return e.sort(t.ascending),a()},c.range=function(n){return arguments.length?(u=Array.from(n),a()):u.slice()},c.unknown=function(n){return arguments.length?(r=n,c):r},c.quantiles=function(){return i.slice()},c.copy=function(){return n().domain(e).range(u).unknown(r)},o.apply(c,arguments)},n.scaleQuantize=function n(){var r,e=0,u=1,i=1,a=[.5],c=[0,1];function f(n){return n<=n?c[t.bisect(a,n,0,i)]:r}function l(){var n=-1;for(a=new Array(i);++n<i;)a[n]=((n+1)*u-(n-i)*e)/(i+1);return f}return f.domain=function(n){return arguments.length?([e,u]=n,e=+e,u=+u,l()):[e,u]},f.range=function(n){return arguments.length?(i=(c=Array.from(n)).length-1,l()):c.slice()},f.invertExtent=function(n){var t=c.indexOf(n);return t<0?[NaN,NaN]:t<1?[e,a[0]]:t>=i?[a[i-1],u]:[a[t-1],a[t]]},f.unknown=function(n){return arguments.length?(r=n,f):f},f.thresholds=function(){return a.slice()},f.copy=function(){return n().domain([e,u]).range(c).unknown(r)},o.apply(w(f),arguments)},n.scaleRadial=function n(){var t,r=M(),e=[0,1],u=!1;function i(n){var e=function(n){return Math.sign(n)*Math.sqrt(Math.abs(n))}(r(n));return isNaN(e)?t:u?Math.round(e):e}return i.invert=function(n){return r.invert(U(n))},i.domain=function(n){return arguments.length?(r.domain(n),i):r.domain()},i.range=function(n){return arguments.length?(r.range((e=Array.from(n,p)).map(U)),i):e.slice()},i.rangeRound=function(n){return i.range(n).round(!0)},i.round=function(n){return arguments.length?(u=!!n,i):u},i.clamp=function(n){return arguments.length?(r.clamp(n),i):r.clamp()},i.unknown=function(n){return arguments.length?(t=n,i):t},i.copy=function(){return n(r.domain(),e).round(u).clamp(r.clamp()).unknown(t)},o.apply(i,arguments),w(i)},n.scaleSequential=function n(){var t=w(K()(h));return t.copy=function(){return V(t,n())},a.apply(t,arguments)},n.scaleSequentialLog=function n(){var t=R(K()).domain([1,10]);return t.copy=function(){return V(t,n()).base(t.base())},a.apply(t,arguments)},n.scaleSequentialPow=X,n.scaleSequentialQuantile=function n(){var r=[],e=h;function u(n){if(!isNaN(n=+n))return e((t.bisect(r,n,1)-1)/(r.length-1))}return u.domain=function(n){if(!arguments.length)return r.slice();r=[];for(let t of n)null==t||isNaN(t=+t)||r.push(t);return r.sort(t.ascending),u},u.interpolator=function(n){return arguments.length?(e=n,u):e},u.range=function(){return r.map((n,t)=>e(t/(r.length-1)))},u.quantiles=function(n){return Array.from({length:n+1},(e,u)=>t.quantile(r,u/n))},u.copy=function(){return n(e).domain(r)},a.apply(u,arguments)},n.scaleSequentialSqrt=function(){return X.apply(null,arguments).exponent(.5)},n.scaleSequentialSymlog=function n(){var t=F(K());return t.copy=function(){return V(t,n()).constant(t.constant())},a.apply(t,arguments)},n.scaleSqrt=function(){return Q.apply(null,arguments).exponent(.5)},n.scaleSymlog=function n(){var t=F(v());return t.copy=function(){return y(t,n()).constant(t.constant())},o.apply(t,arguments)},n.scaleThreshold=function n(){var r,e=[.5],u=[0,1],i=1;function a(n){return n<=n?u[t.bisect(e,n,0,i)]:r}return a.domain=function(n){return arguments.length?(e=Array.from(n),i=Math.min(e.length,u.length-1),a):e.slice()},a.range=function(n){return arguments.length?(u=Array.from(n),i=Math.min(e.length,u.length-1),a):u.slice()},a.invertExtent=function(n){var t=u.indexOf(n);return[e[t-1],e[t]]},a.unknown=function(n){return arguments.length?(r=n,a):r},a.copy=function(){return n().domain(e).range(u).unknown(r)},o.apply(a,arguments)},n.scaleTime=function(){return o.apply(J(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 o.apply(J(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.tickFormat=k,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
// https://d3js.org/d3-scale/ v3.3.0 Copyright 2021 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="undefined"!=typeof globalThis?globalThis:n||self).d3=n.d3||{},n.d3,n.d3,n.d3,n.d3,n.d3)}(this,(function(n,t,r,e,u,i){"use strict";function o(n,t){switch(arguments.length){case 0:break;case 1:this.range(n);break;default:this.range(t).domain(n)}return this}function a(n,t){switch(arguments.length){case 0:break;case 1:"function"==typeof n?this.interpolator(n):this.range(n);break;default:this.domain(n),"function"==typeof t?this.interpolator(t):this.range(t)}return this}const c=Symbol("implicit");function l(){var n=new Map,t=[],r=[],e=c;function u(u){var i=u+"",o=n.get(i);if(!o){if(e!==c)return e;n.set(i,o=t.push(u))}return r[(o-1)%r.length]}return u.domain=function(r){if(!arguments.length)return t.slice();t=[],n=new Map;for(const e of r){const r=e+"";n.has(r)||n.set(r,t.push(e))}return u},u.range=function(n){return arguments.length?(r=Array.from(n),u):r.slice()},u.unknown=function(n){return arguments.length?(e=n,u):e},u.copy=function(){return l(t,r).unknown(e)},o.apply(u,arguments),u}function f(){var n,r,e=l().unknown(void 0),u=e.domain,i=e.range,a=0,c=1,p=!1,s=0,h=0,g=.5;function m(){var e=u().length,o=c<a,l=o?c:a,f=o?a:c;n=(f-l)/Math.max(1,e-s+2*h),p&&(n=Math.floor(n)),l+=(f-l-n*(e-s))*g,r=n*(1-s),p&&(l=Math.round(l),r=Math.round(r));var m=t.range(e).map((function(t){return l+n*t}));return i(o?m.reverse():m)}return delete e.unknown,e.domain=function(n){return arguments.length?(u(n),m()):u()},e.range=function(n){return arguments.length?([a,c]=n,a=+a,c=+c,m()):[a,c]},e.rangeRound=function(n){return[a,c]=n,a=+a,c=+c,p=!0,m()},e.bandwidth=function(){return r},e.step=function(){return n},e.round=function(n){return arguments.length?(p=!!n,m()):p},e.padding=function(n){return arguments.length?(s=Math.min(1,h=+n),m()):s},e.paddingInner=function(n){return arguments.length?(s=Math.min(1,n),m()):s},e.paddingOuter=function(n){return arguments.length?(h=+n,m()):h},e.align=function(n){return arguments.length?(g=Math.max(0,Math.min(1,n)),m()):g},e.copy=function(){return f(u(),[a,c]).round(p).paddingInner(s).paddingOuter(h).align(g)},o.apply(m(),arguments)}function p(n){var t=n.copy;return n.padding=n.paddingOuter,delete n.paddingInner,delete n.paddingOuter,n.copy=function(){return p(t())},n}function s(n){return+n}var h=[0,1];function g(n){return n}function m(n,t){return(t-=n=+n)?function(r){return(r-n)/t}:(r=isNaN(t)?NaN:.5,function(){return r});var r}function d(n,t,r){var e=n[0],u=n[1],i=t[0],o=t[1];return u<e?(e=m(u,e),i=r(o,i)):(e=m(e,u),i=r(i,o)),function(n){return i(e(n))}}function y(n,r,e){var u=Math.min(n.length,r.length)-1,i=new Array(u),o=new Array(u),a=-1;for(n[u]<n[0]&&(n=n.slice().reverse(),r=r.slice().reverse());++a<u;)i[a]=m(n[a],n[a+1]),o[a]=e(r[a],r[a+1]);return function(r){var e=t.bisect(n,r,1,u)-1;return o[e](i[e](r))}}function v(n,t){return t.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function M(){var n,t,e,u,i,o,a=h,c=h,l=r.interpolate,f=g;function p(){var n,t,r,e=Math.min(a.length,c.length);return f!==g&&(n=a[0],t=a[e-1],n>t&&(r=n,n=t,t=r),f=function(r){return Math.max(n,Math.min(t,r))}),u=e>2?y:d,i=o=null,m}function m(t){return null==t||isNaN(t=+t)?e:(i||(i=u(a.map(n),c,l)))(n(f(t)))}return m.invert=function(e){return f(t((o||(o=u(c,a.map(n),r.interpolateNumber)))(e)))},m.domain=function(n){return arguments.length?(a=Array.from(n,s),p()):a.slice()},m.range=function(n){return arguments.length?(c=Array.from(n),p()):c.slice()},m.rangeRound=function(n){return c=Array.from(n),l=r.interpolateRound,p()},m.clamp=function(n){return arguments.length?(f=!!n||g,p()):f!==g},m.interpolate=function(n){return arguments.length?(l=n,p()):l},m.unknown=function(n){return arguments.length?(e=n,m):e},function(r,e){return n=r,t=e,p()}}function k(){return M()(g,g)}function w(n,r,u,i){var o,a=t.tickStep(n,r,u);switch((i=e.formatSpecifier(null==i?",f":i)).type){case"s":var c=Math.max(Math.abs(n),Math.abs(r));return null!=i.precision||isNaN(o=e.precisionPrefix(a,c))||(i.precision=o),e.formatPrefix(i,c);case"":case"e":case"g":case"p":case"r":null!=i.precision||isNaN(o=e.precisionRound(a,Math.max(Math.abs(n),Math.abs(r))))||(i.precision=o-("e"===i.type));break;case"f":case"%":null!=i.precision||isNaN(o=e.precisionFixed(a))||(i.precision=o-2*("%"===i.type))}return e.format(i)}function N(n){var r=n.domain;return n.ticks=function(n){var e=r();return t.ticks(e[0],e[e.length-1],null==n?10:n)},n.tickFormat=function(n,t){var e=r();return w(e[0],e[e.length-1],null==n?10:n,t)},n.nice=function(e){null==e&&(e=10);var u,i,o=r(),a=0,c=o.length-1,l=o[a],f=o[c],p=10;for(f<l&&(i=l,l=f,f=i,i=a,a=c,c=i);p-- >0;){if((i=t.tickIncrement(l,f,e))===u)return o[a]=l,o[c]=f,r(o);if(i>0)l=Math.floor(l/i)*i,f=Math.ceil(f/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,f=Math.floor(f*i)/i}u=i}return n},n}function b(n,t){var r,e=0,u=(n=n.slice()).length-1,i=n[e],o=n[u];return o<i&&(r=e,e=u,u=r,r=i,i=o,o=r),n[e]=t.floor(i),n[u]=t.ceil(o),n}function x(n){return Math.log(n)}function q(n){return Math.exp(n)}function S(n){return-Math.log(-n)}function A(n){return-Math.exp(-n)}function D(n){return isFinite(n)?+("1e"+n):n<0?0:n}function I(n){return function(t){return-n(-t)}}function R(n){var r,u,i=n(x,q),o=i.domain,a=10;function c(){return r=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),u=function(n){return 10===n?D:n===Math.E?Math.exp:function(t){return Math.pow(n,t)}}(a),o()[0]<0?(r=I(r),u=I(u),n(S,A)):n(x,q),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 e,i=o(),c=i[0],l=i[i.length-1];(e=l<c)&&(h=c,c=l,l=h);var f,p,s,h=r(c),g=r(l),m=null==n?10:+n,d=[];if(!(a%1)&&g-h<m){if(h=Math.floor(h),g=Math.ceil(g),c>0){for(;h<=g;++h)for(p=1,f=u(h);p<a;++p)if(!((s=f*p)<c)){if(s>l)break;d.push(s)}}else for(;h<=g;++h)for(p=a-1,f=u(h);p>=1;--p)if(!((s=f*p)<c)){if(s>l)break;d.push(s)}2*d.length<m&&(d=t.ticks(c,l,m))}else d=t.ticks(h,g,Math.min(g-h,m)).map(u);return e?d.reverse():d},i.tickFormat=function(n,t){if(null==t&&(t=10===a?".0e":","),"function"!=typeof t&&(t=e.format(t)),n===1/0)return t;null==n&&(n=10);var o=Math.max(1,a*n/i.ticks().length);return function(n){var e=n/u(Math.round(r(n)));return e*a<a-.5&&(e*=a),e<=o?t(n):""}},i.nice=function(){return o(b(o(),{floor:function(n){return u(Math.floor(r(n)))},ceil:function(n){return u(Math.ceil(r(n)))}}))},i}function T(n){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/n))}}function O(n){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*n}}function F(n){var t=1,r=n(T(t),O(t));return r.constant=function(r){return arguments.length?n(T(t=+r),O(t)):t},N(r)}function P(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function E(n){return n<0?-Math.sqrt(-n):Math.sqrt(n)}function L(n){return n<0?-n*n:n*n}function Q(n){var t=n(g,g),r=1;function e(){return 1===r?n(g,g):.5===r?n(E,L):n(P(r),P(1/r))}return t.exponent=function(n){return arguments.length?(r=+n,e()):r},N(t)}function U(){var n=Q(M());return n.copy=function(){return v(n,U()).exponent(n.exponent())},o.apply(n,arguments),n}function Y(n){return Math.sign(n)*n*n}function j(n){return Math.sign(n)*Math.sqrt(Math.abs(n))}function B(n){return new Date(n)}function C(n){return n instanceof Date?+n:+new Date(+n)}function H(n,t,r,e,u,i,o,a,c,l){var f=k(),p=f.invert,s=f.domain,h=l(".%L"),g=l(":%S"),m=l("%I:%M"),d=l("%I %p"),y=l("%a %d"),M=l("%b %d"),w=l("%B"),N=l("%Y");function x(n){return(c(n)<n?h:a(n)<n?g:o(n)<n?m:i(n)<n?d:e(n)<n?u(n)<n?y:M:r(n)<n?w:N)(n)}return f.invert=function(n){return new Date(p(n))},f.domain=function(n){return arguments.length?s(Array.from(n,C)):s().map(B)},f.ticks=function(t){var r=s();return n(r[0],r[r.length-1],null==t?10:t)},f.tickFormat=function(n,t){return null==t?x:l(t)},f.nice=function(n){var r=s();return n&&"function"==typeof n.range||(n=t(r[0],r[r.length-1],null==n?10:n)),n?s(b(r,n)):f},f.copy=function(){return v(f,H(n,t,r,e,u,i,o,a,c,l))},f}function W(){var n,t,e,u,i,o=0,a=1,c=g,l=!1;function f(t){return null==t||isNaN(t=+t)?i:c(0===e?.5:(t=(u(t)-n)*e,l?Math.max(0,Math.min(1,t)):t))}function p(n){return function(t){var r,e;return arguments.length?([r,e]=t,c=n(r,e),f):[c(0),c(1)]}}return f.domain=function(r){return arguments.length?([o,a]=r,n=u(o=+o),t=u(a=+a),e=n===t?0:1/(t-n),f):[o,a]},f.clamp=function(n){return arguments.length?(l=!!n,f):l},f.interpolator=function(n){return arguments.length?(c=n,f):c},f.range=p(r.interpolate),f.rangeRound=p(r.interpolateRound),f.unknown=function(n){return arguments.length?(i=n,f):i},function(r){return u=r,n=r(o),t=r(a),e=n===t?0:1/(t-n),f}}function _(n,t){return t.domain(n.domain()).interpolator(n.interpolator()).clamp(n.clamp()).unknown(n.unknown())}function z(){var n=Q(W());return n.copy=function(){return _(n,z()).exponent(n.exponent())},a.apply(n,arguments)}function G(){var n,t,e,u,i,o,a,c=0,l=.5,f=1,p=1,s=g,h=!1;function m(n){return isNaN(n=+n)?a:(n=.5+((n=+o(n))-t)*(p*n<p*t?u:i),s(h?Math.max(0,Math.min(1,n)):n))}function d(n){return function(t){var e,u,i;return arguments.length?([e,u,i]=t,s=r.piecewise(n,[e,u,i]),m):[s(0),s(.5),s(1)]}}return m.domain=function(r){return arguments.length?([c,l,f]=r,n=o(c=+c),t=o(l=+l),e=o(f=+f),u=n===t?0:.5/(t-n),i=t===e?0:.5/(e-t),p=t<n?-1:1,m):[c,l,f]},m.clamp=function(n){return arguments.length?(h=!!n,m):h},m.interpolator=function(n){return arguments.length?(s=n,m):s},m.range=d(r.interpolate),m.rangeRound=d(r.interpolateRound),m.unknown=function(n){return arguments.length?(a=n,m):a},function(r){return o=r,n=r(c),t=r(l),e=r(f),u=n===t?0:.5/(t-n),i=t===e?0:.5/(e-t),p=t<n?-1:1,m}}function J(){var n=Q(G());return n.copy=function(){return _(n,J()).exponent(n.exponent())},a.apply(n,arguments)}n.scaleBand=f,n.scaleDiverging=function n(){var t=N(G()(g));return t.copy=function(){return _(t,n())},a.apply(t,arguments)},n.scaleDivergingLog=function n(){var t=R(G()).domain([.1,1,10]);return t.copy=function(){return _(t,n()).base(t.base())},a.apply(t,arguments)},n.scaleDivergingPow=J,n.scaleDivergingSqrt=function(){return J.apply(null,arguments).exponent(.5)},n.scaleDivergingSymlog=function n(){var t=F(G());return t.copy=function(){return _(t,n()).constant(t.constant())},a.apply(t,arguments)},n.scaleIdentity=function n(t){var r;function e(n){return null==n||isNaN(n=+n)?r:n}return e.invert=e,e.domain=e.range=function(n){return arguments.length?(t=Array.from(n,s),e):t.slice()},e.unknown=function(n){return arguments.length?(r=n,e):r},e.copy=function(){return n(t).unknown(r)},t=arguments.length?Array.from(t,s):[0,1],N(e)},n.scaleImplicit=c,n.scaleLinear=function n(){var t=k();return t.copy=function(){return v(t,n())},o.apply(t,arguments),N(t)},n.scaleLog=function n(){var t=R(M()).domain([1,10]);return t.copy=function(){return v(t,n()).base(t.base())},o.apply(t,arguments),t},n.scaleOrdinal=l,n.scalePoint=function(){return p(f.apply(null,arguments).paddingInner(1))},n.scalePow=U,n.scaleQuantile=function n(){var r,e=[],u=[],i=[];function a(){var n=0,r=Math.max(1,u.length);for(i=new Array(r-1);++n<r;)i[n-1]=t.quantileSorted(e,n/r);return c}function c(n){return null==n||isNaN(n=+n)?r: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]:e[0],t<i.length?i[t]:e[e.length-1]]},c.domain=function(n){if(!arguments.length)return e.slice();e=[];for(let t of n)null==t||isNaN(t=+t)||e.push(t);return e.sort(t.ascending),a()},c.range=function(n){return arguments.length?(u=Array.from(n),a()):u.slice()},c.unknown=function(n){return arguments.length?(r=n,c):r},c.quantiles=function(){return i.slice()},c.copy=function(){return n().domain(e).range(u).unknown(r)},o.apply(c,arguments)},n.scaleQuantize=function n(){var r,e=0,u=1,i=1,a=[.5],c=[0,1];function l(n){return null!=n&&n<=n?c[t.bisect(a,n,0,i)]:r}function f(){var n=-1;for(a=new Array(i);++n<i;)a[n]=((n+1)*u-(n-i)*e)/(i+1);return l}return l.domain=function(n){return arguments.length?([e,u]=n,e=+e,u=+u,f()):[e,u]},l.range=function(n){return arguments.length?(i=(c=Array.from(n)).length-1,f()):c.slice()},l.invertExtent=function(n){var t=c.indexOf(n);return t<0?[NaN,NaN]:t<1?[e,a[0]]:t>=i?[a[i-1],u]:[a[t-1],a[t]]},l.unknown=function(n){return arguments.length?(r=n,l):l},l.thresholds=function(){return a.slice()},l.copy=function(){return n().domain([e,u]).range(c).unknown(r)},o.apply(N(l),arguments)},n.scaleRadial=function n(){var t,r=k(),e=[0,1],u=!1;function i(n){var e=j(r(n));return isNaN(e)?t:u?Math.round(e):e}return i.invert=function(n){return r.invert(Y(n))},i.domain=function(n){return arguments.length?(r.domain(n),i):r.domain()},i.range=function(n){return arguments.length?(r.range((e=Array.from(n,s)).map(Y)),i):e.slice()},i.rangeRound=function(n){return i.range(n).round(!0)},i.round=function(n){return arguments.length?(u=!!n,i):u},i.clamp=function(n){return arguments.length?(r.clamp(n),i):r.clamp()},i.unknown=function(n){return arguments.length?(t=n,i):t},i.copy=function(){return n(r.domain(),e).round(u).clamp(r.clamp()).unknown(t)},o.apply(i,arguments),N(i)},n.scaleSequential=function n(){var t=N(W()(g));return t.copy=function(){return _(t,n())},a.apply(t,arguments)},n.scaleSequentialLog=function n(){var t=R(W()).domain([1,10]);return t.copy=function(){return _(t,n()).base(t.base())},a.apply(t,arguments)},n.scaleSequentialPow=z,n.scaleSequentialQuantile=function n(){var r=[],e=g;function u(n){if(null!=n&&!isNaN(n=+n))return e((t.bisect(r,n,1)-1)/(r.length-1))}return u.domain=function(n){if(!arguments.length)return r.slice();r=[];for(let t of n)null==t||isNaN(t=+t)||r.push(t);return r.sort(t.ascending),u},u.interpolator=function(n){return arguments.length?(e=n,u):e},u.range=function(){return r.map(((n,t)=>e(t/(r.length-1))))},u.quantiles=function(n){return Array.from({length:n+1},((e,u)=>t.quantile(r,u/n)))},u.copy=function(){return n(e).domain(r)},a.apply(u,arguments)},n.scaleSequentialSqrt=function(){return z.apply(null,arguments).exponent(.5)},n.scaleSequentialSymlog=function n(){var t=F(W());return t.copy=function(){return _(t,n()).constant(t.constant())},a.apply(t,arguments)},n.scaleSqrt=function(){return U.apply(null,arguments).exponent(.5)},n.scaleSymlog=function n(){var t=F(M());return t.copy=function(){return v(t,n()).constant(t.constant())},o.apply(t,arguments)},n.scaleThreshold=function n(){var r,e=[.5],u=[0,1],i=1;function a(n){return null!=n&&n<=n?u[t.bisect(e,n,0,i)]:r}return a.domain=function(n){return arguments.length?(e=Array.from(n),i=Math.min(e.length,u.length-1),a):e.slice()},a.range=function(n){return arguments.length?(u=Array.from(n),i=Math.min(e.length,u.length-1),a):u.slice()},a.invertExtent=function(n){var t=u.indexOf(n);return[e[t-1],e[t]]},a.unknown=function(n){return arguments.length?(r=n,a):r},a.copy=function(){return n().domain(e).range(u).unknown(r)},o.apply(a,arguments)},n.scaleTime=function(){return o.apply(H(u.timeTicks,u.timeTickInterval,u.timeYear,u.timeMonth,u.timeWeek,u.timeDay,u.timeHour,u.timeMinute,u.timeSecond,i.timeFormat).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},n.scaleUtc=function(){return o.apply(H(u.utcTicks,u.utcTickInterval,u.utcYear,u.utcMonth,u.utcWeek,u.utcDay,u.utcHour,u.utcMinute,u.utcSecond,i.utcFormat).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},n.tickFormat=w,Object.defineProperty(n,"__esModule",{value:!0})})); |
{ | ||
"name": "d3-scale", | ||
"version": "3.3.0-rc.3", | ||
"publishConfig": { | ||
"tag": "next" | ||
}, | ||
"version": "3.3.0", | ||
"description": "Encodings that map abstract data to visual representation.", | ||
@@ -40,15 +37,15 @@ "keywords": [ | ||
"dependencies": { | ||
"d3-array": "1.2.0 - 2", | ||
"d3-format": ">=2.0.0-rc.1", | ||
"d3-interpolate": ">=2.0.0-rc.1", | ||
"d3-time": ">=2.0.0-rc.1", | ||
"d3-time-format": ">=3.0.0-rc.1" | ||
"d3-array": "^2.3.0", | ||
"d3-format": "1 - 2", | ||
"d3-interpolate": "1.2.0 - 2", | ||
"d3-time": "^2.1.1", | ||
"d3-time-format": "2 - 3" | ||
}, | ||
"devDependencies": { | ||
"d3-color": ">=2.0.0-rc.1", | ||
"eslint": "6", | ||
"rollup": "1", | ||
"rollup-plugin-terser": "5", | ||
"d3-color": "1 - 2", | ||
"eslint": "7", | ||
"rollup": "2", | ||
"rollup-plugin-terser": "7", | ||
"tape": "4" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
export default function(s) { | ||
export default function colors(s) { | ||
return s.match(/.{6}/g).map(function(x) { | ||
@@ -3,0 +3,0 @@ return "#" + x; |
@@ -1,2 +0,2 @@ | ||
export default function(x) { | ||
export default function constants(x) { | ||
return function() { | ||
@@ -3,0 +3,0 @@ return x; |
@@ -86,3 +86,3 @@ import {bisect} from "d3-array"; | ||
function scale(x) { | ||
return isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); | ||
return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x))); | ||
} | ||
@@ -89,0 +89,0 @@ |
@@ -8,3 +8,3 @@ import {linearish} from "./linear.js"; | ||
function scale(x) { | ||
return isNaN(x = +x) ? unknown : x; | ||
return x == null || isNaN(x = +x) ? unknown : x; | ||
} | ||
@@ -11,0 +11,0 @@ |
@@ -1,2 +0,2 @@ | ||
export default function(domain, interval) { | ||
export default function nice(domain, interval) { | ||
domain = domain.slice(); | ||
@@ -3,0 +3,0 @@ |
@@ -1,3 +0,3 @@ | ||
export default function(x) { | ||
export default function number(x) { | ||
return +x; | ||
} |
@@ -1,2 +0,2 @@ | ||
import {ascending, bisect, quantile as threshold} from "d3-array"; | ||
import {ascending, bisect, quantileSorted as threshold} from "d3-array"; | ||
import {initRange} from "./init.js"; | ||
@@ -18,3 +18,3 @@ | ||
function scale(x) { | ||
return isNaN(x = +x) ? unknown : range[bisect(thresholds, x)]; | ||
return x == null || isNaN(x = +x) ? unknown : range[bisect(thresholds, x)]; | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -14,3 +14,3 @@ import {bisect} from "d3-array"; | ||
function scale(x) { | ||
return x <= x ? range[bisect(domain, x, 0, n)] : unknown; | ||
return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown; | ||
} | ||
@@ -17,0 +17,0 @@ |
@@ -21,3 +21,3 @@ import {interpolate, interpolateRound} from "d3-interpolate"; | ||
function scale(x) { | ||
return isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); | ||
return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); | ||
} | ||
@@ -24,0 +24,0 @@ |
@@ -10,3 +10,3 @@ import {ascending, bisect, quantile} from "d3-array"; | ||
function scale(x) { | ||
if (!isNaN(x = +x)) return interpolator((bisect(domain, x, 1) - 1) / (domain.length - 1)); | ||
if (x != null && !isNaN(x = +x)) return interpolator((bisect(domain, x, 1) - 1) / (domain.length - 1)); | ||
} | ||
@@ -13,0 +13,0 @@ |
@@ -11,3 +11,3 @@ import {bisect} from "d3-array"; | ||
function scale(x) { | ||
return x <= x ? range[bisect(domain, x, 0, n)] : unknown; | ||
return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown; | ||
} | ||
@@ -14,0 +14,0 @@ |
import {tickStep} from "d3-array"; | ||
import {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from "d3-format"; | ||
export default function(start, stop, count, specifier) { | ||
export default function tickFormat(start, stop, count, specifier) { | ||
var step = tickStep(start, stop, count), | ||
@@ -6,0 +6,0 @@ precision; |
@@ -1,3 +0,2 @@ | ||
import {bisector, tickStep} from "d3-array"; | ||
import {timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeMillisecond} from "d3-time"; | ||
import {timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeTicks, timeTickInterval} from "d3-time"; | ||
import {timeFormat} from "d3-time-format"; | ||
@@ -8,10 +7,2 @@ import continuous, {copy} from "./continuous.js"; | ||
var durationSecond = 1000, | ||
durationMinute = durationSecond * 60, | ||
durationHour = durationMinute * 60, | ||
durationDay = durationHour * 24, | ||
durationWeek = durationDay * 7, | ||
durationMonth = durationDay * 30, | ||
durationYear = durationDay * 365; | ||
function date(t) { | ||
@@ -25,3 +16,3 @@ return new Date(t); | ||
export function calendar(year, month, week, day, hour, minute, second, millisecond, format) { | ||
export function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) { | ||
var scale = continuous(), | ||
@@ -40,23 +31,2 @@ invert = scale.invert, | ||
var tickIntervals = [ | ||
[second, 1, durationSecond], | ||
[second, 5, 5 * durationSecond], | ||
[second, 15, 15 * durationSecond], | ||
[second, 30, 30 * durationSecond], | ||
[minute, 1, durationMinute], | ||
[minute, 5, 5 * durationMinute], | ||
[minute, 15, 15 * durationMinute], | ||
[minute, 30, 30 * durationMinute], | ||
[ hour, 1, durationHour ], | ||
[ hour, 3, 3 * durationHour ], | ||
[ hour, 6, 6 * durationHour ], | ||
[ hour, 12, 12 * durationHour ], | ||
[ day, 1, durationDay ], | ||
[ day, 2, 2 * durationDay ], | ||
[ week, 1, durationWeek ], | ||
[ month, 1, durationMonth ], | ||
[ month, 3, 3 * durationMonth ], | ||
[ year, 1, durationYear ] | ||
]; | ||
function tickFormat(date) { | ||
@@ -72,29 +42,2 @@ return (second(date) < date ? formatMillisecond | ||
function tickInterval(interval, start, stop) { | ||
if (interval == null) interval = 10; | ||
// If a desired tick count is specified, pick a reasonable tick interval | ||
// based on the extent of the domain and a rough estimate of tick size. | ||
// Otherwise, assume interval is already a time interval and use it. | ||
if (typeof interval === "number") { | ||
var target = Math.abs(stop - start) / interval, | ||
i = bisector(function(i) { return i[2]; }).right(tickIntervals, target), | ||
step; | ||
if (i === tickIntervals.length) { | ||
step = tickStep(start / durationYear, stop / durationYear, interval); | ||
interval = year; | ||
} else if (i) { | ||
i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; | ||
step = i[1]; | ||
interval = i[0]; | ||
} else { | ||
step = Math.max(tickStep(start, stop, interval), 1); | ||
interval = millisecond; | ||
} | ||
return interval.every(step); | ||
} | ||
return interval; | ||
} | ||
scale.invert = function(y) { | ||
@@ -109,11 +52,4 @@ return new Date(invert(y)); | ||
scale.ticks = function(interval) { | ||
var d = domain(), | ||
t0 = d[0], | ||
t1 = d[d.length - 1], | ||
r = t1 < t0, | ||
t; | ||
if (r) t = t0, t0 = t1, t1 = t; | ||
t = tickInterval(interval, t0, t1); | ||
t = t ? t.range(t0, t1 + 1) : []; // inclusive stop | ||
return r ? t.reverse() : t; | ||
var d = domain(); | ||
return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval); | ||
}; | ||
@@ -127,9 +63,8 @@ | ||
var d = domain(); | ||
return (interval = tickInterval(interval, d[0], d[d.length - 1])) | ||
? domain(nice(d, interval)) | ||
: scale; | ||
if (!interval || typeof interval.range !== "function") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval); | ||
return interval ? domain(nice(d, interval)) : scale; | ||
}; | ||
scale.copy = function() { | ||
return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format)); | ||
return copy(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format)); | ||
}; | ||
@@ -140,4 +75,4 @@ | ||
export default function() { | ||
return initRange.apply(calendar(timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeMillisecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments); | ||
export default function time() { | ||
return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments); | ||
} |
@@ -0,8 +1,8 @@ | ||
import {utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcTicks, utcTickInterval} from "d3-time"; | ||
import {utcFormat} from "d3-time-format"; | ||
import {calendar} from "./time.js"; | ||
import {utcFormat} from "d3-time-format"; | ||
import {utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcMillisecond} from "d3-time"; | ||
import {initRange} from "./init.js"; | ||
export default function() { | ||
return initRange.apply(calendar(utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcMillisecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments); | ||
export default function utcTime() { | ||
return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments); | ||
} |
Sorry, the diff of this file is too big to display
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
992
174828
2087
+ Addedd3-color@2.0.0(transitive)
+ Addedd3-format@2.0.0(transitive)
+ Addedd3-interpolate@2.0.1(transitive)
+ Addedd3-time@2.1.1(transitive)
+ Addedd3-time-format@3.0.0(transitive)
- Removedd3-color@3.1.0(transitive)
- Removedd3-format@3.1.0(transitive)
- Removedd3-interpolate@3.0.1(transitive)
- Removedd3-time@3.1.0(transitive)
- Removedd3-time-format@4.1.0(transitive)
Updatedd3-array@^2.3.0
Updatedd3-format@1 - 2
Updatedd3-interpolate@1.2.0 - 2
Updatedd3-time@^2.1.1
Updatedd3-time-format@2 - 3