@plotdb/chart 3.5.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/bundle.css +59 -0
- package/bundle.js +5644 -0
- package/bundle.min.css +1 -0
- package/bundle.min.js +1 -0
- package/index.js +32 -10
- package/index.min.js +1 -1
- package/package.json +1 -1
- package/utils/anim.js +483 -0
- package/utils/anim.min.js +1 -0
- package/utils/brush.js +306 -0
- package/utils/brush.min.js +1 -0
- package/utils/color.js +37 -0
- package/utils/color.min.js +1 -0
- package/utils/debounce.js +86 -0
- package/utils/debounce.min.js +1 -0
- package/utils/format.js +266 -5
- package/utils/format.min.js +1 -1
- package/utils/scale.js +434 -0
- package/utils/scale.min.js +1 -0
- package/utils/shape.js +799 -0
- package/utils/shape.min.js +1 -0
package/utils/scale.js
ADDED
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
(function(){
|
|
2
|
+
var e10, e5, e2, tickSpec, ticks, identity, interpNumber, interpValue, normalize, bisectRight, piecewise, continuous, linear, transformPow, transformSqrt, transformSquare, pow, sqrt, symlog, band, point, pointish, scale;
|
|
3
|
+
e10 = Math.sqrt(50);
|
|
4
|
+
e5 = Math.sqrt(10);
|
|
5
|
+
e2 = Math.sqrt(2);
|
|
6
|
+
tickSpec = function(start, stop, count){
|
|
7
|
+
var step, power, error, factor, inc, i1, i2;
|
|
8
|
+
step = (stop - start) / Math.max(0, count);
|
|
9
|
+
power = Math.floor(Math.log10(step));
|
|
10
|
+
error = step / Math.pow(10, power);
|
|
11
|
+
factor = error >= e10
|
|
12
|
+
? 10
|
|
13
|
+
: error >= e5
|
|
14
|
+
? 5
|
|
15
|
+
: error >= e2 ? 2 : 1;
|
|
16
|
+
if (power < 0) {
|
|
17
|
+
inc = Math.pow(10, -power) / factor;
|
|
18
|
+
i1 = Math.round(start * inc);
|
|
19
|
+
i2 = Math.round(stop * inc);
|
|
20
|
+
if (i1 / inc < start) {
|
|
21
|
+
i1++;
|
|
22
|
+
}
|
|
23
|
+
if (i2 / inc > stop) {
|
|
24
|
+
i2--;
|
|
25
|
+
}
|
|
26
|
+
inc = -inc;
|
|
27
|
+
} else {
|
|
28
|
+
inc = Math.pow(10, power) * factor;
|
|
29
|
+
i1 = Math.round(start / inc);
|
|
30
|
+
i2 = Math.round(stop / inc);
|
|
31
|
+
if (i1 * inc < start) {
|
|
32
|
+
i1++;
|
|
33
|
+
}
|
|
34
|
+
if (i2 * inc > stop) {
|
|
35
|
+
i2--;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (i2 < i1 && 0.5 <= count && count < 2) {
|
|
39
|
+
return tickSpec(start, stop, count * 2);
|
|
40
|
+
}
|
|
41
|
+
return [i1, i2, inc];
|
|
42
|
+
};
|
|
43
|
+
ticks = function(start, stop, count){
|
|
44
|
+
var ref$, reverse, i1, i2, inc, n, i$, i, k, results$ = [];
|
|
45
|
+
ref$ = [+start, +stop, +count], start = ref$[0], stop = ref$[1], count = ref$[2];
|
|
46
|
+
if (!(count > 0)) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
if (start === stop) {
|
|
50
|
+
return [start];
|
|
51
|
+
}
|
|
52
|
+
reverse = stop < start;
|
|
53
|
+
ref$ = reverse
|
|
54
|
+
? tickSpec(stop, start, count)
|
|
55
|
+
: tickSpec(start, stop, count), i1 = ref$[0], i2 = ref$[1], inc = ref$[2];
|
|
56
|
+
if (!(i2 >= i1)) {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
n = i2 - i1 + 1;
|
|
60
|
+
for (i$ = 0; i$ < n; ++i$) {
|
|
61
|
+
i = i$;
|
|
62
|
+
k = reverse
|
|
63
|
+
? i2 - i
|
|
64
|
+
: i1 + i;
|
|
65
|
+
if (inc < 0) {
|
|
66
|
+
results$.push(k / -inc);
|
|
67
|
+
} else {
|
|
68
|
+
results$.push(k * inc);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return results$;
|
|
72
|
+
};
|
|
73
|
+
identity = function(x){
|
|
74
|
+
return x;
|
|
75
|
+
};
|
|
76
|
+
interpNumber = function(a, b){
|
|
77
|
+
var ref$;
|
|
78
|
+
ref$ = [+a, +b], a = ref$[0], b = ref$[1];
|
|
79
|
+
return function(t){
|
|
80
|
+
return a * (1 - t) + b * t;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
interpValue = function(a, b){
|
|
84
|
+
if (typeof b === 'number') {
|
|
85
|
+
return interpNumber(a, b);
|
|
86
|
+
}
|
|
87
|
+
if (!((typeof chart != 'undefined' && chart !== null) && chart.utils && chart.utils.anim)) {
|
|
88
|
+
return function(){
|
|
89
|
+
return b;
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return chart.utils.anim.interpolate(a, b);
|
|
93
|
+
};
|
|
94
|
+
normalize = function(a, b){
|
|
95
|
+
a = +a;
|
|
96
|
+
b = b - a;
|
|
97
|
+
if (b) {
|
|
98
|
+
return function(x){
|
|
99
|
+
return (x - a) / b;
|
|
100
|
+
};
|
|
101
|
+
} else {
|
|
102
|
+
if (isNaN(b)) {
|
|
103
|
+
return function(){
|
|
104
|
+
return NaN;
|
|
105
|
+
};
|
|
106
|
+
} else {
|
|
107
|
+
return function(){
|
|
108
|
+
return 0.5;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
bisectRight = function(a, x, lo, hi){
|
|
114
|
+
var mid;
|
|
115
|
+
while (lo < hi) {
|
|
116
|
+
mid = lo + hi >>> 1;
|
|
117
|
+
if (x < a[mid]) {
|
|
118
|
+
hi = mid;
|
|
119
|
+
} else {
|
|
120
|
+
lo = mid + 1;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return lo;
|
|
124
|
+
};
|
|
125
|
+
piecewise = function(dm, rg, ip){
|
|
126
|
+
var j, ref$, d0, d1, r0, r1, n, i, ns, res$, i$, ips;
|
|
127
|
+
j = Math.min(dm.length, rg.length) - 1;
|
|
128
|
+
if (j <= 1) {
|
|
129
|
+
ref$ = [dm[0], dm[1], rg[0], rg[1]], d0 = ref$[0], d1 = ref$[1], r0 = ref$[2], r1 = ref$[3];
|
|
130
|
+
ref$ = d1 < d0
|
|
131
|
+
? [normalize(d1, d0), ip(r1, r0)]
|
|
132
|
+
: [normalize(d0, d1), ip(r0, r1)], n = ref$[0], i = ref$[1];
|
|
133
|
+
return function(x){
|
|
134
|
+
return i(n(x));
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
if (dm[j] < dm[0]) {
|
|
138
|
+
dm = dm.slice().reverse();
|
|
139
|
+
rg = rg.slice().reverse();
|
|
140
|
+
}
|
|
141
|
+
res$ = [];
|
|
142
|
+
for (i$ = 0; i$ < j; ++i$) {
|
|
143
|
+
i = i$;
|
|
144
|
+
res$.push(normalize(dm[i], dm[i + 1]));
|
|
145
|
+
}
|
|
146
|
+
ns = res$;
|
|
147
|
+
res$ = [];
|
|
148
|
+
for (i$ = 0; i$ < j; ++i$) {
|
|
149
|
+
i = i$;
|
|
150
|
+
res$.push(ip(rg[i], rg[i + 1]));
|
|
151
|
+
}
|
|
152
|
+
ips = res$;
|
|
153
|
+
return function(x){
|
|
154
|
+
var i;
|
|
155
|
+
i = bisectRight(dm, x, 1, j) - 1;
|
|
156
|
+
return ips[i](ns[i](x));
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
continuous = function(tf, utf){
|
|
160
|
+
var ref$, dm, rg, clamp, out, inp, clamper, rescale, s;
|
|
161
|
+
tf == null && (tf = identity);
|
|
162
|
+
utf == null && (utf = identity);
|
|
163
|
+
ref$ = [[0, 1], [0, 1], false], dm = ref$[0], rg = ref$[1], clamp = ref$[2];
|
|
164
|
+
ref$ = [null, null], out = ref$[0], inp = ref$[1];
|
|
165
|
+
clamper = function(x){
|
|
166
|
+
var ref$, a, b;
|
|
167
|
+
if (!clamp) {
|
|
168
|
+
return x;
|
|
169
|
+
}
|
|
170
|
+
ref$ = [dm[0], dm[Math.min(dm.length, rg.length) - 1]], a = ref$[0], b = ref$[1];
|
|
171
|
+
if (a > b) {
|
|
172
|
+
ref$ = [b, a], a = ref$[0], b = ref$[1];
|
|
173
|
+
}
|
|
174
|
+
return Math.max(a, Math.min(b, x));
|
|
175
|
+
};
|
|
176
|
+
rescale = function(){
|
|
177
|
+
out = null;
|
|
178
|
+
inp = null;
|
|
179
|
+
return s;
|
|
180
|
+
};
|
|
181
|
+
s = function(x){
|
|
182
|
+
if (!(x != null) || isNaN(x = +x)) {
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
if (!out) {
|
|
186
|
+
out = piecewise(dm.map(tf), rg, interpValue);
|
|
187
|
+
}
|
|
188
|
+
return out(tf(clamper(x)));
|
|
189
|
+
};
|
|
190
|
+
s.invert = function(y){
|
|
191
|
+
if (!inp) {
|
|
192
|
+
inp = piecewise(rg, dm.map(tf), interpNumber);
|
|
193
|
+
}
|
|
194
|
+
return clamper(utf(inp(y)));
|
|
195
|
+
};
|
|
196
|
+
s.domain = function(it){
|
|
197
|
+
if (!arguments.length) {
|
|
198
|
+
return dm.slice();
|
|
199
|
+
}
|
|
200
|
+
dm = Array.from(it, function(v){
|
|
201
|
+
return +v;
|
|
202
|
+
});
|
|
203
|
+
return rescale();
|
|
204
|
+
};
|
|
205
|
+
s.range = function(it){
|
|
206
|
+
if (!arguments.length) {
|
|
207
|
+
return rg.slice();
|
|
208
|
+
}
|
|
209
|
+
rg = Array.from(it);
|
|
210
|
+
return rescale();
|
|
211
|
+
};
|
|
212
|
+
s.clamp = function(it){
|
|
213
|
+
if (!arguments.length) {
|
|
214
|
+
return clamp;
|
|
215
|
+
}
|
|
216
|
+
clamp = !!it;
|
|
217
|
+
return rescale();
|
|
218
|
+
};
|
|
219
|
+
s.ticks = function(count){
|
|
220
|
+
count == null && (count = 10);
|
|
221
|
+
return ticks(dm[0], dm[dm.length - 1], count);
|
|
222
|
+
};
|
|
223
|
+
s._transform = function(t, u){
|
|
224
|
+
tf = t;
|
|
225
|
+
utf = u;
|
|
226
|
+
return rescale();
|
|
227
|
+
};
|
|
228
|
+
s._copy = function(c){
|
|
229
|
+
return c.domain(dm).range(rg).clamp(clamp);
|
|
230
|
+
};
|
|
231
|
+
s.copy = function(){
|
|
232
|
+
return s._copy(continuous(tf, utf));
|
|
233
|
+
};
|
|
234
|
+
return s;
|
|
235
|
+
};
|
|
236
|
+
linear = function(){
|
|
237
|
+
return continuous();
|
|
238
|
+
};
|
|
239
|
+
transformPow = function(e){
|
|
240
|
+
return function(x){
|
|
241
|
+
if (x < 0) {
|
|
242
|
+
return -Math.pow(-x, e);
|
|
243
|
+
} else {
|
|
244
|
+
return Math.pow(x, e);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
transformSqrt = function(x){
|
|
249
|
+
if (x < 0) {
|
|
250
|
+
return -Math.sqrt(-x);
|
|
251
|
+
} else {
|
|
252
|
+
return Math.sqrt(x);
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
transformSquare = function(x){
|
|
256
|
+
if (x < 0) {
|
|
257
|
+
return -x * x;
|
|
258
|
+
} else {
|
|
259
|
+
return x * x;
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
pow = function(){
|
|
263
|
+
var s, e, update;
|
|
264
|
+
s = continuous();
|
|
265
|
+
e = 1;
|
|
266
|
+
update = function(){
|
|
267
|
+
if (e === 1) {
|
|
268
|
+
return s._transform(identity, identity);
|
|
269
|
+
} else if (e === 0.5) {
|
|
270
|
+
return s._transform(transformSqrt, transformSquare);
|
|
271
|
+
} else {
|
|
272
|
+
return s._transform(transformPow(e), transformPow(1 / e));
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
s.exponent = function(it){
|
|
276
|
+
if (!arguments.length) {
|
|
277
|
+
return e;
|
|
278
|
+
}
|
|
279
|
+
e = +it;
|
|
280
|
+
return update();
|
|
281
|
+
};
|
|
282
|
+
s.copy = function(){
|
|
283
|
+
return s._copy(pow().exponent(e));
|
|
284
|
+
};
|
|
285
|
+
return s;
|
|
286
|
+
};
|
|
287
|
+
sqrt = function(){
|
|
288
|
+
return pow().exponent(0.5);
|
|
289
|
+
};
|
|
290
|
+
symlog = function(){
|
|
291
|
+
var s, c, update;
|
|
292
|
+
s = continuous();
|
|
293
|
+
c = 1;
|
|
294
|
+
update = function(){
|
|
295
|
+
return s._transform(function(x){
|
|
296
|
+
return Math.sign(x) * Math.log1p(Math.abs(x / c));
|
|
297
|
+
}, function(x){
|
|
298
|
+
return Math.sign(x) * Math.expm1(Math.abs(x)) * c;
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
s.constant = function(it){
|
|
302
|
+
if (!arguments.length) {
|
|
303
|
+
return c;
|
|
304
|
+
}
|
|
305
|
+
c = +it;
|
|
306
|
+
return update();
|
|
307
|
+
};
|
|
308
|
+
s.copy = function(){
|
|
309
|
+
return s._copy(symlog().constant(c));
|
|
310
|
+
};
|
|
311
|
+
return update();
|
|
312
|
+
};
|
|
313
|
+
band = function(){
|
|
314
|
+
var ref$, dm, idx, r, pi, po, al, step, bw, vals, rescale, s;
|
|
315
|
+
ref$ = [[], new Map(), [0, 1], 0, 0, 0.5], dm = ref$[0], idx = ref$[1], r = ref$[2], pi = ref$[3], po = ref$[4], al = ref$[5];
|
|
316
|
+
ref$ = [0, 0, []], step = ref$[0], bw = ref$[1], vals = ref$[2];
|
|
317
|
+
rescale = function(){
|
|
318
|
+
var n, r0, r1, reverse, ref$, start, stop, res$, i$, i;
|
|
319
|
+
n = dm.length;
|
|
320
|
+
r0 = r[0], r1 = r[1];
|
|
321
|
+
reverse = r1 < r0;
|
|
322
|
+
ref$ = reverse
|
|
323
|
+
? [r1, r0]
|
|
324
|
+
: [r0, r1], start = ref$[0], stop = ref$[1];
|
|
325
|
+
step = (stop - start) / Math.max(1, n - pi + po * 2);
|
|
326
|
+
start = start + (stop - start - step * (n - pi)) * al;
|
|
327
|
+
bw = step * (1 - pi);
|
|
328
|
+
res$ = [];
|
|
329
|
+
for (i$ = 0; i$ < n; ++i$) {
|
|
330
|
+
i = i$;
|
|
331
|
+
res$.push(start + step * i);
|
|
332
|
+
}
|
|
333
|
+
vals = res$;
|
|
334
|
+
if (reverse) {
|
|
335
|
+
vals.reverse();
|
|
336
|
+
}
|
|
337
|
+
return s;
|
|
338
|
+
};
|
|
339
|
+
s = function(x){
|
|
340
|
+
if (idx.has(x)) {
|
|
341
|
+
return vals[idx.get(x)];
|
|
342
|
+
} else {
|
|
343
|
+
return undefined;
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
s.domain = function(it){
|
|
347
|
+
var ref$, i$, len$, v;
|
|
348
|
+
if (!arguments.length) {
|
|
349
|
+
return dm.slice();
|
|
350
|
+
}
|
|
351
|
+
ref$ = [[], new Map()], dm = ref$[0], idx = ref$[1];
|
|
352
|
+
for (i$ = 0, len$ = it.length; i$ < len$; ++i$) {
|
|
353
|
+
v = it[i$];
|
|
354
|
+
if (!idx.has(v)) {
|
|
355
|
+
idx.set(v, dm.push(v) - 1);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return rescale();
|
|
359
|
+
};
|
|
360
|
+
s.range = function(it){
|
|
361
|
+
if (!arguments.length) {
|
|
362
|
+
return r.slice();
|
|
363
|
+
}
|
|
364
|
+
r = Array.from(it, function(v){
|
|
365
|
+
return +v;
|
|
366
|
+
});
|
|
367
|
+
return rescale();
|
|
368
|
+
};
|
|
369
|
+
s.bandwidth = function(){
|
|
370
|
+
return bw;
|
|
371
|
+
};
|
|
372
|
+
s.step = function(){
|
|
373
|
+
return step;
|
|
374
|
+
};
|
|
375
|
+
s.paddingInner = function(it){
|
|
376
|
+
if (!arguments.length) {
|
|
377
|
+
return pi;
|
|
378
|
+
}
|
|
379
|
+
pi = Math.min(1, it);
|
|
380
|
+
return rescale();
|
|
381
|
+
};
|
|
382
|
+
s.paddingOuter = function(it){
|
|
383
|
+
if (!arguments.length) {
|
|
384
|
+
return po;
|
|
385
|
+
}
|
|
386
|
+
po = it;
|
|
387
|
+
return rescale();
|
|
388
|
+
};
|
|
389
|
+
s.padding = function(it){
|
|
390
|
+
if (!arguments.length) {
|
|
391
|
+
return pi;
|
|
392
|
+
}
|
|
393
|
+
pi = Math.min(1, po = it);
|
|
394
|
+
return rescale();
|
|
395
|
+
};
|
|
396
|
+
s.align = function(it){
|
|
397
|
+
if (!arguments.length) {
|
|
398
|
+
return al;
|
|
399
|
+
}
|
|
400
|
+
al = Math.max(0, Math.min(1, it));
|
|
401
|
+
return rescale();
|
|
402
|
+
};
|
|
403
|
+
s.copy = function(){
|
|
404
|
+
return band().domain(dm).range(r).paddingInner(pi).paddingOuter(po).align(al);
|
|
405
|
+
};
|
|
406
|
+
return rescale();
|
|
407
|
+
};
|
|
408
|
+
point = function(){
|
|
409
|
+
return pointish(band().paddingInner(1));
|
|
410
|
+
};
|
|
411
|
+
pointish = function(s){
|
|
412
|
+
var copy;
|
|
413
|
+
copy = s.copy;
|
|
414
|
+
s.padding = s.paddingOuter;
|
|
415
|
+
delete s.paddingInner;
|
|
416
|
+
delete s.paddingOuter;
|
|
417
|
+
s.copy = function(){
|
|
418
|
+
return pointish(copy());
|
|
419
|
+
};
|
|
420
|
+
return s;
|
|
421
|
+
};
|
|
422
|
+
scale = {
|
|
423
|
+
linear: linear,
|
|
424
|
+
pow: pow,
|
|
425
|
+
sqrt: sqrt,
|
|
426
|
+
symlog: symlog,
|
|
427
|
+
band: band,
|
|
428
|
+
point: point,
|
|
429
|
+
ticks: ticks
|
|
430
|
+
};
|
|
431
|
+
if (typeof chart != 'undefined' && chart !== null) {
|
|
432
|
+
(chart.utils || (chart.utils = {})).scale = scale;
|
|
433
|
+
}
|
|
434
|
+
}).call(this);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(){var c=Math.sqrt(50),f=Math.sqrt(10),h=Math.sqrt(2),p=function(n,t,r){var u,e,i,o=(t-n)/Math.max(0,r),a=Math.floor(Math.log10(o)),o=o/Math.pow(10,a),o=c<=o?10:f<=o?5:h<=o?2:1;return a<0?(u=Math.pow(10,-a)/o,(e=Math.round(n*u))/u<n&&e++,t<(i=Math.round(t*u))/u&&i--,u=-u):(u=Math.pow(10,a)*o,(e=Math.round(n/u))*u<n&&e++,t<(i=Math.round(t/u))*u&&i--),i<e&&.5<=r&&r<2?p(n,t,2*r):[e,i,u]},l=function(n,t,r){var u,e,i,o,a,c,f,h=[],l=[+n,+t,+r];if(!(0<(r=l[2])))return[];if((n=l[0])===(t=l[1]))return[n];if(e=(l=(u=t<n)?p(t,n,r):p(n,t,r))[0],o=l[2],!(e<=(i=l[1])))return[];for(a=i-e+1,c=0;c<a;++c)f=u?i-c:e+c,h.push(o<0?f/-o:f*o);return h},s=function(n){return n},g=function(t,r){var n=[+t,+r];return t=n[0],r=n[1],function(n){return t*(1-n)+r*n}},d=function(n,t){return"number"==typeof t?g(n,t):"undefined"!=typeof chart&&null!==chart&&chart.utils&&chart.utils.anim?chart.utils.anim.interpolate(n,t):function(){return t}},M=function(t,r){return(r-=t=+t)?function(n){return(n-t)/r}:isNaN(r)?function(){return NaN}:function(){return.5}},m=function(n,t,r,u){for(var e;r<u;)t<n[e=r+u>>>1]?u=e:r=1+e;return r},v=function(r,n,t){var u,e,i,o,a,c,f,h,l,p,s,g=Math.min(r.length,n.length)-1;if(g<=1)return o=(u=[r[0],r[1],n[0],n[1]])[2],a=u[3],u=(i=u[1])<(e=u[0])?[M(i,e),t(a,o)]:[M(e,i),t(o,a)],c=u[0],f=u[1],function(n){return f(c(n))};for(r[g]<r[0]&&(r=r.slice().reverse(),n=n.slice().reverse()),l=[],p=0;p<g;++p)f=p,l.push(M(r[f],r[f+1]));for(h=l,l=[],p=0;p<g;++p)f=p,l.push(t(n[f],n[f+1]));return s=l,function(n){var t=m(r,n,1,g)-1;return s[t](h[t](n))}},y=function(r,u){var n,e,i,o,t,a,c,f,h;return null==r&&(r=s),null==u&&(u=s),e=(n=[[0,1],[0,1],!1])[0],i=n[1],o=n[2],t=(n=[null,null])[0],a=n[1],c=function(n){var t,r,u;return o?((u=(t=[e[0],e[Math.min(e.length,i.length)-1]])[1])<(r=t[0])&&(r=(t=[u,r])[0],u=t[1]),Math.max(r,Math.min(u,n))):n},f=function(){return a=t=null,h},(h=function(n){if(null!=n&&!isNaN(n=+n))return(t=t||v(e.map(r),i,d))(r(c(n)))}).invert=function(n){return a=a||v(i,e.map(r),g),c(u(a(n)))},h.domain=function(n){return arguments.length?(e=Array.from(n,function(n){return+n}),f()):e.slice()},h.range=function(n){return arguments.length?(i=Array.from(n),f()):i.slice()},h.clamp=function(n){return arguments.length?(o=!!n,f()):o},h.ticks=function(n){return l(e[0],e[e.length-1],n=null==n?10:n)},h._transform=function(n,t){return r=n,u=t,f()},h._copy=function(n){return n.domain(e).range(i).clamp(o)},h.copy=function(){return h._copy(y(r,u))},h},u=function(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}},e=function(n){return n<0?-Math.sqrt(-n):Math.sqrt(n)},i=function(n){return n<0?-n*n:n*n},o=function(){var n=y(),t=1,r=function(){return 1===t?n._transform(s,s):.5===t?n._transform(e,i):n._transform(u(t),u(1/t))};return n.exponent=function(n){return arguments.length?(t=+n,r()):t},n.copy=function(){return n._copy(o().exponent(t))},n},a=function(){var n=y(),t=1,r=function(){return n._transform(function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))},function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t})};return n.constant=function(n){return arguments.length?(t=+n,r()):t},n.copy=function(){return n._copy(a().constant(t))},r()},t=function(){var c,n=[[],new Map,[0,1],0,0,.5],f=n[0],i=n[1],h=n[2],l=n[3],p=n[4],s=n[5],g=(n=[0,0,[]])[0],d=n[1],M=n[2],o=function(){var n,t,r,u=f.length,e=h[0],i=h[1],o=i<e,e=o?[i,e]:[e,i],a=e[0],i=e[1];for(a+=(i-a-(g=(i-a)/Math.max(1,u-l+2*p))*(u-l))*s,d=g*(1-l),n=[],t=0;t<u;++t)r=t,n.push(a+g*r);return M=n,o&&M.reverse(),c};return(c=function(n){if(i.has(n))return M[i.get(n)]}).domain=function(n){var t,r,u,e;if(!arguments.length)return f.slice();for(t=[[],new Map],f=t[0],i=t[1],r=0,u=n.length;r<u;++r)e=n[r],i.has(e)||i.set(e,f.push(e)-1);return o()},c.range=function(n){return arguments.length?(h=Array.from(n,function(n){return+n}),o()):h.slice()},c.bandwidth=function(){return d},c.step=function(){return g},c.paddingInner=function(n){return arguments.length?(l=Math.min(1,n),o()):l},c.paddingOuter=function(n){return arguments.length?(p=n,o()):p},c.padding=function(n){return arguments.length?(l=Math.min(1,p=n),o()):l},c.align=function(n){return arguments.length?(s=Math.max(0,Math.min(1,n)),o()):s},c.copy=function(){return t().domain(f).range(h).paddingInner(l).paddingOuter(p).align(s)},o()},r=function(n){var t=n.copy;return n.padding=n.paddingOuter,delete n.paddingInner,delete n.paddingOuter,n.copy=function(){return r(t())},n},n={linear:function(){return y()},pow:o,sqrt:function(){return o().exponent(.5)},symlog:a,band:t,point:function(){return r(t().paddingInner(1))},ticks:l};"undefined"!=typeof chart&&null!==chart&&((chart.utils||(chart.utils={})).scale=n)}.call(this);
|