add lisp packages
This commit is contained in:
4
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/array.js
generated
vendored
Normal file
4
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/array.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
var array = Array.prototype;
|
||||
|
||||
export var map = array.map;
|
||||
export var slice = array.slice;
|
||||
100
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/band.js
generated
vendored
Normal file
100
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/band.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
import {range as sequence} from "d3-array";
|
||||
import {initRange} from "./init";
|
||||
import ordinal from "./ordinal";
|
||||
|
||||
export default function band() {
|
||||
var scale = ordinal().unknown(undefined),
|
||||
domain = scale.domain,
|
||||
ordinalRange = scale.range,
|
||||
range = [0, 1],
|
||||
step,
|
||||
bandwidth,
|
||||
round = false,
|
||||
paddingInner = 0,
|
||||
paddingOuter = 0,
|
||||
align = 0.5;
|
||||
|
||||
delete scale.unknown;
|
||||
|
||||
function rescale() {
|
||||
var n = domain().length,
|
||||
reverse = range[1] < range[0],
|
||||
start = range[reverse - 0],
|
||||
stop = range[1 - reverse];
|
||||
step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
|
||||
if (round) step = Math.floor(step);
|
||||
start += (stop - start - step * (n - paddingInner)) * align;
|
||||
bandwidth = step * (1 - paddingInner);
|
||||
if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);
|
||||
var values = sequence(n).map(function(i) { return start + step * i; });
|
||||
return ordinalRange(reverse ? values.reverse() : values);
|
||||
}
|
||||
|
||||
scale.domain = function(_) {
|
||||
return arguments.length ? (domain(_), rescale()) : domain();
|
||||
};
|
||||
|
||||
scale.range = function(_) {
|
||||
return arguments.length ? (range = [+_[0], +_[1]], rescale()) : range.slice();
|
||||
};
|
||||
|
||||
scale.rangeRound = function(_) {
|
||||
return range = [+_[0], +_[1]], round = true, rescale();
|
||||
};
|
||||
|
||||
scale.bandwidth = function() {
|
||||
return bandwidth;
|
||||
};
|
||||
|
||||
scale.step = function() {
|
||||
return step;
|
||||
};
|
||||
|
||||
scale.round = function(_) {
|
||||
return arguments.length ? (round = !!_, rescale()) : round;
|
||||
};
|
||||
|
||||
scale.padding = function(_) {
|
||||
return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;
|
||||
};
|
||||
|
||||
scale.paddingInner = function(_) {
|
||||
return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;
|
||||
};
|
||||
|
||||
scale.paddingOuter = function(_) {
|
||||
return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;
|
||||
};
|
||||
|
||||
scale.align = function(_) {
|
||||
return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return band(domain(), range)
|
||||
.round(round)
|
||||
.paddingInner(paddingInner)
|
||||
.paddingOuter(paddingOuter)
|
||||
.align(align);
|
||||
};
|
||||
|
||||
return initRange.apply(rescale(), arguments);
|
||||
}
|
||||
|
||||
function pointish(scale) {
|
||||
var copy = scale.copy;
|
||||
|
||||
scale.padding = scale.paddingOuter;
|
||||
delete scale.paddingInner;
|
||||
delete scale.paddingOuter;
|
||||
|
||||
scale.copy = function() {
|
||||
return pointish(copy());
|
||||
};
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
export function point() {
|
||||
return pointish(band.apply(null, arguments).paddingInner(1));
|
||||
}
|
||||
5
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/colors.js
generated
vendored
Normal file
5
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/colors.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export default function(s) {
|
||||
return s.match(/.{6}/g).map(function(x) {
|
||||
return "#" + x;
|
||||
});
|
||||
}
|
||||
5
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/constant.js
generated
vendored
Normal file
5
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/constant.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export default function(x) {
|
||||
return function() {
|
||||
return x;
|
||||
};
|
||||
}
|
||||
124
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/continuous.js
generated
vendored
Normal file
124
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/continuous.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
import {bisect} from "d3-array";
|
||||
import {interpolate as interpolateValue, interpolateNumber, interpolateRound} from "d3-interpolate";
|
||||
import {map, slice} from "./array";
|
||||
import constant from "./constant";
|
||||
import number from "./number";
|
||||
|
||||
var unit = [0, 1];
|
||||
|
||||
export function identity(x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
function normalize(a, b) {
|
||||
return (b -= (a = +a))
|
||||
? function(x) { return (x - a) / b; }
|
||||
: constant(isNaN(b) ? NaN : 0.5);
|
||||
}
|
||||
|
||||
function clamper(domain) {
|
||||
var a = domain[0], b = domain[domain.length - 1], t;
|
||||
if (a > b) t = a, a = b, b = t;
|
||||
return function(x) { return Math.max(a, Math.min(b, x)); };
|
||||
}
|
||||
|
||||
// normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1].
|
||||
// interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b].
|
||||
function bimap(domain, range, interpolate) {
|
||||
var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
|
||||
if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
|
||||
else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
|
||||
return function(x) { return r0(d0(x)); };
|
||||
}
|
||||
|
||||
function polymap(domain, range, interpolate) {
|
||||
var j = Math.min(domain.length, range.length) - 1,
|
||||
d = new Array(j),
|
||||
r = new Array(j),
|
||||
i = -1;
|
||||
|
||||
// Reverse descending domains.
|
||||
if (domain[j] < domain[0]) {
|
||||
domain = domain.slice().reverse();
|
||||
range = range.slice().reverse();
|
||||
}
|
||||
|
||||
while (++i < j) {
|
||||
d[i] = normalize(domain[i], domain[i + 1]);
|
||||
r[i] = interpolate(range[i], range[i + 1]);
|
||||
}
|
||||
|
||||
return function(x) {
|
||||
var i = bisect(domain, x, 1, j) - 1;
|
||||
return r[i](d[i](x));
|
||||
};
|
||||
}
|
||||
|
||||
export function copy(source, target) {
|
||||
return target
|
||||
.domain(source.domain())
|
||||
.range(source.range())
|
||||
.interpolate(source.interpolate())
|
||||
.clamp(source.clamp())
|
||||
.unknown(source.unknown());
|
||||
}
|
||||
|
||||
export function transformer() {
|
||||
var domain = unit,
|
||||
range = unit,
|
||||
interpolate = interpolateValue,
|
||||
transform,
|
||||
untransform,
|
||||
unknown,
|
||||
clamp = identity,
|
||||
piecewise,
|
||||
output,
|
||||
input;
|
||||
|
||||
function rescale() {
|
||||
piecewise = Math.min(domain.length, range.length) > 2 ? polymap : bimap;
|
||||
output = input = null;
|
||||
return scale;
|
||||
}
|
||||
|
||||
function scale(x) {
|
||||
return isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));
|
||||
}
|
||||
|
||||
scale.invert = function(y) {
|
||||
return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));
|
||||
};
|
||||
|
||||
scale.domain = function(_) {
|
||||
return arguments.length ? (domain = map.call(_, number), clamp === identity || (clamp = clamper(domain)), rescale()) : domain.slice();
|
||||
};
|
||||
|
||||
scale.range = function(_) {
|
||||
return arguments.length ? (range = slice.call(_), rescale()) : range.slice();
|
||||
};
|
||||
|
||||
scale.rangeRound = function(_) {
|
||||
return range = slice.call(_), interpolate = interpolateRound, rescale();
|
||||
};
|
||||
|
||||
scale.clamp = function(_) {
|
||||
return arguments.length ? (clamp = _ ? clamper(domain) : identity, scale) : clamp !== identity;
|
||||
};
|
||||
|
||||
scale.interpolate = function(_) {
|
||||
return arguments.length ? (interpolate = _, rescale()) : interpolate;
|
||||
};
|
||||
|
||||
scale.unknown = function(_) {
|
||||
return arguments.length ? (unknown = _, scale) : unknown;
|
||||
};
|
||||
|
||||
return function(t, u) {
|
||||
transform = t, untransform = u;
|
||||
return rescale();
|
||||
};
|
||||
}
|
||||
|
||||
export default function continuous(transform, untransform) {
|
||||
return transformer()(transform, untransform);
|
||||
}
|
||||
91
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/diverging.js
generated
vendored
Normal file
91
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/diverging.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
import {identity} from "./continuous";
|
||||
import {initInterpolator} from "./init";
|
||||
import {linearish} from "./linear";
|
||||
import {loggish} from "./log";
|
||||
import {copy} from "./sequential";
|
||||
import {symlogish} from "./symlog";
|
||||
import {powish} from "./pow";
|
||||
|
||||
function transformer() {
|
||||
var x0 = 0,
|
||||
x1 = 0.5,
|
||||
x2 = 1,
|
||||
t0,
|
||||
t1,
|
||||
t2,
|
||||
k10,
|
||||
k21,
|
||||
interpolator = identity,
|
||||
transform,
|
||||
clamp = false,
|
||||
unknown;
|
||||
|
||||
function scale(x) {
|
||||
return isNaN(x = +x) ? unknown : (x = 0.5 + ((x = +transform(x)) - t1) * (x < t1 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x)) : x));
|
||||
}
|
||||
|
||||
scale.domain = function(_) {
|
||||
return arguments.length ? (t0 = transform(x0 = +_[0]), t1 = transform(x1 = +_[1]), t2 = transform(x2 = +_[2]), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1), scale) : [x0, x1, x2];
|
||||
};
|
||||
|
||||
scale.clamp = function(_) {
|
||||
return arguments.length ? (clamp = !!_, scale) : clamp;
|
||||
};
|
||||
|
||||
scale.interpolator = function(_) {
|
||||
return arguments.length ? (interpolator = _, scale) : interpolator;
|
||||
};
|
||||
|
||||
scale.unknown = function(_) {
|
||||
return arguments.length ? (unknown = _, scale) : unknown;
|
||||
};
|
||||
|
||||
return function(t) {
|
||||
transform = t, t0 = t(x0), t1 = t(x1), t2 = t(x2), k10 = t0 === t1 ? 0 : 0.5 / (t1 - t0), k21 = t1 === t2 ? 0 : 0.5 / (t2 - t1);
|
||||
return scale;
|
||||
};
|
||||
}
|
||||
|
||||
export default function diverging() {
|
||||
var scale = linearish(transformer()(identity));
|
||||
|
||||
scale.copy = function() {
|
||||
return copy(scale, diverging());
|
||||
};
|
||||
|
||||
return initInterpolator.apply(scale, arguments);
|
||||
}
|
||||
|
||||
export function divergingLog() {
|
||||
var scale = loggish(transformer()).domain([0.1, 1, 10]);
|
||||
|
||||
scale.copy = function() {
|
||||
return copy(scale, divergingLog()).base(scale.base());
|
||||
};
|
||||
|
||||
return initInterpolator.apply(scale, arguments);
|
||||
}
|
||||
|
||||
export function divergingSymlog() {
|
||||
var scale = symlogish(transformer());
|
||||
|
||||
scale.copy = function() {
|
||||
return copy(scale, divergingSymlog()).constant(scale.constant());
|
||||
};
|
||||
|
||||
return initInterpolator.apply(scale, arguments);
|
||||
}
|
||||
|
||||
export function divergingPow() {
|
||||
var scale = powish(transformer());
|
||||
|
||||
scale.copy = function() {
|
||||
return copy(scale, divergingPow()).exponent(scale.exponent());
|
||||
};
|
||||
|
||||
return initInterpolator.apply(scale, arguments);
|
||||
}
|
||||
|
||||
export function divergingSqrt() {
|
||||
return divergingPow.apply(null, arguments).exponent(0.5);
|
||||
}
|
||||
29
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/identity.js
generated
vendored
Normal file
29
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/identity.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import {map} from "./array";
|
||||
import {linearish} from "./linear";
|
||||
import number from "./number";
|
||||
|
||||
export default function identity(domain) {
|
||||
var unknown;
|
||||
|
||||
function scale(x) {
|
||||
return isNaN(x = +x) ? unknown : x;
|
||||
}
|
||||
|
||||
scale.invert = scale;
|
||||
|
||||
scale.domain = scale.range = function(_) {
|
||||
return arguments.length ? (domain = map.call(_, number), scale) : domain.slice();
|
||||
};
|
||||
|
||||
scale.unknown = function(_) {
|
||||
return arguments.length ? (unknown = _, scale) : unknown;
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return identity(domain).unknown(unknown);
|
||||
};
|
||||
|
||||
domain = arguments.length ? map.call(domain, number) : [0, 1];
|
||||
|
||||
return linearish(scale);
|
||||
}
|
||||
74
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/index.js
generated
vendored
Normal file
74
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
export {
|
||||
default as scaleBand,
|
||||
point as scalePoint
|
||||
} from "./band";
|
||||
|
||||
export {
|
||||
default as scaleIdentity
|
||||
} from "./identity";
|
||||
|
||||
export {
|
||||
default as scaleLinear
|
||||
} from "./linear";
|
||||
|
||||
export {
|
||||
default as scaleLog
|
||||
} from "./log";
|
||||
|
||||
export {
|
||||
default as scaleSymlog
|
||||
} from "./symlog";
|
||||
|
||||
export {
|
||||
default as scaleOrdinal,
|
||||
implicit as scaleImplicit
|
||||
} from "./ordinal";
|
||||
|
||||
export {
|
||||
default as scalePow,
|
||||
sqrt as scaleSqrt
|
||||
} from "./pow";
|
||||
|
||||
export {
|
||||
default as scaleQuantile
|
||||
} from "./quantile";
|
||||
|
||||
export {
|
||||
default as scaleQuantize
|
||||
} from "./quantize";
|
||||
|
||||
export {
|
||||
default as scaleThreshold
|
||||
} from "./threshold";
|
||||
|
||||
export {
|
||||
default as scaleTime
|
||||
} from "./time";
|
||||
|
||||
export {
|
||||
default as scaleUtc
|
||||
} from "./utcTime";
|
||||
|
||||
export {
|
||||
default as scaleSequential,
|
||||
sequentialLog as scaleSequentialLog,
|
||||
sequentialPow as scaleSequentialPow,
|
||||
sequentialSqrt as scaleSequentialSqrt,
|
||||
sequentialSymlog as scaleSequentialSymlog
|
||||
} from "./sequential";
|
||||
|
||||
export {
|
||||
default as scaleSequentialQuantile
|
||||
} from "./sequentialQuantile";
|
||||
|
||||
export {
|
||||
default as scaleDiverging,
|
||||
divergingLog as scaleDivergingLog,
|
||||
divergingPow as scaleDivergingPow,
|
||||
divergingSqrt as scaleDivergingSqrt,
|
||||
divergingSymlog as scaleDivergingSymlog
|
||||
} from "./diverging";
|
||||
|
||||
export {
|
||||
default as tickFormat
|
||||
} from "./tickFormat";
|
||||
17
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/init.js
generated
vendored
Normal file
17
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/init.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export function initRange(domain, range) {
|
||||
switch (arguments.length) {
|
||||
case 0: break;
|
||||
case 1: this.range(domain); break;
|
||||
default: this.range(range).domain(domain); break;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
export function initInterpolator(domain, interpolator) {
|
||||
switch (arguments.length) {
|
||||
case 0: break;
|
||||
case 1: this.interpolator(domain); break;
|
||||
default: this.interpolator(interpolator).domain(domain); break;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
72
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/linear.js
generated
vendored
Normal file
72
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/linear.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
import {ticks, tickIncrement} from "d3-array";
|
||||
import continuous, {copy, identity} from "./continuous";
|
||||
import {initRange} from "./init";
|
||||
import tickFormat from "./tickFormat";
|
||||
|
||||
export function linearish(scale) {
|
||||
var domain = scale.domain;
|
||||
|
||||
scale.ticks = function(count) {
|
||||
var d = domain();
|
||||
return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
|
||||
};
|
||||
|
||||
scale.tickFormat = function(count, specifier) {
|
||||
var d = domain();
|
||||
return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
|
||||
};
|
||||
|
||||
scale.nice = function(count) {
|
||||
if (count == null) count = 10;
|
||||
|
||||
var d = domain(),
|
||||
i0 = 0,
|
||||
i1 = d.length - 1,
|
||||
start = d[i0],
|
||||
stop = d[i1],
|
||||
step;
|
||||
|
||||
if (stop < start) {
|
||||
step = start, start = stop, stop = step;
|
||||
step = i0, i0 = i1, i1 = step;
|
||||
}
|
||||
|
||||
step = tickIncrement(start, stop, count);
|
||||
|
||||
if (step > 0) {
|
||||
start = Math.floor(start / step) * step;
|
||||
stop = Math.ceil(stop / step) * step;
|
||||
step = tickIncrement(start, stop, count);
|
||||
} else if (step < 0) {
|
||||
start = Math.ceil(start * step) / step;
|
||||
stop = Math.floor(stop * step) / step;
|
||||
step = tickIncrement(start, stop, count);
|
||||
}
|
||||
|
||||
if (step > 0) {
|
||||
d[i0] = Math.floor(start / step) * step;
|
||||
d[i1] = Math.ceil(stop / step) * step;
|
||||
domain(d);
|
||||
} else if (step < 0) {
|
||||
d[i0] = Math.ceil(start * step) / step;
|
||||
d[i1] = Math.floor(stop * step) / step;
|
||||
domain(d);
|
||||
}
|
||||
|
||||
return scale;
|
||||
};
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
export default function linear() {
|
||||
var scale = continuous(identity, identity);
|
||||
|
||||
scale.copy = function() {
|
||||
return copy(scale, linear());
|
||||
};
|
||||
|
||||
initRange.apply(scale, arguments);
|
||||
|
||||
return linearish(scale);
|
||||
}
|
||||
145
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/log.js
generated
vendored
Normal file
145
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/log.js
generated
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
import {ticks} from "d3-array";
|
||||
import {format} from "d3-format";
|
||||
import nice from "./nice";
|
||||
import {copy, transformer} from "./continuous";
|
||||
import {initRange} from "./init";
|
||||
|
||||
function transformLog(x) {
|
||||
return Math.log(x);
|
||||
}
|
||||
|
||||
function transformExp(x) {
|
||||
return Math.exp(x);
|
||||
}
|
||||
|
||||
function transformLogn(x) {
|
||||
return -Math.log(-x);
|
||||
}
|
||||
|
||||
function transformExpn(x) {
|
||||
return -Math.exp(-x);
|
||||
}
|
||||
|
||||
function pow10(x) {
|
||||
return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x;
|
||||
}
|
||||
|
||||
function powp(base) {
|
||||
return base === 10 ? pow10
|
||||
: base === Math.E ? Math.exp
|
||||
: function(x) { return Math.pow(base, x); };
|
||||
}
|
||||
|
||||
function logp(base) {
|
||||
return base === Math.E ? Math.log
|
||||
: base === 10 && Math.log10
|
||||
|| base === 2 && Math.log2
|
||||
|| (base = Math.log(base), function(x) { return Math.log(x) / base; });
|
||||
}
|
||||
|
||||
function reflect(f) {
|
||||
return function(x) {
|
||||
return -f(-x);
|
||||
};
|
||||
}
|
||||
|
||||
export function loggish(transform) {
|
||||
var scale = transform(transformLog, transformExp),
|
||||
domain = scale.domain,
|
||||
base = 10,
|
||||
logs,
|
||||
pows;
|
||||
|
||||
function rescale() {
|
||||
logs = logp(base), pows = powp(base);
|
||||
if (domain()[0] < 0) {
|
||||
logs = reflect(logs), pows = reflect(pows);
|
||||
transform(transformLogn, transformExpn);
|
||||
} else {
|
||||
transform(transformLog, transformExp);
|
||||
}
|
||||
return scale;
|
||||
}
|
||||
|
||||
scale.base = function(_) {
|
||||
return arguments.length ? (base = +_, rescale()) : base;
|
||||
};
|
||||
|
||||
scale.domain = function(_) {
|
||||
return arguments.length ? (domain(_), rescale()) : domain();
|
||||
};
|
||||
|
||||
scale.ticks = function(count) {
|
||||
var d = domain(),
|
||||
u = d[0],
|
||||
v = d[d.length - 1],
|
||||
r;
|
||||
|
||||
if (r = v < u) i = u, u = v, v = i;
|
||||
|
||||
var i = logs(u),
|
||||
j = logs(v),
|
||||
p,
|
||||
k,
|
||||
t,
|
||||
n = count == null ? 10 : +count,
|
||||
z = [];
|
||||
|
||||
if (!(base % 1) && j - i < n) {
|
||||
i = Math.round(i) - 1, j = Math.round(j) + 1;
|
||||
if (u > 0) for (; i < j; ++i) {
|
||||
for (k = 1, p = pows(i); k < base; ++k) {
|
||||
t = p * k;
|
||||
if (t < u) continue;
|
||||
if (t > v) break;
|
||||
z.push(t);
|
||||
}
|
||||
} else for (; i < j; ++i) {
|
||||
for (k = base - 1, p = pows(i); k >= 1; --k) {
|
||||
t = p * k;
|
||||
if (t < u) continue;
|
||||
if (t > v) break;
|
||||
z.push(t);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
z = ticks(i, j, Math.min(j - i, n)).map(pows);
|
||||
}
|
||||
|
||||
return r ? z.reverse() : z;
|
||||
};
|
||||
|
||||
scale.tickFormat = function(count, specifier) {
|
||||
if (specifier == null) specifier = base === 10 ? ".0e" : ",";
|
||||
if (typeof specifier !== "function") specifier = format(specifier);
|
||||
if (count === Infinity) return specifier;
|
||||
if (count == null) count = 10;
|
||||
var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?
|
||||
return function(d) {
|
||||
var i = d / pows(Math.round(logs(d)));
|
||||
if (i * base < base - 0.5) i *= base;
|
||||
return i <= k ? specifier(d) : "";
|
||||
};
|
||||
};
|
||||
|
||||
scale.nice = function() {
|
||||
return domain(nice(domain(), {
|
||||
floor: function(x) { return pows(Math.floor(logs(x))); },
|
||||
ceil: function(x) { return pows(Math.ceil(logs(x))); }
|
||||
}));
|
||||
};
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
export default function log() {
|
||||
var scale = loggish(transformer()).domain([1, 10]);
|
||||
|
||||
scale.copy = function() {
|
||||
return copy(scale, log()).base(scale.base());
|
||||
};
|
||||
|
||||
initRange.apply(scale, arguments);
|
||||
|
||||
return scale;
|
||||
}
|
||||
18
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/nice.js
generated
vendored
Normal file
18
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/nice.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
export default function(domain, interval) {
|
||||
domain = domain.slice();
|
||||
|
||||
var i0 = 0,
|
||||
i1 = domain.length - 1,
|
||||
x0 = domain[i0],
|
||||
x1 = domain[i1],
|
||||
t;
|
||||
|
||||
if (x1 < x0) {
|
||||
t = i0, i0 = i1, i1 = t;
|
||||
t = x0, x0 = x1, x1 = t;
|
||||
}
|
||||
|
||||
domain[i0] = interval.floor(x0);
|
||||
domain[i1] = interval.ceil(x1);
|
||||
return domain;
|
||||
}
|
||||
3
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/number.js
generated
vendored
Normal file
3
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/number.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function(x) {
|
||||
return +x;
|
||||
}
|
||||
45
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/ordinal.js
generated
vendored
Normal file
45
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/ordinal.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import {map} from "d3-collection";
|
||||
import {slice} from "./array";
|
||||
import {initRange} from "./init";
|
||||
|
||||
export var implicit = {name: "implicit"};
|
||||
|
||||
export default function ordinal() {
|
||||
var index = map(),
|
||||
domain = [],
|
||||
range = [],
|
||||
unknown = implicit;
|
||||
|
||||
function scale(d) {
|
||||
var key = d + "", i = index.get(key);
|
||||
if (!i) {
|
||||
if (unknown !== implicit) return unknown;
|
||||
index.set(key, i = domain.push(d));
|
||||
}
|
||||
return range[(i - 1) % range.length];
|
||||
}
|
||||
|
||||
scale.domain = function(_) {
|
||||
if (!arguments.length) return domain.slice();
|
||||
domain = [], index = map();
|
||||
var i = -1, n = _.length, d, key;
|
||||
while (++i < n) if (!index.has(key = (d = _[i]) + "")) index.set(key, domain.push(d));
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.range = function(_) {
|
||||
return arguments.length ? (range = slice.call(_), scale) : range.slice();
|
||||
};
|
||||
|
||||
scale.unknown = function(_) {
|
||||
return arguments.length ? (unknown = _, scale) : unknown;
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return ordinal(domain, range).unknown(unknown);
|
||||
};
|
||||
|
||||
initRange.apply(scale, arguments);
|
||||
|
||||
return scale;
|
||||
}
|
||||
50
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/pow.js
generated
vendored
Normal file
50
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/pow.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
import {linearish} from "./linear";
|
||||
import {copy, identity, transformer} from "./continuous";
|
||||
import {initRange} from "./init";
|
||||
|
||||
function transformPow(exponent) {
|
||||
return function(x) {
|
||||
return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
|
||||
};
|
||||
}
|
||||
|
||||
function transformSqrt(x) {
|
||||
return x < 0 ? -Math.sqrt(-x) : Math.sqrt(x);
|
||||
}
|
||||
|
||||
function transformSquare(x) {
|
||||
return x < 0 ? -x * x : x * x;
|
||||
}
|
||||
|
||||
export function powish(transform) {
|
||||
var scale = transform(identity, identity),
|
||||
exponent = 1;
|
||||
|
||||
function rescale() {
|
||||
return exponent === 1 ? transform(identity, identity)
|
||||
: exponent === 0.5 ? transform(transformSqrt, transformSquare)
|
||||
: transform(transformPow(exponent), transformPow(1 / exponent));
|
||||
}
|
||||
|
||||
scale.exponent = function(_) {
|
||||
return arguments.length ? (exponent = +_, rescale()) : exponent;
|
||||
};
|
||||
|
||||
return linearish(scale);
|
||||
}
|
||||
|
||||
export default function pow() {
|
||||
var scale = powish(transformer());
|
||||
|
||||
scale.copy = function() {
|
||||
return copy(scale, pow()).exponent(scale.exponent());
|
||||
};
|
||||
|
||||
initRange.apply(scale, arguments);
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
export function sqrt() {
|
||||
return pow.apply(null, arguments).exponent(0.5);
|
||||
}
|
||||
58
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/quantile.js
generated
vendored
Normal file
58
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/quantile.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
import {ascending, bisect, quantile as threshold} from "d3-array";
|
||||
import {slice} from "./array";
|
||||
import {initRange} from "./init";
|
||||
|
||||
export default function quantile() {
|
||||
var domain = [],
|
||||
range = [],
|
||||
thresholds = [],
|
||||
unknown;
|
||||
|
||||
function rescale() {
|
||||
var i = 0, n = Math.max(1, range.length);
|
||||
thresholds = new Array(n - 1);
|
||||
while (++i < n) thresholds[i - 1] = threshold(domain, i / n);
|
||||
return scale;
|
||||
}
|
||||
|
||||
function scale(x) {
|
||||
return isNaN(x = +x) ? unknown : range[bisect(thresholds, x)];
|
||||
}
|
||||
|
||||
scale.invertExtent = function(y) {
|
||||
var i = range.indexOf(y);
|
||||
return i < 0 ? [NaN, NaN] : [
|
||||
i > 0 ? thresholds[i - 1] : domain[0],
|
||||
i < thresholds.length ? thresholds[i] : domain[domain.length - 1]
|
||||
];
|
||||
};
|
||||
|
||||
scale.domain = function(_) {
|
||||
if (!arguments.length) return domain.slice();
|
||||
domain = [];
|
||||
for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d);
|
||||
domain.sort(ascending);
|
||||
return rescale();
|
||||
};
|
||||
|
||||
scale.range = function(_) {
|
||||
return arguments.length ? (range = slice.call(_), rescale()) : range.slice();
|
||||
};
|
||||
|
||||
scale.unknown = function(_) {
|
||||
return arguments.length ? (unknown = _, scale) : unknown;
|
||||
};
|
||||
|
||||
scale.quantiles = function() {
|
||||
return thresholds.slice();
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return quantile()
|
||||
.domain(domain)
|
||||
.range(range)
|
||||
.unknown(unknown);
|
||||
};
|
||||
|
||||
return initRange.apply(scale, arguments);
|
||||
}
|
||||
57
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/quantize.js
generated
vendored
Normal file
57
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/quantize.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
import {bisect} from "d3-array";
|
||||
import {slice} from "./array";
|
||||
import {linearish} from "./linear";
|
||||
import {initRange} from "./init";
|
||||
|
||||
export default function quantize() {
|
||||
var x0 = 0,
|
||||
x1 = 1,
|
||||
n = 1,
|
||||
domain = [0.5],
|
||||
range = [0, 1],
|
||||
unknown;
|
||||
|
||||
function scale(x) {
|
||||
return x <= x ? range[bisect(domain, x, 0, n)] : unknown;
|
||||
}
|
||||
|
||||
function rescale() {
|
||||
var i = -1;
|
||||
domain = new Array(n);
|
||||
while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
|
||||
return scale;
|
||||
}
|
||||
|
||||
scale.domain = function(_) {
|
||||
return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [x0, x1];
|
||||
};
|
||||
|
||||
scale.range = function(_) {
|
||||
return arguments.length ? (n = (range = slice.call(_)).length - 1, rescale()) : range.slice();
|
||||
};
|
||||
|
||||
scale.invertExtent = function(y) {
|
||||
var i = range.indexOf(y);
|
||||
return i < 0 ? [NaN, NaN]
|
||||
: i < 1 ? [x0, domain[0]]
|
||||
: i >= n ? [domain[n - 1], x1]
|
||||
: [domain[i - 1], domain[i]];
|
||||
};
|
||||
|
||||
scale.unknown = function(_) {
|
||||
return arguments.length ? (unknown = _, scale) : scale;
|
||||
};
|
||||
|
||||
scale.thresholds = function() {
|
||||
return domain.slice();
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return quantize()
|
||||
.domain([x0, x1])
|
||||
.range(range)
|
||||
.unknown(unknown);
|
||||
};
|
||||
|
||||
return initRange.apply(linearish(scale), arguments);
|
||||
}
|
||||
95
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/sequential.js
generated
vendored
Normal file
95
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/sequential.js
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
import {identity} from "./continuous";
|
||||
import {initInterpolator} from "./init";
|
||||
import {linearish} from "./linear";
|
||||
import {loggish} from "./log";
|
||||
import {symlogish} from "./symlog";
|
||||
import {powish} from "./pow";
|
||||
|
||||
function transformer() {
|
||||
var x0 = 0,
|
||||
x1 = 1,
|
||||
t0,
|
||||
t1,
|
||||
k10,
|
||||
transform,
|
||||
interpolator = identity,
|
||||
clamp = false,
|
||||
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));
|
||||
}
|
||||
|
||||
scale.domain = function(_) {
|
||||
return arguments.length ? (t0 = transform(x0 = +_[0]), t1 = transform(x1 = +_[1]), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1];
|
||||
};
|
||||
|
||||
scale.clamp = function(_) {
|
||||
return arguments.length ? (clamp = !!_, scale) : clamp;
|
||||
};
|
||||
|
||||
scale.interpolator = function(_) {
|
||||
return arguments.length ? (interpolator = _, scale) : interpolator;
|
||||
};
|
||||
|
||||
scale.unknown = function(_) {
|
||||
return arguments.length ? (unknown = _, scale) : unknown;
|
||||
};
|
||||
|
||||
return function(t) {
|
||||
transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0);
|
||||
return scale;
|
||||
};
|
||||
}
|
||||
|
||||
export function copy(source, target) {
|
||||
return target
|
||||
.domain(source.domain())
|
||||
.interpolator(source.interpolator())
|
||||
.clamp(source.clamp())
|
||||
.unknown(source.unknown());
|
||||
}
|
||||
|
||||
export default function sequential() {
|
||||
var scale = linearish(transformer()(identity));
|
||||
|
||||
scale.copy = function() {
|
||||
return copy(scale, sequential());
|
||||
};
|
||||
|
||||
return initInterpolator.apply(scale, arguments);
|
||||
}
|
||||
|
||||
export function sequentialLog() {
|
||||
var scale = loggish(transformer()).domain([1, 10]);
|
||||
|
||||
scale.copy = function() {
|
||||
return copy(scale, sequentialLog()).base(scale.base());
|
||||
};
|
||||
|
||||
return initInterpolator.apply(scale, arguments);
|
||||
}
|
||||
|
||||
export function sequentialSymlog() {
|
||||
var scale = symlogish(transformer());
|
||||
|
||||
scale.copy = function() {
|
||||
return copy(scale, sequentialSymlog()).constant(scale.constant());
|
||||
};
|
||||
|
||||
return initInterpolator.apply(scale, arguments);
|
||||
}
|
||||
|
||||
export function sequentialPow() {
|
||||
var scale = powish(transformer());
|
||||
|
||||
scale.copy = function() {
|
||||
return copy(scale, sequentialPow()).exponent(scale.exponent());
|
||||
};
|
||||
|
||||
return initInterpolator.apply(scale, arguments);
|
||||
}
|
||||
|
||||
export function sequentialSqrt() {
|
||||
return sequentialPow.apply(null, arguments).exponent(0.5);
|
||||
}
|
||||
30
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/sequentialQuantile.js
generated
vendored
Normal file
30
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/sequentialQuantile.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import {ascending, bisect} from "d3-array";
|
||||
import {identity} from "./continuous";
|
||||
import {initInterpolator} from "./init";
|
||||
|
||||
export default function sequentialQuantile() {
|
||||
var domain = [],
|
||||
interpolator = identity;
|
||||
|
||||
function scale(x) {
|
||||
if (!isNaN(x = +x)) return interpolator((bisect(domain, x) - 1) / (domain.length - 1));
|
||||
}
|
||||
|
||||
scale.domain = function(_) {
|
||||
if (!arguments.length) return domain.slice();
|
||||
domain = [];
|
||||
for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d);
|
||||
domain.sort(ascending);
|
||||
return scale;
|
||||
};
|
||||
|
||||
scale.interpolator = function(_) {
|
||||
return arguments.length ? (interpolator = _, scale) : interpolator;
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return sequentialQuantile(interpolator).domain(domain);
|
||||
};
|
||||
|
||||
return initInterpolator.apply(scale, arguments);
|
||||
}
|
||||
35
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/symlog.js
generated
vendored
Normal file
35
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/symlog.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import {linearish} from "./linear";
|
||||
import {copy, transformer} from "./continuous";
|
||||
import {initRange} from "./init";
|
||||
|
||||
function transformSymlog(c) {
|
||||
return function(x) {
|
||||
return Math.sign(x) * Math.log1p(Math.abs(x / c));
|
||||
};
|
||||
}
|
||||
|
||||
function transformSymexp(c) {
|
||||
return function(x) {
|
||||
return Math.sign(x) * Math.expm1(Math.abs(x)) * c;
|
||||
};
|
||||
}
|
||||
|
||||
export function symlogish(transform) {
|
||||
var c = 1, scale = transform(transformSymlog(c), transformSymexp(c));
|
||||
|
||||
scale.constant = function(_) {
|
||||
return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c;
|
||||
};
|
||||
|
||||
return linearish(scale);
|
||||
}
|
||||
|
||||
export default function symlog() {
|
||||
var scale = symlogish(transformer());
|
||||
|
||||
scale.copy = function() {
|
||||
return copy(scale, symlog()).constant(scale.constant());
|
||||
};
|
||||
|
||||
return initRange.apply(scale, arguments);
|
||||
}
|
||||
40
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/threshold.js
generated
vendored
Normal file
40
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/threshold.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import {bisect} from "d3-array";
|
||||
import {slice} from "./array";
|
||||
import {initRange} from "./init";
|
||||
|
||||
export default function threshold() {
|
||||
var domain = [0.5],
|
||||
range = [0, 1],
|
||||
unknown,
|
||||
n = 1;
|
||||
|
||||
function scale(x) {
|
||||
return x <= x ? range[bisect(domain, x, 0, n)] : unknown;
|
||||
}
|
||||
|
||||
scale.domain = function(_) {
|
||||
return arguments.length ? (domain = slice.call(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();
|
||||
};
|
||||
|
||||
scale.range = function(_) {
|
||||
return arguments.length ? (range = slice.call(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();
|
||||
};
|
||||
|
||||
scale.invertExtent = function(y) {
|
||||
var i = range.indexOf(y);
|
||||
return [domain[i - 1], domain[i]];
|
||||
};
|
||||
|
||||
scale.unknown = function(_) {
|
||||
return arguments.length ? (unknown = _, scale) : unknown;
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return threshold()
|
||||
.domain(domain)
|
||||
.range(range)
|
||||
.unknown(unknown);
|
||||
};
|
||||
|
||||
return initRange.apply(scale, arguments);
|
||||
}
|
||||
29
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/tickFormat.js
generated
vendored
Normal file
29
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/tickFormat.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
import {tickStep} from "d3-array";
|
||||
import {format, formatPrefix, formatSpecifier, precisionFixed, precisionPrefix, precisionRound} from "d3-format";
|
||||
|
||||
export default function(start, stop, count, specifier) {
|
||||
var step = tickStep(start, stop, count),
|
||||
precision;
|
||||
specifier = formatSpecifier(specifier == null ? ",f" : specifier);
|
||||
switch (specifier.type) {
|
||||
case "s": {
|
||||
var value = Math.max(Math.abs(start), Math.abs(stop));
|
||||
if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision;
|
||||
return formatPrefix(specifier, value);
|
||||
}
|
||||
case "":
|
||||
case "e":
|
||||
case "g":
|
||||
case "p":
|
||||
case "r": {
|
||||
if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e");
|
||||
break;
|
||||
}
|
||||
case "f":
|
||||
case "%": {
|
||||
if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return format(specifier);
|
||||
}
|
||||
135
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/time.js
generated
vendored
Normal file
135
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/time.js
generated
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
import {bisector, tickStep} from "d3-array";
|
||||
import {timeYear, timeMonth, timeWeek, timeDay, timeHour, timeMinute, timeSecond, timeMillisecond} from "d3-time";
|
||||
import {timeFormat} from "d3-time-format";
|
||||
import {map} from "./array";
|
||||
import continuous, {copy, identity} from "./continuous";
|
||||
import {initRange} from "./init";
|
||||
import nice from "./nice";
|
||||
|
||||
var durationSecond = 1000,
|
||||
durationMinute = durationSecond * 60,
|
||||
durationHour = durationMinute * 60,
|
||||
durationDay = durationHour * 24,
|
||||
durationWeek = durationDay * 7,
|
||||
durationMonth = durationDay * 30,
|
||||
durationYear = durationDay * 365;
|
||||
|
||||
function date(t) {
|
||||
return new Date(t);
|
||||
}
|
||||
|
||||
function number(t) {
|
||||
return t instanceof Date ? +t : +new Date(+t);
|
||||
}
|
||||
|
||||
export function calendar(year, month, week, day, hour, minute, second, millisecond, format) {
|
||||
var scale = continuous(identity, identity),
|
||||
invert = scale.invert,
|
||||
domain = scale.domain;
|
||||
|
||||
var formatMillisecond = format(".%L"),
|
||||
formatSecond = format(":%S"),
|
||||
formatMinute = format("%I:%M"),
|
||||
formatHour = format("%I %p"),
|
||||
formatDay = format("%a %d"),
|
||||
formatWeek = format("%b %d"),
|
||||
formatMonth = format("%B"),
|
||||
formatYear = format("%Y");
|
||||
|
||||
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) {
|
||||
return (second(date) < date ? formatMillisecond
|
||||
: minute(date) < date ? formatSecond
|
||||
: hour(date) < date ? formatMinute
|
||||
: day(date) < date ? formatHour
|
||||
: month(date) < date ? (week(date) < date ? formatDay : formatWeek)
|
||||
: year(date) < date ? formatMonth
|
||||
: formatYear)(date);
|
||||
}
|
||||
|
||||
function tickInterval(interval, start, stop, step) {
|
||||
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);
|
||||
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 step == null ? interval : interval.every(step);
|
||||
}
|
||||
|
||||
scale.invert = function(y) {
|
||||
return new Date(invert(y));
|
||||
};
|
||||
|
||||
scale.domain = function(_) {
|
||||
return arguments.length ? domain(map.call(_, number)) : domain().map(date);
|
||||
};
|
||||
|
||||
scale.ticks = function(interval, step) {
|
||||
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, step);
|
||||
t = t ? t.range(t0, t1 + 1) : []; // inclusive stop
|
||||
return r ? t.reverse() : t;
|
||||
};
|
||||
|
||||
scale.tickFormat = function(count, specifier) {
|
||||
return specifier == null ? tickFormat : format(specifier);
|
||||
};
|
||||
|
||||
scale.nice = function(interval, step) {
|
||||
var d = domain();
|
||||
return (interval = tickInterval(interval, d[0], d[d.length - 1], step))
|
||||
? domain(nice(d, interval))
|
||||
: scale;
|
||||
};
|
||||
|
||||
scale.copy = function() {
|
||||
return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format));
|
||||
};
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
8
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/utcTime.js
generated
vendored
Normal file
8
lisp/emacs-application-framework/app/mermaid/node_modules/d3-scale/src/utcTime.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import {calendar} from "./time";
|
||||
import {utcFormat} from "d3-time-format";
|
||||
import {utcYear, utcMonth, utcWeek, utcDay, utcHour, utcMinute, utcSecond, utcMillisecond} from "d3-time";
|
||||
import {initRange} from "./init";
|
||||
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user