vega 0.2.5 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +47 -6
- data/lib/vega/base_chart.rb +3 -2
- data/lib/vega/helper.rb +29 -0
- data/lib/vega/spec.rb +7 -5
- data/lib/vega/version.rb +1 -1
- data/lib/vega.rb +9 -2
- data/vendor/assets/javascripts/vega-embed.js +632 -558
- data/vendor/assets/javascripts/vega-lite.js +382 -167
- data/vendor/assets/javascripts/vega.js +1295 -700
- metadata +4 -3
@@ -2,89 +2,7 @@
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vega = {}));
|
5
|
-
}(this, (function (exports) { 'use strict';
|
6
|
-
|
7
|
-
var name = "vega";
|
8
|
-
var version$1 = "5.21.0";
|
9
|
-
var description = "The Vega visualization grammar.";
|
10
|
-
var keywords$1 = [
|
11
|
-
"vega",
|
12
|
-
"visualization",
|
13
|
-
"interaction",
|
14
|
-
"dataflow",
|
15
|
-
"library",
|
16
|
-
"data",
|
17
|
-
"d3"
|
18
|
-
];
|
19
|
-
var license = "BSD-3-Clause";
|
20
|
-
var author = "UW Interactive Data Lab (http://idl.cs.washington.edu)";
|
21
|
-
var main = "build/vega-node.js";
|
22
|
-
var module = "build/vega.module.js";
|
23
|
-
var unpkg = "build/vega.min.js";
|
24
|
-
var jsdelivr = "build/vega.min.js";
|
25
|
-
var types = "index.d.ts";
|
26
|
-
var repository = "vega/vega";
|
27
|
-
var scripts = {
|
28
|
-
bundle: "rollup -c --config-bundle",
|
29
|
-
prebuild: "rimraf build && rimraf build-es5",
|
30
|
-
build: "rollup -c --config-core --config-bundle --config-ie",
|
31
|
-
postbuild: "node schema-copy",
|
32
|
-
pretest: "yarn build --config-test",
|
33
|
-
test: "TZ=America/Los_Angeles tape 'test/**/*-test.js'",
|
34
|
-
prepublishOnly: "yarn test && yarn build",
|
35
|
-
postpublish: "./schema-deploy.sh"
|
36
|
-
};
|
37
|
-
var dependencies = {
|
38
|
-
"vega-crossfilter": "~4.0.5",
|
39
|
-
"vega-dataflow": "~5.7.4",
|
40
|
-
"vega-encode": "~4.8.3",
|
41
|
-
"vega-event-selector": "~3.0.0",
|
42
|
-
"vega-expression": "~5.0.0",
|
43
|
-
"vega-force": "~4.0.7",
|
44
|
-
"vega-format": "~1.0.4",
|
45
|
-
"vega-functions": "~5.12.1",
|
46
|
-
"vega-geo": "~4.3.8",
|
47
|
-
"vega-hierarchy": "~4.0.9",
|
48
|
-
"vega-label": "~1.1.0",
|
49
|
-
"vega-loader": "~4.4.1",
|
50
|
-
"vega-parser": "~6.1.4",
|
51
|
-
"vega-projection": "~1.4.5",
|
52
|
-
"vega-regression": "~1.0.9",
|
53
|
-
"vega-runtime": "~6.1.3",
|
54
|
-
"vega-scale": "~7.1.1",
|
55
|
-
"vega-scenegraph": "~4.9.4",
|
56
|
-
"vega-statistics": "~1.7.10",
|
57
|
-
"vega-time": "~2.0.4",
|
58
|
-
"vega-transforms": "~4.9.4",
|
59
|
-
"vega-typings": "~0.22.0",
|
60
|
-
"vega-util": "~1.17.0",
|
61
|
-
"vega-view": "~5.10.1",
|
62
|
-
"vega-view-transforms": "~4.5.8",
|
63
|
-
"vega-voronoi": "~4.1.5",
|
64
|
-
"vega-wordcloud": "~4.1.3"
|
65
|
-
};
|
66
|
-
var devDependencies = {
|
67
|
-
"vega-schema": "*"
|
68
|
-
};
|
69
|
-
var gitHead = "774165e29850b66ec8b79ba52a7955f1ab936ea6";
|
70
|
-
var pkg = {
|
71
|
-
name: name,
|
72
|
-
version: version$1,
|
73
|
-
description: description,
|
74
|
-
keywords: keywords$1,
|
75
|
-
license: license,
|
76
|
-
author: author,
|
77
|
-
main: main,
|
78
|
-
module: module,
|
79
|
-
unpkg: unpkg,
|
80
|
-
jsdelivr: jsdelivr,
|
81
|
-
types: types,
|
82
|
-
repository: repository,
|
83
|
-
scripts: scripts,
|
84
|
-
dependencies: dependencies,
|
85
|
-
devDependencies: devDependencies,
|
86
|
-
gitHead: gitHead
|
87
|
-
};
|
5
|
+
})(this, (function (exports) { 'use strict';
|
88
6
|
|
89
7
|
function accessor(fn, fields, name) {
|
90
8
|
fn.fields = fields || [];
|
@@ -211,7 +129,8 @@
|
|
211
129
|
const Info = 3;
|
212
130
|
const Debug = 4;
|
213
131
|
|
214
|
-
function logger(_, method
|
132
|
+
function logger(_, method) {
|
133
|
+
let handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : log$1$1;
|
215
134
|
let level = _ || None$2;
|
216
135
|
return {
|
217
136
|
level(_) {
|
@@ -254,7 +173,11 @@
|
|
254
173
|
|
255
174
|
const isLegalKey = key => key !== '__proto__';
|
256
175
|
|
257
|
-
function mergeConfig(
|
176
|
+
function mergeConfig() {
|
177
|
+
for (var _len = arguments.length, configs = new Array(_len), _key = 0; _key < _len; _key++) {
|
178
|
+
configs[_key] = arguments[_key];
|
179
|
+
}
|
180
|
+
|
258
181
|
return configs.reduce((out, source) => {
|
259
182
|
for (const key in source) {
|
260
183
|
if (key === 'signals') {
|
@@ -437,12 +360,12 @@
|
|
437
360
|
return get.length === 0 ? null : accessor(gen(get, ord), Object.keys(fmap));
|
438
361
|
}
|
439
362
|
|
440
|
-
const ascending$
|
363
|
+
const ascending$2 = (u, v) => (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0;
|
441
364
|
|
442
365
|
const comparator = (fields, orders) => fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length);
|
443
366
|
|
444
367
|
const compare1 = (field, order) => function (a, b) {
|
445
|
-
return ascending$
|
368
|
+
return ascending$2(field(a), field(b)) * order;
|
446
369
|
};
|
447
370
|
|
448
371
|
const compareN = (fields, orders, n) => {
|
@@ -455,7 +378,7 @@
|
|
455
378
|
|
456
379
|
while (c === 0 && ++i < n) {
|
457
380
|
f = fields[i];
|
458
|
-
c = ascending$
|
381
|
+
c = ascending$2(f(a), f(b));
|
459
382
|
}
|
460
383
|
|
461
384
|
return c * orders[i];
|
@@ -1416,47 +1339,58 @@
|
|
1416
1339
|
return arcs;
|
1417
1340
|
}
|
1418
1341
|
|
1419
|
-
function ascending$
|
1420
|
-
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
1342
|
+
function ascending$1(a, b) {
|
1343
|
+
return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
1421
1344
|
}
|
1422
1345
|
|
1423
|
-
function bisector
|
1346
|
+
function bisector(f) {
|
1424
1347
|
let delta = f;
|
1425
|
-
let
|
1348
|
+
let compare1 = f;
|
1349
|
+
let compare2 = f;
|
1426
1350
|
|
1427
|
-
if (f.length
|
1351
|
+
if (f.length !== 2) {
|
1428
1352
|
delta = (d, x) => f(d) - x;
|
1429
1353
|
|
1430
|
-
|
1354
|
+
compare1 = ascending$1;
|
1355
|
+
|
1356
|
+
compare2 = (d, x) => ascending$1(f(d), x);
|
1431
1357
|
}
|
1432
1358
|
|
1433
|
-
function left(a, x
|
1434
|
-
|
1435
|
-
|
1359
|
+
function left(a, x) {
|
1360
|
+
let lo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
1361
|
+
let hi = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : a.length;
|
1436
1362
|
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1363
|
+
if (lo < hi) {
|
1364
|
+
if (compare1(x, x) !== 0) return hi;
|
1365
|
+
|
1366
|
+
do {
|
1367
|
+
const mid = lo + hi >>> 1;
|
1368
|
+
if (compare2(a[mid], x) < 0) lo = mid + 1;else hi = mid;
|
1369
|
+
} while (lo < hi);
|
1440
1370
|
}
|
1441
1371
|
|
1442
1372
|
return lo;
|
1443
1373
|
}
|
1444
1374
|
|
1445
|
-
function right(a, x
|
1446
|
-
|
1447
|
-
|
1375
|
+
function right(a, x) {
|
1376
|
+
let lo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
1377
|
+
let hi = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : a.length;
|
1448
1378
|
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1379
|
+
if (lo < hi) {
|
1380
|
+
if (compare1(x, x) !== 0) return hi;
|
1381
|
+
|
1382
|
+
do {
|
1383
|
+
const mid = lo + hi >>> 1;
|
1384
|
+
if (compare2(a[mid], x) <= 0) lo = mid + 1;else hi = mid;
|
1385
|
+
} while (lo < hi);
|
1452
1386
|
}
|
1453
1387
|
|
1454
1388
|
return lo;
|
1455
1389
|
}
|
1456
1390
|
|
1457
|
-
function center(a, x
|
1458
|
-
|
1459
|
-
|
1391
|
+
function center(a, x) {
|
1392
|
+
let lo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
1393
|
+
let hi = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : a.length;
|
1460
1394
|
const i = left(a, x, lo, hi - 1);
|
1461
1395
|
return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
|
1462
1396
|
}
|
@@ -1468,11 +1402,7 @@
|
|
1468
1402
|
};
|
1469
1403
|
}
|
1470
1404
|
|
1471
|
-
function
|
1472
|
-
return (d, x) => ascending$2(f(d), x);
|
1473
|
-
}
|
1474
|
-
|
1475
|
-
function number$6 (x) {
|
1405
|
+
function number$6(x) {
|
1476
1406
|
return x === null ? NaN : +x;
|
1477
1407
|
}
|
1478
1408
|
function* numbers$2(values, valueof) {
|
@@ -1493,10 +1423,10 @@
|
|
1493
1423
|
}
|
1494
1424
|
}
|
1495
1425
|
|
1496
|
-
const ascendingBisect = bisector
|
1426
|
+
const ascendingBisect = bisector(ascending$1);
|
1497
1427
|
const bisectRight$1 = ascendingBisect.right;
|
1498
1428
|
const bisectLeft$1 = ascendingBisect.left;
|
1499
|
-
bisector
|
1429
|
+
bisector(number$6).center;
|
1500
1430
|
var bisect$1 = bisectRight$1;
|
1501
1431
|
|
1502
1432
|
function variance(values, valueof) {
|
@@ -1588,14 +1518,136 @@
|
|
1588
1518
|
|
1589
1519
|
}
|
1590
1520
|
|
1591
|
-
|
1521
|
+
class InternMap extends Map {
|
1522
|
+
constructor(entries) {
|
1523
|
+
let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : keyof;
|
1524
|
+
super();
|
1525
|
+
Object.defineProperties(this, {
|
1526
|
+
_intern: {
|
1527
|
+
value: new Map()
|
1528
|
+
},
|
1529
|
+
_key: {
|
1530
|
+
value: key
|
1531
|
+
}
|
1532
|
+
});
|
1533
|
+
if (entries != null) for (const [key, value] of entries) this.set(key, value);
|
1534
|
+
}
|
1535
|
+
|
1536
|
+
get(key) {
|
1537
|
+
return super.get(intern_get(this, key));
|
1538
|
+
}
|
1539
|
+
|
1540
|
+
has(key) {
|
1541
|
+
return super.has(intern_get(this, key));
|
1542
|
+
}
|
1543
|
+
|
1544
|
+
set(key, value) {
|
1545
|
+
return super.set(intern_set(this, key), value);
|
1546
|
+
}
|
1547
|
+
|
1548
|
+
delete(key) {
|
1549
|
+
return super.delete(intern_delete(this, key));
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
}
|
1553
|
+
class InternSet extends Set {
|
1554
|
+
constructor(values) {
|
1555
|
+
let key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : keyof;
|
1556
|
+
super();
|
1557
|
+
Object.defineProperties(this, {
|
1558
|
+
_intern: {
|
1559
|
+
value: new Map()
|
1560
|
+
},
|
1561
|
+
_key: {
|
1562
|
+
value: key
|
1563
|
+
}
|
1564
|
+
});
|
1565
|
+
if (values != null) for (const value of values) this.add(value);
|
1566
|
+
}
|
1567
|
+
|
1568
|
+
has(value) {
|
1569
|
+
return super.has(intern_get(this, value));
|
1570
|
+
}
|
1571
|
+
|
1572
|
+
add(value) {
|
1573
|
+
return super.add(intern_set(this, value));
|
1574
|
+
}
|
1575
|
+
|
1576
|
+
delete(value) {
|
1577
|
+
return super.delete(intern_delete(this, value));
|
1578
|
+
}
|
1579
|
+
|
1580
|
+
}
|
1581
|
+
|
1582
|
+
function intern_get(_ref, value) {
|
1583
|
+
let {
|
1584
|
+
_intern,
|
1585
|
+
_key
|
1586
|
+
} = _ref;
|
1587
|
+
|
1588
|
+
const key = _key(value);
|
1589
|
+
|
1590
|
+
return _intern.has(key) ? _intern.get(key) : value;
|
1591
|
+
}
|
1592
|
+
|
1593
|
+
function intern_set(_ref2, value) {
|
1594
|
+
let {
|
1595
|
+
_intern,
|
1596
|
+
_key
|
1597
|
+
} = _ref2;
|
1598
|
+
|
1599
|
+
const key = _key(value);
|
1600
|
+
|
1601
|
+
if (_intern.has(key)) return _intern.get(key);
|
1602
|
+
|
1603
|
+
_intern.set(key, value);
|
1604
|
+
|
1605
|
+
return value;
|
1606
|
+
}
|
1607
|
+
|
1608
|
+
function intern_delete(_ref3, value) {
|
1609
|
+
let {
|
1610
|
+
_intern,
|
1611
|
+
_key
|
1612
|
+
} = _ref3;
|
1613
|
+
|
1614
|
+
const key = _key(value);
|
1615
|
+
|
1616
|
+
if (_intern.has(key)) {
|
1617
|
+
value = _intern.get(key);
|
1618
|
+
|
1619
|
+
_intern.delete(key);
|
1620
|
+
}
|
1621
|
+
|
1622
|
+
return value;
|
1623
|
+
}
|
1624
|
+
|
1625
|
+
function keyof(value) {
|
1626
|
+
return value !== null && typeof value === "object" ? value.valueOf() : value;
|
1627
|
+
}
|
1628
|
+
|
1629
|
+
function permute(source, keys) {
|
1592
1630
|
return Array.from(keys, key => source[key]);
|
1593
1631
|
}
|
1594
1632
|
|
1633
|
+
function compareDefined() {
|
1634
|
+
let compare = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ascending$1;
|
1635
|
+
if (compare === ascending$1) return ascendingDefined;
|
1636
|
+
if (typeof compare !== "function") throw new TypeError("compare is not a function");
|
1637
|
+
return (a, b) => {
|
1638
|
+
const x = compare(a, b);
|
1639
|
+
if (x || x === 0) return x;
|
1640
|
+
return (compare(b, b) === 0) - (compare(a, a) === 0);
|
1641
|
+
};
|
1642
|
+
}
|
1643
|
+
function ascendingDefined(a, b) {
|
1644
|
+
return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);
|
1645
|
+
}
|
1646
|
+
|
1595
1647
|
var e10 = Math.sqrt(50),
|
1596
1648
|
e5 = Math.sqrt(10),
|
1597
1649
|
e2 = Math.sqrt(2);
|
1598
|
-
function ticks
|
1650
|
+
function ticks(start, stop, count) {
|
1599
1651
|
var reverse,
|
1600
1652
|
i = -1,
|
1601
1653
|
n,
|
@@ -1688,7 +1740,12 @@
|
|
1688
1740
|
|
1689
1741
|
// ISC license, Copyright 2018 Vladimir Agafonkin.
|
1690
1742
|
|
1691
|
-
function quickselect(array, k
|
1743
|
+
function quickselect(array, k) {
|
1744
|
+
let left = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
1745
|
+
let right = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : array.length - 1;
|
1746
|
+
let compare = arguments.length > 4 ? arguments[4] : undefined;
|
1747
|
+
compare = compare === undefined ? ascendingDefined : compareDefined(compare);
|
1748
|
+
|
1692
1749
|
while (right > left) {
|
1693
1750
|
if (right - left > 600) {
|
1694
1751
|
const n = right - left + 1;
|
@@ -1741,7 +1798,8 @@
|
|
1741
1798
|
value1 = min$2(values.subarray(i0 + 1));
|
1742
1799
|
return value0 + (value1 - value0) * (i - i0);
|
1743
1800
|
}
|
1744
|
-
function quantileSorted(values, p
|
1801
|
+
function quantileSorted(values, p) {
|
1802
|
+
let valueof = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : number$6;
|
1745
1803
|
if (!(n = values.length)) return;
|
1746
1804
|
if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);
|
1747
1805
|
if (p >= 1) return +valueof(values[n - 1], n - 1, values);
|
@@ -1776,7 +1834,7 @@
|
|
1776
1834
|
if (count) return sum / count;
|
1777
1835
|
}
|
1778
1836
|
|
1779
|
-
function median
|
1837
|
+
function median(values, valueof) {
|
1780
1838
|
return quantile$1(values, 0.5, valueof);
|
1781
1839
|
}
|
1782
1840
|
|
@@ -1790,7 +1848,7 @@
|
|
1790
1848
|
return Array.from(flatten(arrays));
|
1791
1849
|
}
|
1792
1850
|
|
1793
|
-
function range$
|
1851
|
+
function range$3(start, stop, step) {
|
1794
1852
|
start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
|
1795
1853
|
var i = -1,
|
1796
1854
|
n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
|
@@ -1803,7 +1861,7 @@
|
|
1803
1861
|
return range;
|
1804
1862
|
}
|
1805
1863
|
|
1806
|
-
function sum(values, valueof) {
|
1864
|
+
function sum$1(values, valueof) {
|
1807
1865
|
let sum = 0;
|
1808
1866
|
|
1809
1867
|
if (valueof === undefined) {
|
@@ -1825,6 +1883,46 @@
|
|
1825
1883
|
return sum;
|
1826
1884
|
}
|
1827
1885
|
|
1886
|
+
function intersection(values) {
|
1887
|
+
for (var _len = arguments.length, others = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
1888
|
+
others[_key - 1] = arguments[_key];
|
1889
|
+
}
|
1890
|
+
|
1891
|
+
values = new InternSet(values);
|
1892
|
+
others = others.map(set$4);
|
1893
|
+
|
1894
|
+
out: for (const value of values) {
|
1895
|
+
for (const other of others) {
|
1896
|
+
if (!other.has(value)) {
|
1897
|
+
values.delete(value);
|
1898
|
+
continue out;
|
1899
|
+
}
|
1900
|
+
}
|
1901
|
+
}
|
1902
|
+
|
1903
|
+
return values;
|
1904
|
+
}
|
1905
|
+
|
1906
|
+
function set$4(values) {
|
1907
|
+
return values instanceof InternSet ? values : new InternSet(values);
|
1908
|
+
}
|
1909
|
+
|
1910
|
+
function union() {
|
1911
|
+
const set = new InternSet();
|
1912
|
+
|
1913
|
+
for (var _len = arguments.length, others = new Array(_len), _key = 0; _key < _len; _key++) {
|
1914
|
+
others[_key] = arguments[_key];
|
1915
|
+
}
|
1916
|
+
|
1917
|
+
for (const other of others) {
|
1918
|
+
for (const o of other) {
|
1919
|
+
set.add(o);
|
1920
|
+
}
|
1921
|
+
}
|
1922
|
+
|
1923
|
+
return set;
|
1924
|
+
}
|
1925
|
+
|
1828
1926
|
function formatDecimal (x) {
|
1829
1927
|
return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
|
1830
1928
|
} // Computes the decimal coefficient and exponent of the specified number x with
|
@@ -2427,7 +2525,10 @@
|
|
2427
2525
|
|
2428
2526
|
function tickInterval(start, stop, count) {
|
2429
2527
|
const target = Math.abs(stop - start) / count;
|
2430
|
-
const i = bisector
|
2528
|
+
const i = bisector(_ref => {
|
2529
|
+
let [,, step] = _ref;
|
2530
|
+
return step;
|
2531
|
+
}).right(tickIntervals, target);
|
2431
2532
|
if (i === tickIntervals.length) return year.every(tickStep(start / durationYear$1, stop / durationYear$1, count));
|
2432
2533
|
if (i === 0) return utcMillisecond.every(Math.max(tickStep(start, stop, count), 1));
|
2433
2534
|
const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
|
@@ -2463,13 +2564,13 @@
|
|
2463
2564
|
if (has$1(UNITS, unit)) {
|
2464
2565
|
m[unit] = 1;
|
2465
2566
|
} else {
|
2466
|
-
error(
|
2567
|
+
error("Invalid time unit: ".concat(unit, "."));
|
2467
2568
|
}
|
2468
2569
|
});
|
2469
2570
|
const numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0);
|
2470
2571
|
|
2471
2572
|
if (numTypes > 1) {
|
2472
|
-
error(
|
2573
|
+
error("Incompatible time units: ".concat(units));
|
2473
2574
|
} // ensure proper sort order
|
2474
2575
|
|
2475
2576
|
|
@@ -2489,9 +2590,9 @@
|
|
2489
2590
|
[MINUTES]: '00:%M',
|
2490
2591
|
[SECONDS]: ':%S',
|
2491
2592
|
[MILLISECONDS]: '.%L',
|
2492
|
-
[
|
2493
|
-
[
|
2494
|
-
[
|
2593
|
+
["".concat(YEAR, "-").concat(MONTH)]: '%Y-%m ',
|
2594
|
+
["".concat(YEAR, "-").concat(MONTH, "-").concat(DATE)]: '%Y-%m-%d ',
|
2595
|
+
["".concat(HOURS, "-").concat(MINUTES)]: '%H:%M'
|
2495
2596
|
};
|
2496
2597
|
|
2497
2598
|
function timeUnitSpecifier(units, specifiers) {
|
@@ -2754,7 +2855,7 @@
|
|
2754
2855
|
const ext = opt.extent,
|
2755
2856
|
max = opt.maxbins || 40,
|
2756
2857
|
target = Math.abs(span(ext)) / max;
|
2757
|
-
let i = bisector
|
2858
|
+
let i = bisector(i => i[2]).right(intervals, target),
|
2758
2859
|
units,
|
2759
2860
|
step;
|
2760
2861
|
|
@@ -3637,7 +3738,7 @@
|
|
3637
3738
|
spec = spec || {};
|
3638
3739
|
|
3639
3740
|
if (!isObject(spec)) {
|
3640
|
-
error(
|
3741
|
+
error("Invalid time multi-format specifier: ".concat(spec));
|
3641
3742
|
}
|
3642
3743
|
|
3643
3744
|
const second = interval(SECONDS),
|
@@ -4034,12 +4135,12 @@
|
|
4034
4135
|
const reader = formats$1(schema.type || 'json');
|
4035
4136
|
if (!reader) error('Unknown data format type: ' + schema.type);
|
4036
4137
|
data = reader(data, schema);
|
4037
|
-
if (schema.parse) parse$
|
4138
|
+
if (schema.parse) parse$6(data, schema.parse, timeParser, utcParser);
|
4038
4139
|
if (has$1(data, 'columns')) delete data.columns;
|
4039
4140
|
return data;
|
4040
4141
|
}
|
4041
4142
|
|
4042
|
-
function parse$
|
4143
|
+
function parse$6(data, types, timeParser, utcParser) {
|
4043
4144
|
if (!data.length) return; // early exit for empty data
|
4044
4145
|
|
4045
4146
|
const locale = timeFormatDefaultLocale();
|
@@ -4601,7 +4702,7 @@
|
|
4601
4702
|
* this flag determines if the operator registers itself as a listener on
|
4602
4703
|
* any upstream operators included in the parameters.
|
4603
4704
|
* @param {boolean} [initonly=false] - A flag indicating if this operator
|
4604
|
-
* should calculate an update only upon its
|
4705
|
+
* should calculate an update only upon its initial evaluation, then
|
4605
4706
|
* deregister dependencies and suppress all future update invocations.
|
4606
4707
|
* @return {Operator[]} - An array of upstream dependencies.
|
4607
4708
|
*/
|
@@ -5002,7 +5103,7 @@
|
|
5002
5103
|
return s;
|
5003
5104
|
}
|
5004
5105
|
|
5005
|
-
function parse$
|
5106
|
+
function parse$5(data, format) {
|
5006
5107
|
const locale = this.locale();
|
5007
5108
|
return read(data, format, locale.timeParse, locale.utcParse);
|
5008
5109
|
}
|
@@ -5829,7 +5930,7 @@
|
|
5829
5930
|
|
5830
5931
|
df._input = {};
|
5831
5932
|
df._pulse = null;
|
5832
|
-
df.debug(
|
5933
|
+
df.debug("Pulse ".concat(stamp, ": ").concat(count, " operators"));
|
5833
5934
|
|
5834
5935
|
if (error) {
|
5835
5936
|
df._postrun = [];
|
@@ -6323,7 +6424,7 @@
|
|
6323
6424
|
changeset,
|
6324
6425
|
// DATA LOADING
|
6325
6426
|
ingest,
|
6326
|
-
parse: parse$
|
6427
|
+
parse: parse$5,
|
6327
6428
|
preload,
|
6328
6429
|
request,
|
6329
6430
|
// EVENT HANDLING
|
@@ -6441,7 +6542,7 @@
|
|
6441
6542
|
const values = Float64Array.from(numbers$1(array, f)); // don't depend on return value from typed array sort call
|
6442
6543
|
// protects against undefined sort results in Safari (vega/vega-lite#4964)
|
6443
6544
|
|
6444
|
-
values.sort(ascending$
|
6545
|
+
values.sort(ascending$1);
|
6445
6546
|
return p.map(_ => quantileSorted(values, _));
|
6446
6547
|
}
|
6447
6548
|
|
@@ -6541,7 +6642,7 @@
|
|
6541
6642
|
mu[j] = a / n;
|
6542
6643
|
}
|
6543
6644
|
|
6544
|
-
mu.sort(ascending$
|
6645
|
+
mu.sort(ascending$1);
|
6545
6646
|
return [quantile$1(mu, alpha / 2), quantile$1(mu, 1 - alpha / 2)];
|
6546
6647
|
} // Dot density binning for dot plot construction.
|
6547
6648
|
// Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999.
|
@@ -7494,7 +7595,7 @@
|
|
7494
7595
|
}
|
7495
7596
|
|
7496
7597
|
const maxiters = 2,
|
7497
|
-
epsilon$
|
7598
|
+
epsilon$6 = 1e-12; // Adapted from science.js by Jason Davies
|
7498
7599
|
// Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js
|
7499
7600
|
// License: https://github.com/jasondavies/science.js/blob/master/LICENSE
|
7500
7601
|
|
@@ -7546,13 +7647,13 @@
|
|
7546
7647
|
}
|
7547
7648
|
|
7548
7649
|
const medianResidual = median(residuals);
|
7549
|
-
if (Math.abs(medianResidual) < epsilon$
|
7650
|
+
if (Math.abs(medianResidual) < epsilon$6) break;
|
7550
7651
|
|
7551
7652
|
for (let i = 0, arg, w; i < n; ++i) {
|
7552
7653
|
arg = residuals[i] / (6 * medianResidual); // default to epsilon (rather than zero) for large deviations
|
7553
7654
|
// keeping weights tiny but non-zero prevents singularites
|
7554
7655
|
|
7555
|
-
robustWeights[i] = arg >= 1 ? epsilon$
|
7656
|
+
robustWeights[i] = arg >= 1 ? epsilon$6 : (w = 1 - arg * arg) * w;
|
7556
7657
|
}
|
7557
7658
|
}
|
7558
7659
|
|
@@ -8963,7 +9064,7 @@
|
|
8963
9064
|
* @return {object} - The output distribution object.
|
8964
9065
|
*/
|
8965
9066
|
|
8966
|
-
function parse$
|
9067
|
+
function parse$4(def, data) {
|
8967
9068
|
const func = def[FUNCTION];
|
8968
9069
|
|
8969
9070
|
if (!has$1(Distributions, func)) {
|
@@ -8978,7 +9079,7 @@
|
|
8978
9079
|
d.data((def.from || data()).map(def[name]));
|
8979
9080
|
} // if distribution mixture, recurse to parse each definition
|
8980
9081
|
else if (name === DISTRIBUTIONS) {
|
8981
|
-
d[name](def[name].map(_ => parse$
|
9082
|
+
d[name](def[name].map(_ => parse$4(_, data)));
|
8982
9083
|
} // otherwise, simply set the parameter
|
8983
9084
|
else if (typeof d[name] === FUNCTION) {
|
8984
9085
|
d[name](def[name]);
|
@@ -9130,7 +9231,7 @@
|
|
9130
9231
|
const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
|
9131
9232
|
|
9132
9233
|
if (!this.value || pulse.changed() || _.modified()) {
|
9133
|
-
const dist = parse$
|
9234
|
+
const dist = parse$4(_.distribution, source$1(pulse)),
|
9134
9235
|
minsteps = _.steps || _.minsteps || 25,
|
9135
9236
|
maxsteps = _.steps || _.maxsteps || 200;
|
9136
9237
|
let method = _.method || 'pdf';
|
@@ -9353,8 +9454,8 @@
|
|
9353
9454
|
|
9354
9455
|
if (!Number.isFinite(min) || !Number.isFinite(max)) {
|
9355
9456
|
let name = accessorName(field);
|
9356
|
-
if (name) name =
|
9357
|
-
pulse.dataflow.warn(
|
9457
|
+
if (name) name = " for field \"".concat(name, "\"");
|
9458
|
+
pulse.dataflow.warn("Infinite extent".concat(name, ": [").concat(min, ", ").concat(max, "]"));
|
9358
9459
|
min = max = undefined;
|
9359
9460
|
}
|
9360
9461
|
|
@@ -10665,7 +10766,7 @@
|
|
10665
10766
|
list.push(k);
|
10666
10767
|
}
|
10667
10768
|
});
|
10668
|
-
list.sort(ascending$
|
10769
|
+
list.sort(ascending$2);
|
10669
10770
|
return limit ? list.slice(0, limit) : list;
|
10670
10771
|
}
|
10671
10772
|
/**
|
@@ -10882,7 +10983,7 @@
|
|
10882
10983
|
names = (_.groupby || []).map(accessorName),
|
10883
10984
|
values = [],
|
10884
10985
|
step = _.step || 0.01,
|
10885
|
-
p = _.probs || range$
|
10986
|
+
p = _.probs || range$3(step / 2, 1 - EPSILON$2, step),
|
10886
10987
|
n = p.length;
|
10887
10988
|
groups.forEach(g => {
|
10888
10989
|
const q = quantiles(g, p);
|
@@ -11116,7 +11217,7 @@
|
|
11116
11217
|
const out = pulse.materialize().fork(pulse.MOD),
|
11117
11218
|
as = _.as || 'data';
|
11118
11219
|
out.rem = this.value ? pulse.rem.concat(this.value) : pulse.rem;
|
11119
|
-
this.value = range$
|
11220
|
+
this.value = range$3(_.start, _.stop, _.step || 1).map(v => {
|
11120
11221
|
const t = {};
|
11121
11222
|
t[as] = v;
|
11122
11223
|
return ingest$1(t);
|
@@ -11216,7 +11317,7 @@
|
|
11216
11317
|
max = floor.stop || -Infinity,
|
11217
11318
|
flag = pulse.ADD;
|
11218
11319
|
|
11219
|
-
if (_.modified() || pulse.modified(accessorFields(field))) {
|
11320
|
+
if (_.modified() || pulse.changed(pulse.REM) || pulse.modified(accessorFields(field))) {
|
11220
11321
|
pulse = pulse.reflow(true);
|
11221
11322
|
flag = pulse.SOURCE;
|
11222
11323
|
min = Infinity;
|
@@ -11751,7 +11852,7 @@
|
|
11751
11852
|
data = list.data(cmp),
|
11752
11853
|
// use cmp for stable sort
|
11753
11854
|
n = data.length,
|
11754
|
-
b = range ? bisector
|
11855
|
+
b = range ? bisector(sort) : null,
|
11755
11856
|
w = {
|
11756
11857
|
i0: 0,
|
11757
11858
|
i1: 0,
|
@@ -11835,8 +11936,8 @@
|
|
11835
11936
|
|
11836
11937
|
const pi$3 = Math.PI,
|
11837
11938
|
tau$3 = 2 * pi$3,
|
11838
|
-
epsilon$
|
11839
|
-
tauEpsilon = tau$3 - epsilon$
|
11939
|
+
epsilon$5 = 1e-6,
|
11940
|
+
tauEpsilon = tau$3 - epsilon$5;
|
11840
11941
|
|
11841
11942
|
function Path$1() {
|
11842
11943
|
this._x0 = this._y0 = // start of current subpath
|
@@ -11884,10 +11985,10 @@
|
|
11884
11985
|
if (this._x1 === null) {
|
11885
11986
|
this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
|
11886
11987
|
} // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
|
11887
|
-
else if (!(l01_2 > epsilon$
|
11988
|
+
else if (!(l01_2 > epsilon$5)) ; // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
|
11888
11989
|
// Equivalently, is (x1,y1) coincident with (x2,y2)?
|
11889
11990
|
// Or, is the radius zero? Line to (x1,y1).
|
11890
|
-
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$
|
11991
|
+
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$5) || !r) {
|
11891
11992
|
this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
|
11892
11993
|
} // Otherwise, draw an arc!
|
11893
11994
|
else {
|
@@ -11901,7 +12002,7 @@
|
|
11901
12002
|
t01 = l / l01,
|
11902
12003
|
t21 = l / l21; // If the start tangent is not coincident with (x0,y0), line to.
|
11903
12004
|
|
11904
|
-
if (Math.abs(t01 - 1) > epsilon$
|
12005
|
+
if (Math.abs(t01 - 1) > epsilon$5) {
|
11905
12006
|
this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
|
11906
12007
|
}
|
11907
12008
|
|
@@ -11922,7 +12023,7 @@
|
|
11922
12023
|
if (this._x1 === null) {
|
11923
12024
|
this._ += "M" + x0 + "," + y0;
|
11924
12025
|
} // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
|
11925
|
-
else if (Math.abs(this._x1 - x0) > epsilon$
|
12026
|
+
else if (Math.abs(this._x1 - x0) > epsilon$5 || Math.abs(this._y1 - y0) > epsilon$5) {
|
11926
12027
|
this._ += "L" + x0 + "," + y0;
|
11927
12028
|
} // Is this arc empty? We’re done.
|
11928
12029
|
|
@@ -11934,7 +12035,7 @@
|
|
11934
12035
|
if (da > tauEpsilon) {
|
11935
12036
|
this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
|
11936
12037
|
} // Is this arc non-empty? Draw an arc!
|
11937
|
-
else if (da > epsilon$
|
12038
|
+
else if (da > epsilon$5) {
|
11938
12039
|
this._ += "A" + r + "," + r + ",0," + +(da >= pi$3) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
|
11939
12040
|
}
|
11940
12041
|
},
|
@@ -11952,17 +12053,17 @@
|
|
11952
12053
|
};
|
11953
12054
|
}
|
11954
12055
|
|
11955
|
-
|
11956
|
-
|
11957
|
-
|
11958
|
-
|
11959
|
-
|
11960
|
-
|
11961
|
-
|
11962
|
-
|
11963
|
-
|
11964
|
-
|
11965
|
-
|
12056
|
+
const abs$2 = Math.abs;
|
12057
|
+
const atan2$1 = Math.atan2;
|
12058
|
+
const cos$2 = Math.cos;
|
12059
|
+
const max$1 = Math.max;
|
12060
|
+
const min$1 = Math.min;
|
12061
|
+
const sin$2 = Math.sin;
|
12062
|
+
const sqrt$3 = Math.sqrt;
|
12063
|
+
const epsilon$4 = 1e-12;
|
12064
|
+
const pi$2 = Math.PI;
|
12065
|
+
const halfPi$2 = pi$2 / 2;
|
12066
|
+
const tau$2 = 2 * pi$2;
|
11966
12067
|
function acos$1(x) {
|
11967
12068
|
return x > 1 ? 0 : x < -1 ? pi$2 : Math.acos(x);
|
11968
12069
|
}
|
@@ -11996,7 +12097,7 @@
|
|
11996
12097
|
x32 = x3 - x2,
|
11997
12098
|
y32 = y3 - y2,
|
11998
12099
|
t = y32 * x10 - x32 * y10;
|
11999
|
-
if (t * t < epsilon$
|
12100
|
+
if (t * t < epsilon$4) return;
|
12000
12101
|
t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
|
12001
12102
|
return [x0 + t * x10, y0 + t * y10];
|
12002
12103
|
} // Compute perpendicular offset line of length rc.
|
@@ -12065,12 +12166,12 @@
|
|
12065
12166
|
|
12066
12167
|
if (r1 < r0) r = r1, r1 = r0, r0 = r; // Is it a point?
|
12067
12168
|
|
12068
|
-
if (!(r1 > epsilon$
|
12069
|
-
else if (da > tau$2 - epsilon$
|
12169
|
+
if (!(r1 > epsilon$4)) context.moveTo(0, 0); // Or is it a circle or annulus?
|
12170
|
+
else if (da > tau$2 - epsilon$4) {
|
12070
12171
|
context.moveTo(r1 * cos$2(a0), r1 * sin$2(a0));
|
12071
12172
|
context.arc(0, 0, r1, a0, a1, !cw);
|
12072
12173
|
|
12073
|
-
if (r0 > epsilon$
|
12174
|
+
if (r0 > epsilon$4) {
|
12074
12175
|
context.moveTo(r0 * cos$2(a1), r0 * sin$2(a1));
|
12075
12176
|
context.arc(0, 0, r0, a1, a0, cw);
|
12076
12177
|
}
|
@@ -12083,18 +12184,18 @@
|
|
12083
12184
|
da0 = da,
|
12084
12185
|
da1 = da,
|
12085
12186
|
ap = padAngle.apply(this, arguments) / 2,
|
12086
|
-
rp = ap > epsilon$
|
12187
|
+
rp = ap > epsilon$4 && (padRadius ? +padRadius.apply(this, arguments) : sqrt$3(r0 * r0 + r1 * r1)),
|
12087
12188
|
rc = min$1(abs$2(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
|
12088
12189
|
rc0 = rc,
|
12089
12190
|
rc1 = rc,
|
12090
12191
|
t0,
|
12091
12192
|
t1; // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.
|
12092
12193
|
|
12093
|
-
if (rp > epsilon$
|
12194
|
+
if (rp > epsilon$4) {
|
12094
12195
|
var p0 = asin$2(rp / r0 * sin$2(ap)),
|
12095
12196
|
p1 = asin$2(rp / r1 * sin$2(ap));
|
12096
|
-
if ((da0 -= p0 * 2) > epsilon$
|
12097
|
-
if ((da1 -= p1 * 2) > epsilon$
|
12197
|
+
if ((da0 -= p0 * 2) > epsilon$4) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;else da0 = 0, a00 = a10 = (a0 + a1) / 2;
|
12198
|
+
if ((da1 -= p1 * 2) > epsilon$4) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;else da1 = 0, a01 = a11 = (a0 + a1) / 2;
|
12098
12199
|
}
|
12099
12200
|
|
12100
12201
|
var x01 = r1 * cos$2(a01),
|
@@ -12102,7 +12203,7 @@
|
|
12102
12203
|
x10 = r0 * cos$2(a10),
|
12103
12204
|
y10 = r0 * sin$2(a10); // Apply rounded corners?
|
12104
12205
|
|
12105
|
-
if (rc > epsilon$
|
12206
|
+
if (rc > epsilon$4) {
|
12106
12207
|
var x11 = r1 * cos$2(a11),
|
12107
12208
|
y11 = r1 * sin$2(a11),
|
12108
12209
|
x00 = r0 * cos$2(a00),
|
@@ -12122,8 +12223,8 @@
|
|
12122
12223
|
} // Is the sector collapsed to a line?
|
12123
12224
|
|
12124
12225
|
|
12125
|
-
if (!(da1 > epsilon$
|
12126
|
-
else if (rc1 > epsilon$
|
12226
|
+
if (!(da1 > epsilon$4)) context.moveTo(x01, y01); // Does the sector’s outer ring have rounded corners?
|
12227
|
+
else if (rc1 > epsilon$4) {
|
12127
12228
|
t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
|
12128
12229
|
t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
|
12129
12230
|
context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); // Have the corners merged?
|
@@ -12138,8 +12239,8 @@
|
|
12138
12239
|
else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); // Is there no inner ring, and it’s a circular sector?
|
12139
12240
|
// Or perhaps it’s an annular sector collapsed due to padding?
|
12140
12241
|
|
12141
|
-
if (!(r0 > epsilon$
|
12142
|
-
else if (rc0 > epsilon$
|
12242
|
+
if (!(r0 > epsilon$4) || !(da0 > epsilon$4)) context.lineTo(x10, y10); // Does the sector’s inner ring (or point) have rounded corners?
|
12243
|
+
else if (rc0 > epsilon$4) {
|
12143
12244
|
t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
|
12144
12245
|
t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
|
12145
12246
|
context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); // Have the corners merged?
|
@@ -12232,7 +12333,7 @@
|
|
12232
12333
|
|
12233
12334
|
case 1:
|
12234
12335
|
this._point = 2;
|
12235
|
-
//
|
12336
|
+
// falls through
|
12236
12337
|
|
12237
12338
|
default:
|
12238
12339
|
this._context.lineTo(x, y);
|
@@ -12408,20 +12509,21 @@
|
|
12408
12509
|
}
|
12409
12510
|
|
12410
12511
|
var circle$1 = {
|
12411
|
-
draw
|
12412
|
-
|
12512
|
+
draw(context, size) {
|
12513
|
+
const r = sqrt$3(size / pi$2);
|
12413
12514
|
context.moveTo(r, 0);
|
12414
12515
|
context.arc(0, 0, r, 0, tau$2);
|
12415
12516
|
}
|
12517
|
+
|
12416
12518
|
};
|
12417
12519
|
|
12418
|
-
function
|
12419
|
-
|
12520
|
+
function Symbol$1(type, size) {
|
12521
|
+
let context = null;
|
12420
12522
|
type = typeof type === "function" ? type : constant$3(type || circle$1);
|
12421
12523
|
size = typeof size === "function" ? size : constant$3(size === undefined ? 64 : +size);
|
12422
12524
|
|
12423
12525
|
function symbol() {
|
12424
|
-
|
12526
|
+
let buffer;
|
12425
12527
|
if (!context) context = buffer = path$3();
|
12426
12528
|
type.apply(this, arguments).draw(context, +size.apply(this, arguments));
|
12427
12529
|
if (buffer) return context = null, buffer + "" || null;
|
@@ -12465,7 +12567,7 @@
|
|
12465
12567
|
switch (this._point) {
|
12466
12568
|
case 3:
|
12467
12569
|
point$5(this, this._x1, this._y1);
|
12468
|
-
//
|
12570
|
+
// falls through
|
12469
12571
|
|
12470
12572
|
case 2:
|
12471
12573
|
this._context.lineTo(this._x1, this._y1);
|
@@ -12494,7 +12596,7 @@
|
|
12494
12596
|
|
12495
12597
|
this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);
|
12496
12598
|
|
12497
|
-
//
|
12599
|
+
// falls through
|
12498
12600
|
|
12499
12601
|
default:
|
12500
12602
|
point$5(this, x, y);
|
@@ -12626,7 +12728,7 @@
|
|
12626
12728
|
|
12627
12729
|
case 3:
|
12628
12730
|
this._point = 4;
|
12629
|
-
//
|
12731
|
+
// falls through
|
12630
12732
|
|
12631
12733
|
default:
|
12632
12734
|
point$5(this, x, y);
|
@@ -12744,7 +12846,7 @@
|
|
12744
12846
|
|
12745
12847
|
case 2:
|
12746
12848
|
this._point = 3;
|
12747
|
-
//
|
12849
|
+
// falls through
|
12748
12850
|
|
12749
12851
|
default:
|
12750
12852
|
point$4(this, x, y);
|
@@ -12887,7 +12989,7 @@
|
|
12887
12989
|
|
12888
12990
|
case 3:
|
12889
12991
|
this._point = 4;
|
12890
|
-
//
|
12992
|
+
// falls through
|
12891
12993
|
|
12892
12994
|
default:
|
12893
12995
|
point$4(this, x, y);
|
@@ -12916,14 +13018,14 @@
|
|
12916
13018
|
x2 = that._x2,
|
12917
13019
|
y2 = that._y2;
|
12918
13020
|
|
12919
|
-
if (that._l01_a > epsilon$
|
13021
|
+
if (that._l01_a > epsilon$4) {
|
12920
13022
|
var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,
|
12921
13023
|
n = 3 * that._l01_a * (that._l01_a + that._l12_a);
|
12922
13024
|
x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;
|
12923
13025
|
y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;
|
12924
13026
|
}
|
12925
13027
|
|
12926
|
-
if (that._l23_a > epsilon$
|
13028
|
+
if (that._l23_a > epsilon$4) {
|
12927
13029
|
var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,
|
12928
13030
|
m = 3 * that._l23_a * (that._l23_a + that._l12_a);
|
12929
13031
|
x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;
|
@@ -12985,7 +13087,7 @@
|
|
12985
13087
|
|
12986
13088
|
case 2:
|
12987
13089
|
this._point = 3;
|
12988
|
-
//
|
13090
|
+
// falls through
|
12989
13091
|
|
12990
13092
|
default:
|
12991
13093
|
point$3(this, x, y);
|
@@ -13146,7 +13248,7 @@
|
|
13146
13248
|
|
13147
13249
|
case 3:
|
13148
13250
|
this._point = 4;
|
13149
|
-
//
|
13251
|
+
// falls through
|
13150
13252
|
|
13151
13253
|
default:
|
13152
13254
|
point$3(this, x, y);
|
@@ -13431,7 +13533,7 @@
|
|
13431
13533
|
|
13432
13534
|
case 1:
|
13433
13535
|
this._point = 2;
|
13434
|
-
//
|
13536
|
+
// falls through
|
13435
13537
|
|
13436
13538
|
default:
|
13437
13539
|
{
|
@@ -13520,31 +13622,29 @@
|
|
13520
13622
|
|
13521
13623
|
const implicit = Symbol("implicit");
|
13522
13624
|
function ordinal() {
|
13523
|
-
var index = new
|
13625
|
+
var index = new InternMap(),
|
13524
13626
|
domain = [],
|
13525
13627
|
range = [],
|
13526
13628
|
unknown = implicit;
|
13527
13629
|
|
13528
13630
|
function scale(d) {
|
13529
|
-
|
13530
|
-
i = index.get(key);
|
13631
|
+
let i = index.get(d);
|
13531
13632
|
|
13532
|
-
if (
|
13633
|
+
if (i === undefined) {
|
13533
13634
|
if (unknown !== implicit) return unknown;
|
13534
|
-
index.set(
|
13635
|
+
index.set(d, i = domain.push(d) - 1);
|
13535
13636
|
}
|
13536
13637
|
|
13537
|
-
return range[
|
13638
|
+
return range[i % range.length];
|
13538
13639
|
}
|
13539
13640
|
|
13540
13641
|
scale.domain = function (_) {
|
13541
13642
|
if (!arguments.length) return domain.slice();
|
13542
|
-
domain = [], index = new
|
13643
|
+
domain = [], index = new InternMap();
|
13543
13644
|
|
13544
13645
|
for (const value of _) {
|
13545
|
-
|
13546
|
-
|
13547
|
-
index.set(key, domain.push(value));
|
13646
|
+
if (index.has(value)) continue;
|
13647
|
+
index.set(value, domain.push(value) - 1);
|
13548
13648
|
}
|
13549
13649
|
|
13550
13650
|
return scale;
|
@@ -14027,13 +14127,13 @@
|
|
14027
14127
|
}));
|
14028
14128
|
|
14029
14129
|
var A = -0.14861,
|
14030
|
-
B = +1.78277,
|
14130
|
+
B$1 = +1.78277,
|
14031
14131
|
C$1 = -0.29227,
|
14032
|
-
D = -0.90649,
|
14132
|
+
D$1 = -0.90649,
|
14033
14133
|
E = +1.97294,
|
14034
|
-
ED = E * D,
|
14035
|
-
EB = E * B,
|
14036
|
-
BC_DA = B * C$1 - D * A;
|
14134
|
+
ED = E * D$1,
|
14135
|
+
EB = E * B$1,
|
14136
|
+
BC_DA = B$1 * C$1 - D$1 * A;
|
14037
14137
|
|
14038
14138
|
function cubehelixConvert(o) {
|
14039
14139
|
if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
|
@@ -14043,7 +14143,7 @@
|
|
14043
14143
|
b = o.b / 255,
|
14044
14144
|
l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
|
14045
14145
|
bl = b - l,
|
14046
|
-
k = (E * (g - l) - C$1 * bl) / D,
|
14146
|
+
k = (E * (g - l) - C$1 * bl) / D$1,
|
14047
14147
|
s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)),
|
14048
14148
|
// NaN if l=0 or l=1
|
14049
14149
|
h = s ? Math.atan2(k, bl) * degrees$2 - 120 : NaN;
|
@@ -14074,7 +14174,7 @@
|
|
14074
14174
|
a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
|
14075
14175
|
cosh = Math.cos(h),
|
14076
14176
|
sinh = Math.sin(h);
|
14077
|
-
return new Rgb(255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C$1 * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity);
|
14177
|
+
return new Rgb(255 * (l + a * (A * cosh + B$1 * sinh)), 255 * (l + a * (C$1 * cosh + D$1 * sinh)), 255 * (l + a * (E * cosh)), this.opacity);
|
14078
14178
|
}
|
14079
14179
|
}));
|
14080
14180
|
|
@@ -14701,7 +14801,7 @@
|
|
14701
14801
|
return x;
|
14702
14802
|
}
|
14703
14803
|
|
14704
|
-
function normalize(a, b) {
|
14804
|
+
function normalize$1(a, b) {
|
14705
14805
|
return (b -= a = +a) ? function (x) {
|
14706
14806
|
return (x - a) / b;
|
14707
14807
|
} : constants(isNaN(b) ? NaN : 0.5);
|
@@ -14722,7 +14822,7 @@
|
|
14722
14822
|
d1 = domain[1],
|
14723
14823
|
r0 = range[0],
|
14724
14824
|
r1 = range[1];
|
14725
|
-
if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
|
14825
|
+
if (d1 < d0) d0 = normalize$1(d1, d0), r0 = interpolate(r1, r0);else d0 = normalize$1(d0, d1), r0 = interpolate(r0, r1);
|
14726
14826
|
return function (x) {
|
14727
14827
|
return r0(d0(x));
|
14728
14828
|
};
|
@@ -14740,7 +14840,7 @@
|
|
14740
14840
|
}
|
14741
14841
|
|
14742
14842
|
while (++i < j) {
|
14743
|
-
d[i] = normalize(domain[i], domain[i + 1]);
|
14843
|
+
d[i] = normalize$1(domain[i], domain[i + 1]);
|
14744
14844
|
r[i] = interpolate(range[i], range[i + 1]);
|
14745
14845
|
}
|
14746
14846
|
|
@@ -14977,29 +15077,23 @@
|
|
14977
15077
|
}
|
14978
15078
|
|
14979
15079
|
function powp(base) {
|
14980
|
-
return base === 10 ? pow10 : base === Math.E ? Math.exp :
|
14981
|
-
return Math.pow(base, x);
|
14982
|
-
};
|
15080
|
+
return base === 10 ? pow10 : base === Math.E ? Math.exp : x => Math.pow(base, x);
|
14983
15081
|
}
|
14984
15082
|
|
14985
15083
|
function logp(base) {
|
14986
|
-
return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base),
|
14987
|
-
return Math.log(x) / base;
|
14988
|
-
});
|
15084
|
+
return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base), x => Math.log(x) / base);
|
14989
15085
|
}
|
14990
15086
|
|
14991
15087
|
function reflect(f) {
|
14992
|
-
return
|
14993
|
-
return -f(-x);
|
14994
|
-
};
|
15088
|
+
return (x, k) => -f(-x, k);
|
14995
15089
|
}
|
14996
15090
|
|
14997
15091
|
function loggish(transform) {
|
14998
|
-
|
14999
|
-
|
15000
|
-
|
15001
|
-
|
15002
|
-
|
15092
|
+
const scale = transform(transformLog, transformExp);
|
15093
|
+
const domain = scale.domain;
|
15094
|
+
let base = 10;
|
15095
|
+
let logs;
|
15096
|
+
let pows;
|
15003
15097
|
|
15004
15098
|
function rescale() {
|
15005
15099
|
logs = logp(base), pows = powp(base);
|
@@ -15022,32 +15116,31 @@
|
|
15022
15116
|
return arguments.length ? (domain(_), rescale()) : domain();
|
15023
15117
|
};
|
15024
15118
|
|
15025
|
-
scale.ticks =
|
15026
|
-
|
15027
|
-
|
15028
|
-
|
15029
|
-
|
15030
|
-
if (r
|
15031
|
-
|
15032
|
-
|
15033
|
-
|
15034
|
-
|
15035
|
-
|
15036
|
-
|
15037
|
-
z = [];
|
15119
|
+
scale.ticks = count => {
|
15120
|
+
const d = domain();
|
15121
|
+
let u = d[0];
|
15122
|
+
let v = d[d.length - 1];
|
15123
|
+
const r = v < u;
|
15124
|
+
if (r) [u, v] = [v, u];
|
15125
|
+
let i = logs(u);
|
15126
|
+
let j = logs(v);
|
15127
|
+
let k;
|
15128
|
+
let t;
|
15129
|
+
const n = count == null ? 10 : +count;
|
15130
|
+
let z = [];
|
15038
15131
|
|
15039
15132
|
if (!(base % 1) && j - i < n) {
|
15040
15133
|
i = Math.floor(i), j = Math.ceil(j);
|
15041
15134
|
if (u > 0) for (; i <= j; ++i) {
|
15042
|
-
for (k = 1
|
15043
|
-
t =
|
15135
|
+
for (k = 1; k < base; ++k) {
|
15136
|
+
t = i < 0 ? k / pows(-i) : k * pows(i);
|
15044
15137
|
if (t < u) continue;
|
15045
15138
|
if (t > v) break;
|
15046
15139
|
z.push(t);
|
15047
15140
|
}
|
15048
15141
|
} else for (; i <= j; ++i) {
|
15049
|
-
for (k = base - 1
|
15050
|
-
t =
|
15142
|
+
for (k = base - 1; k >= 1; --k) {
|
15143
|
+
t = i > 0 ? k / pows(-i) : k * pows(i);
|
15051
15144
|
if (t < u) continue;
|
15052
15145
|
if (t > v) break;
|
15053
15146
|
z.push(t);
|
@@ -15061,39 +15154,38 @@
|
|
15061
15154
|
return r ? z.reverse() : z;
|
15062
15155
|
};
|
15063
15156
|
|
15064
|
-
scale.tickFormat =
|
15065
|
-
if (specifier == null) specifier = base === 10 ? ".0e" : ",";
|
15066
|
-
if (typeof specifier !== "function") specifier = format$3(specifier);
|
15067
|
-
if (count === Infinity) return specifier;
|
15157
|
+
scale.tickFormat = (count, specifier) => {
|
15068
15158
|
if (count == null) count = 10;
|
15069
|
-
|
15159
|
+
if (specifier == null) specifier = base === 10 ? "s" : ",";
|
15070
15160
|
|
15071
|
-
|
15072
|
-
|
15161
|
+
if (typeof specifier !== "function") {
|
15162
|
+
if (!(base % 1) && (specifier = formatSpecifier(specifier)).precision == null) specifier.trim = true;
|
15163
|
+
specifier = format$3(specifier);
|
15164
|
+
}
|
15165
|
+
|
15166
|
+
if (count === Infinity) return specifier;
|
15167
|
+
const k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?
|
15168
|
+
|
15169
|
+
return d => {
|
15170
|
+
let i = d / pows(Math.round(logs(d)));
|
15073
15171
|
if (i * base < base - 0.5) i *= base;
|
15074
15172
|
return i <= k ? specifier(d) : "";
|
15075
15173
|
};
|
15076
15174
|
};
|
15077
15175
|
|
15078
|
-
scale.nice =
|
15176
|
+
scale.nice = () => {
|
15079
15177
|
return domain(nice(domain(), {
|
15080
|
-
floor:
|
15081
|
-
|
15082
|
-
},
|
15083
|
-
ceil: function (x) {
|
15084
|
-
return pows(Math.ceil(logs(x)));
|
15085
|
-
}
|
15178
|
+
floor: x => pows(Math.floor(logs(x))),
|
15179
|
+
ceil: x => pows(Math.ceil(logs(x)))
|
15086
15180
|
}));
|
15087
15181
|
};
|
15088
15182
|
|
15089
15183
|
return scale;
|
15090
15184
|
}
|
15091
15185
|
function log$2() {
|
15092
|
-
|
15186
|
+
const scale = loggish(transformer$3()).domain([1, 10]);
|
15093
15187
|
|
15094
|
-
scale.copy =
|
15095
|
-
return copy$2(scale, log$2()).base(scale.base());
|
15096
|
-
};
|
15188
|
+
scale.copy = () => copy$2(scale, log$2()).base(scale.base());
|
15097
15189
|
|
15098
15190
|
initRange.apply(scale, arguments);
|
15099
15191
|
return scale;
|
@@ -15204,7 +15296,7 @@
|
|
15204
15296
|
|
15205
15297
|
for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d);
|
15206
15298
|
|
15207
|
-
domain.sort(ascending$
|
15299
|
+
domain.sort(ascending$1);
|
15208
15300
|
return rescale();
|
15209
15301
|
};
|
15210
15302
|
|
@@ -15662,7 +15754,7 @@
|
|
15662
15754
|
bandwidth = Math.round(bandwidth);
|
15663
15755
|
}
|
15664
15756
|
|
15665
|
-
const values = range$
|
15757
|
+
const values = range$3(n).map(i => start + step * i);
|
15666
15758
|
return ordinalRange(reverse ? values.reverse() : values);
|
15667
15759
|
}
|
15668
15760
|
|
@@ -15897,17 +15989,17 @@
|
|
15897
15989
|
|
15898
15990
|
scale$4(Sequential, sequential, [Continuous, Interpolating]); // backwards compat
|
15899
15991
|
|
15900
|
-
scale$4(
|
15901
|
-
scale$4(
|
15902
|
-
scale$4(
|
15903
|
-
scale$4(
|
15904
|
-
scale$4(
|
15992
|
+
scale$4("".concat(Sequential, "-").concat(Linear), sequential, [Continuous, Interpolating]);
|
15993
|
+
scale$4("".concat(Sequential, "-").concat(Log), sequentialLog, [Continuous, Interpolating, Log]);
|
15994
|
+
scale$4("".concat(Sequential, "-").concat(Pow), sequentialPow, [Continuous, Interpolating]);
|
15995
|
+
scale$4("".concat(Sequential, "-").concat(Sqrt), sequentialSqrt, [Continuous, Interpolating]);
|
15996
|
+
scale$4("".concat(Sequential, "-").concat(Symlog), sequentialSymlog, [Continuous, Interpolating]); // diverging scales
|
15905
15997
|
|
15906
|
-
scale$4(
|
15907
|
-
scale$4(
|
15908
|
-
scale$4(
|
15909
|
-
scale$4(
|
15910
|
-
scale$4(
|
15998
|
+
scale$4("".concat(Diverging, "-").concat(Linear), diverging, [Continuous, Interpolating]);
|
15999
|
+
scale$4("".concat(Diverging, "-").concat(Log), divergingLog, [Continuous, Interpolating, Log]);
|
16000
|
+
scale$4("".concat(Diverging, "-").concat(Pow), divergingPow, [Continuous, Interpolating]);
|
16001
|
+
scale$4("".concat(Diverging, "-").concat(Sqrt), divergingSqrt, [Continuous, Interpolating]);
|
16002
|
+
scale$4("".concat(Diverging, "-").concat(Symlog), divergingSymlog, [Continuous, Interpolating]); // discretizing scales
|
15911
16003
|
|
15912
16004
|
scale$4(Quantile, quantile, [Discretizing, Quantile]);
|
15913
16005
|
scale$4(Quantize, quantize$1, Discretizing);
|
@@ -16110,7 +16202,7 @@
|
|
16110
16202
|
|
16111
16203
|
const defaultFormatter = value => isArray(value) ? value.map(v => String(v)) : String(value);
|
16112
16204
|
|
16113
|
-
const ascending
|
16205
|
+
const ascending = (a, b) => a[1] - b[1];
|
16114
16206
|
|
16115
16207
|
const descending = (a, b) => b[1] - a[1];
|
16116
16208
|
/**
|
@@ -16161,7 +16253,7 @@
|
|
16161
16253
|
let range = scale.range(),
|
16162
16254
|
lo = range[0],
|
16163
16255
|
hi = peek$1(range),
|
16164
|
-
cmp = ascending
|
16256
|
+
cmp = ascending;
|
16165
16257
|
|
16166
16258
|
if (lo > hi) {
|
16167
16259
|
range = hi;
|
@@ -16363,17 +16455,17 @@
|
|
16363
16455
|
if (isDiscretizing(scale.type)) {
|
16364
16456
|
const v = labelValues(scale).slice(1).map(fmt),
|
16365
16457
|
n = v.length;
|
16366
|
-
return
|
16458
|
+
return "".concat(n, " boundar").concat(n === 1 ? 'y' : 'ies', ": ").concat(v.join(', '));
|
16367
16459
|
} // if scale domain is discrete, list values
|
16368
16460
|
else if (isDiscrete(scale.type)) {
|
16369
16461
|
const d = scale.domain(),
|
16370
16462
|
n = d.length,
|
16371
16463
|
v = n > max ? d.slice(0, max - 2).map(fmt).join(', ') + ', ending with ' + d.slice(-1).map(fmt) : d.map(fmt).join(', ');
|
16372
|
-
return
|
16464
|
+
return "".concat(n, " value").concat(n === 1 ? '' : 's', ": ").concat(v);
|
16373
16465
|
} // if scale domain is continuous, describe value range
|
16374
16466
|
else {
|
16375
16467
|
const d = scale.domain();
|
16376
|
-
return
|
16468
|
+
return "values from ".concat(fmt(d[0]), " to ").concat(fmt(peek$1(d)));
|
16377
16469
|
}
|
16378
16470
|
}
|
16379
16471
|
|
@@ -16525,59 +16617,83 @@
|
|
16525
16617
|
}
|
16526
16618
|
|
16527
16619
|
return curve;
|
16528
|
-
}
|
16529
|
-
|
16620
|
+
}
|
16530
16621
|
|
16531
|
-
const
|
16622
|
+
const paramCounts = {
|
16532
16623
|
m: 2,
|
16533
16624
|
l: 2,
|
16534
16625
|
h: 1,
|
16535
16626
|
v: 1,
|
16627
|
+
z: 0,
|
16536
16628
|
c: 6,
|
16537
16629
|
s: 4,
|
16538
16630
|
q: 4,
|
16539
16631
|
t: 2,
|
16540
16632
|
a: 7
|
16541
|
-
}
|
16542
|
-
|
16633
|
+
};
|
16634
|
+
const commandPattern = /[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi;
|
16635
|
+
const numberPattern = /^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/;
|
16636
|
+
const spacePattern = /^((\s+,?\s*)|(,\s*))/;
|
16637
|
+
const flagPattern = /^[01]/;
|
16543
16638
|
|
16544
|
-
function
|
16545
|
-
const
|
16546
|
-
|
16639
|
+
function parse$3(path) {
|
16640
|
+
const commands = [];
|
16641
|
+
const matches = path.match(commandPattern) || [];
|
16642
|
+
matches.forEach(str => {
|
16643
|
+
let cmd = str[0];
|
16644
|
+
const type = cmd.toLowerCase(); // parse parameters
|
16547
16645
|
|
16548
|
-
|
16646
|
+
const paramCount = paramCounts[type];
|
16647
|
+
const params = parseParams(type, paramCount, str.slice(1).trim());
|
16648
|
+
const count = params.length; // error checking based on parameter count
|
16549
16649
|
|
16550
|
-
|
16551
|
-
|
16552
|
-
|
16553
|
-
cmd = curr.charAt(0);
|
16554
|
-
parsed = [cmd];
|
16650
|
+
if (count < paramCount || count && count % paramCount !== 0) {
|
16651
|
+
throw Error('Invalid SVG path, incorrect parameter count');
|
16652
|
+
} // register the command
|
16555
16653
|
|
16556
|
-
|
16557
|
-
|
16558
|
-
|
16559
|
-
|
16560
|
-
|
16654
|
+
|
16655
|
+
commands.push([cmd, ...params.slice(0, paramCount)]); // exit now if we're done, also handles zero-param 'z'
|
16656
|
+
|
16657
|
+
if (count === paramCount) {
|
16658
|
+
return;
|
16659
|
+
} // handle implicit line-to
|
16660
|
+
|
16661
|
+
|
16662
|
+
if (type === 'm') {
|
16663
|
+
cmd = cmd === 'M' ? 'L' : 'l';
|
16664
|
+
} // repeat command when given extended param list
|
16665
|
+
|
16666
|
+
|
16667
|
+
for (let i = paramCount; i < count; i += paramCount) {
|
16668
|
+
commands.push([cmd, ...params.slice(i, i + paramCount)]);
|
16561
16669
|
}
|
16670
|
+
});
|
16671
|
+
return commands;
|
16672
|
+
}
|
16562
16673
|
|
16563
|
-
|
16674
|
+
function parseParams(type, paramCount, segment) {
|
16675
|
+
const params = [];
|
16564
16676
|
|
16565
|
-
|
16566
|
-
|
16567
|
-
|
16568
|
-
|
16677
|
+
for (let index = 0; paramCount && index < segment.length;) {
|
16678
|
+
for (let i = 0; i < paramCount; ++i) {
|
16679
|
+
const pattern = type === 'a' && (i === 3 || i === 4) ? flagPattern : numberPattern;
|
16680
|
+
const match = segment.slice(index).match(pattern);
|
16569
16681
|
|
16570
|
-
|
16682
|
+
if (match === null) {
|
16683
|
+
throw Error('Invalid SVG path, incorrect parameter type');
|
16684
|
+
}
|
16571
16685
|
|
16572
|
-
|
16573
|
-
|
16686
|
+
index += match[0].length;
|
16687
|
+
params.push(+match[0]);
|
16688
|
+
const ws = segment.slice(index).match(spacePattern);
|
16689
|
+
|
16690
|
+
if (ws !== null) {
|
16691
|
+
index += ws[0].length;
|
16574
16692
|
}
|
16575
|
-
} else {
|
16576
|
-
result.push(parsed);
|
16577
16693
|
}
|
16578
16694
|
}
|
16579
16695
|
|
16580
|
-
return
|
16696
|
+
return params;
|
16581
16697
|
}
|
16582
16698
|
|
16583
16699
|
const DegToRad = Math.PI / 180;
|
@@ -16724,7 +16840,9 @@
|
|
16724
16840
|
tempX,
|
16725
16841
|
tempY,
|
16726
16842
|
tempControlX,
|
16727
|
-
tempControlY
|
16843
|
+
tempControlY,
|
16844
|
+
anchorX = 0,
|
16845
|
+
anchorY = 0;
|
16728
16846
|
if (l == null) l = 0;
|
16729
16847
|
if (t == null) t = 0;
|
16730
16848
|
if (sX == null) sX = 1;
|
@@ -16782,6 +16900,8 @@
|
|
16782
16900
|
// moveTo, relative
|
16783
16901
|
x += current[1];
|
16784
16902
|
y += current[2];
|
16903
|
+
anchorX = x;
|
16904
|
+
anchorY = y;
|
16785
16905
|
context.moveTo(x + l, y + t);
|
16786
16906
|
break;
|
16787
16907
|
|
@@ -16789,6 +16909,8 @@
|
|
16789
16909
|
// moveTo, absolute
|
16790
16910
|
x = current[1];
|
16791
16911
|
y = current[2];
|
16912
|
+
anchorX = x;
|
16913
|
+
anchorY = y;
|
16792
16914
|
context.moveTo(x + l, y + t);
|
16793
16915
|
break;
|
16794
16916
|
|
@@ -16931,6 +17053,8 @@
|
|
16931
17053
|
|
16932
17054
|
case 'z':
|
16933
17055
|
case 'Z':
|
17056
|
+
x = anchorX;
|
17057
|
+
y = anchorY;
|
16934
17058
|
context.closePath();
|
16935
17059
|
break;
|
16936
17060
|
}
|
@@ -17096,7 +17220,7 @@
|
|
17096
17220
|
|
17097
17221
|
function customSymbol(path) {
|
17098
17222
|
if (!has$1(custom, path)) {
|
17099
|
-
const parsed =
|
17223
|
+
const parsed = parse$3(path);
|
17100
17224
|
custom[path] = {
|
17101
17225
|
draw: function (context, size) {
|
17102
17226
|
pathRender(context, parsed, 0, 0, Math.sqrt(size) / 2);
|
@@ -17389,7 +17513,7 @@
|
|
17389
17513
|
areahShape = area$2$1().y(y$2).x1(x$2).x0(xw).defined(def),
|
17390
17514
|
lineShape = line$2$1().x(x$2).y(y$2).defined(def),
|
17391
17515
|
rectShape = vg_rect().x(x$2).y(y$2).width(w).height(h).cornerRadius(tl, tr, br, bl),
|
17392
|
-
symbolShape =
|
17516
|
+
symbolShape = Symbol$1().type(type).size(sz),
|
17393
17517
|
trailShape = vg_trail().x(x$2).y(y$2).defined(def).size(ts);
|
17394
17518
|
|
17395
17519
|
function hasCornerRadius(item) {
|
@@ -18712,7 +18836,7 @@
|
|
18712
18836
|
cache = item.pathCache;
|
18713
18837
|
|
18714
18838
|
if (!cache || cache.path !== path) {
|
18715
|
-
(item.pathCache = cache =
|
18839
|
+
(item.pathCache = cache = parse$3(path)).path = path;
|
18716
18840
|
}
|
18717
18841
|
|
18718
18842
|
if (a && context.rotate && context.translate) {
|
@@ -18853,7 +18977,7 @@
|
|
18853
18977
|
}
|
18854
18978
|
|
18855
18979
|
function _measureWidth(text, currentFont) {
|
18856
|
-
const key =
|
18980
|
+
const key = "(".concat(currentFont, ") ").concat(text);
|
18857
18981
|
let width = widthCache.get(key);
|
18858
18982
|
|
18859
18983
|
if (width === undefined) {
|
@@ -20230,11 +20354,11 @@
|
|
20230
20354
|
},
|
20231
20355
|
'title-text': {
|
20232
20356
|
desc: 'title',
|
20233
|
-
caption: item =>
|
20357
|
+
caption: item => "Title text '".concat(titleCaption(item), "'")
|
20234
20358
|
},
|
20235
20359
|
'title-subtitle': {
|
20236
20360
|
desc: 'subtitle',
|
20237
|
-
caption: item =>
|
20361
|
+
caption: item => "Subtitle text '".concat(titleCaption(item), "'")
|
20238
20362
|
}
|
20239
20363
|
}; // aria properties generated for mark item encoding channels
|
20240
20364
|
|
@@ -20256,7 +20380,7 @@
|
|
20256
20380
|
const type = item.mark.marktype;
|
20257
20381
|
emit(ARIA_LABEL, item.description);
|
20258
20382
|
emit(ARIA_ROLE, item.ariaRole || (type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL));
|
20259
|
-
emit(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription ||
|
20383
|
+
emit(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || "".concat(type, " mark"));
|
20260
20384
|
}
|
20261
20385
|
}
|
20262
20386
|
|
@@ -20269,7 +20393,7 @@
|
|
20269
20393
|
function ariaMark(mark) {
|
20270
20394
|
const type = mark.marktype;
|
20271
20395
|
const recurse = type === 'group' || type === 'text' || mark.items.some(_ => _.description != null && _.aria !== false);
|
20272
|
-
return bundle(recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL,
|
20396
|
+
return bundle(recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, "".concat(type, " mark container"), mark.description);
|
20273
20397
|
}
|
20274
20398
|
|
20275
20399
|
function ariaGuide(mark, opt) {
|
@@ -20296,19 +20420,19 @@
|
|
20296
20420
|
locale = ctx.dataflow.locale(),
|
20297
20421
|
type = scale.type,
|
20298
20422
|
xy = orient === 'left' || orient === 'right' ? 'Y' : 'X';
|
20299
|
-
return
|
20423
|
+
return "".concat(xy, "-axis") + (title ? " titled '".concat(title, "'") : '') + " for a ".concat(isDiscrete(type) ? 'discrete' : type, " scale") + " with ".concat(domainCaption(locale, scale, item));
|
20300
20424
|
}
|
20301
20425
|
|
20302
20426
|
function legendCaption(item) {
|
20303
20427
|
const datum = item.datum,
|
20304
20428
|
title = datum.title ? extractTitle(item) : null,
|
20305
|
-
type =
|
20429
|
+
type = "".concat(datum.type || '', " legend").trim(),
|
20306
20430
|
scales = datum.scales,
|
20307
20431
|
props = Object.keys(scales),
|
20308
20432
|
ctx = item.context,
|
20309
20433
|
scale = ctx.scales[scales[props[0]]].value,
|
20310
20434
|
locale = ctx.dataflow.locale();
|
20311
|
-
return capitalize(type) + (title ?
|
20435
|
+
return capitalize(type) + (title ? " titled '".concat(title, "'") : '') + " for ".concat(channelCaption(props)) + " with ".concat(domainCaption(locale, scale, item));
|
20312
20436
|
}
|
20313
20437
|
|
20314
20438
|
function extractTitle(item) {
|
@@ -20341,21 +20465,25 @@
|
|
20341
20465
|
clear = () => outer = inner = '',
|
20342
20466
|
push = tag => {
|
20343
20467
|
if (outer) {
|
20344
|
-
buf +=
|
20468
|
+
buf += "".concat(outer, ">").concat(inner);
|
20345
20469
|
clear();
|
20346
20470
|
}
|
20347
20471
|
|
20348
20472
|
stack.push(tag);
|
20349
20473
|
},
|
20350
20474
|
attr = (name, value) => {
|
20351
|
-
if (value != null) outer +=
|
20475
|
+
if (value != null) outer += " ".concat(name, "=\"").concat(attrText(value), "\"");
|
20352
20476
|
return m;
|
20353
20477
|
},
|
20354
20478
|
m = {
|
20355
|
-
open(tag
|
20479
|
+
open(tag) {
|
20356
20480
|
push(tag);
|
20357
20481
|
outer = '<' + tag;
|
20358
20482
|
|
20483
|
+
for (var _len = arguments.length, attrs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
20484
|
+
attrs[_key - 1] = arguments[_key];
|
20485
|
+
}
|
20486
|
+
|
20359
20487
|
for (const set of attrs) {
|
20360
20488
|
for (const key in set) attr(key, set[key]);
|
20361
20489
|
}
|
@@ -20367,9 +20495,9 @@
|
|
20367
20495
|
const tag = stack.pop();
|
20368
20496
|
|
20369
20497
|
if (outer) {
|
20370
|
-
buf += outer + (inner ?
|
20498
|
+
buf += outer + (inner ? ">".concat(inner, "</").concat(tag, ">") : '/>');
|
20371
20499
|
} else {
|
20372
|
-
buf +=
|
20500
|
+
buf += "</".concat(tag, ">");
|
20373
20501
|
}
|
20374
20502
|
|
20375
20503
|
clear();
|
@@ -20410,7 +20538,7 @@
|
|
20410
20538
|
return m.close();
|
20411
20539
|
}
|
20412
20540
|
|
20413
|
-
const
|
20541
|
+
const stylesAttr = {
|
20414
20542
|
fill: 'fill',
|
20415
20543
|
fillOpacity: 'fill-opacity',
|
20416
20544
|
stroke: 'stroke',
|
@@ -20421,7 +20549,9 @@
|
|
20421
20549
|
strokeDash: 'stroke-dasharray',
|
20422
20550
|
strokeDashOffset: 'stroke-dashoffset',
|
20423
20551
|
strokeMiterLimit: 'stroke-miterlimit',
|
20424
|
-
opacity: 'opacity'
|
20552
|
+
opacity: 'opacity'
|
20553
|
+
};
|
20554
|
+
const stylesCss = {
|
20425
20555
|
blend: 'mix-blend-mode'
|
20426
20556
|
}; // ensure miter limit default is consistent with canvas (#2498)
|
20427
20557
|
|
@@ -20513,10 +20643,10 @@
|
|
20513
20643
|
setAttributes(this._svg, {
|
20514
20644
|
width: this._width * this._scale,
|
20515
20645
|
height: this._height * this._scale,
|
20516
|
-
viewBox:
|
20646
|
+
viewBox: "0 0 ".concat(this._width, " ").concat(this._height)
|
20517
20647
|
});
|
20518
20648
|
|
20519
|
-
this._root.setAttribute('transform',
|
20649
|
+
this._root.setAttribute('transform', "translate(".concat(this._origin, ")"));
|
20520
20650
|
}
|
20521
20651
|
|
20522
20652
|
this._dirty = [];
|
@@ -20599,7 +20729,7 @@
|
|
20599
20729
|
* @param {Item} item - The mark item.
|
20600
20730
|
*/
|
20601
20731
|
isDirty(item) {
|
20602
|
-
return this._dirtyAll || !item._svg || item.dirty === this._dirtyID;
|
20732
|
+
return this._dirtyAll || !item._svg || !item._svg.ownerSVGElement || item.dirty === this._dirtyID;
|
20603
20733
|
},
|
20604
20734
|
|
20605
20735
|
/**
|
@@ -20676,13 +20806,14 @@
|
|
20676
20806
|
* @param {SVGElement} prev - The previous sibling in the SVG tree.
|
20677
20807
|
*/
|
20678
20808
|
mark(el, scene, prev) {
|
20679
|
-
if (!this.isDirty(scene))
|
20809
|
+
if (!this.isDirty(scene)) {
|
20810
|
+
return scene._svg;
|
20811
|
+
}
|
20812
|
+
|
20680
20813
|
const svg = this._svg,
|
20681
20814
|
mdef = Marks[scene.marktype],
|
20682
20815
|
events = scene.interactive === false ? 'none' : null,
|
20683
20816
|
isGroup = mdef.tag === 'g';
|
20684
|
-
let sibling = null,
|
20685
|
-
i = 0;
|
20686
20817
|
const parent = bind$1(scene, el, prev, 'g', svg);
|
20687
20818
|
parent.setAttribute('class', cssClass(scene)); // apply aria attributes to parent container element
|
20688
20819
|
|
@@ -20695,6 +20826,8 @@
|
|
20695
20826
|
}
|
20696
20827
|
|
20697
20828
|
setAttribute(parent, 'clip-path', scene.clip ? clip$1$1(this, scene, scene.group) : null);
|
20829
|
+
let sibling = null,
|
20830
|
+
i = 0;
|
20698
20831
|
|
20699
20832
|
const process = item => {
|
20700
20833
|
const dirty = this.isDirty(item),
|
@@ -20751,10 +20884,10 @@
|
|
20751
20884
|
style(el, item) {
|
20752
20885
|
if (item == null) return;
|
20753
20886
|
|
20754
|
-
for (const prop in
|
20887
|
+
for (const prop in stylesAttr) {
|
20755
20888
|
let value = prop === 'font' ? fontFamily(item) : item[prop];
|
20756
20889
|
if (value === values[prop]) continue;
|
20757
|
-
const name =
|
20890
|
+
const name = stylesAttr[prop];
|
20758
20891
|
|
20759
20892
|
if (value == null) {
|
20760
20893
|
el.removeAttribute(name);
|
@@ -20768,6 +20901,10 @@
|
|
20768
20901
|
|
20769
20902
|
values[prop] = value;
|
20770
20903
|
}
|
20904
|
+
|
20905
|
+
for (const prop in stylesCss) {
|
20906
|
+
setStyle(el, stylesCss[prop], item[prop]);
|
20907
|
+
}
|
20771
20908
|
},
|
20772
20909
|
|
20773
20910
|
/**
|
@@ -20839,7 +20976,7 @@
|
|
20839
20976
|
setAttributes(pt, {
|
20840
20977
|
width: 1,
|
20841
20978
|
height: 1,
|
20842
|
-
fill:
|
20979
|
+
fill: "url(".concat(href(), "#").concat(grad.id, ")")
|
20843
20980
|
});
|
20844
20981
|
el = domChild(el, index++, 'radialGradient', svgns);
|
20845
20982
|
setAttributes(el, {
|
@@ -20897,6 +21034,8 @@
|
|
20897
21034
|
|
20898
21035
|
|
20899
21036
|
function recurse(renderer, el, group) {
|
21037
|
+
// child 'g' element is second to last among children (path, g, path)
|
21038
|
+
// other children here are foreground and background path elements
|
20900
21039
|
el = el.lastChild.previousSibling;
|
20901
21040
|
let prev,
|
20902
21041
|
idx = 0;
|
@@ -21141,7 +21280,7 @@
|
|
21141
21280
|
class: 'marks',
|
21142
21281
|
width: this._width * this._scale,
|
21143
21282
|
height: this._height * this._scale,
|
21144
|
-
viewBox:
|
21283
|
+
viewBox: "0 0 ".concat(this._width, " ").concat(this._height)
|
21145
21284
|
})); // background, if defined
|
21146
21285
|
|
21147
21286
|
const bg = this._bgcolor;
|
@@ -21393,6 +21532,7 @@
|
|
21393
21532
|
}); // Helper function for attr for style presentation attributes
|
21394
21533
|
|
21395
21534
|
function style(s, item, scene, tag, defs) {
|
21535
|
+
let styleList;
|
21396
21536
|
if (item == null) return s;
|
21397
21537
|
|
21398
21538
|
if (tag === 'bgrect' && scene.interactive === false) {
|
@@ -21409,7 +21549,7 @@
|
|
21409
21549
|
}
|
21410
21550
|
|
21411
21551
|
if (tag === 'image' && item.smooth === false) {
|
21412
|
-
|
21552
|
+
styleList = ['image-rendering: optimizeSpeed;', 'image-rendering: pixelated;'];
|
21413
21553
|
}
|
21414
21554
|
|
21415
21555
|
if (tag === 'text') {
|
@@ -21420,9 +21560,9 @@
|
|
21420
21560
|
s['font-weight'] = item.fontWeight;
|
21421
21561
|
}
|
21422
21562
|
|
21423
|
-
for (const prop in
|
21563
|
+
for (const prop in stylesAttr) {
|
21424
21564
|
let value = item[prop];
|
21425
|
-
const name =
|
21565
|
+
const name = stylesAttr[prop];
|
21426
21566
|
if (value === 'transparent' && (name === 'fill' || name === 'stroke')) ;else if (value != null) {
|
21427
21567
|
if (isGradient(value)) {
|
21428
21568
|
value = gradientRef(value, defs.gradient, '');
|
@@ -21432,6 +21572,19 @@
|
|
21432
21572
|
}
|
21433
21573
|
}
|
21434
21574
|
|
21575
|
+
for (const prop in stylesCss) {
|
21576
|
+
const value = item[prop];
|
21577
|
+
|
21578
|
+
if (value != null) {
|
21579
|
+
styleList = styleList || [];
|
21580
|
+
styleList.push("".concat(stylesCss[prop], ": ").concat(value, ";"));
|
21581
|
+
}
|
21582
|
+
}
|
21583
|
+
|
21584
|
+
if (styleList) {
|
21585
|
+
s.style = styleList.join(' ');
|
21586
|
+
}
|
21587
|
+
|
21435
21588
|
return s;
|
21436
21589
|
}
|
21437
21590
|
|
@@ -21561,7 +21714,7 @@
|
|
21561
21714
|
}
|
21562
21715
|
|
21563
21716
|
function pathEqual(a, b) {
|
21564
|
-
return sceneEqual(
|
21717
|
+
return sceneEqual(parse$3(a), parse$3(b));
|
21565
21718
|
}
|
21566
21719
|
|
21567
21720
|
function objectEqual(a, b) {
|
@@ -23336,7 +23489,7 @@
|
|
23336
23489
|
ellipsis = values[items.length];
|
23337
23490
|
items.push(ingest$1({
|
23338
23491
|
index: items.length,
|
23339
|
-
label:
|
23492
|
+
label: "\u2026".concat(values.length - items.length, " entries"),
|
23340
23493
|
value: ellipsis,
|
23341
23494
|
offset: offset,
|
23342
23495
|
size: size(ellipsis, _)
|
@@ -23581,8 +23734,8 @@
|
|
23581
23734
|
values = data.map(field),
|
23582
23735
|
n = values.length,
|
23583
23736
|
a = start,
|
23584
|
-
k = (stop - start) / sum(values),
|
23585
|
-
index = range$
|
23737
|
+
k = (stop - start) / sum$1(values),
|
23738
|
+
index = range$3(n),
|
23586
23739
|
i,
|
23587
23740
|
t,
|
23588
23741
|
v;
|
@@ -23768,7 +23921,7 @@
|
|
23768
23921
|
if (!step) error('Scale bins parameter missing step property.');
|
23769
23922
|
if (start < lo) start = step * Math.ceil(lo / step);
|
23770
23923
|
if (stop > hi) stop = step * Math.floor(hi / step);
|
23771
|
-
bins = range$
|
23924
|
+
bins = range$3(start, stop + step / 2, step);
|
23772
23925
|
}
|
23773
23926
|
|
23774
23927
|
if (bins) {
|
@@ -23810,7 +23963,7 @@
|
|
23810
23963
|
if (scale.interpolator) {
|
23811
23964
|
return scale.interpolator(range);
|
23812
23965
|
} else {
|
23813
|
-
error(
|
23966
|
+
error("Scale type ".concat(type, " does not support interpolating color schemes."));
|
23814
23967
|
}
|
23815
23968
|
}
|
23816
23969
|
} // given a range array for an interpolating scale, convert to interpolator
|
@@ -23853,7 +24006,7 @@
|
|
23853
24006
|
} else {
|
23854
24007
|
name = _.scheme.toLowerCase();
|
23855
24008
|
scheme$1 = scheme(name);
|
23856
|
-
if (!scheme$1) error(
|
24009
|
+
if (!scheme$1) error("Unrecognized scheme name: ".concat(_.scheme));
|
23857
24010
|
} // determine size for potential discrete range
|
23858
24011
|
|
23859
24012
|
|
@@ -24072,7 +24225,7 @@
|
|
24072
24225
|
stack: Stack
|
24073
24226
|
});
|
24074
24227
|
|
24075
|
-
var epsilon$
|
24228
|
+
var epsilon$3 = 1e-6;
|
24076
24229
|
var epsilon2 = 1e-12;
|
24077
24230
|
var pi$1 = Math.PI;
|
24078
24231
|
var halfPi$1 = pi$1 / 2;
|
@@ -24312,7 +24465,7 @@
|
|
24312
24465
|
boundsStream$2.point = boundsPoint$1;
|
24313
24466
|
boundsStream$2.lineStart = boundsLineStart;
|
24314
24467
|
boundsStream$2.lineEnd = boundsLineEnd;
|
24315
|
-
if (areaRingSum$1 < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);else if (deltaSum > epsilon$
|
24468
|
+
if (areaRingSum$1 < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);else if (deltaSum > epsilon$3) phi1 = 90;else if (deltaSum < -epsilon$3) phi0 = -90;
|
24316
24469
|
range$2[0] = lambda0, range$2[1] = lambda1;
|
24317
24470
|
},
|
24318
24471
|
sphere: function () {
|
@@ -24408,7 +24561,7 @@
|
|
24408
24561
|
function boundsRingEnd() {
|
24409
24562
|
boundsRingPoint(lambda00$1, phi00$1);
|
24410
24563
|
areaStream$1.lineEnd();
|
24411
|
-
if (abs$1(deltaSum) > epsilon$
|
24564
|
+
if (abs$1(deltaSum) > epsilon$3) lambda0 = -(lambda1 = 180);
|
24412
24565
|
range$2[0] = lambda0, range$2[1] = lambda1;
|
24413
24566
|
p0 = null;
|
24414
24567
|
} // Finds the left-right distance between two longitudes.
|
@@ -24583,7 +24736,7 @@
|
|
24583
24736
|
if (m < epsilon2) {
|
24584
24737
|
x = X1$1, y = Y1$1, z = Z1$1; // If the feature has zero length, fall back to arithmetic mean of point vectors.
|
24585
24738
|
|
24586
|
-
if (W1 < epsilon$
|
24739
|
+
if (W1 < epsilon$3) x = X0$1, y = Y0$1, z = Z0$1;
|
24587
24740
|
m = hypot(x, y, z); // If the feature still has an undefined ccentroid, then return.
|
24588
24741
|
|
24589
24742
|
if (m < epsilon2) return [NaN, NaN];
|
@@ -24692,7 +24845,7 @@
|
|
24692
24845
|
point = cartesian(point), point[0] -= cosRadius;
|
24693
24846
|
cartesianNormalizeInPlace(point);
|
24694
24847
|
var radius = acos(-point[1]);
|
24695
|
-
return ((-point[2] < 0 ? -radius : radius) + tau$1 - epsilon$
|
24848
|
+
return ((-point[2] < 0 ? -radius : radius) + tau$1 - epsilon$3) % tau$1;
|
24696
24849
|
}
|
24697
24850
|
|
24698
24851
|
function clipBuffer () {
|
@@ -24719,7 +24872,7 @@
|
|
24719
24872
|
}
|
24720
24873
|
|
24721
24874
|
function pointEqual (a, b) {
|
24722
|
-
return abs$1(a[0] - b[0]) < epsilon$
|
24875
|
+
return abs$1(a[0] - b[0]) < epsilon$3 && abs$1(a[1] - b[1]) < epsilon$3;
|
24723
24876
|
}
|
24724
24877
|
|
24725
24878
|
function Intersection(point, points, other, entry) {
|
@@ -24760,7 +24913,7 @@
|
|
24760
24913
|
} // handle degenerate cases by moving the point
|
24761
24914
|
|
24762
24915
|
|
24763
|
-
p1[0] += 2 * epsilon$
|
24916
|
+
p1[0] += 2 * epsilon$3;
|
24764
24917
|
}
|
24765
24918
|
|
24766
24919
|
subject.push(x = new Intersection(p0, segment, null, true));
|
@@ -24841,7 +24994,7 @@
|
|
24841
24994
|
}
|
24842
24995
|
|
24843
24996
|
function longitude(point) {
|
24844
|
-
|
24997
|
+
return abs$1(point[0]) <= pi$1 ? point[0] : sign(point[0]) * ((abs$1(point[0]) + pi$1) % tau$1 - pi$1);
|
24845
24998
|
}
|
24846
24999
|
|
24847
25000
|
function polygonContains (polygon, point) {
|
@@ -24852,7 +25005,7 @@
|
|
24852
25005
|
angle = 0,
|
24853
25006
|
winding = 0;
|
24854
25007
|
var sum = new Adder();
|
24855
|
-
if (sinPhi === 1) phi = halfPi$1 + epsilon$
|
25008
|
+
if (sinPhi === 1) phi = halfPi$1 + epsilon$3;else if (sinPhi === -1) phi = -halfPi$1 - epsilon$3;
|
24856
25009
|
|
24857
25010
|
for (var i = 0, n = polygon.length; i < n; ++i) {
|
24858
25011
|
if (!(m = (ring = polygon[i]).length)) continue;
|
@@ -24903,7 +25056,7 @@
|
|
24903
25056
|
// same side as the South pole.
|
24904
25057
|
|
24905
25058
|
|
24906
|
-
return (angle < -epsilon$
|
25059
|
+
return (angle < -epsilon$3 || angle < epsilon$3 && sum < -epsilon2) ^ winding & 1;
|
24907
25060
|
}
|
24908
25061
|
|
24909
25062
|
function clip$1 (pointVisible, clipLine, interpolate, start) {
|
@@ -25030,7 +25183,7 @@
|
|
25030
25183
|
|
25031
25184
|
|
25032
25185
|
function compareIntersection(a, b) {
|
25033
|
-
return ((a = a.x)[0] < 0 ? a[1] - halfPi$1 - epsilon$
|
25186
|
+
return ((a = a.x)[0] < 0 ? a[1] - halfPi$1 - epsilon$3 : halfPi$1 - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi$1 - epsilon$3 : halfPi$1 - b[1]);
|
25034
25187
|
}
|
25035
25188
|
|
25036
25189
|
var clipAntimeridian = clip$1(function () {
|
@@ -25054,7 +25207,7 @@
|
|
25054
25207
|
var sign1 = lambda1 > 0 ? pi$1 : -pi$1,
|
25055
25208
|
delta = abs$1(lambda1 - lambda0);
|
25056
25209
|
|
25057
|
-
if (abs$1(delta - pi$1) < epsilon$
|
25210
|
+
if (abs$1(delta - pi$1) < epsilon$3) {
|
25058
25211
|
// line crosses a pole
|
25059
25212
|
stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi$1 : -halfPi$1);
|
25060
25213
|
stream.point(sign0, phi0);
|
@@ -25065,9 +25218,9 @@
|
|
25065
25218
|
clean = 0;
|
25066
25219
|
} else if (sign0 !== sign1 && delta >= pi$1) {
|
25067
25220
|
// line crosses antimeridian
|
25068
|
-
if (abs$1(lambda0 - sign0) < epsilon$
|
25221
|
+
if (abs$1(lambda0 - sign0) < epsilon$3) lambda0 -= sign0 * epsilon$3; // handle degeneracies
|
25069
25222
|
|
25070
|
-
if (abs$1(lambda1 - sign1) < epsilon$
|
25223
|
+
if (abs$1(lambda1 - sign1) < epsilon$3) lambda1 -= sign1 * epsilon$3;
|
25071
25224
|
phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);
|
25072
25225
|
stream.point(sign0, phi0);
|
25073
25226
|
stream.lineEnd();
|
@@ -25093,7 +25246,7 @@
|
|
25093
25246
|
var cosPhi0,
|
25094
25247
|
cosPhi1,
|
25095
25248
|
sinLambda0Lambda1 = sin$1(lambda0 - lambda1);
|
25096
|
-
return abs$1(sinLambda0Lambda1) > epsilon$
|
25249
|
+
return abs$1(sinLambda0Lambda1) > epsilon$3 ? atan((sin$1(phi0) * (cosPhi1 = cos$1(phi1)) * sin$1(lambda1) - sin$1(phi1) * (cosPhi0 = cos$1(phi0)) * sin$1(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2;
|
25097
25250
|
}
|
25098
25251
|
|
25099
25252
|
function clipAntimeridianInterpolate(from, to, direction, stream) {
|
@@ -25110,7 +25263,7 @@
|
|
25110
25263
|
stream.point(-pi$1, -phi);
|
25111
25264
|
stream.point(-pi$1, 0);
|
25112
25265
|
stream.point(-pi$1, phi);
|
25113
|
-
} else if (abs$1(from[0] - to[0]) > epsilon$
|
25266
|
+
} else if (abs$1(from[0] - to[0]) > epsilon$3) {
|
25114
25267
|
var lambda = from[0] < to[0] ? pi$1 : -pi$1;
|
25115
25268
|
phi = direction * lambda / 2;
|
25116
25269
|
stream.point(-lambda, phi);
|
@@ -25125,7 +25278,7 @@
|
|
25125
25278
|
var cr = cos$1(radius),
|
25126
25279
|
delta = 6 * radians,
|
25127
25280
|
smallRadius = cr > 0,
|
25128
|
-
notHemisphere = abs$1(cr) > epsilon$
|
25281
|
+
notHemisphere = abs$1(cr) > epsilon$3; // TODO optimise for this common case
|
25129
25282
|
|
25130
25283
|
function interpolate(from, to, direction, stream) {
|
25131
25284
|
circleStream(stream, radius, delta, direction, from, to);
|
@@ -25258,11 +25411,11 @@
|
|
25258
25411
|
z;
|
25259
25412
|
if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;
|
25260
25413
|
var delta = lambda1 - lambda0,
|
25261
|
-
polar = abs$1(delta - pi$1) < epsilon$
|
25262
|
-
meridian = polar || delta < epsilon$
|
25414
|
+
polar = abs$1(delta - pi$1) < epsilon$3,
|
25415
|
+
meridian = polar || delta < epsilon$3;
|
25263
25416
|
if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; // Check that the first point is between a and b.
|
25264
25417
|
|
25265
|
-
if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < (abs$1(q[0] - lambda0) < epsilon$
|
25418
|
+
if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < (abs$1(q[0] - lambda0) < epsilon$3 ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta > pi$1 ^ (lambda0 <= q[0] && q[0] <= lambda1)) {
|
25266
25419
|
var q1 = cartesianScale(u, (-w + t) / uu);
|
25267
25420
|
cartesianAddInPlace(q1, A);
|
25268
25421
|
return [q, spherical(q1)];
|
@@ -25370,7 +25523,7 @@
|
|
25370
25523
|
}
|
25371
25524
|
|
25372
25525
|
function corner(p, direction) {
|
25373
|
-
return abs$1(p[0] - x0) < epsilon$
|
25526
|
+
return abs$1(p[0] - x0) < epsilon$3 ? direction > 0 ? 0 : 3 : abs$1(p[0] - x1) < epsilon$3 ? direction > 0 ? 2 : 1 : abs$1(p[1] - y0) < epsilon$3 ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon
|
25374
25527
|
}
|
25375
25528
|
|
25376
25529
|
function compareIntersection(a, b) {
|
@@ -25522,7 +25675,7 @@
|
|
25522
25675
|
}
|
25523
25676
|
|
25524
25677
|
function graticuleX(y0, y1, dy) {
|
25525
|
-
var y = range$
|
25678
|
+
var y = range$3(y0, y1 - epsilon$3, dy).concat(y1);
|
25526
25679
|
return function (x) {
|
25527
25680
|
return y.map(function (y) {
|
25528
25681
|
return [x, y];
|
@@ -25531,7 +25684,7 @@
|
|
25531
25684
|
}
|
25532
25685
|
|
25533
25686
|
function graticuleY(x0, x1, dx) {
|
25534
|
-
var x = range$
|
25687
|
+
var x = range$3(x0, x1 - epsilon$3, dx).concat(x1);
|
25535
25688
|
return function (y) {
|
25536
25689
|
return x.map(function (x) {
|
25537
25690
|
return [x, y];
|
@@ -25566,10 +25719,10 @@
|
|
25566
25719
|
}
|
25567
25720
|
|
25568
25721
|
function lines() {
|
25569
|
-
return range$
|
25570
|
-
return abs$1(x % DX) > epsilon$
|
25571
|
-
}).map(x)).concat(range$
|
25572
|
-
return abs$1(y % DY) > epsilon$
|
25722
|
+
return range$3(ceil(X0 / DX) * DX, X1, DX).map(X).concat(range$3(ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(range$3(ceil(x0 / dx) * dx, x1, dx).filter(function (x) {
|
25723
|
+
return abs$1(x % DX) > epsilon$3;
|
25724
|
+
}).map(x)).concat(range$3(ceil(y0 / dy) * dy, y1, dy).filter(function (y) {
|
25725
|
+
return abs$1(y % DY) > epsilon$3;
|
25573
25726
|
}).map(y));
|
25574
25727
|
}
|
25575
25728
|
|
@@ -25639,7 +25792,7 @@
|
|
25639
25792
|
return graticule;
|
25640
25793
|
};
|
25641
25794
|
|
25642
|
-
return graticule.extentMajor([[-180, -90 + epsilon$
|
25795
|
+
return graticule.extentMajor([[-180, -90 + epsilon$3], [180, 90 - epsilon$3]]).extentMinor([[-180, -80 - epsilon$3], [180, 80 + epsilon$3]]);
|
25643
25796
|
}
|
25644
25797
|
|
25645
25798
|
var identity = (x => x);
|
@@ -26125,7 +26278,7 @@
|
|
26125
26278
|
c = c0 + c1,
|
26126
26279
|
m = sqrt$1(a * a + b * b + c * c),
|
26127
26280
|
phi2 = asin$1(c /= m),
|
26128
|
-
lambda2 = abs$1(abs$1(c) - 1) < epsilon$
|
26281
|
+
lambda2 = abs$1(abs$1(c) - 1) < epsilon$3 || abs$1(lambda0 - lambda1) < epsilon$3 ? (lambda0 + lambda1) / 2 : atan2(b, a),
|
26129
26282
|
p = project(lambda2, phi2),
|
26130
26283
|
x2 = p[0],
|
26131
26284
|
y2 = p[1],
|
@@ -26432,7 +26585,7 @@
|
|
26432
26585
|
var sy0 = sin$1(y0),
|
26433
26586
|
n = (sy0 + sin$1(y1)) / 2; // Are the parallels symmetrical around the Equator?
|
26434
26587
|
|
26435
|
-
if (abs$1(n) < epsilon$
|
26588
|
+
if (abs$1(n) < epsilon$3) return cylindricalEqualAreaRaw(y0);
|
26436
26589
|
var c = 1 + sy0 * (2 * n - sy0),
|
26437
26590
|
r0 = sqrt$1(c) / n;
|
26438
26591
|
|
@@ -26555,8 +26708,8 @@
|
|
26555
26708
|
x = +_[0],
|
26556
26709
|
y = +_[1];
|
26557
26710
|
lower48Point = lower48.translate(_).clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]]).stream(pointStream);
|
26558
|
-
alaskaPoint = alaska.translate([x - 0.307 * k, y + 0.201 * k]).clipExtent([[x - 0.425 * k + epsilon$
|
26559
|
-
hawaiiPoint = hawaii.translate([x - 0.205 * k, y + 0.212 * k]).clipExtent([[x - 0.214 * k + epsilon$
|
26711
|
+
alaskaPoint = alaska.translate([x - 0.307 * k, y + 0.201 * k]).clipExtent([[x - 0.425 * k + epsilon$3, y + 0.120 * k + epsilon$3], [x - 0.214 * k - epsilon$3, y + 0.234 * k - epsilon$3]]).stream(pointStream);
|
26712
|
+
hawaiiPoint = hawaii.translate([x - 0.205 * k, y + 0.212 * k]).clipExtent([[x - 0.214 * k + epsilon$3, y + 0.166 * k + epsilon$3], [x - 0.115 * k - epsilon$3, y + 0.234 * k - epsilon$3]]).stream(pointStream);
|
26560
26713
|
return reset();
|
26561
26714
|
};
|
26562
26715
|
|
@@ -26682,9 +26835,9 @@
|
|
26682
26835
|
|
26683
26836
|
function project(x, y) {
|
26684
26837
|
if (f > 0) {
|
26685
|
-
if (y < -halfPi$1 + epsilon$
|
26838
|
+
if (y < -halfPi$1 + epsilon$3) y = -halfPi$1 + epsilon$3;
|
26686
26839
|
} else {
|
26687
|
-
if (y > halfPi$1 - epsilon$
|
26840
|
+
if (y > halfPi$1 - epsilon$3) y = halfPi$1 - epsilon$3;
|
26688
26841
|
}
|
26689
26842
|
|
26690
26843
|
var r = f / pow$1(tany(y), n);
|
@@ -26717,7 +26870,7 @@
|
|
26717
26870
|
var cy0 = cos$1(y0),
|
26718
26871
|
n = y0 === y1 ? sin$1(y0) : (cy0 - cos$1(y1)) / (y1 - y0),
|
26719
26872
|
g = cy0 / n + y0;
|
26720
|
-
if (abs$1(n) < epsilon$
|
26873
|
+
if (abs$1(n) < epsilon$3) return equirectangularRaw;
|
26721
26874
|
|
26722
26875
|
function project(x, y) {
|
26723
26876
|
var gy = g - y,
|
@@ -26907,7 +27060,7 @@
|
|
26907
27060
|
var phi2 = phi * phi,
|
26908
27061
|
phi4 = phi2 * phi2;
|
26909
27062
|
phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) / (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi2 - 0.005916 * 11 * phi4)));
|
26910
|
-
} while (abs$1(delta) > epsilon$
|
27063
|
+
} while (abs$1(delta) > epsilon$3 && --i > 0);
|
26911
27064
|
|
26912
27065
|
return [x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))), phi];
|
26913
27066
|
};
|
@@ -26921,7 +27074,7 @@
|
|
26921
27074
|
}
|
26922
27075
|
orthographicRaw.invert = azimuthalInvert(asin$1);
|
26923
27076
|
function geoOrthographic () {
|
26924
|
-
return projection$1(orthographicRaw).scale(249.5).clipAngle(90 + epsilon$
|
27077
|
+
return projection$1(orthographicRaw).scale(249.5).clipAngle(90 + epsilon$3);
|
26925
27078
|
}
|
26926
27079
|
|
26927
27080
|
function stereographicRaw(x, y) {
|
@@ -26963,7 +27116,7 @@
|
|
26963
27116
|
var abs = Math.abs;
|
26964
27117
|
var cos = Math.cos;
|
26965
27118
|
var sin = Math.sin;
|
26966
|
-
var epsilon$
|
27119
|
+
var epsilon$2 = 1e-6;
|
26967
27120
|
var pi = Math.PI;
|
26968
27121
|
var halfPi = pi / 2;
|
26969
27122
|
var sqrt2 = sqrt(2);
|
@@ -26979,7 +27132,7 @@
|
|
26979
27132
|
i = 30,
|
26980
27133
|
delta;
|
26981
27134
|
|
26982
|
-
do phi -= delta = (phi + sin(phi) - cpsinPhi) / (1 + cos(phi)); while (abs(delta) > epsilon$
|
27135
|
+
do phi -= delta = (phi + sin(phi) - cpsinPhi) / (1 + cos(phi)); while (abs(delta) > epsilon$2 && --i > 0);
|
26983
27136
|
|
26984
27137
|
return phi / 2;
|
26985
27138
|
}
|
@@ -27318,7 +27471,7 @@
|
|
27318
27471
|
stop = ex[1],
|
27319
27472
|
span = stop - start,
|
27320
27473
|
step = nice ? tickStep(start, stop, k) : span / (k + 1);
|
27321
|
-
return range$
|
27474
|
+
return range$3(start + step, stop, step);
|
27322
27475
|
};
|
27323
27476
|
}
|
27324
27477
|
/**
|
@@ -27546,7 +27699,7 @@
|
|
27546
27699
|
// density in points per square pixel or probability density
|
27547
27700
|
|
27548
27701
|
|
27549
|
-
const s = counts ? Math.pow(2, -2 * k) : 1 / sum(values);
|
27702
|
+
const s = counts ? Math.pow(2, -2 * k) : 1 / sum$1(values);
|
27550
27703
|
|
27551
27704
|
for (let i = 0, sz = n * m; i < sz; ++i) values[i] *= s;
|
27552
27705
|
|
@@ -29382,7 +29535,7 @@
|
|
29382
29535
|
e;
|
29383
29536
|
|
29384
29537
|
while (t) {
|
29385
|
-
if ((e = clockNow - t._time) >= 0) t._call.call(
|
29538
|
+
if ((e = clockNow - t._time) >= 0) t._call.call(undefined, e);
|
29386
29539
|
t = t._next;
|
29387
29540
|
}
|
29388
29541
|
|
@@ -30926,7 +31079,8 @@
|
|
30926
31079
|
var preroot = {
|
30927
31080
|
depth: -1
|
30928
31081
|
},
|
30929
|
-
ambiguous = {}
|
31082
|
+
ambiguous = {},
|
31083
|
+
imputed = {};
|
30930
31084
|
|
30931
31085
|
function defaultId(d) {
|
30932
31086
|
return d.id;
|
@@ -30938,11 +31092,14 @@
|
|
30938
31092
|
|
30939
31093
|
function stratify () {
|
30940
31094
|
var id = defaultId,
|
30941
|
-
parentId = defaultParentId
|
31095
|
+
parentId = defaultParentId,
|
31096
|
+
path;
|
30942
31097
|
|
30943
31098
|
function stratify(data) {
|
30944
31099
|
var nodes = Array.from(data),
|
30945
|
-
|
31100
|
+
currentId = id,
|
31101
|
+
currentParentId = parentId,
|
31102
|
+
n,
|
30946
31103
|
d,
|
30947
31104
|
i,
|
30948
31105
|
root,
|
@@ -30952,15 +31109,34 @@
|
|
30952
31109
|
nodeKey,
|
30953
31110
|
nodeByKey = new Map();
|
30954
31111
|
|
30955
|
-
|
31112
|
+
if (path != null) {
|
31113
|
+
const I = nodes.map((d, i) => normalize(path(d, i, data)));
|
31114
|
+
const P = I.map(parentof);
|
31115
|
+
const S = new Set(I).add("");
|
31116
|
+
|
31117
|
+
for (const i of P) {
|
31118
|
+
if (!S.has(i)) {
|
31119
|
+
S.add(i);
|
31120
|
+
I.push(i);
|
31121
|
+
P.push(parentof(i));
|
31122
|
+
nodes.push(imputed);
|
31123
|
+
}
|
31124
|
+
}
|
31125
|
+
|
31126
|
+
currentId = (_, i) => I[i];
|
31127
|
+
|
31128
|
+
currentParentId = (_, i) => P[i];
|
31129
|
+
}
|
31130
|
+
|
31131
|
+
for (i = 0, n = nodes.length; i < n; ++i) {
|
30956
31132
|
d = nodes[i], node = nodes[i] = new Node$1(d);
|
30957
31133
|
|
30958
|
-
if ((nodeId =
|
31134
|
+
if ((nodeId = currentId(d, i, data)) != null && (nodeId += "")) {
|
30959
31135
|
nodeKey = node.id = nodeId;
|
30960
31136
|
nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node);
|
30961
31137
|
}
|
30962
31138
|
|
30963
|
-
if ((nodeId =
|
31139
|
+
if ((nodeId = currentParentId(d, i, data)) != null && (nodeId += "")) {
|
30964
31140
|
node.parent = nodeId;
|
30965
31141
|
}
|
30966
31142
|
}
|
@@ -30980,7 +31156,21 @@
|
|
30980
31156
|
}
|
30981
31157
|
}
|
30982
31158
|
|
30983
|
-
if (!root) throw new Error("no root");
|
31159
|
+
if (!root) throw new Error("no root"); // When imputing internal nodes, only introduce roots if needed.
|
31160
|
+
// Then replace the imputed marker data with null.
|
31161
|
+
|
31162
|
+
if (path != null) {
|
31163
|
+
while (root.data === imputed && root.children.length === 1) {
|
31164
|
+
root = root.children[0], --n;
|
31165
|
+
}
|
31166
|
+
|
31167
|
+
for (let i = nodes.length - 1; i >= 0; --i) {
|
31168
|
+
node = nodes[i];
|
31169
|
+
if (node.data !== imputed) break;
|
31170
|
+
node.data = null;
|
31171
|
+
}
|
31172
|
+
}
|
31173
|
+
|
30984
31174
|
root.parent = preroot;
|
30985
31175
|
root.eachBefore(function (node) {
|
30986
31176
|
node.depth = node.parent.depth + 1;
|
@@ -30992,14 +31182,54 @@
|
|
30992
31182
|
}
|
30993
31183
|
|
30994
31184
|
stratify.id = function (x) {
|
30995
|
-
return arguments.length ? (id =
|
31185
|
+
return arguments.length ? (id = optional(x), stratify) : id;
|
30996
31186
|
};
|
30997
31187
|
|
30998
31188
|
stratify.parentId = function (x) {
|
30999
|
-
return arguments.length ? (parentId =
|
31189
|
+
return arguments.length ? (parentId = optional(x), stratify) : parentId;
|
31190
|
+
};
|
31191
|
+
|
31192
|
+
stratify.path = function (x) {
|
31193
|
+
return arguments.length ? (path = optional(x), stratify) : path;
|
31000
31194
|
};
|
31001
31195
|
|
31002
31196
|
return stratify;
|
31197
|
+
} // To normalize a path, we coerce to a string, strip the trailing slash if any
|
31198
|
+
// (as long as the trailing slash is not immediately preceded by another slash),
|
31199
|
+
// and add leading slash if missing.
|
31200
|
+
|
31201
|
+
function normalize(path) {
|
31202
|
+
path = "".concat(path);
|
31203
|
+
let i = path.length;
|
31204
|
+
if (slash(path, i - 1) && !slash(path, i - 2)) path = path.slice(0, -1);
|
31205
|
+
return path[0] === "/" ? path : "/".concat(path);
|
31206
|
+
} // Walk backwards to find the first slash that is not the leading slash, e.g.:
|
31207
|
+
// "/foo/bar" ⇥ "/foo", "/foo" ⇥ "/", "/" ↦ "". (The root is special-cased
|
31208
|
+
// because the id of the root must be a truthy value.)
|
31209
|
+
|
31210
|
+
|
31211
|
+
function parentof(path) {
|
31212
|
+
let i = path.length;
|
31213
|
+
if (i < 2) return "";
|
31214
|
+
|
31215
|
+
while (--i > 1) if (slash(path, i)) break;
|
31216
|
+
|
31217
|
+
return path.slice(0, i);
|
31218
|
+
} // Slashes can be escaped; to determine whether a slash is a path delimiter, we
|
31219
|
+
// count the number of preceding backslashes escaping the forward slash: an odd
|
31220
|
+
// number indicates an escaped forward slash.
|
31221
|
+
|
31222
|
+
|
31223
|
+
function slash(path, i) {
|
31224
|
+
if (path[i] === "/") {
|
31225
|
+
let k = 0;
|
31226
|
+
|
31227
|
+
while (i > 0 && path[--i] === "\\") ++k;
|
31228
|
+
|
31229
|
+
if ((k & 1) === 0) return true;
|
31230
|
+
}
|
31231
|
+
|
31232
|
+
return false;
|
31003
31233
|
}
|
31004
31234
|
|
31005
31235
|
function defaultSeparation$1(a, b) {
|
@@ -32115,10 +32345,7 @@
|
|
32115
32345
|
treemap: Treemap
|
32116
32346
|
});
|
32117
32347
|
|
32118
|
-
const ALPHA_MASK = 0xff000000;
|
32119
|
-
|
32120
|
-
const INSIDE_OPACITY_IN_ALPHA = 0x10000000;
|
32121
|
-
const INSIDE_OPACITY = 0.0625;
|
32348
|
+
const ALPHA_MASK = 0xff000000;
|
32122
32349
|
|
32123
32350
|
function baseBitmaps($, data) {
|
32124
32351
|
const bitmap = $.bitmap(); // when there is no base mark but data points are to be avoided
|
@@ -32127,31 +32354,44 @@
|
|
32127
32354
|
return [bitmap, undefined];
|
32128
32355
|
}
|
32129
32356
|
|
32130
|
-
function markBitmaps($, avoidMarks, labelInside, isGroupArea) {
|
32357
|
+
function markBitmaps($, baseMark, avoidMarks, labelInside, isGroupArea) {
|
32131
32358
|
// create canvas
|
32132
32359
|
const width = $.width,
|
32133
32360
|
height = $.height,
|
32134
32361
|
border = labelInside || isGroupArea,
|
32135
|
-
context = domCanvas(width, height).getContext('2d')
|
32362
|
+
context = domCanvas(width, height).getContext('2d'),
|
32363
|
+
baseMarkContext = domCanvas(width, height).getContext('2d'),
|
32364
|
+
strokeContext = border && domCanvas(width, height).getContext('2d'); // render all marks to be avoided into canvas
|
32365
|
+
|
32366
|
+
avoidMarks.forEach(items => draw(context, items, false));
|
32367
|
+
draw(baseMarkContext, baseMark, false);
|
32136
32368
|
|
32137
|
-
|
32369
|
+
if (border) {
|
32370
|
+
draw(strokeContext, baseMark, true);
|
32371
|
+
} // get canvas buffer, create bitmaps
|
32138
32372
|
|
32139
|
-
|
32373
|
+
|
32374
|
+
const buffer = getBuffer(context, width, height),
|
32375
|
+
baseMarkBuffer = getBuffer(baseMarkContext, width, height),
|
32376
|
+
strokeBuffer = border && getBuffer(strokeContext, width, height),
|
32140
32377
|
layer1 = $.bitmap(),
|
32141
32378
|
layer2 = border && $.bitmap(); // populate bitmap layers
|
32142
32379
|
|
32143
|
-
let x, y, u, v, alpha;
|
32380
|
+
let x, y, u, v, index, alpha, strokeAlpha, baseMarkAlpha;
|
32144
32381
|
|
32145
32382
|
for (y = 0; y < height; ++y) {
|
32146
32383
|
for (x = 0; x < width; ++x) {
|
32147
|
-
|
32384
|
+
index = y * width + x;
|
32385
|
+
alpha = buffer[index] & ALPHA_MASK;
|
32386
|
+
baseMarkAlpha = baseMarkBuffer[index] & ALPHA_MASK;
|
32387
|
+
strokeAlpha = border && strokeBuffer[index] & ALPHA_MASK;
|
32148
32388
|
|
32149
|
-
if (alpha) {
|
32389
|
+
if (alpha || strokeAlpha || baseMarkAlpha) {
|
32150
32390
|
u = $(x);
|
32151
32391
|
v = $(y);
|
32152
|
-
if (!isGroupArea) layer1.set(u, v); // update interior bitmap
|
32392
|
+
if (!isGroupArea && (alpha || baseMarkAlpha)) layer1.set(u, v); // update interior bitmap
|
32153
32393
|
|
32154
|
-
if (border && alpha
|
32394
|
+
if (border && (alpha || strokeAlpha)) layer2.set(u, v); // update border bitmap
|
32155
32395
|
}
|
32156
32396
|
}
|
32157
32397
|
}
|
@@ -32159,6 +32399,10 @@
|
|
32159
32399
|
return [layer1, layer2];
|
32160
32400
|
}
|
32161
32401
|
|
32402
|
+
function getBuffer(context, width, height) {
|
32403
|
+
return new Uint32Array(context.getImageData(0, 0, width, height).data.buffer);
|
32404
|
+
}
|
32405
|
+
|
32162
32406
|
function draw(context, items, interior) {
|
32163
32407
|
if (!items.length) return;
|
32164
32408
|
const type = items[0].mark.marktype;
|
@@ -32183,15 +32427,12 @@
|
|
32183
32427
|
function prepare(source) {
|
32184
32428
|
const item = rederive(source, {});
|
32185
32429
|
|
32186
|
-
if (item.stroke) {
|
32187
|
-
|
32188
|
-
|
32189
|
-
|
32190
|
-
|
32191
|
-
|
32192
|
-
item.stroke = '#000';
|
32193
|
-
item.strokeOpacity = 1;
|
32194
|
-
item.strokeWidth = 2;
|
32430
|
+
if (item.stroke && item.strokeOpacity !== 0 || item.fill && item.fillOpacity !== 0) {
|
32431
|
+
return { ...item,
|
32432
|
+
strokeOpacity: 1,
|
32433
|
+
stroke: '#000',
|
32434
|
+
fillOpacity: 0
|
32435
|
+
};
|
32195
32436
|
}
|
32196
32437
|
|
32197
32438
|
return item;
|
@@ -32401,10 +32642,6 @@
|
|
32401
32642
|
return x - r < 0 || x + r > width || y - (r = textHeight / 2) < 0 || y + r > height;
|
32402
32643
|
}
|
32403
32644
|
|
32404
|
-
function _outOfBounds() {
|
32405
|
-
return false;
|
32406
|
-
}
|
32407
|
-
|
32408
32645
|
function collision($, x, y, textHeight, textWidth, h, bm0, bm1) {
|
32409
32646
|
const w = textWidth * h / (textHeight * 2),
|
32410
32647
|
x1 = $(x - w),
|
@@ -32414,27 +32651,9 @@
|
|
32414
32651
|
return bm0.outOfBounds(x1, y1, x2, y2) || bm0.getRange(x1, y1, x2, y2) || bm1 && bm1.getRange(x1, y1, x2, y2);
|
32415
32652
|
}
|
32416
32653
|
|
32417
|
-
function
|
32418
|
-
const w = textWidth * h / (textHeight * 2);
|
32419
|
-
let x1 = $(x - w),
|
32420
|
-
x2 = $(x + w),
|
32421
|
-
y1 = $(y - (h = h / 2)),
|
32422
|
-
y2 = $(y + h);
|
32423
|
-
x1 = x1 > 0 ? x1 : 0;
|
32424
|
-
y1 = y1 > 0 ? y1 : 0;
|
32425
|
-
x2 = x2 < $.width ? x2 : $.width - 1;
|
32426
|
-
y2 = y2 < $.height ? y2 : $.height - 1;
|
32427
|
-
return bm0.getRange(x1, y1, x2, y2) || bm1 && bm1.getRange(x1, y1, x2, y2);
|
32428
|
-
}
|
32429
|
-
|
32430
|
-
function getTests(infPadding) {
|
32431
|
-
return infPadding ? [_collision, _outOfBounds] : [collision, outOfBounds];
|
32432
|
-
}
|
32433
|
-
|
32434
|
-
function placeAreaLabelReducedSearch($, bitmaps, avoidBaseMark, markIndex, infPadding) {
|
32654
|
+
function placeAreaLabelReducedSearch($, bitmaps, avoidBaseMark, markIndex) {
|
32435
32655
|
const width = $.width,
|
32436
32656
|
height = $.height,
|
32437
|
-
[collision, outOfBounds] = getTests(infPadding),
|
32438
32657
|
bm0 = bitmaps[0],
|
32439
32658
|
// where labels have been placed
|
32440
32659
|
bm1 = bitmaps[1]; // area outlines
|
@@ -32579,10 +32798,9 @@
|
|
32579
32798
|
const X_DIR = [-1, -1, 1, 1];
|
32580
32799
|
const Y_DIR = [-1, 1, -1, 1];
|
32581
32800
|
|
32582
|
-
function placeAreaLabelFloodFill($, bitmaps, avoidBaseMark, markIndex
|
32801
|
+
function placeAreaLabelFloodFill($, bitmaps, avoidBaseMark, markIndex) {
|
32583
32802
|
const width = $.width,
|
32584
32803
|
height = $.height,
|
32585
|
-
[collision, outOfBounds] = getTests(infPadding),
|
32586
32804
|
bm0 = bitmaps[0],
|
32587
32805
|
// where labels have been placed
|
32588
32806
|
bm1 = bitmaps[1],
|
@@ -32704,21 +32922,23 @@
|
|
32704
32922
|
const Aligns = ['right', 'center', 'left'],
|
32705
32923
|
Baselines = ['bottom', 'middle', 'top'];
|
32706
32924
|
|
32707
|
-
function placeMarkLabel($, bitmaps, anchors, offsets
|
32925
|
+
function placeMarkLabel($, bitmaps, anchors, offsets) {
|
32708
32926
|
const width = $.width,
|
32709
32927
|
height = $.height,
|
32710
32928
|
bm0 = bitmaps[0],
|
32711
32929
|
bm1 = bitmaps[1],
|
32712
32930
|
n = offsets.length;
|
32713
32931
|
return function (d) {
|
32932
|
+
var _d$textWidth;
|
32933
|
+
|
32714
32934
|
const boundary = d.boundary,
|
32715
32935
|
textHeight = d.datum.fontSize; // can not be placed if the mark is not visible in the graph bound
|
32716
32936
|
|
32717
|
-
if (
|
32937
|
+
if (boundary[2] < 0 || boundary[5] < 0 || boundary[0] > width || boundary[3] > height) {
|
32718
32938
|
return false;
|
32719
32939
|
}
|
32720
32940
|
|
32721
|
-
let textWidth = 0,
|
32941
|
+
let textWidth = (_d$textWidth = d.textWidth) !== null && _d$textWidth !== void 0 ? _d$textWidth : 0,
|
32722
32942
|
dx,
|
32723
32943
|
dy,
|
32724
32944
|
isInside,
|
@@ -32750,12 +32970,6 @@
|
|
32750
32970
|
_y1 = $(y1);
|
32751
32971
|
_y2 = $(y2);
|
32752
32972
|
|
32753
|
-
if (infPadding) {
|
32754
|
-
_x1 = _x1 < 0 ? 0 : _x1;
|
32755
|
-
_y1 = _y1 < 0 ? 0 : _y1;
|
32756
|
-
_y2 = _y2 >= $.height ? $.height - 1 : _y2;
|
32757
|
-
}
|
32758
|
-
|
32759
32973
|
if (!textWidth) {
|
32760
32974
|
// to avoid finding width of text label,
|
32761
32975
|
if (!test(_x1, _x1, _y1, _y2, bm0, bm1, x1, x1, y1, y2, boundary, isInside)) {
|
@@ -32773,11 +32987,6 @@
|
|
32773
32987
|
_x1 = $(x1);
|
32774
32988
|
_x2 = $(x2);
|
32775
32989
|
|
32776
|
-
if (infPadding) {
|
32777
|
-
_x1 = _x1 < 0 ? 0 : _x1;
|
32778
|
-
_x2 = _x2 >= $.width ? $.width - 1 : _x2;
|
32779
|
-
}
|
32780
|
-
|
32781
32990
|
if (test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside)) {
|
32782
32991
|
// place label if the position is placeable
|
32783
32992
|
d.x = !dx ? xc : dx * insideFactor < 0 ? x2 : x1;
|
@@ -32795,11 +33004,7 @@
|
|
32795
33004
|
|
32796
33005
|
|
32797
33006
|
function test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside) {
|
32798
|
-
return !(bm0.outOfBounds(_x1, _y1, _x2, _y2) || (isInside && bm1
|
32799
|
-
}
|
32800
|
-
|
32801
|
-
function isInMarkBound(x1, y1, x2, y2, boundary) {
|
32802
|
-
return boundary[0] <= x1 && x2 <= boundary[2] && boundary[3] <= y1 && y2 <= boundary[5];
|
33007
|
+
return !(bm0.outOfBounds(_x1, _y1, _x2, _y2) || (isInside && bm1 || bm0).getRange(_x1, _y1, _x2, _y2));
|
32803
33008
|
}
|
32804
33009
|
|
32805
33010
|
const TOP = 0x0,
|
@@ -32837,18 +33042,27 @@
|
|
32837
33042
|
isGroupArea = grouptype === 'area',
|
32838
33043
|
boundary = markBoundary(marktype, grouptype, lineAnchor, markIndex),
|
32839
33044
|
infPadding = padding === null || padding === Infinity,
|
32840
|
-
|
32841
|
-
|
32842
|
-
|
32843
|
-
|
32844
|
-
|
32845
|
-
|
32846
|
-
|
32847
|
-
|
32848
|
-
|
32849
|
-
|
32850
|
-
|
32851
|
-
|
33045
|
+
isNaiveGroupArea = isGroupArea && method === 'naive';
|
33046
|
+
let maxTextWidth = -1,
|
33047
|
+
maxTextHeight = -1; // prepare text mark data for placing
|
33048
|
+
|
33049
|
+
const data = texts.map(d => {
|
33050
|
+
const textWidth = infPadding ? textMetrics.width(d, d.text) : undefined;
|
33051
|
+
maxTextWidth = Math.max(maxTextWidth, textWidth);
|
33052
|
+
maxTextHeight = Math.max(maxTextHeight, d.fontSize);
|
33053
|
+
return {
|
33054
|
+
datum: d,
|
33055
|
+
opacity: 0,
|
33056
|
+
x: undefined,
|
33057
|
+
y: undefined,
|
33058
|
+
align: undefined,
|
33059
|
+
baseline: undefined,
|
33060
|
+
boundary: boundary(d),
|
33061
|
+
textWidth
|
33062
|
+
};
|
33063
|
+
});
|
33064
|
+
padding = padding === null || padding === Infinity ? Math.max(maxTextWidth, maxTextHeight) + Math.max(...offset) : padding;
|
33065
|
+
const $ = scaler(size[0], size[1], padding);
|
32852
33066
|
let bitmaps;
|
32853
33067
|
|
32854
33068
|
if (!isNaiveGroupArea) {
|
@@ -32868,16 +33082,13 @@
|
|
32868
33082
|
// base mark is implicitly avoided if it is a group area
|
32869
33083
|
|
32870
33084
|
|
32871
|
-
|
32872
|
-
avoidMarks = [texts.map(d => d.datum)].concat(avoidMarks);
|
32873
|
-
} // generate bitmaps for layout calculation
|
32874
|
-
|
33085
|
+
const baseMark = (marktype && avoidBaseMark || isGroupArea) && texts.map(d => d.datum); // generate bitmaps for layout calculation
|
32875
33086
|
|
32876
|
-
bitmaps = avoidMarks.length ? markBitmaps($, avoidMarks, labelInside, isGroupArea) : baseBitmaps($, avoidBaseMark && data);
|
33087
|
+
bitmaps = avoidMarks.length || baseMark ? markBitmaps($, baseMark || [], avoidMarks, labelInside, isGroupArea) : baseBitmaps($, avoidBaseMark && data);
|
32877
33088
|
} // generate label placement function
|
32878
33089
|
|
32879
33090
|
|
32880
|
-
const place = isGroupArea ? placeAreaLabel[method]($, bitmaps, avoidBaseMark, markIndex
|
33091
|
+
const place = isGroupArea ? placeAreaLabel[method]($, bitmaps, avoidBaseMark, markIndex) : placeMarkLabel($, bitmaps, anchors, offsets); // place all labels
|
32881
33092
|
|
32882
33093
|
data.forEach(d => d.opacity = +place(d));
|
32883
33094
|
return data;
|
@@ -32912,7 +33123,7 @@
|
|
32912
33123
|
* Factory function for function for getting base mark boundary, depending
|
32913
33124
|
* on mark and group type. When mark type is undefined, line or area: boundary
|
32914
33125
|
* is the coordinate of each data point. When base mark is grouped line,
|
32915
|
-
* boundary is either at the
|
33126
|
+
* boundary is either at the start or end of the line depending on the
|
32916
33127
|
* value of lineAnchor. Otherwise, use bounds of base mark.
|
32917
33128
|
*/
|
32918
33129
|
|
@@ -33326,10 +33537,285 @@
|
|
33326
33537
|
regression: Regression
|
33327
33538
|
});
|
33328
33539
|
|
33540
|
+
const epsilon$1 = 1.1102230246251565e-16;
|
33541
|
+
const splitter = 134217729;
|
33542
|
+
const resulterrbound = (3 + 8 * epsilon$1) * epsilon$1; // fast_expansion_sum_zeroelim routine from oritinal code
|
33543
|
+
|
33544
|
+
function sum(elen, e, flen, f, h) {
|
33545
|
+
let Q, Qnew, hh, bvirt;
|
33546
|
+
let enow = e[0];
|
33547
|
+
let fnow = f[0];
|
33548
|
+
let eindex = 0;
|
33549
|
+
let findex = 0;
|
33550
|
+
|
33551
|
+
if (fnow > enow === fnow > -enow) {
|
33552
|
+
Q = enow;
|
33553
|
+
enow = e[++eindex];
|
33554
|
+
} else {
|
33555
|
+
Q = fnow;
|
33556
|
+
fnow = f[++findex];
|
33557
|
+
}
|
33558
|
+
|
33559
|
+
let hindex = 0;
|
33560
|
+
|
33561
|
+
if (eindex < elen && findex < flen) {
|
33562
|
+
if (fnow > enow === fnow > -enow) {
|
33563
|
+
Qnew = enow + Q;
|
33564
|
+
hh = Q - (Qnew - enow);
|
33565
|
+
enow = e[++eindex];
|
33566
|
+
} else {
|
33567
|
+
Qnew = fnow + Q;
|
33568
|
+
hh = Q - (Qnew - fnow);
|
33569
|
+
fnow = f[++findex];
|
33570
|
+
}
|
33571
|
+
|
33572
|
+
Q = Qnew;
|
33573
|
+
|
33574
|
+
if (hh !== 0) {
|
33575
|
+
h[hindex++] = hh;
|
33576
|
+
}
|
33577
|
+
|
33578
|
+
while (eindex < elen && findex < flen) {
|
33579
|
+
if (fnow > enow === fnow > -enow) {
|
33580
|
+
Qnew = Q + enow;
|
33581
|
+
bvirt = Qnew - Q;
|
33582
|
+
hh = Q - (Qnew - bvirt) + (enow - bvirt);
|
33583
|
+
enow = e[++eindex];
|
33584
|
+
} else {
|
33585
|
+
Qnew = Q + fnow;
|
33586
|
+
bvirt = Qnew - Q;
|
33587
|
+
hh = Q - (Qnew - bvirt) + (fnow - bvirt);
|
33588
|
+
fnow = f[++findex];
|
33589
|
+
}
|
33590
|
+
|
33591
|
+
Q = Qnew;
|
33592
|
+
|
33593
|
+
if (hh !== 0) {
|
33594
|
+
h[hindex++] = hh;
|
33595
|
+
}
|
33596
|
+
}
|
33597
|
+
}
|
33598
|
+
|
33599
|
+
while (eindex < elen) {
|
33600
|
+
Qnew = Q + enow;
|
33601
|
+
bvirt = Qnew - Q;
|
33602
|
+
hh = Q - (Qnew - bvirt) + (enow - bvirt);
|
33603
|
+
enow = e[++eindex];
|
33604
|
+
Q = Qnew;
|
33605
|
+
|
33606
|
+
if (hh !== 0) {
|
33607
|
+
h[hindex++] = hh;
|
33608
|
+
}
|
33609
|
+
}
|
33610
|
+
|
33611
|
+
while (findex < flen) {
|
33612
|
+
Qnew = Q + fnow;
|
33613
|
+
bvirt = Qnew - Q;
|
33614
|
+
hh = Q - (Qnew - bvirt) + (fnow - bvirt);
|
33615
|
+
fnow = f[++findex];
|
33616
|
+
Q = Qnew;
|
33617
|
+
|
33618
|
+
if (hh !== 0) {
|
33619
|
+
h[hindex++] = hh;
|
33620
|
+
}
|
33621
|
+
}
|
33622
|
+
|
33623
|
+
if (Q !== 0 || hindex === 0) {
|
33624
|
+
h[hindex++] = Q;
|
33625
|
+
}
|
33626
|
+
|
33627
|
+
return hindex;
|
33628
|
+
}
|
33629
|
+
function estimate(elen, e) {
|
33630
|
+
let Q = e[0];
|
33631
|
+
|
33632
|
+
for (let i = 1; i < elen; i++) Q += e[i];
|
33633
|
+
|
33634
|
+
return Q;
|
33635
|
+
}
|
33636
|
+
function vec(n) {
|
33637
|
+
return new Float64Array(n);
|
33638
|
+
}
|
33639
|
+
|
33640
|
+
const ccwerrboundA = (3 + 16 * epsilon$1) * epsilon$1;
|
33641
|
+
const ccwerrboundB = (2 + 12 * epsilon$1) * epsilon$1;
|
33642
|
+
const ccwerrboundC = (9 + 64 * epsilon$1) * epsilon$1 * epsilon$1;
|
33643
|
+
const B = vec(4);
|
33644
|
+
const C1 = vec(8);
|
33645
|
+
const C2 = vec(12);
|
33646
|
+
const D = vec(16);
|
33647
|
+
const u = vec(4);
|
33648
|
+
|
33649
|
+
function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
|
33650
|
+
let acxtail, acytail, bcxtail, bcytail;
|
33651
|
+
|
33652
|
+
let bvirt, c, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3;
|
33653
|
+
|
33654
|
+
const acx = ax - cx;
|
33655
|
+
const bcx = bx - cx;
|
33656
|
+
const acy = ay - cy;
|
33657
|
+
const bcy = by - cy;
|
33658
|
+
s1 = acx * bcy;
|
33659
|
+
c = splitter * acx;
|
33660
|
+
ahi = c - (c - acx);
|
33661
|
+
alo = acx - ahi;
|
33662
|
+
c = splitter * bcy;
|
33663
|
+
bhi = c - (c - bcy);
|
33664
|
+
blo = bcy - bhi;
|
33665
|
+
s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
|
33666
|
+
t1 = acy * bcx;
|
33667
|
+
c = splitter * acy;
|
33668
|
+
ahi = c - (c - acy);
|
33669
|
+
alo = acy - ahi;
|
33670
|
+
c = splitter * bcx;
|
33671
|
+
bhi = c - (c - bcx);
|
33672
|
+
blo = bcx - bhi;
|
33673
|
+
t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
|
33674
|
+
_i = s0 - t0;
|
33675
|
+
bvirt = s0 - _i;
|
33676
|
+
B[0] = s0 - (_i + bvirt) + (bvirt - t0);
|
33677
|
+
_j = s1 + _i;
|
33678
|
+
bvirt = _j - s1;
|
33679
|
+
_0 = s1 - (_j - bvirt) + (_i - bvirt);
|
33680
|
+
_i = _0 - t1;
|
33681
|
+
bvirt = _0 - _i;
|
33682
|
+
B[1] = _0 - (_i + bvirt) + (bvirt - t1);
|
33683
|
+
u3 = _j + _i;
|
33684
|
+
bvirt = u3 - _j;
|
33685
|
+
B[2] = _j - (u3 - bvirt) + (_i - bvirt);
|
33686
|
+
B[3] = u3;
|
33687
|
+
let det = estimate(4, B);
|
33688
|
+
let errbound = ccwerrboundB * detsum;
|
33689
|
+
|
33690
|
+
if (det >= errbound || -det >= errbound) {
|
33691
|
+
return det;
|
33692
|
+
}
|
33693
|
+
|
33694
|
+
bvirt = ax - acx;
|
33695
|
+
acxtail = ax - (acx + bvirt) + (bvirt - cx);
|
33696
|
+
bvirt = bx - bcx;
|
33697
|
+
bcxtail = bx - (bcx + bvirt) + (bvirt - cx);
|
33698
|
+
bvirt = ay - acy;
|
33699
|
+
acytail = ay - (acy + bvirt) + (bvirt - cy);
|
33700
|
+
bvirt = by - bcy;
|
33701
|
+
bcytail = by - (bcy + bvirt) + (bvirt - cy);
|
33702
|
+
|
33703
|
+
if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {
|
33704
|
+
return det;
|
33705
|
+
}
|
33706
|
+
|
33707
|
+
errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);
|
33708
|
+
det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail);
|
33709
|
+
if (det >= errbound || -det >= errbound) return det;
|
33710
|
+
s1 = acxtail * bcy;
|
33711
|
+
c = splitter * acxtail;
|
33712
|
+
ahi = c - (c - acxtail);
|
33713
|
+
alo = acxtail - ahi;
|
33714
|
+
c = splitter * bcy;
|
33715
|
+
bhi = c - (c - bcy);
|
33716
|
+
blo = bcy - bhi;
|
33717
|
+
s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
|
33718
|
+
t1 = acytail * bcx;
|
33719
|
+
c = splitter * acytail;
|
33720
|
+
ahi = c - (c - acytail);
|
33721
|
+
alo = acytail - ahi;
|
33722
|
+
c = splitter * bcx;
|
33723
|
+
bhi = c - (c - bcx);
|
33724
|
+
blo = bcx - bhi;
|
33725
|
+
t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
|
33726
|
+
_i = s0 - t0;
|
33727
|
+
bvirt = s0 - _i;
|
33728
|
+
u[0] = s0 - (_i + bvirt) + (bvirt - t0);
|
33729
|
+
_j = s1 + _i;
|
33730
|
+
bvirt = _j - s1;
|
33731
|
+
_0 = s1 - (_j - bvirt) + (_i - bvirt);
|
33732
|
+
_i = _0 - t1;
|
33733
|
+
bvirt = _0 - _i;
|
33734
|
+
u[1] = _0 - (_i + bvirt) + (bvirt - t1);
|
33735
|
+
u3 = _j + _i;
|
33736
|
+
bvirt = u3 - _j;
|
33737
|
+
u[2] = _j - (u3 - bvirt) + (_i - bvirt);
|
33738
|
+
u[3] = u3;
|
33739
|
+
const C1len = sum(4, B, 4, u, C1);
|
33740
|
+
s1 = acx * bcytail;
|
33741
|
+
c = splitter * acx;
|
33742
|
+
ahi = c - (c - acx);
|
33743
|
+
alo = acx - ahi;
|
33744
|
+
c = splitter * bcytail;
|
33745
|
+
bhi = c - (c - bcytail);
|
33746
|
+
blo = bcytail - bhi;
|
33747
|
+
s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
|
33748
|
+
t1 = acy * bcxtail;
|
33749
|
+
c = splitter * acy;
|
33750
|
+
ahi = c - (c - acy);
|
33751
|
+
alo = acy - ahi;
|
33752
|
+
c = splitter * bcxtail;
|
33753
|
+
bhi = c - (c - bcxtail);
|
33754
|
+
blo = bcxtail - bhi;
|
33755
|
+
t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
|
33756
|
+
_i = s0 - t0;
|
33757
|
+
bvirt = s0 - _i;
|
33758
|
+
u[0] = s0 - (_i + bvirt) + (bvirt - t0);
|
33759
|
+
_j = s1 + _i;
|
33760
|
+
bvirt = _j - s1;
|
33761
|
+
_0 = s1 - (_j - bvirt) + (_i - bvirt);
|
33762
|
+
_i = _0 - t1;
|
33763
|
+
bvirt = _0 - _i;
|
33764
|
+
u[1] = _0 - (_i + bvirt) + (bvirt - t1);
|
33765
|
+
u3 = _j + _i;
|
33766
|
+
bvirt = u3 - _j;
|
33767
|
+
u[2] = _j - (u3 - bvirt) + (_i - bvirt);
|
33768
|
+
u[3] = u3;
|
33769
|
+
const C2len = sum(C1len, C1, 4, u, C2);
|
33770
|
+
s1 = acxtail * bcytail;
|
33771
|
+
c = splitter * acxtail;
|
33772
|
+
ahi = c - (c - acxtail);
|
33773
|
+
alo = acxtail - ahi;
|
33774
|
+
c = splitter * bcytail;
|
33775
|
+
bhi = c - (c - bcytail);
|
33776
|
+
blo = bcytail - bhi;
|
33777
|
+
s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
|
33778
|
+
t1 = acytail * bcxtail;
|
33779
|
+
c = splitter * acytail;
|
33780
|
+
ahi = c - (c - acytail);
|
33781
|
+
alo = acytail - ahi;
|
33782
|
+
c = splitter * bcxtail;
|
33783
|
+
bhi = c - (c - bcxtail);
|
33784
|
+
blo = bcxtail - bhi;
|
33785
|
+
t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
|
33786
|
+
_i = s0 - t0;
|
33787
|
+
bvirt = s0 - _i;
|
33788
|
+
u[0] = s0 - (_i + bvirt) + (bvirt - t0);
|
33789
|
+
_j = s1 + _i;
|
33790
|
+
bvirt = _j - s1;
|
33791
|
+
_0 = s1 - (_j - bvirt) + (_i - bvirt);
|
33792
|
+
_i = _0 - t1;
|
33793
|
+
bvirt = _0 - _i;
|
33794
|
+
u[1] = _0 - (_i + bvirt) + (bvirt - t1);
|
33795
|
+
u3 = _j + _i;
|
33796
|
+
bvirt = u3 - _j;
|
33797
|
+
u[2] = _j - (u3 - bvirt) + (_i - bvirt);
|
33798
|
+
u[3] = u3;
|
33799
|
+
const Dlen = sum(C2len, C2, 4, u, D);
|
33800
|
+
return D[Dlen - 1];
|
33801
|
+
}
|
33802
|
+
|
33803
|
+
function orient2d(ax, ay, bx, by, cx, cy) {
|
33804
|
+
const detleft = (ay - cy) * (bx - cx);
|
33805
|
+
const detright = (ax - cx) * (by - cy);
|
33806
|
+
const det = detleft - detright;
|
33807
|
+
if (detleft === 0 || detright === 0 || detleft > 0 !== detright > 0) return det;
|
33808
|
+
const detsum = Math.abs(detleft + detright);
|
33809
|
+
if (Math.abs(det) >= ccwerrboundA * detsum) return det;
|
33810
|
+
return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
|
33811
|
+
}
|
33812
|
+
|
33329
33813
|
const EPSILON = Math.pow(2, -52);
|
33330
33814
|
const EDGE_STACK = new Uint32Array(512);
|
33331
33815
|
class Delaunator {
|
33332
|
-
static from(points
|
33816
|
+
static from(points) {
|
33817
|
+
let getX = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultGetX;
|
33818
|
+
let getY = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultGetY;
|
33333
33819
|
const n = points.length;
|
33334
33820
|
const coords = new Float64Array(n * 2);
|
33335
33821
|
|
@@ -33463,7 +33949,7 @@
|
|
33463
33949
|
} // swap the order of the seed points for counter-clockwise orientation
|
33464
33950
|
|
33465
33951
|
|
33466
|
-
if (
|
33952
|
+
if (orient2d(i0x, i0y, i1x, i1y, i2x, i2y) < 0) {
|
33467
33953
|
const i = i1;
|
33468
33954
|
const x = i1x;
|
33469
33955
|
const y = i1y;
|
@@ -33524,7 +34010,7 @@
|
|
33524
34010
|
let e = start,
|
33525
34011
|
q;
|
33526
34012
|
|
33527
|
-
while (q = hullNext[e],
|
34013
|
+
while (q = hullNext[e], orient2d(x, y, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1]) >= 0) {
|
33528
34014
|
e = q;
|
33529
34015
|
|
33530
34016
|
if (e === start) {
|
@@ -33546,7 +34032,7 @@
|
|
33546
34032
|
|
33547
34033
|
let n = hullNext[e];
|
33548
34034
|
|
33549
|
-
while (q = hullNext[n],
|
34035
|
+
while (q = hullNext[n], orient2d(x, y, coords[2 * n], coords[2 * n + 1], coords[2 * q], coords[2 * q + 1]) < 0) {
|
33550
34036
|
t = this._addTriangle(n, i, q, hullTri[i], -1, hullTri[n]);
|
33551
34037
|
hullTri[i] = this._legalize(t + 2);
|
33552
34038
|
hullNext[n] = n; // mark as removed
|
@@ -33557,7 +34043,7 @@
|
|
33557
34043
|
|
33558
34044
|
|
33559
34045
|
if (e === start) {
|
33560
|
-
while (q = hullPrev[e],
|
34046
|
+
while (q = hullPrev[e], orient2d(x, y, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1]) < 0) {
|
33561
34047
|
t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]);
|
33562
34048
|
|
33563
34049
|
this._legalize(t + 2);
|
@@ -33712,19 +34198,6 @@
|
|
33712
34198
|
const dx = ax - bx;
|
33713
34199
|
const dy = ay - by;
|
33714
34200
|
return dx * dx + dy * dy;
|
33715
|
-
} // return 2d orientation sign if we're confident in it through J. Shewchuk's error bound check
|
33716
|
-
|
33717
|
-
|
33718
|
-
function orientIfSure(px, py, rx, ry, qx, qy) {
|
33719
|
-
const l = (ry - py) * (qx - px);
|
33720
|
-
const r = (rx - px) * (qy - py);
|
33721
|
-
return Math.abs(l - r) >= 3.3306690738754716e-16 * Math.abs(l + r) ? l - r : 0;
|
33722
|
-
} // a more robust orientation test that's stable in a given triangle (to fix robustness issues)
|
33723
|
-
|
33724
|
-
|
33725
|
-
function orient(rx, ry, qx, qy, px, py) {
|
33726
|
-
const sign = orientIfSure(px, py, rx, ry, qx, qy) || orientIfSure(rx, ry, qx, qy, px, py) || orientIfSure(qx, qy, px, py, rx, ry);
|
33727
|
-
return sign < 0;
|
33728
34201
|
}
|
33729
34202
|
|
33730
34203
|
function inCircle(ax, ay, bx, by, cx, cy, px, py) {
|
@@ -33837,7 +34310,7 @@
|
|
33837
34310
|
}
|
33838
34311
|
|
33839
34312
|
moveTo(x, y) {
|
33840
|
-
this._ +=
|
34313
|
+
this._ += "M".concat(this._x0 = this._x1 = +x, ",").concat(this._y0 = this._y1 = +y);
|
33841
34314
|
}
|
33842
34315
|
|
33843
34316
|
closePath() {
|
@@ -33848,7 +34321,7 @@
|
|
33848
34321
|
}
|
33849
34322
|
|
33850
34323
|
lineTo(x, y) {
|
33851
|
-
this._ +=
|
34324
|
+
this._ += "L".concat(this._x1 = +x, ",").concat(this._y1 = +y);
|
33852
34325
|
}
|
33853
34326
|
|
33854
34327
|
arc(x, y, r) {
|
@@ -33856,13 +34329,13 @@
|
|
33856
34329
|
const x0 = x + r;
|
33857
34330
|
const y0 = y;
|
33858
34331
|
if (r < 0) throw new Error("negative radius");
|
33859
|
-
if (this._x1 === null) this._ +=
|
34332
|
+
if (this._x1 === null) this._ += "M".concat(x0, ",").concat(y0);else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._ += "L" + x0 + "," + y0;
|
33860
34333
|
if (!r) return;
|
33861
|
-
this._ +=
|
34334
|
+
this._ += "A".concat(r, ",").concat(r, ",0,1,1,").concat(x - r, ",").concat(y, "A").concat(r, ",").concat(r, ",0,1,1,").concat(this._x1 = x0, ",").concat(this._y1 = y0);
|
33862
34335
|
}
|
33863
34336
|
|
33864
34337
|
rect(x, y, w, h) {
|
33865
|
-
this._ +=
|
34338
|
+
this._ += "M".concat(this._x0 = this._x1 = +x, ",").concat(this._y0 = this._y1 = +y, "h").concat(+w, "v").concat(+h, "h").concat(-w, "Z");
|
33866
34339
|
}
|
33867
34340
|
|
33868
34341
|
value() {
|
@@ -33895,7 +34368,8 @@
|
|
33895
34368
|
}
|
33896
34369
|
|
33897
34370
|
class Voronoi$1 {
|
33898
|
-
constructor(delaunay
|
34371
|
+
constructor(delaunay) {
|
34372
|
+
let [xmin, ymin, xmax, ymax] = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 960, 500];
|
33899
34373
|
if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds");
|
33900
34374
|
this.delaunay = delaunay;
|
33901
34375
|
this._circumcenters = new Float64Array(delaunay.points.length * 2);
|
@@ -33940,20 +34414,26 @@
|
|
33940
34414
|
const dy = y2 - y1;
|
33941
34415
|
const ex = x3 - x1;
|
33942
34416
|
const ey = y3 - y1;
|
33943
|
-
const bl = dx * dx + dy * dy;
|
33944
|
-
const cl = ex * ex + ey * ey;
|
33945
34417
|
const ab = (dx * ey - dy * ex) * 2;
|
33946
34418
|
|
33947
|
-
if (
|
34419
|
+
if (Math.abs(ab) < 1e-9) {
|
33948
34420
|
// degenerate case (collinear diagram)
|
33949
|
-
x = (x1 + x3) / 2 - 1e8 * ey;
|
33950
|
-
y = (y1 + y3) / 2 + 1e8 * ex;
|
33951
|
-
} else if (Math.abs(ab) < 1e-8) {
|
33952
34421
|
// almost equal points (degenerate triangle)
|
33953
|
-
|
33954
|
-
|
34422
|
+
// the circumcenter is at the infinity, in a
|
34423
|
+
// direction that is:
|
34424
|
+
// 1. orthogonal to the halfedge.
|
34425
|
+
let a = 1e9; // 2. points away from the center; since the list of triangles starts
|
34426
|
+
// in the center, the first point of the first triangle
|
34427
|
+
// will be our reference
|
34428
|
+
|
34429
|
+
const r = triangles[0] * 2;
|
34430
|
+
a *= Math.sign((points[r] - x1) * ey - (points[r + 1] - y1) * ex);
|
34431
|
+
x = (x1 + x3) / 2 - a * ey;
|
34432
|
+
y = (y1 + y3) / 2 + a * ex;
|
33955
34433
|
} else {
|
33956
34434
|
const d = 1 / ab;
|
34435
|
+
const bl = dx * dx + dy * dy;
|
34436
|
+
const cl = ex * ex + ey * ey;
|
33957
34437
|
x = x1 + (ey * bl - dy * cl) * d;
|
33958
34438
|
y = y1 + (dx * cl - ex * bl) * d;
|
33959
34439
|
}
|
@@ -34162,7 +34642,8 @@
|
|
34162
34642
|
let c0,
|
34163
34643
|
c1 = this._regioncode(x1, y1);
|
34164
34644
|
|
34165
|
-
let e0,
|
34645
|
+
let e0,
|
34646
|
+
e1 = 0;
|
34166
34647
|
|
34167
34648
|
for (let j = 0; j < n; j += 2) {
|
34168
34649
|
x0 = x1, y0 = y1, x1 = points[j], y1 = points[j + 1];
|
@@ -34275,7 +34756,9 @@
|
|
34275
34756
|
e0 = 0b0101, x = this.xmin, y = this.ymin;
|
34276
34757
|
break;
|
34277
34758
|
// left
|
34278
|
-
}
|
34759
|
+
} // Note: this implicitly checks for out of bounds: if P[j] or P[j+1] are
|
34760
|
+
// undefined, the conditional statement will be executed.
|
34761
|
+
|
34279
34762
|
|
34280
34763
|
if ((P[j] !== x || P[j + 1] !== y) && this.contains(i, x, y)) {
|
34281
34764
|
P.splice(j, 0, x, y), j += 2;
|
@@ -34366,7 +34849,10 @@
|
|
34366
34849
|
}
|
34367
34850
|
|
34368
34851
|
class Delaunay {
|
34369
|
-
static from(points
|
34852
|
+
static from(points) {
|
34853
|
+
let fx = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : pointX;
|
34854
|
+
let fy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : pointY;
|
34855
|
+
let that = arguments.length > 3 ? arguments[3] : undefined;
|
34370
34856
|
return new Delaunay("length" in points ? flatArray(points, fx, fy, that) : Float64Array.from(flatIterable(points, fx, fy, that)));
|
34371
34857
|
}
|
34372
34858
|
|
@@ -34436,10 +34922,13 @@
|
|
34436
34922
|
this.triangles = new Int32Array(3).fill(-1);
|
34437
34923
|
this.halfedges = new Int32Array(3).fill(-1);
|
34438
34924
|
this.triangles[0] = hull[0];
|
34439
|
-
this.triangles[1] = hull[1];
|
34440
|
-
this.triangles[2] = hull[1];
|
34441
34925
|
inedges[hull[0]] = 1;
|
34442
|
-
|
34926
|
+
|
34927
|
+
if (hull.length === 2) {
|
34928
|
+
inedges[hull[1]] = 0;
|
34929
|
+
this.triangles[1] = hull[1];
|
34930
|
+
this.triangles[2] = hull[1];
|
34931
|
+
}
|
34443
34932
|
}
|
34444
34933
|
}
|
34445
34934
|
|
@@ -34485,7 +34974,8 @@
|
|
34485
34974
|
} while (e !== e0);
|
34486
34975
|
}
|
34487
34976
|
|
34488
|
-
find(x, y
|
34977
|
+
find(x, y) {
|
34978
|
+
let i = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
34489
34979
|
if ((x = +x, x !== x) || (y = +y, y !== y)) return -1;
|
34490
34980
|
const i0 = i;
|
34491
34981
|
let c;
|
@@ -34554,7 +35044,9 @@
|
|
34554
35044
|
return buffer && buffer.value();
|
34555
35045
|
}
|
34556
35046
|
|
34557
|
-
renderPoints(context, r
|
35047
|
+
renderPoints(context, r) {
|
35048
|
+
if (r === undefined && (!context || typeof context.moveTo !== "function")) r = context, context = null;
|
35049
|
+
r = r == undefined ? 2 : +r;
|
34558
35050
|
const buffer = context == null ? context = new Path() : undefined;
|
34559
35051
|
const {
|
34560
35052
|
points
|
@@ -36068,6 +36560,8 @@
|
|
36068
36560
|
resolvefilter: ResolveFilter
|
36069
36561
|
});
|
36070
36562
|
|
36563
|
+
var version = "5.22.1";
|
36564
|
+
|
36071
36565
|
const RawCode = 'RawCode';
|
36072
36566
|
const Literal = 'Literal';
|
36073
36567
|
const Property = 'Property';
|
@@ -36248,11 +36742,20 @@
|
|
36248
36742
|
|
36249
36743
|
|
36250
36744
|
function isIdentifierStart(ch) {
|
36251
|
-
return ch === 0x24 || ch === 0x5F ||
|
36745
|
+
return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore)
|
36746
|
+
ch >= 0x41 && ch <= 0x5A || // A..Z
|
36747
|
+
ch >= 0x61 && ch <= 0x7A || // a..z
|
36748
|
+
ch === 0x5C || // \ (backslash)
|
36749
|
+
ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch));
|
36252
36750
|
}
|
36253
36751
|
|
36254
36752
|
function isIdentifierPart(ch) {
|
36255
|
-
return ch === 0x24 || ch === 0x5F ||
|
36753
|
+
return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore)
|
36754
|
+
ch >= 0x41 && ch <= 0x5A || // A..Z
|
36755
|
+
ch >= 0x61 && ch <= 0x7A || // a..z
|
36756
|
+
ch >= 0x30 && ch <= 0x39 || // 0..9
|
36757
|
+
ch === 0x5C || // \ (backslash)
|
36758
|
+
ch >= 0x80 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch));
|
36256
36759
|
} // 7.6.1.1 Keywords
|
36257
36760
|
|
36258
36761
|
|
@@ -37742,7 +38245,7 @@
|
|
37742
38245
|
functions = (opt.functions || Functions)(visit),
|
37743
38246
|
globalvar = opt.globalvar,
|
37744
38247
|
fieldvar = opt.fieldvar,
|
37745
|
-
outputGlobal = isFunction(globalvar) ? globalvar : id =>
|
38248
|
+
outputGlobal = isFunction(globalvar) ? globalvar : id => "".concat(globalvar, "[\"").concat(id, "\"]");
|
37746
38249
|
let globals = {},
|
37747
38250
|
fields = {},
|
37748
38251
|
memberDepth = 0;
|
@@ -37827,70 +38330,15 @@
|
|
37827
38330
|
return codegen;
|
37828
38331
|
}
|
37829
38332
|
|
37830
|
-
function ascending(a, b) {
|
37831
|
-
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
37832
|
-
}
|
37833
|
-
|
37834
|
-
function bisector(f) {
|
37835
|
-
let delta = f;
|
37836
|
-
let compare = f;
|
37837
|
-
|
37838
|
-
if (f.length === 1) {
|
37839
|
-
delta = (d, x) => f(d) - x;
|
37840
|
-
|
37841
|
-
compare = ascendingComparator(f);
|
37842
|
-
}
|
37843
|
-
|
37844
|
-
function left(a, x, lo, hi) {
|
37845
|
-
if (lo == null) lo = 0;
|
37846
|
-
if (hi == null) hi = a.length;
|
37847
|
-
|
37848
|
-
while (lo < hi) {
|
37849
|
-
const mid = lo + hi >>> 1;
|
37850
|
-
if (compare(a[mid], x) < 0) lo = mid + 1;else hi = mid;
|
37851
|
-
}
|
37852
|
-
|
37853
|
-
return lo;
|
37854
|
-
}
|
37855
|
-
|
37856
|
-
function right(a, x, lo, hi) {
|
37857
|
-
if (lo == null) lo = 0;
|
37858
|
-
if (hi == null) hi = a.length;
|
37859
|
-
|
37860
|
-
while (lo < hi) {
|
37861
|
-
const mid = lo + hi >>> 1;
|
37862
|
-
if (compare(a[mid], x) > 0) hi = mid;else lo = mid + 1;
|
37863
|
-
}
|
37864
|
-
|
37865
|
-
return lo;
|
37866
|
-
}
|
37867
|
-
|
37868
|
-
function center(a, x, lo, hi) {
|
37869
|
-
if (lo == null) lo = 0;
|
37870
|
-
if (hi == null) hi = a.length;
|
37871
|
-
const i = left(a, x, lo, hi - 1);
|
37872
|
-
return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
|
37873
|
-
}
|
37874
|
-
|
37875
|
-
return {
|
37876
|
-
left,
|
37877
|
-
center,
|
37878
|
-
right
|
37879
|
-
};
|
37880
|
-
}
|
37881
|
-
|
37882
|
-
function ascendingComparator(f) {
|
37883
|
-
return (d, x) => ascending(f(d), x);
|
37884
|
-
}
|
37885
|
-
|
37886
38333
|
const Intersect = 'intersect';
|
37887
38334
|
const Union = 'union';
|
37888
38335
|
const VlMulti = 'vlMulti';
|
37889
38336
|
const VlPoint = 'vlPoint';
|
37890
38337
|
const Or = 'or';
|
37891
38338
|
const And = 'and';
|
37892
|
-
const
|
37893
|
-
|
38339
|
+
const SelectionId = '_vgsid_';
|
38340
|
+
const $selectionId = field$1(SelectionId);
|
38341
|
+
const TYPE_ENUM = 'E',
|
37894
38342
|
TYPE_RANGE_INC = 'R',
|
37895
38343
|
TYPE_RANGE_EXC = 'R-E',
|
37896
38344
|
TYPE_RANGE_LE = 'R-LE',
|
@@ -37994,8 +38442,7 @@
|
|
37994
38442
|
return n && intersect;
|
37995
38443
|
}
|
37996
38444
|
|
37997
|
-
const
|
37998
|
-
bisect = bisector(selectionId),
|
38445
|
+
const bisect = bisector($selectionId),
|
37999
38446
|
bisectLeft = bisect.left,
|
38000
38447
|
bisectRight = bisect.right;
|
38001
38448
|
|
@@ -38004,10 +38451,10 @@
|
|
38004
38451
|
entries = data ? data.values.value : [],
|
38005
38452
|
unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined,
|
38006
38453
|
intersect = op === Intersect,
|
38007
|
-
value = selectionId(datum),
|
38454
|
+
value = $selectionId(datum),
|
38008
38455
|
index = bisectLeft(entries, value);
|
38009
38456
|
if (index === entries.length) return false;
|
38010
|
-
if (selectionId(entries[index]) !== value) return false;
|
38457
|
+
if ($selectionId(entries[index]) !== value) return false;
|
38011
38458
|
|
38012
38459
|
if (unitIdx && intersect) {
|
38013
38460
|
if (unitIdx.size === 1) return true;
|
@@ -38019,15 +38466,17 @@
|
|
38019
38466
|
/**
|
38020
38467
|
* Maps an array of scene graph items to an array of selection tuples.
|
38021
38468
|
* @param {string} name - The name of the dataset representing the selection.
|
38022
|
-
* @param {string}
|
38469
|
+
* @param {string} base - The base object that generated tuples extend.
|
38023
38470
|
*
|
38024
38471
|
* @returns {array} An array of selection entries for the given unit.
|
38025
38472
|
*/
|
38026
38473
|
|
38027
38474
|
|
38028
38475
|
function selectionTuples(array, base) {
|
38029
|
-
return array.map(x => extend$1({
|
38476
|
+
return array.map(x => extend$1(base.fields ? {
|
38030
38477
|
values: base.fields.map(f => (f.getter || (f.getter = field$1(f.field)))(x.datum))
|
38478
|
+
} : {
|
38479
|
+
[SelectionId]: $selectionId(x.datum)
|
38031
38480
|
}, base));
|
38032
38481
|
}
|
38033
38482
|
/**
|
@@ -38056,6 +38505,7 @@
|
|
38056
38505
|
values,
|
38057
38506
|
unit,
|
38058
38507
|
field,
|
38508
|
+
value,
|
38059
38509
|
res,
|
38060
38510
|
resUnit,
|
38061
38511
|
type,
|
@@ -38071,32 +38521,55 @@
|
|
38071
38521
|
fields = entry.fields;
|
38072
38522
|
values = entry.values;
|
38073
38523
|
|
38074
|
-
|
38075
|
-
|
38076
|
-
|
38524
|
+
if (fields && values) {
|
38525
|
+
// Intentional selection stores
|
38526
|
+
for (j = 0, m = fields.length; j < m; ++j) {
|
38527
|
+
field = fields[j];
|
38528
|
+
res = resolved[field.field] || (resolved[field.field] = {});
|
38529
|
+
resUnit = res[unit] || (res[unit] = []);
|
38530
|
+
types[field.field] = type = field.type.charAt(0);
|
38531
|
+
union = ops["".concat(type, "_union")];
|
38532
|
+
res[unit] = union(resUnit, array$5(values[j]));
|
38533
|
+
} // If the same multi-selection is repeated over views and projected over
|
38534
|
+
// an encoding, it may operate over different fields making it especially
|
38535
|
+
// tricky to reliably resolve it. At best, we can de-dupe identical entries
|
38536
|
+
// but doing so may be more computationally expensive than it is worth.
|
38537
|
+
// Instead, for now, we simply transform our store representation into
|
38538
|
+
// a more human-friendly one.
|
38539
|
+
|
38540
|
+
|
38541
|
+
if (isMulti) {
|
38542
|
+
resUnit = multiRes[unit] || (multiRes[unit] = []);
|
38543
|
+
resUnit.push(array$5(values).reduce((obj, curr, j) => (obj[fields[j].field] = curr, obj), {}));
|
38544
|
+
}
|
38545
|
+
} else {
|
38546
|
+
// Short circuit extensional selectionId stores which hold sorted IDs unique to each unit.
|
38547
|
+
field = SelectionId;
|
38548
|
+
value = $selectionId(entry);
|
38549
|
+
res = resolved[field] || (resolved[field] = {});
|
38077
38550
|
resUnit = res[unit] || (res[unit] = []);
|
38078
|
-
|
38079
|
-
union = ops[type + '_union'];
|
38080
|
-
res[unit] = union(resUnit, array$5(values[j]));
|
38081
|
-
} // If the same multi-selection is repeated over views and projected over
|
38082
|
-
// an encoding, it may operate over different fields making it especially
|
38083
|
-
// tricky to reliably resolve it. At best, we can de-dupe identical entries
|
38084
|
-
// but doing so may be more computationally expensive than it is worth.
|
38085
|
-
// Instead, for now, we simply transform our store representation into
|
38086
|
-
// a more human-friendly one.
|
38087
|
-
|
38551
|
+
resUnit.push(value);
|
38088
38552
|
|
38089
|
-
|
38090
|
-
|
38091
|
-
|
38553
|
+
if (isMulti) {
|
38554
|
+
resUnit = multiRes[unit] || (multiRes[unit] = []);
|
38555
|
+
resUnit.push({
|
38556
|
+
[SelectionId]: value
|
38557
|
+
});
|
38558
|
+
}
|
38092
38559
|
}
|
38093
38560
|
} // Then resolve fields across units as per the op.
|
38094
38561
|
|
38095
38562
|
|
38096
38563
|
op = op || Union;
|
38097
|
-
|
38098
|
-
|
38099
|
-
|
38564
|
+
|
38565
|
+
if (resolved[SelectionId]) {
|
38566
|
+
resolved[SelectionId] = ops["".concat(SelectionId, "_").concat(op)](...Object.values(resolved[SelectionId]));
|
38567
|
+
} else {
|
38568
|
+
Object.keys(resolved).forEach(field => {
|
38569
|
+
resolved[field] = Object.keys(resolved[field]).map(unit => resolved[field][unit]).reduce((acc, curr) => acc === undefined ? curr : ops["".concat(types[field], "_").concat(op)](acc, curr));
|
38570
|
+
});
|
38571
|
+
}
|
38572
|
+
|
38100
38573
|
entries = Object.keys(multiRes);
|
38101
38574
|
|
38102
38575
|
if (isMulti && entries.length) {
|
@@ -38114,6 +38587,8 @@
|
|
38114
38587
|
}
|
38115
38588
|
|
38116
38589
|
var ops = {
|
38590
|
+
["".concat(SelectionId, "_union")]: union,
|
38591
|
+
["".concat(SelectionId, "_intersect")]: intersection,
|
38117
38592
|
E_union: function (base, value) {
|
38118
38593
|
if (!base.length) return value;
|
38119
38594
|
var i = 0,
|
@@ -38322,9 +38797,9 @@
|
|
38322
38797
|
|
38323
38798
|
|
38324
38799
|
return {
|
38325
|
-
_bandwidth: args =>
|
38326
|
-
_range: args =>
|
38327
|
-
_scale: args =>
|
38800
|
+
_bandwidth: args => "this.__bandwidth(".concat(ref(args[0]), ")"),
|
38801
|
+
_range: args => "".concat(ref(args[0]), ".range()"),
|
38802
|
+
_scale: args => "".concat(ref(args[0]), "(").concat(codegen(args[1]), ")")
|
38328
38803
|
};
|
38329
38804
|
}
|
38330
38805
|
|
@@ -38516,19 +38991,35 @@
|
|
38516
38991
|
return array(seq) || (isString(seq) ? seq : null);
|
38517
38992
|
}
|
38518
38993
|
|
38519
|
-
function join(seq
|
38994
|
+
function join(seq) {
|
38995
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
38996
|
+
args[_key - 1] = arguments[_key];
|
38997
|
+
}
|
38998
|
+
|
38520
38999
|
return array(seq).join(...args);
|
38521
39000
|
}
|
38522
39001
|
|
38523
|
-
function indexof(seq
|
39002
|
+
function indexof(seq) {
|
39003
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
39004
|
+
args[_key2 - 1] = arguments[_key2];
|
39005
|
+
}
|
39006
|
+
|
38524
39007
|
return sequence(seq).indexOf(...args);
|
38525
39008
|
}
|
38526
39009
|
|
38527
|
-
function lastindexof(seq
|
39010
|
+
function lastindexof(seq) {
|
39011
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
39012
|
+
args[_key3 - 1] = arguments[_key3];
|
39013
|
+
}
|
39014
|
+
|
38528
39015
|
return sequence(seq).lastIndexOf(...args);
|
38529
39016
|
}
|
38530
39017
|
|
38531
|
-
function slice(seq
|
39018
|
+
function slice(seq) {
|
39019
|
+
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
39020
|
+
args[_key4 - 1] = arguments[_key4];
|
39021
|
+
}
|
39022
|
+
|
38532
39023
|
return sequence(seq).slice(...args);
|
38533
39024
|
}
|
38534
39025
|
|
@@ -38610,7 +39101,7 @@
|
|
38610
39101
|
function pathShape(path) {
|
38611
39102
|
let p = null;
|
38612
39103
|
return function (context) {
|
38613
|
-
return context ? pathRender(context, p = p ||
|
39104
|
+
return context ? pathRender(context, p = p || parse$3(path)) : path;
|
38614
39105
|
};
|
38615
39106
|
}
|
38616
39107
|
|
@@ -38673,6 +39164,101 @@
|
|
38673
39164
|
|
38674
39165
|
return p;
|
38675
39166
|
}
|
39167
|
+
/**
|
39168
|
+
* Appends a new point to the lasso
|
39169
|
+
*
|
39170
|
+
* @param {*} lasso the lasso in pixel space
|
39171
|
+
* @param {*} x the x coordinate in pixel space
|
39172
|
+
* @param {*} y the y coordinate in pixel space
|
39173
|
+
* @param {*} minDist the minimum distance, in pixels, that thenew point needs to be apart from the last point
|
39174
|
+
* @returns a new array containing the lasso with the new point
|
39175
|
+
*/
|
39176
|
+
|
39177
|
+
|
39178
|
+
function lassoAppend(lasso, x, y) {
|
39179
|
+
let minDist = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5;
|
39180
|
+
const last = lasso[lasso.length - 1]; // Add point to lasso if distance to last point exceed minDist or its the first point
|
39181
|
+
|
39182
|
+
if (last === undefined || Math.sqrt((last[0] - x) ** 2 + (last[1] - y) ** 2) > minDist) {
|
39183
|
+
lasso.push([x, y]);
|
39184
|
+
return [...lasso];
|
39185
|
+
}
|
39186
|
+
|
39187
|
+
return lasso;
|
39188
|
+
}
|
39189
|
+
/**
|
39190
|
+
* Generates a svg path command which draws a lasso
|
39191
|
+
*
|
39192
|
+
* @param {*} lasso the lasso in pixel space in the form [[x,y], [x,y], ...]
|
39193
|
+
* @returns the svg path command that draws the lasso
|
39194
|
+
*/
|
39195
|
+
|
39196
|
+
|
39197
|
+
function lassoPath(lasso) {
|
39198
|
+
return (lasso !== null && lasso !== void 0 ? lasso : []).reduce((svg, _ref, i) => {
|
39199
|
+
let [x, y] = _ref;
|
39200
|
+
return svg += i == 0 ? "M ".concat(x, ",").concat(y, " ") : i === lasso.length - 1 ? ' Z' : "L ".concat(x, ",").concat(y, " ");
|
39201
|
+
}, '');
|
39202
|
+
}
|
39203
|
+
/**
|
39204
|
+
* Inverts the lasso from pixel space to an array of vega scenegraph tuples
|
39205
|
+
*
|
39206
|
+
* @param {*} data the dataset
|
39207
|
+
* @param {*} pixelLasso the lasso in pixel space, [[x,y], [x,y], ...]
|
39208
|
+
* @param {*} unit the unit where the lasso is defined
|
39209
|
+
*
|
39210
|
+
* @returns an array of vega scenegraph tuples
|
39211
|
+
*/
|
39212
|
+
|
39213
|
+
|
39214
|
+
function intersectLasso(markname, pixelLasso, unit) {
|
39215
|
+
const {
|
39216
|
+
x,
|
39217
|
+
y,
|
39218
|
+
mark
|
39219
|
+
} = unit;
|
39220
|
+
const bb = new Bounds().set(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER); // Get bounding box around lasso
|
39221
|
+
|
39222
|
+
for (const [px, py] of pixelLasso) {
|
39223
|
+
if (px < bb.x1) bb.x1 = px;
|
39224
|
+
if (px > bb.x2) bb.x2 = px;
|
39225
|
+
if (py < bb.y1) bb.y1 = py;
|
39226
|
+
if (py > bb.y2) bb.y2 = py;
|
39227
|
+
} // Translate bb against unit coordinates
|
39228
|
+
|
39229
|
+
|
39230
|
+
bb.translate(x, y);
|
39231
|
+
const intersection = intersect([[bb.x1, bb.y1], [bb.x2, bb.y2]], markname, mark); // Check every point against the lasso
|
39232
|
+
|
39233
|
+
return intersection.filter(tuple => pointInPolygon(tuple.x, tuple.y, pixelLasso));
|
39234
|
+
}
|
39235
|
+
/**
|
39236
|
+
* Performs a test if a point is inside a polygon based on the idea from
|
39237
|
+
* https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html
|
39238
|
+
*
|
39239
|
+
* This method will not need the same start/end point since it wraps around the edges of the array
|
39240
|
+
*
|
39241
|
+
* @param {*} test a point to test against
|
39242
|
+
* @param {*} polygon a polygon in the form [[x,y], [x,y], ...]
|
39243
|
+
* @returns true if the point lies inside the polygon, false otherwise
|
39244
|
+
*/
|
39245
|
+
|
39246
|
+
|
39247
|
+
function pointInPolygon(testx, testy, polygon) {
|
39248
|
+
let intersections = 0;
|
39249
|
+
|
39250
|
+
for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
|
39251
|
+
const [prevX, prevY] = polygon[j];
|
39252
|
+
const [x, y] = polygon[i]; // count intersections
|
39253
|
+
|
39254
|
+
if (y > testy != prevY > testy && testx < (prevX - x) * (testy - y) / (prevY - y) + x) {
|
39255
|
+
intersections++;
|
39256
|
+
}
|
39257
|
+
} // point is in polygon if intersection count is odd
|
39258
|
+
|
39259
|
+
|
39260
|
+
return intersections & 1;
|
39261
|
+
}
|
38676
39262
|
|
38677
39263
|
const functionContext = {
|
38678
39264
|
random() {
|
@@ -38711,7 +39297,12 @@
|
|
38711
39297
|
},
|
38712
39298
|
|
38713
39299
|
toBoolean,
|
38714
|
-
|
39300
|
+
|
39301
|
+
toDate(_) {
|
39302
|
+
return toDate(_);
|
39303
|
+
},
|
39304
|
+
|
39305
|
+
// suppress extra arguments
|
38715
39306
|
toNumber,
|
38716
39307
|
toString,
|
38717
39308
|
indexof,
|
@@ -38735,7 +39326,7 @@
|
|
38735
39326
|
hsl: hsl$2,
|
38736
39327
|
luminance,
|
38737
39328
|
contrast,
|
38738
|
-
sequence: range$
|
39329
|
+
sequence: range$3,
|
38739
39330
|
format,
|
38740
39331
|
utcFormat,
|
38741
39332
|
utcParse,
|
@@ -38759,7 +39350,12 @@
|
|
38759
39350
|
warn,
|
38760
39351
|
info,
|
38761
39352
|
debug,
|
38762
|
-
|
39353
|
+
|
39354
|
+
extent(_) {
|
39355
|
+
return extent(_);
|
39356
|
+
},
|
39357
|
+
|
39358
|
+
// suppress extra arguments
|
38763
39359
|
inScope,
|
38764
39360
|
intersect,
|
38765
39361
|
clampRange,
|
@@ -38780,7 +39376,10 @@
|
|
38780
39376
|
zoomPow,
|
38781
39377
|
zoomSymlog,
|
38782
39378
|
encode,
|
38783
|
-
modify
|
39379
|
+
modify,
|
39380
|
+
lassoAppend,
|
39381
|
+
lassoPath,
|
39382
|
+
intersectLasso
|
38784
39383
|
};
|
38785
39384
|
const eventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'],
|
38786
39385
|
// event functions
|
@@ -38795,7 +39394,7 @@
|
|
38795
39394
|
forbidden: ['_'],
|
38796
39395
|
allowed: ['datum', 'event', 'item'],
|
38797
39396
|
fieldvar: 'datum',
|
38798
|
-
globalvar: id =>
|
39397
|
+
globalvar: id => "_[".concat($(SignalPrefix + id), "]"),
|
38799
39398
|
functions: buildFunctions,
|
38800
39399
|
constants: Constants,
|
38801
39400
|
visitors: astVisitors
|
@@ -38993,10 +39592,7 @@
|
|
38993
39592
|
|
38994
39593
|
|
38995
39594
|
function _compare(u, v, lt, gt) {
|
38996
|
-
return
|
38997
|
-
: (u > v || v == null) && u != null ? ${gt}
|
38998
|
-
: ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt}
|
38999
|
-
: v !== v && u === u ? ${gt} : `;
|
39595
|
+
return "((u = ".concat(u, ") < (v = ").concat(v, ") || u == null) && v != null ? ").concat(lt, "\n : (u > v || v == null) && u != null ? ").concat(gt, "\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ").concat(lt, "\n : v !== v && u === u ? ").concat(gt, " : ");
|
39000
39596
|
}
|
39001
39597
|
|
39002
39598
|
var expressionCodegen = {
|
@@ -39019,7 +39615,7 @@
|
|
39019
39615
|
* Parse an expression used to handle an event-driven operator update.
|
39020
39616
|
*/
|
39021
39617
|
handler: (ctx, expr) => {
|
39022
|
-
const code =
|
39618
|
+
const code = "var datum=event.item&&event.item.datum;return ".concat(expr.code, ";");
|
39023
39619
|
return expression(ctx, ['_', 'event'], code);
|
39024
39620
|
},
|
39025
39621
|
|
@@ -39035,7 +39631,7 @@
|
|
39035
39631
|
|
39036
39632
|
for (const name in channels) {
|
39037
39633
|
const o = 'o[' + $(name) + ']';
|
39038
|
-
code +=
|
39634
|
+
code += "$=".concat(channels[name].code, ";if(").concat(o, "!==$)").concat(o, "=$,m=1;");
|
39039
39635
|
}
|
39040
39636
|
|
39041
39637
|
code += adjustSpatial(channels, marktype);
|
@@ -39048,8 +39644,8 @@
|
|
39048
39644
|
*/
|
39049
39645
|
codegen: {
|
39050
39646
|
get(path) {
|
39051
|
-
const ref =
|
39052
|
-
const get = Function('_',
|
39647
|
+
const ref = "[".concat(path.map($).join(']['), "]");
|
39648
|
+
const get = Function('_', "return _".concat(ref, ";"));
|
39053
39649
|
get.path = ref;
|
39054
39650
|
return get;
|
39055
39651
|
},
|
@@ -39062,12 +39658,12 @@
|
|
39062
39658
|
let u, v;
|
39063
39659
|
|
39064
39660
|
if (f.path) {
|
39065
|
-
u =
|
39066
|
-
v =
|
39661
|
+
u = "a".concat(f.path);
|
39662
|
+
v = "b".concat(f.path);
|
39067
39663
|
} else {
|
39068
39664
|
(t = t || {})['f' + i] = f;
|
39069
|
-
u =
|
39070
|
-
v =
|
39665
|
+
u = "this.f".concat(i, "(a)");
|
39666
|
+
v = "this.f".concat(i, "(b)");
|
39071
39667
|
}
|
39072
39668
|
|
39073
39669
|
return _compare(u, v, -o, o);
|
@@ -39844,7 +40440,7 @@
|
|
39844
40440
|
const rule = view._eventConfig && view._eventConfig[key];
|
39845
40441
|
|
39846
40442
|
if (rule === false || isObject(rule) && !rule[type]) {
|
39847
|
-
view.warn(
|
40443
|
+
view.warn("Blocked ".concat(key, " ").concat(type, " event listener."));
|
39848
40444
|
return false;
|
39849
40445
|
}
|
39850
40446
|
|
@@ -40330,7 +40926,7 @@
|
|
40330
40926
|
|
40331
40927
|
if (el && clear) {
|
40332
40928
|
try {
|
40333
|
-
el.
|
40929
|
+
el.textContent = '';
|
40334
40930
|
} catch (e) {
|
40335
40931
|
el = null;
|
40336
40932
|
view.error(e);
|
@@ -41345,14 +41941,14 @@
|
|
41345
41941
|
};
|
41346
41942
|
}
|
41347
41943
|
|
41348
|
-
const scaleRef = scale => isString(scale) ? $(scale) : scale.signal ?
|
41944
|
+
const scaleRef = scale => isString(scale) ? $(scale) : scale.signal ? "(".concat(scale.signal, ")") : field(scale);
|
41349
41945
|
|
41350
41946
|
function entry$1(enc) {
|
41351
41947
|
if (enc.gradient != null) {
|
41352
41948
|
return gradient(enc);
|
41353
41949
|
}
|
41354
41950
|
|
41355
|
-
let value = enc.signal ?
|
41951
|
+
let value = enc.signal ? "(".concat(enc.signal, ")") : enc.color ? color(enc.color) : enc.field != null ? field(enc.field) : enc.value !== undefined ? $(enc.value) : undefined;
|
41356
41952
|
|
41357
41953
|
if (enc.scale != null) {
|
41358
41954
|
value = scale(enc, value);
|
@@ -41363,25 +41959,25 @@
|
|
41363
41959
|
}
|
41364
41960
|
|
41365
41961
|
if (enc.exponent != null) {
|
41366
|
-
value =
|
41962
|
+
value = "pow(".concat(value, ",").concat(property(enc.exponent), ")");
|
41367
41963
|
}
|
41368
41964
|
|
41369
41965
|
if (enc.mult != null) {
|
41370
|
-
value +=
|
41966
|
+
value += "*".concat(property(enc.mult));
|
41371
41967
|
}
|
41372
41968
|
|
41373
41969
|
if (enc.offset != null) {
|
41374
|
-
value +=
|
41970
|
+
value += "+".concat(property(enc.offset));
|
41375
41971
|
}
|
41376
41972
|
|
41377
41973
|
if (enc.round) {
|
41378
|
-
value =
|
41974
|
+
value = "round(".concat(value, ")");
|
41379
41975
|
}
|
41380
41976
|
|
41381
41977
|
return value;
|
41382
41978
|
}
|
41383
41979
|
|
41384
|
-
const _color = (type, x, y, z) =>
|
41980
|
+
const _color = (type, x, y, z) => "(".concat(type, "(").concat([x, y, z].map(entry$1).join(','), ")+'')");
|
41385
41981
|
|
41386
41982
|
function color(enc) {
|
41387
41983
|
return enc.c ? _color('hcl', enc.h, enc.c, enc.l) : enc.h || enc.s ? _color('hsl', enc.h, enc.s, enc.l) : enc.l || enc.a ? _color('lab', enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color('rgb', enc.r, enc.g, enc.b) : null;
|
@@ -41394,7 +41990,7 @@
|
|
41394
41990
|
while (args.length && peek$1(args) == null) args.pop();
|
41395
41991
|
|
41396
41992
|
args.unshift(scaleRef(enc.gradient));
|
41397
|
-
return
|
41993
|
+
return "gradient(".concat(args.join(','), ")");
|
41398
41994
|
}
|
41399
41995
|
|
41400
41996
|
function property(property) {
|
@@ -41446,17 +42042,17 @@
|
|
41446
42042
|
|
41447
42043
|
if (enc.range != null) {
|
41448
42044
|
// pull value from scale range
|
41449
|
-
value =
|
42045
|
+
value = "lerp(_range(".concat(scale, "), ").concat(+enc.range, ")");
|
41450
42046
|
} else {
|
41451
42047
|
// run value through scale and/or pull scale bandwidth
|
41452
|
-
if (value !== undefined) value =
|
42048
|
+
if (value !== undefined) value = "_scale(".concat(scale, ", ").concat(value, ")");
|
41453
42049
|
|
41454
42050
|
if (enc.band) {
|
41455
|
-
value = (value ? value + '+' : '') +
|
42051
|
+
value = (value ? value + '+' : '') + "_bandwidth(".concat(scale, ")") + (+enc.band === 1 ? '' : '*' + property(enc.band));
|
41456
42052
|
|
41457
42053
|
if (enc.extra) {
|
41458
42054
|
// include logic to handle extraneous elements
|
41459
|
-
value =
|
42055
|
+
value = "(datum.extra ? _scale(".concat(scale, ", datum.extra.value) : ").concat(value, ")");
|
41460
42056
|
}
|
41461
42057
|
}
|
41462
42058
|
|
@@ -41470,7 +42066,7 @@
|
|
41470
42066
|
let code = '';
|
41471
42067
|
enc.forEach(rule => {
|
41472
42068
|
const value = entry$1(rule);
|
41473
|
-
code += rule.test ?
|
42069
|
+
code += rule.test ? "(".concat(rule.test, ")?").concat(value, ":") : value;
|
41474
42070
|
}); // if no else clause, terminate with null (#1366)
|
41475
42071
|
|
41476
42072
|
if (peek$1(code) === ':') {
|
@@ -42229,7 +42825,7 @@
|
|
42229
42825
|
}
|
42230
42826
|
|
42231
42827
|
function anchorExpr(s, e, m) {
|
42232
|
-
return
|
42828
|
+
return "item.anchor === '".concat(Start, "' ? ").concat(s, " : item.anchor === '").concat(End, "' ? ").concat(e, " : ").concat(m);
|
42233
42829
|
}
|
42234
42830
|
|
42235
42831
|
const alignExpr$1 = anchorExpr($(Left), $(Right), $(Center));
|
@@ -42248,15 +42844,15 @@
|
|
42248
42844
|
} else if (v.signal) {
|
42249
42845
|
// if signal, augment code to interpret values
|
42250
42846
|
band = {
|
42251
|
-
signal:
|
42847
|
+
signal: "(".concat(v.signal, ") === 'extent' ? 1 : 0.5")
|
42252
42848
|
};
|
42253
42849
|
extra = {
|
42254
|
-
signal:
|
42850
|
+
signal: "(".concat(v.signal, ") === 'extent'")
|
42255
42851
|
};
|
42256
42852
|
|
42257
42853
|
if (!isObject(offset)) {
|
42258
42854
|
offset = {
|
42259
|
-
signal:
|
42855
|
+
signal: "(".concat(v.signal, ") === 'extent' ? 0 : ").concat(offset)
|
42260
42856
|
};
|
42261
42857
|
}
|
42262
42858
|
} else if (v === 'extent') {
|
@@ -42406,8 +43002,8 @@
|
|
42406
43002
|
}, userEncode);
|
42407
43003
|
}
|
42408
43004
|
|
42409
|
-
const alignExpr =
|
42410
|
-
baselineExpr =
|
43005
|
+
const alignExpr = "datum.".concat(Perc, "<=0?\"").concat(Left, "\":datum.").concat(Perc, ">=1?\"").concat(Right, "\":\"").concat(Center, "\""),
|
43006
|
+
baselineExpr = "datum.".concat(Perc, "<=0?\"").concat(Bottom, "\":datum.").concat(Perc, ">=1?\"").concat(Top, "\":\"").concat(Middle, "\"");
|
42411
43007
|
|
42412
43008
|
function legendGradientLabels(spec, config, userEncode, dataRef) {
|
42413
43009
|
const _ = lookup(spec, config),
|
@@ -42500,12 +43096,12 @@
|
|
42500
43096
|
valueRef = {
|
42501
43097
|
data: 'value'
|
42502
43098
|
},
|
42503
|
-
xSignal =
|
43099
|
+
xSignal = "(".concat(columns, ") ? datum.").concat(Offset, " : datum.").concat(Size),
|
42504
43100
|
yEncode = height ? encoder(height) : {
|
42505
43101
|
field: Size
|
42506
43102
|
},
|
42507
|
-
index =
|
42508
|
-
ncols =
|
43103
|
+
index = "datum.".concat(Index),
|
43104
|
+
ncols = "max(1, ".concat(columns, ")");
|
42509
43105
|
|
42510
43106
|
let encode, enter, update, nrows, sort;
|
42511
43107
|
yEncode.mult = 0.5; // -- LEGEND SYMBOLS --
|
@@ -42634,22 +43230,22 @@
|
|
42634
43230
|
}; // annotate and sort groups to ensure correct ordering
|
42635
43231
|
|
42636
43232
|
if (_.isVertical(true)) {
|
42637
|
-
nrows =
|
42638
|
-
update.row.signal =
|
42639
|
-
update.column.signal =
|
43233
|
+
nrows = "ceil(item.mark.items.length / ".concat(ncols, ")");
|
43234
|
+
update.row.signal = "".concat(index, "%").concat(nrows);
|
43235
|
+
update.column.signal = "floor(".concat(index, " / ").concat(nrows, ")");
|
42640
43236
|
sort = {
|
42641
43237
|
field: ['row', index]
|
42642
43238
|
};
|
42643
43239
|
} else {
|
42644
|
-
update.row.signal =
|
42645
|
-
update.column.signal =
|
43240
|
+
update.row.signal = "floor(".concat(index, " / ").concat(ncols, ")");
|
43241
|
+
update.column.signal = "".concat(index, " % ").concat(ncols);
|
42646
43242
|
sort = {
|
42647
43243
|
field: index
|
42648
43244
|
};
|
42649
43245
|
} // handle zero column case (implies infinite columns)
|
42650
43246
|
|
42651
43247
|
|
42652
|
-
update.column.signal =
|
43248
|
+
update.column.signal = "(".concat(columns, ")?").concat(update.column.signal, ":").concat(index); // facet legend entries into sub-groups
|
42653
43249
|
|
42654
43250
|
dataRef = {
|
42655
43251
|
facet: {
|
@@ -42689,14 +43285,14 @@
|
|
42689
43285
|
|
42690
43286
|
const isL = 'item.orient === "left"',
|
42691
43287
|
isR = 'item.orient === "right"',
|
42692
|
-
isLR =
|
42693
|
-
isVG =
|
43288
|
+
isLR = "(".concat(isL, " || ").concat(isR, ")"),
|
43289
|
+
isVG = "datum.vgrad && ".concat(isLR),
|
42694
43290
|
baseline = anchorExpr('"top"', '"bottom"', '"middle"'),
|
42695
43291
|
alignFlip = anchorExpr('"right"', '"left"', '"center"'),
|
42696
|
-
exprAlign =
|
42697
|
-
exprAnchor =
|
42698
|
-
exprAngle =
|
42699
|
-
exprBaseline =
|
43292
|
+
exprAlign = "datum.vgrad && ".concat(isR, " ? (").concat(alignFlip, ") : (").concat(isLR, " && !(datum.vgrad && ").concat(isL, ")) ? \"left\" : ").concat(alignExpr$1),
|
43293
|
+
exprAnchor = "item._anchor || (".concat(isLR, " ? \"middle\" : \"start\")"),
|
43294
|
+
exprAngle = "".concat(isVG, " ? (").concat(isL, " ? -90 : 90) : 0"),
|
43295
|
+
exprBaseline = "".concat(isLR, " ? (datum.vgrad ? (").concat(isR, " ? \"bottom\" : \"top\") : ").concat(baseline, ") : \"top\"");
|
42700
43296
|
|
42701
43297
|
function legendTitle(spec, config, userEncode, dataRef) {
|
42702
43298
|
const _ = lookup(spec, config);
|
@@ -43429,7 +44025,7 @@
|
|
43429
44025
|
if (type === Gradient) {
|
43430
44026
|
children = [legendGradient(spec, scale, config, encode.gradient), legendGradientLabels(spec, config, encode.labels, entryRef)]; // adjust default tick count based on the gradient length
|
43431
44027
|
|
43432
|
-
params.count = params.count || scope.signalRef(
|
44028
|
+
params.count = params.count || scope.signalRef("max(2,2*floor((".concat(deref(_.gradientLength()), ")/100))"));
|
43433
44029
|
} // discrete gradient legend
|
43434
44030
|
else if (type === Discrete) {
|
43435
44031
|
children = [legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), legendGradientLabels(spec, config, encode.labels, entryRef)];
|
@@ -43513,18 +44109,18 @@
|
|
43513
44109
|
const size = deref(getChannel('size', spec, marks)),
|
43514
44110
|
strokeWidth = deref(getChannel('strokeWidth', spec, marks)),
|
43515
44111
|
fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle));
|
43516
|
-
return parser(
|
44112
|
+
return parser("max(ceil(sqrt(".concat(size, ")+").concat(strokeWidth, "),").concat(fontSize, ")"), scope);
|
43517
44113
|
}
|
43518
44114
|
|
43519
44115
|
function getChannel(name, spec, marks) {
|
43520
|
-
return spec[name] ?
|
44116
|
+
return spec[name] ? "scale(\"".concat(spec[name], "\",datum)") : getEncoding(name, marks[0].encode);
|
43521
44117
|
}
|
43522
44118
|
|
43523
44119
|
function getFontSize(encode, scope, style) {
|
43524
44120
|
return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style);
|
43525
44121
|
}
|
43526
44122
|
|
43527
|
-
const angleExpr =
|
44123
|
+
const angleExpr = "item.orient===\"".concat(Left, "\"?-90:item.orient===\"").concat(Right, "\"?90:0");
|
43528
44124
|
|
43529
44125
|
function parseTitle(spec, scope) {
|
43530
44126
|
spec = isString(spec) ? {
|
@@ -43841,15 +44437,15 @@
|
|
43841
44437
|
value: b
|
43842
44438
|
};
|
43843
44439
|
|
43844
|
-
const ifXEnc = ($orient, a, b) => ifEnc(
|
44440
|
+
const ifXEnc = ($orient, a, b) => ifEnc("".concat($orient, " === '").concat(Top, "' || ").concat($orient, " === '").concat(Bottom, "'"), a, b);
|
43845
44441
|
|
43846
|
-
const ifYEnc = ($orient, a, b) => ifEnc(
|
44442
|
+
const ifYEnc = ($orient, a, b) => ifEnc("".concat($orient, " !== '").concat(Top, "' && ").concat($orient, " !== '").concat(Bottom, "'"), a, b);
|
43847
44443
|
|
43848
|
-
const ifLeftTopExpr = ($orient, a, b) => ifExpr(
|
44444
|
+
const ifLeftTopExpr = ($orient, a, b) => ifExpr("".concat($orient, " === '").concat(Left, "' || ").concat($orient, " === '").concat(Top, "'"), a, b);
|
43849
44445
|
|
43850
|
-
const ifTopExpr = ($orient, a, b) => ifExpr(
|
44446
|
+
const ifTopExpr = ($orient, a, b) => ifExpr("".concat($orient, " === '").concat(Top, "'"), a, b);
|
43851
44447
|
|
43852
|
-
const ifRightExpr = ($orient, a, b) => ifExpr(
|
44448
|
+
const ifRightExpr = ($orient, a, b) => ifExpr("".concat($orient, " === '").concat(Right, "'"), a, b);
|
43853
44449
|
|
43854
44450
|
const ifEnc = (test, a, b) => {
|
43855
44451
|
// ensure inputs are encoder objects (or null)
|
@@ -43861,7 +44457,7 @@
|
|
43861
44457
|
a = a ? a.signal || $(a.value) : null;
|
43862
44458
|
b = b ? b.signal || $(b.value) : null;
|
43863
44459
|
return {
|
43864
|
-
signal:
|
44460
|
+
signal: "".concat(test, " ? (").concat(a, ") : (").concat(b, ")")
|
43865
44461
|
};
|
43866
44462
|
} else {
|
43867
44463
|
// otherwise generate rule set
|
@@ -43874,17 +44470,17 @@
|
|
43874
44470
|
const isSimple = enc => enc == null || Object.keys(enc).length === 1;
|
43875
44471
|
|
43876
44472
|
const ifExpr = (test, a, b) => ({
|
43877
|
-
signal:
|
44473
|
+
signal: "".concat(test, " ? (").concat(toExpr(a), ") : (").concat(toExpr(b), ")")
|
43878
44474
|
});
|
43879
44475
|
|
43880
44476
|
const ifOrient = ($orient, t, b, l, r) => ({
|
43881
|
-
signal: (l != null ?
|
44477
|
+
signal: (l != null ? "".concat($orient, " === '").concat(Left, "' ? (").concat(toExpr(l), ") : ") : '') + (b != null ? "".concat($orient, " === '").concat(Bottom, "' ? (").concat(toExpr(b), ") : ") : '') + (r != null ? "".concat($orient, " === '").concat(Right, "' ? (").concat(toExpr(r), ") : ") : '') + (t != null ? "".concat($orient, " === '").concat(Top, "' ? (").concat(toExpr(t), ") : ") : '') + '(null)'
|
43882
44478
|
});
|
43883
44479
|
|
43884
44480
|
const toExpr = v => isSignal(v) ? v.signal : v == null ? null : $(v);
|
43885
44481
|
|
43886
44482
|
const mult = (sign, value) => value === 0 ? 0 : isSignal(sign) ? {
|
43887
|
-
signal:
|
44483
|
+
signal: "(".concat(sign.signal, ") * ").concat(value)
|
43888
44484
|
} : {
|
43889
44485
|
value: sign * value
|
43890
44486
|
};
|
@@ -44099,7 +44695,7 @@
|
|
44099
44695
|
function offsetValue(offset, sign) {
|
44100
44696
|
if (sign === 1) ;else if (!isObject(offset)) {
|
44101
44697
|
offset = isSignal(sign) ? {
|
44102
|
-
signal:
|
44698
|
+
signal: "(".concat(sign.signal, ") * (").concat(offset || 0, ")")
|
44103
44699
|
} : sign * (offset || 0);
|
44104
44700
|
} else {
|
44105
44701
|
let entry = offset = extend$1({}, offset);
|
@@ -44108,7 +44704,7 @@
|
|
44108
44704
|
if (!isObject(entry.mult)) {
|
44109
44705
|
entry.mult = isSignal(sign) // no offset if sign === 1
|
44110
44706
|
? {
|
44111
|
-
signal:
|
44707
|
+
signal: "(".concat(entry.mult, ") * (").concat(sign.signal, ")")
|
44112
44708
|
} : entry.mult * sign;
|
44113
44709
|
return offset;
|
44114
44710
|
} else {
|
@@ -44205,7 +44801,7 @@
|
|
44205
44801
|
const baseline = ifX(orient, ifTop(orient, 'bottom', 'top'), flushOn ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') : {
|
44206
44802
|
value: 'middle'
|
44207
44803
|
});
|
44208
|
-
const offsetExpr = flushExpr(scale, flush,
|
44804
|
+
const offsetExpr = flushExpr(scale, flush, "-(".concat(flushOffset, ")"), flushOffset, 0);
|
44209
44805
|
flushOn = flushOn && flushOffset;
|
44210
44806
|
const enter = {
|
44211
44807
|
opacity: zero,
|
@@ -44307,7 +44903,7 @@
|
|
44307
44903
|
}
|
44308
44904
|
};
|
44309
44905
|
const titlePos = {
|
44310
|
-
signal:
|
44906
|
+
signal: "lerp(range(\"".concat(spec.scale, "\"), ").concat(anchorExpr(0, 1, 0.5), ")")
|
44311
44907
|
};
|
44312
44908
|
update.x = ifX(orient, titlePos);
|
44313
44909
|
update.y = ifY(orient, titlePos);
|
@@ -44441,7 +45037,7 @@
|
|
44441
45037
|
minExtent: _('minExtent'),
|
44442
45038
|
maxExtent: _('maxExtent'),
|
44443
45039
|
range: {
|
44444
|
-
signal:
|
45040
|
+
signal: "abs(span(range(\"".concat(spec.scale, "\")))")
|
44445
45041
|
},
|
44446
45042
|
translate: _('translate'),
|
44447
45043
|
// accessibility support
|
@@ -45268,8 +45864,6 @@
|
|
45268
45864
|
// -- Transforms -----
|
45269
45865
|
extend$1(transforms, tx, vtx, encode$1, geo, force, label, tree, reg, voronoi, wordcloud, xf); // -- Exports -----
|
45270
45866
|
|
45271
|
-
const version = pkg.version;
|
45272
|
-
|
45273
45867
|
exports.Bounds = Bounds;
|
45274
45868
|
exports.CanvasHandler = CanvasHandler;
|
45275
45869
|
exports.CanvasRenderer = CanvasRenderer;
|
@@ -45314,7 +45908,7 @@
|
|
45314
45908
|
exports.accessorFields = accessorFields;
|
45315
45909
|
exports.accessorName = accessorName;
|
45316
45910
|
exports.array = array$5;
|
45317
|
-
exports.ascending = ascending$
|
45911
|
+
exports.ascending = ascending$2;
|
45318
45912
|
exports.bandwidthNRD = estimateBandwidth;
|
45319
45913
|
exports.bin = bin;
|
45320
45914
|
exports.bootstrapCI = bootstrapCI;
|
@@ -45404,9 +45998,10 @@
|
|
45404
45998
|
exports.parse = parse;
|
45405
45999
|
exports.parseExpression = parser$1;
|
45406
46000
|
exports.parseSelector = eventSelector;
|
46001
|
+
exports.path = path$3;
|
45407
46002
|
exports.pathCurves = curves;
|
45408
46003
|
exports.pathEqual = pathEqual;
|
45409
|
-
exports.pathParse =
|
46004
|
+
exports.pathParse = parse$3;
|
45410
46005
|
exports.pathRectangle = vg_rect;
|
45411
46006
|
exports.pathRender = pathRender;
|
45412
46007
|
exports.pathSymbols = symbols;
|
@@ -45499,4 +46094,4 @@
|
|
45499
46094
|
|
45500
46095
|
Object.defineProperty(exports, '__esModule', { value: true });
|
45501
46096
|
|
45502
|
-
}))
|
46097
|
+
}));
|