vega 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/LICENSE.txt +1 -1
- data/README.md +3 -3
- data/lib/vega/spec.rb +3 -3
- data/lib/vega/version.rb +1 -1
- data/vendor/assets/javascripts/vega-embed.js +1117 -171
- data/vendor/assets/javascripts/vega-lite.js +6 -6
- data/vendor/assets/javascripts/vega.js +602 -370
- metadata +9 -51
@@ -1,10 +1,10 @@
|
|
1
1
|
(function (global, factory) {
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports'
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vegaLite = {}));
|
5
5
|
}(this, (function (exports) { 'use strict';
|
6
6
|
|
7
|
-
var version = "4.
|
7
|
+
var version = "4.17.0";
|
8
8
|
|
9
9
|
function accessor(fn, fields, name) {
|
10
10
|
fn.fields = fields || [];
|
@@ -14637,7 +14637,7 @@
|
|
14637
14637
|
function defaultLabelOverlap(type, scaleType, hasTimeUnit, sort) {
|
14638
14638
|
// do not prevent overlap for nominal data because there is no way to infer what the missing labels are
|
14639
14639
|
if (hasTimeUnit && !isObject(sort) || type !== 'nominal' && type !== 'ordinal') {
|
14640
|
-
if (scaleType === 'log') {
|
14640
|
+
if (scaleType === 'log' || scaleType === 'symlog') {
|
14641
14641
|
return 'greedy';
|
14642
14642
|
}
|
14643
14643
|
|
@@ -15647,7 +15647,7 @@
|
|
15647
15647
|
}
|
15648
15648
|
|
15649
15649
|
function defaultLabelOverlap$1(scaleType) {
|
15650
|
-
if (contains(['quantile', 'threshold', 'log'], scaleType)) {
|
15650
|
+
if (contains(['quantile', 'threshold', 'log', 'symlog'], scaleType)) {
|
15651
15651
|
return 'greedy';
|
15652
15652
|
}
|
15653
15653
|
|
@@ -17918,7 +17918,7 @@
|
|
17918
17918
|
|
17919
17919
|
class RemoveUnusedSubtrees extends BottomUpOptimizer {
|
17920
17920
|
run(node) {
|
17921
|
-
if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) ; else {
|
17921
|
+
if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) ; else if (node instanceof SourceNode) ; else {
|
17922
17922
|
this.setModified();
|
17923
17923
|
node.remove();
|
17924
17924
|
}
|
@@ -4,6 +4,88 @@
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vega = {}));
|
5
5
|
}(this, (function (exports) { 'use strict';
|
6
6
|
|
7
|
+
var name = "vega";
|
8
|
+
var version = "5.19.1";
|
9
|
+
var description = "The Vega visualization grammar.";
|
10
|
+
var keywords = [
|
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.3",
|
40
|
+
"vega-encode": "~4.8.3",
|
41
|
+
"vega-event-selector": "~2.0.6",
|
42
|
+
"vega-expression": "~4.0.1",
|
43
|
+
"vega-force": "~4.0.7",
|
44
|
+
"vega-format": "~1.0.4",
|
45
|
+
"vega-functions": "~5.12.0",
|
46
|
+
"vega-geo": "~4.3.8",
|
47
|
+
"vega-hierarchy": "~4.0.9",
|
48
|
+
"vega-label": "~1.0.0",
|
49
|
+
"vega-loader": "~4.4.0",
|
50
|
+
"vega-parser": "~6.1.3",
|
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.3",
|
56
|
+
"vega-statistics": "~1.7.9",
|
57
|
+
"vega-time": "~2.0.4",
|
58
|
+
"vega-transforms": "~4.9.3",
|
59
|
+
"vega-typings": "~0.19.2",
|
60
|
+
"vega-util": "~1.16.0",
|
61
|
+
"vega-view": "~5.9.2",
|
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 = "f112ee55fc5ddd025df8820fce371803106a3968";
|
70
|
+
var pkg = {
|
71
|
+
name: name,
|
72
|
+
version: version,
|
73
|
+
description: description,
|
74
|
+
keywords: keywords,
|
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
|
+
};
|
88
|
+
|
7
89
|
function accessor(fn, fields, name) {
|
8
90
|
fn.fields = fields || [];
|
9
91
|
fn.fname = name;
|
@@ -662,6 +744,10 @@
|
|
662
744
|
return Object.prototype.toString.call(_) === '[object Date]';
|
663
745
|
}
|
664
746
|
|
747
|
+
function isIterable(_) {
|
748
|
+
return _ && isFunction(_[Symbol.iterator]);
|
749
|
+
}
|
750
|
+
|
665
751
|
function isNumber(_) {
|
666
752
|
return typeof _ === 'number';
|
667
753
|
}
|
@@ -851,6 +937,231 @@
|
|
851
937
|
}
|
852
938
|
}
|
853
939
|
|
940
|
+
// https://... file://... //...
|
941
|
+
|
942
|
+
const protocol_re = /^([A-Za-z]+:)?\/\//; // Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file://
|
943
|
+
|
944
|
+
const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape
|
945
|
+
|
946
|
+
const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex
|
947
|
+
// Special treatment in node.js for the file: protocol
|
948
|
+
|
949
|
+
const fileProtocol = 'file://';
|
950
|
+
/**
|
951
|
+
* Factory for a loader constructor that provides methods for requesting
|
952
|
+
* files from either the network or disk, and for sanitizing request URIs.
|
953
|
+
* @param {function} fetch - The Fetch API for HTTP network requests.
|
954
|
+
* If null or undefined, HTTP loading will be disabled.
|
955
|
+
* @param {object} fs - The file system interface for file loading.
|
956
|
+
* If null or undefined, local file loading will be disabled.
|
957
|
+
* @return {function} A loader constructor with the following signature:
|
958
|
+
* param {object} [options] - Optional default loading options to use.
|
959
|
+
* return {object} - A new loader instance.
|
960
|
+
*/
|
961
|
+
|
962
|
+
function loaderFactory (fetch, fs) {
|
963
|
+
return options => ({
|
964
|
+
options: options || {},
|
965
|
+
sanitize: sanitize,
|
966
|
+
load: load,
|
967
|
+
fileAccess: !!fs,
|
968
|
+
file: fileLoader(fs),
|
969
|
+
http: httpLoader(fetch)
|
970
|
+
});
|
971
|
+
}
|
972
|
+
/**
|
973
|
+
* Load an external resource, typically either from the web or from the local
|
974
|
+
* filesystem. This function uses {@link sanitize} to first sanitize the uri,
|
975
|
+
* then calls either {@link http} (for web requests) or {@link file} (for
|
976
|
+
* filesystem loading).
|
977
|
+
* @param {string} uri - The resource indicator (e.g., URL or filename).
|
978
|
+
* @param {object} [options] - Optional loading options. These options will
|
979
|
+
* override any existing default options.
|
980
|
+
* @return {Promise} - A promise that resolves to the loaded content.
|
981
|
+
*/
|
982
|
+
|
983
|
+
async function load(uri, options) {
|
984
|
+
const opt = await this.sanitize(uri, options),
|
985
|
+
url = opt.href;
|
986
|
+
return opt.localFile ? this.file(url) : this.http(url, options);
|
987
|
+
}
|
988
|
+
/**
|
989
|
+
* URI sanitizer function.
|
990
|
+
* @param {string} uri - The uri (url or filename) to check.
|
991
|
+
* @param {object} options - An options hash.
|
992
|
+
* @return {Promise} - A promise that resolves to an object containing
|
993
|
+
* sanitized uri data, or rejects it the input uri is deemed invalid.
|
994
|
+
* The properties of the resolved object are assumed to be
|
995
|
+
* valid attributes for an HTML 'a' tag. The sanitized uri *must* be
|
996
|
+
* provided by the 'href' property of the returned object.
|
997
|
+
*/
|
998
|
+
|
999
|
+
|
1000
|
+
async function sanitize(uri, options) {
|
1001
|
+
options = extend({}, this.options, options);
|
1002
|
+
const fileAccess = this.fileAccess,
|
1003
|
+
result = {
|
1004
|
+
href: null
|
1005
|
+
};
|
1006
|
+
let isFile, loadFile, base;
|
1007
|
+
const isAllowed = allowed_re.test(uri.replace(whitespace_re, ''));
|
1008
|
+
|
1009
|
+
if (uri == null || typeof uri !== 'string' || !isAllowed) {
|
1010
|
+
error('Sanitize failure, invalid URI: ' + $(uri));
|
1011
|
+
}
|
1012
|
+
|
1013
|
+
const hasProtocol = protocol_re.test(uri); // if relative url (no protocol/host), prepend baseURL
|
1014
|
+
|
1015
|
+
if ((base = options.baseURL) && !hasProtocol) {
|
1016
|
+
// Ensure that there is a slash between the baseURL (e.g. hostname) and url
|
1017
|
+
if (!uri.startsWith('/') && base[base.length - 1] !== '/') {
|
1018
|
+
uri = '/' + uri;
|
1019
|
+
}
|
1020
|
+
|
1021
|
+
uri = base + uri;
|
1022
|
+
} // should we load from file system?
|
1023
|
+
|
1024
|
+
|
1025
|
+
loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === 'file' || options.mode !== 'http' && !hasProtocol && fileAccess;
|
1026
|
+
|
1027
|
+
if (isFile) {
|
1028
|
+
// strip file protocol
|
1029
|
+
uri = uri.slice(fileProtocol.length);
|
1030
|
+
} else if (uri.startsWith('//')) {
|
1031
|
+
if (options.defaultProtocol === 'file') {
|
1032
|
+
// if is file, strip protocol and set loadFile flag
|
1033
|
+
uri = uri.slice(2);
|
1034
|
+
loadFile = true;
|
1035
|
+
} else {
|
1036
|
+
// if relative protocol (starts with '//'), prepend default protocol
|
1037
|
+
uri = (options.defaultProtocol || 'http') + ':' + uri;
|
1038
|
+
}
|
1039
|
+
} // set non-enumerable mode flag to indicate local file load
|
1040
|
+
|
1041
|
+
|
1042
|
+
Object.defineProperty(result, 'localFile', {
|
1043
|
+
value: !!loadFile
|
1044
|
+
}); // set uri
|
1045
|
+
|
1046
|
+
result.href = uri; // set default result target, if specified
|
1047
|
+
|
1048
|
+
if (options.target) {
|
1049
|
+
result.target = options.target + '';
|
1050
|
+
} // set default result rel, if specified (#1542)
|
1051
|
+
|
1052
|
+
|
1053
|
+
if (options.rel) {
|
1054
|
+
result.rel = options.rel + '';
|
1055
|
+
} // provide control over cross-origin image handling (#2238)
|
1056
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image
|
1057
|
+
|
1058
|
+
|
1059
|
+
if (options.context === 'image' && options.crossOrigin) {
|
1060
|
+
result.crossOrigin = options.crossOrigin + '';
|
1061
|
+
} // return
|
1062
|
+
|
1063
|
+
|
1064
|
+
return result;
|
1065
|
+
}
|
1066
|
+
/**
|
1067
|
+
* File system loader factory.
|
1068
|
+
* @param {object} fs - The file system interface.
|
1069
|
+
* @return {function} - A file loader with the following signature:
|
1070
|
+
* param {string} filename - The file system path to load.
|
1071
|
+
* param {string} filename - The file system path to load.
|
1072
|
+
* return {Promise} A promise that resolves to the file contents.
|
1073
|
+
*/
|
1074
|
+
|
1075
|
+
|
1076
|
+
function fileLoader(fs) {
|
1077
|
+
return fs ? filename => new Promise((accept, reject) => {
|
1078
|
+
fs.readFile(filename, (error, data) => {
|
1079
|
+
if (error) reject(error);else accept(data);
|
1080
|
+
});
|
1081
|
+
}) : fileReject;
|
1082
|
+
}
|
1083
|
+
/**
|
1084
|
+
* Default file system loader that simply rejects.
|
1085
|
+
*/
|
1086
|
+
|
1087
|
+
|
1088
|
+
async function fileReject() {
|
1089
|
+
error('No file system access.');
|
1090
|
+
}
|
1091
|
+
/**
|
1092
|
+
* HTTP request handler factory.
|
1093
|
+
* @param {function} fetch - The Fetch API method.
|
1094
|
+
* @return {function} - An http loader with the following signature:
|
1095
|
+
* param {string} url - The url to request.
|
1096
|
+
* param {object} options - An options hash.
|
1097
|
+
* return {Promise} - A promise that resolves to the file contents.
|
1098
|
+
*/
|
1099
|
+
|
1100
|
+
|
1101
|
+
function httpLoader(fetch) {
|
1102
|
+
return fetch ? async function (url, options) {
|
1103
|
+
const opt = extend({}, this.options.http, options),
|
1104
|
+
type = options && options.response,
|
1105
|
+
response = await fetch(url, opt);
|
1106
|
+
return !response.ok ? error(response.status + '' + response.statusText) : isFunction(response[type]) ? response[type]() : response.text();
|
1107
|
+
} : httpReject;
|
1108
|
+
}
|
1109
|
+
/**
|
1110
|
+
* Default http request handler that simply rejects.
|
1111
|
+
*/
|
1112
|
+
|
1113
|
+
|
1114
|
+
async function httpReject() {
|
1115
|
+
error('No HTTP fetch method available.');
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
const isValid = _ => _ != null && _ === _;
|
1119
|
+
|
1120
|
+
const isBoolean$1 = _ => _ === 'true' || _ === 'false' || _ === true || _ === false;
|
1121
|
+
|
1122
|
+
const isDate$1 = _ => !Number.isNaN(Date.parse(_));
|
1123
|
+
|
1124
|
+
const isNumber$1 = _ => !Number.isNaN(+_) && !(_ instanceof Date);
|
1125
|
+
|
1126
|
+
const isInteger = _ => isNumber$1(_) && Number.isInteger(+_);
|
1127
|
+
|
1128
|
+
const typeParsers = {
|
1129
|
+
boolean: toBoolean,
|
1130
|
+
integer: toNumber,
|
1131
|
+
number: toNumber,
|
1132
|
+
date: toDate,
|
1133
|
+
string: toString,
|
1134
|
+
unknown: identity
|
1135
|
+
};
|
1136
|
+
const typeTests = [isBoolean$1, isInteger, isNumber$1, isDate$1];
|
1137
|
+
const typeList = ['boolean', 'integer', 'number', 'date'];
|
1138
|
+
function inferType(values, field) {
|
1139
|
+
if (!values || !values.length) return 'unknown';
|
1140
|
+
const n = values.length,
|
1141
|
+
m = typeTests.length,
|
1142
|
+
a = typeTests.map((_, i) => i + 1);
|
1143
|
+
|
1144
|
+
for (let i = 0, t = 0, j, value; i < n; ++i) {
|
1145
|
+
value = field ? values[i][field] : values[i];
|
1146
|
+
|
1147
|
+
for (j = 0; j < m; ++j) {
|
1148
|
+
if (a[j] && isValid(value) && !typeTests[j](value)) {
|
1149
|
+
a[j] = 0;
|
1150
|
+
++t;
|
1151
|
+
if (t === typeTests.length) return 'string';
|
1152
|
+
}
|
1153
|
+
}
|
1154
|
+
}
|
1155
|
+
|
1156
|
+
return typeList[a.reduce((u, v) => u === 0 ? v : u, 0) - 1];
|
1157
|
+
}
|
1158
|
+
function inferTypes(data, fields) {
|
1159
|
+
return fields.reduce((types, field) => {
|
1160
|
+
types[field] = inferType(data, field);
|
1161
|
+
return types;
|
1162
|
+
}, {});
|
1163
|
+
}
|
1164
|
+
|
854
1165
|
var EOL = {},
|
855
1166
|
EOF = {},
|
856
1167
|
QUOTE = 34,
|
@@ -1019,6 +1330,44 @@
|
|
1019
1330
|
};
|
1020
1331
|
}
|
1021
1332
|
|
1333
|
+
function delimitedFormat(delimiter) {
|
1334
|
+
const parse = function (data, format) {
|
1335
|
+
const delim = {
|
1336
|
+
delimiter: delimiter
|
1337
|
+
};
|
1338
|
+
return dsv(data, format ? extend(format, delim) : delim);
|
1339
|
+
};
|
1340
|
+
|
1341
|
+
parse.responseType = 'text';
|
1342
|
+
return parse;
|
1343
|
+
}
|
1344
|
+
function dsv(data, format) {
|
1345
|
+
if (format.header) {
|
1346
|
+
data = format.header.map($).join(format.delimiter) + '\n' + data;
|
1347
|
+
}
|
1348
|
+
|
1349
|
+
return dsvFormat(format.delimiter).parse(data + '');
|
1350
|
+
}
|
1351
|
+
dsv.responseType = 'text';
|
1352
|
+
|
1353
|
+
function isBuffer(_) {
|
1354
|
+
return typeof Buffer === 'function' && isFunction(Buffer.isBuffer) ? Buffer.isBuffer(_) : false;
|
1355
|
+
}
|
1356
|
+
|
1357
|
+
function json(data, format) {
|
1358
|
+
const prop = format && format.property ? field(format.property) : identity;
|
1359
|
+
return isObject(data) && !isBuffer(data) ? parseJSON(prop(data), format) : prop(JSON.parse(data));
|
1360
|
+
}
|
1361
|
+
json.responseType = 'json';
|
1362
|
+
|
1363
|
+
function parseJSON(data, format) {
|
1364
|
+
if (!isArray(data) && isIterable(data)) {
|
1365
|
+
data = [...data];
|
1366
|
+
}
|
1367
|
+
|
1368
|
+
return format && format.copy ? JSON.parse(JSON.stringify(data)) : data;
|
1369
|
+
}
|
1370
|
+
|
1022
1371
|
function identity$1 (x) {
|
1023
1372
|
return x;
|
1024
1373
|
}
|
@@ -1325,6 +1674,50 @@
|
|
1325
1674
|
return arcs;
|
1326
1675
|
}
|
1327
1676
|
|
1677
|
+
const filters = {
|
1678
|
+
interior: (a, b) => a !== b,
|
1679
|
+
exterior: (a, b) => a === b
|
1680
|
+
};
|
1681
|
+
function topojson(data, format) {
|
1682
|
+
let method, object, property, filter;
|
1683
|
+
data = json(data, format);
|
1684
|
+
|
1685
|
+
if (format && format.feature) {
|
1686
|
+
method = feature;
|
1687
|
+
property = format.feature;
|
1688
|
+
} else if (format && format.mesh) {
|
1689
|
+
method = mesh;
|
1690
|
+
property = format.mesh;
|
1691
|
+
filter = filters[format.filter];
|
1692
|
+
} else {
|
1693
|
+
error('Missing TopoJSON feature or mesh parameter.');
|
1694
|
+
}
|
1695
|
+
|
1696
|
+
object = (object = data.objects[property]) ? method(data, object, filter) : error('Invalid TopoJSON object: ' + property);
|
1697
|
+
return object && object.features || [object];
|
1698
|
+
}
|
1699
|
+
topojson.responseType = 'json';
|
1700
|
+
|
1701
|
+
const format = {
|
1702
|
+
dsv: dsv,
|
1703
|
+
csv: delimitedFormat(','),
|
1704
|
+
tsv: delimitedFormat('\t'),
|
1705
|
+
json: json,
|
1706
|
+
topojson: topojson
|
1707
|
+
};
|
1708
|
+
function formats(name, reader) {
|
1709
|
+
if (arguments.length > 1) {
|
1710
|
+
format[name] = reader;
|
1711
|
+
return this;
|
1712
|
+
} else {
|
1713
|
+
return has(format, name) ? format[name] : null;
|
1714
|
+
}
|
1715
|
+
}
|
1716
|
+
function responseType(type) {
|
1717
|
+
const f = formats(type);
|
1718
|
+
return f && f.responseType || 'text';
|
1719
|
+
}
|
1720
|
+
|
1328
1721
|
function ascending$1 (a, b) {
|
1329
1722
|
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
1330
1723
|
}
|
@@ -2010,7 +2403,7 @@
|
|
2010
2403
|
}
|
2011
2404
|
|
2012
2405
|
var locale;
|
2013
|
-
var format;
|
2406
|
+
var format$1;
|
2014
2407
|
var formatPrefix;
|
2015
2408
|
defaultLocale({
|
2016
2409
|
thousands: ",",
|
@@ -2019,7 +2412,7 @@
|
|
2019
2412
|
});
|
2020
2413
|
function defaultLocale(definition) {
|
2021
2414
|
locale = formatLocale(definition);
|
2022
|
-
format = locale.format;
|
2415
|
+
format$1 = locale.format;
|
2023
2416
|
formatPrefix = locale.formatPrefix;
|
2024
2417
|
return locale;
|
2025
2418
|
}
|
@@ -3480,7 +3873,7 @@
|
|
3480
3873
|
|
3481
3874
|
function resetNumberFormatDefaultLocale() {
|
3482
3875
|
return defaultNumberLocale = numberLocale({
|
3483
|
-
format: format,
|
3876
|
+
format: format$1,
|
3484
3877
|
formatPrefix: formatPrefix
|
3485
3878
|
});
|
3486
3879
|
}
|
@@ -3575,317 +3968,7 @@
|
|
3575
3968
|
return defaultLocale$2();
|
3576
3969
|
}
|
3577
3970
|
|
3578
|
-
|
3579
|
-
|
3580
|
-
const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape
|
3581
|
-
|
3582
|
-
const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex
|
3583
|
-
// Special treatment in node.js for the file: protocol
|
3584
|
-
|
3585
|
-
const fileProtocol = 'file://';
|
3586
|
-
/**
|
3587
|
-
* Factory for a loader constructor that provides methods for requesting
|
3588
|
-
* files from either the network or disk, and for sanitizing request URIs.
|
3589
|
-
* @param {function} fetch - The Fetch API for HTTP network requests.
|
3590
|
-
* If null or undefined, HTTP loading will be disabled.
|
3591
|
-
* @param {object} fs - The file system interface for file loading.
|
3592
|
-
* If null or undefined, local file loading will be disabled.
|
3593
|
-
* @return {function} A loader constructor with the following signature:
|
3594
|
-
* param {object} [options] - Optional default loading options to use.
|
3595
|
-
* return {object} - A new loader instance.
|
3596
|
-
*/
|
3597
|
-
|
3598
|
-
function loaderFactory(fetch, fs) {
|
3599
|
-
return options => ({
|
3600
|
-
options: options || {},
|
3601
|
-
sanitize: sanitize,
|
3602
|
-
load: load,
|
3603
|
-
fileAccess: !!fs,
|
3604
|
-
file: fileLoader(fs),
|
3605
|
-
http: httpLoader(fetch)
|
3606
|
-
});
|
3607
|
-
}
|
3608
|
-
/**
|
3609
|
-
* Load an external resource, typically either from the web or from the local
|
3610
|
-
* filesystem. This function uses {@link sanitize} to first sanitize the uri,
|
3611
|
-
* then calls either {@link http} (for web requests) or {@link file} (for
|
3612
|
-
* filesystem loading).
|
3613
|
-
* @param {string} uri - The resource indicator (e.g., URL or filename).
|
3614
|
-
* @param {object} [options] - Optional loading options. These options will
|
3615
|
-
* override any existing default options.
|
3616
|
-
* @return {Promise} - A promise that resolves to the loaded content.
|
3617
|
-
*/
|
3618
|
-
|
3619
|
-
|
3620
|
-
async function load(uri, options) {
|
3621
|
-
const opt = await this.sanitize(uri, options),
|
3622
|
-
url = opt.href;
|
3623
|
-
return opt.localFile ? this.file(url) : this.http(url, options);
|
3624
|
-
}
|
3625
|
-
/**
|
3626
|
-
* URI sanitizer function.
|
3627
|
-
* @param {string} uri - The uri (url or filename) to sanity check.
|
3628
|
-
* @param {object} options - An options hash.
|
3629
|
-
* @return {Promise} - A promise that resolves to an object containing
|
3630
|
-
* sanitized uri data, or rejects it the input uri is deemed invalid.
|
3631
|
-
* The properties of the resolved object are assumed to be
|
3632
|
-
* valid attributes for an HTML 'a' tag. The sanitized uri *must* be
|
3633
|
-
* provided by the 'href' property of the returned object.
|
3634
|
-
*/
|
3635
|
-
|
3636
|
-
|
3637
|
-
async function sanitize(uri, options) {
|
3638
|
-
options = extend({}, this.options, options);
|
3639
|
-
const fileAccess = this.fileAccess,
|
3640
|
-
result = {
|
3641
|
-
href: null
|
3642
|
-
};
|
3643
|
-
let isFile, loadFile, base;
|
3644
|
-
const isAllowed = allowed_re.test(uri.replace(whitespace_re, ''));
|
3645
|
-
|
3646
|
-
if (uri == null || typeof uri !== 'string' || !isAllowed) {
|
3647
|
-
error('Sanitize failure, invalid URI: ' + $(uri));
|
3648
|
-
}
|
3649
|
-
|
3650
|
-
const hasProtocol = protocol_re.test(uri); // if relative url (no protocol/host), prepend baseURL
|
3651
|
-
|
3652
|
-
if ((base = options.baseURL) && !hasProtocol) {
|
3653
|
-
// Ensure that there is a slash between the baseURL (e.g. hostname) and url
|
3654
|
-
if (!uri.startsWith('/') && base[base.length - 1] !== '/') {
|
3655
|
-
uri = '/' + uri;
|
3656
|
-
}
|
3657
|
-
|
3658
|
-
uri = base + uri;
|
3659
|
-
} // should we load from file system?
|
3660
|
-
|
3661
|
-
|
3662
|
-
loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === 'file' || options.mode !== 'http' && !hasProtocol && fileAccess;
|
3663
|
-
|
3664
|
-
if (isFile) {
|
3665
|
-
// strip file protocol
|
3666
|
-
uri = uri.slice(fileProtocol.length);
|
3667
|
-
} else if (uri.startsWith('//')) {
|
3668
|
-
if (options.defaultProtocol === 'file') {
|
3669
|
-
// if is file, strip protocol and set loadFile flag
|
3670
|
-
uri = uri.slice(2);
|
3671
|
-
loadFile = true;
|
3672
|
-
} else {
|
3673
|
-
// if relative protocol (starts with '//'), prepend default protocol
|
3674
|
-
uri = (options.defaultProtocol || 'http') + ':' + uri;
|
3675
|
-
}
|
3676
|
-
} // set non-enumerable mode flag to indicate local file load
|
3677
|
-
|
3678
|
-
|
3679
|
-
Object.defineProperty(result, 'localFile', {
|
3680
|
-
value: !!loadFile
|
3681
|
-
}); // set uri
|
3682
|
-
|
3683
|
-
result.href = uri; // set default result target, if specified
|
3684
|
-
|
3685
|
-
if (options.target) {
|
3686
|
-
result.target = options.target + '';
|
3687
|
-
} // set default result rel, if specified (#1542)
|
3688
|
-
|
3689
|
-
|
3690
|
-
if (options.rel) {
|
3691
|
-
result.rel = options.rel + '';
|
3692
|
-
} // provide control over cross-origin image handling (#2238)
|
3693
|
-
// https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image
|
3694
|
-
|
3695
|
-
|
3696
|
-
if (options.context === 'image' && options.crossOrigin) {
|
3697
|
-
result.crossOrigin = options.crossOrigin + '';
|
3698
|
-
} // return
|
3699
|
-
|
3700
|
-
|
3701
|
-
return result;
|
3702
|
-
}
|
3703
|
-
/**
|
3704
|
-
* File system loader factory.
|
3705
|
-
* @param {object} fs - The file system interface.
|
3706
|
-
* @return {function} - A file loader with the following signature:
|
3707
|
-
* param {string} filename - The file system path to load.
|
3708
|
-
* param {string} filename - The file system path to load.
|
3709
|
-
* return {Promise} A promise that resolves to the file contents.
|
3710
|
-
*/
|
3711
|
-
|
3712
|
-
|
3713
|
-
function fileLoader(fs) {
|
3714
|
-
return fs ? filename => new Promise((accept, reject) => {
|
3715
|
-
fs.readFile(filename, (error, data) => {
|
3716
|
-
if (error) reject(error);else accept(data);
|
3717
|
-
});
|
3718
|
-
}) : fileReject;
|
3719
|
-
}
|
3720
|
-
/**
|
3721
|
-
* Default file system loader that simply rejects.
|
3722
|
-
*/
|
3723
|
-
|
3724
|
-
|
3725
|
-
async function fileReject() {
|
3726
|
-
error('No file system access.');
|
3727
|
-
}
|
3728
|
-
/**
|
3729
|
-
* HTTP request handler factory.
|
3730
|
-
* @param {function} fetch - The Fetch API method.
|
3731
|
-
* @return {function} - An http loader with the following signature:
|
3732
|
-
* param {string} url - The url to request.
|
3733
|
-
* param {object} options - An options hash.
|
3734
|
-
* return {Promise} - A promise that resolves to the file contents.
|
3735
|
-
*/
|
3736
|
-
|
3737
|
-
|
3738
|
-
function httpLoader(fetch) {
|
3739
|
-
return fetch ? async function (url, options) {
|
3740
|
-
const opt = extend({}, this.options.http, options),
|
3741
|
-
type = options && options.response,
|
3742
|
-
response = await fetch(url, opt);
|
3743
|
-
return !response.ok ? error(response.status + '' + response.statusText) : isFunction(response[type]) ? response[type]() : response.text();
|
3744
|
-
} : httpReject;
|
3745
|
-
}
|
3746
|
-
/**
|
3747
|
-
* Default http request handler that simply rejects.
|
3748
|
-
*/
|
3749
|
-
|
3750
|
-
|
3751
|
-
async function httpReject() {
|
3752
|
-
error('No HTTP fetch method available.');
|
3753
|
-
}
|
3754
|
-
|
3755
|
-
const isValid = _ => _ != null && _ === _;
|
3756
|
-
|
3757
|
-
const isBoolean$1 = _ => _ === 'true' || _ === 'false' || _ === true || _ === false;
|
3758
|
-
|
3759
|
-
const isDate$1 = _ => !Number.isNaN(Date.parse(_));
|
3760
|
-
|
3761
|
-
const isNumber$1 = _ => !Number.isNaN(+_) && !(_ instanceof Date);
|
3762
|
-
|
3763
|
-
const isInteger = _ => isNumber$1(_) && Number.isInteger(+_);
|
3764
|
-
|
3765
|
-
const typeParsers = {
|
3766
|
-
boolean: toBoolean,
|
3767
|
-
integer: toNumber,
|
3768
|
-
number: toNumber,
|
3769
|
-
date: toDate,
|
3770
|
-
string: toString,
|
3771
|
-
unknown: identity
|
3772
|
-
};
|
3773
|
-
const typeTests = [isBoolean$1, isInteger, isNumber$1, isDate$1];
|
3774
|
-
const typeList = ['boolean', 'integer', 'number', 'date'];
|
3775
|
-
|
3776
|
-
function inferType(values, field) {
|
3777
|
-
if (!values || !values.length) return 'unknown';
|
3778
|
-
const n = values.length,
|
3779
|
-
m = typeTests.length,
|
3780
|
-
a = typeTests.map((_, i) => i + 1);
|
3781
|
-
|
3782
|
-
for (let i = 0, t = 0, j, value; i < n; ++i) {
|
3783
|
-
value = field ? values[i][field] : values[i];
|
3784
|
-
|
3785
|
-
for (j = 0; j < m; ++j) {
|
3786
|
-
if (a[j] && isValid(value) && !typeTests[j](value)) {
|
3787
|
-
a[j] = 0;
|
3788
|
-
++t;
|
3789
|
-
if (t === typeTests.length) return 'string';
|
3790
|
-
}
|
3791
|
-
}
|
3792
|
-
}
|
3793
|
-
|
3794
|
-
return typeList[a.reduce((u, v) => u === 0 ? v : u, 0) - 1];
|
3795
|
-
}
|
3796
|
-
|
3797
|
-
function inferTypes(data, fields) {
|
3798
|
-
return fields.reduce((types, field) => {
|
3799
|
-
types[field] = inferType(data, field);
|
3800
|
-
return types;
|
3801
|
-
}, {});
|
3802
|
-
}
|
3803
|
-
|
3804
|
-
function delimitedFormat(delimiter) {
|
3805
|
-
const parse = function (data, format) {
|
3806
|
-
const delim = {
|
3807
|
-
delimiter: delimiter
|
3808
|
-
};
|
3809
|
-
return dsv(data, format ? extend(format, delim) : delim);
|
3810
|
-
};
|
3811
|
-
|
3812
|
-
parse.responseType = 'text';
|
3813
|
-
return parse;
|
3814
|
-
}
|
3815
|
-
|
3816
|
-
function dsv(data, format) {
|
3817
|
-
if (format.header) {
|
3818
|
-
data = format.header.map($).join(format.delimiter) + '\n' + data;
|
3819
|
-
}
|
3820
|
-
|
3821
|
-
return dsvFormat(format.delimiter).parse(data + '');
|
3822
|
-
}
|
3823
|
-
|
3824
|
-
dsv.responseType = 'text';
|
3825
|
-
|
3826
|
-
function isBuffer(_) {
|
3827
|
-
return typeof Buffer === 'function' && isFunction(Buffer.isBuffer) ? Buffer.isBuffer(_) : false;
|
3828
|
-
}
|
3829
|
-
|
3830
|
-
function json(data, format) {
|
3831
|
-
const prop = format && format.property ? field(format.property) : identity;
|
3832
|
-
return isObject(data) && !isBuffer(data) ? parseJSON(prop(data), format) : prop(JSON.parse(data));
|
3833
|
-
}
|
3834
|
-
|
3835
|
-
json.responseType = 'json';
|
3836
|
-
|
3837
|
-
function parseJSON(data, format) {
|
3838
|
-
return format && format.copy ? JSON.parse(JSON.stringify(data)) : data;
|
3839
|
-
}
|
3840
|
-
|
3841
|
-
const filters = {
|
3842
|
-
interior: (a, b) => a !== b,
|
3843
|
-
exterior: (a, b) => a === b
|
3844
|
-
};
|
3845
|
-
|
3846
|
-
function topojson(data, format) {
|
3847
|
-
let method, object, property, filter;
|
3848
|
-
data = json(data, format);
|
3849
|
-
|
3850
|
-
if (format && format.feature) {
|
3851
|
-
method = feature;
|
3852
|
-
property = format.feature;
|
3853
|
-
} else if (format && format.mesh) {
|
3854
|
-
method = mesh;
|
3855
|
-
property = format.mesh;
|
3856
|
-
filter = filters[format.filter];
|
3857
|
-
} else {
|
3858
|
-
error('Missing TopoJSON feature or mesh parameter.');
|
3859
|
-
}
|
3860
|
-
|
3861
|
-
object = (object = data.objects[property]) ? method(data, object, filter) : error('Invalid TopoJSON object: ' + property);
|
3862
|
-
return object && object.features || [object];
|
3863
|
-
}
|
3864
|
-
|
3865
|
-
topojson.responseType = 'json';
|
3866
|
-
const format$1 = {
|
3867
|
-
dsv: dsv,
|
3868
|
-
csv: delimitedFormat(','),
|
3869
|
-
tsv: delimitedFormat('\t'),
|
3870
|
-
json: json,
|
3871
|
-
topojson: topojson
|
3872
|
-
};
|
3873
|
-
|
3874
|
-
function formats(name, reader) {
|
3875
|
-
if (arguments.length > 1) {
|
3876
|
-
format$1[name] = reader;
|
3877
|
-
return this;
|
3878
|
-
} else {
|
3879
|
-
return has(format$1, name) ? format$1[name] : null;
|
3880
|
-
}
|
3881
|
-
}
|
3882
|
-
|
3883
|
-
function responseType(type) {
|
3884
|
-
const f = formats(type);
|
3885
|
-
return f && f.responseType || 'text';
|
3886
|
-
}
|
3887
|
-
|
3888
|
-
function read(data, schema, timeParser, utcParser) {
|
3971
|
+
function read (data, schema, timeParser, utcParser) {
|
3889
3972
|
schema = schema || {};
|
3890
3973
|
const reader = formats(schema.type || 'json');
|
3891
3974
|
if (!reader) error('Unknown data format type: ' + schema.type);
|
@@ -13294,7 +13377,6 @@
|
|
13294
13377
|
|
13295
13378
|
return null;
|
13296
13379
|
}
|
13297
|
-
|
13298
13380
|
const domImage = () => typeof Image !== 'undefined' ? Image : null;
|
13299
13381
|
|
13300
13382
|
function initRange(domain, range) {
|
@@ -14662,7 +14744,7 @@
|
|
14662
14744
|
}
|
14663
14745
|
}
|
14664
14746
|
|
14665
|
-
return format(specifier);
|
14747
|
+
return format$1(specifier);
|
14666
14748
|
}
|
14667
14749
|
|
14668
14750
|
function linearish(scale) {
|
@@ -14880,7 +14962,7 @@
|
|
14880
14962
|
|
14881
14963
|
scale.tickFormat = function (count, specifier) {
|
14882
14964
|
if (specifier == null) specifier = base === 10 ? ".0e" : ",";
|
14883
|
-
if (typeof specifier !== "function") specifier = format(specifier);
|
14965
|
+
if (typeof specifier !== "function") specifier = format$1(specifier);
|
14884
14966
|
if (count === Infinity) return specifier;
|
14885
14967
|
if (count == null) count = 10;
|
14886
14968
|
var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?
|
@@ -18697,7 +18779,7 @@
|
|
18697
18779
|
|
18698
18780
|
function useCanvas(use) {
|
18699
18781
|
textMetrics.width = use && context$1 ? measureWidth : estimateWidth;
|
18700
|
-
} // make
|
18782
|
+
} // make simple estimate if no canvas is available
|
18701
18783
|
|
18702
18784
|
|
18703
18785
|
function estimateWidth(item, text) {
|
@@ -20301,7 +20383,8 @@
|
|
20301
20383
|
'stroke-miterlimit': 10
|
20302
20384
|
};
|
20303
20385
|
const RootIndex = 0,
|
20304
|
-
|
20386
|
+
xmlns = 'http://www.w3.org/2000/xmlns/',
|
20387
|
+
svgns = metadata.xmlns;
|
20305
20388
|
|
20306
20389
|
function SVGRenderer(loader) {
|
20307
20390
|
Renderer.call(this, loader);
|
@@ -20332,14 +20415,19 @@
|
|
20332
20415
|
this._clearDefs();
|
20333
20416
|
|
20334
20417
|
if (el) {
|
20335
|
-
this._svg = domChild(el, 0, 'svg',
|
20336
|
-
|
20418
|
+
this._svg = domChild(el, 0, 'svg', svgns);
|
20419
|
+
|
20420
|
+
this._svg.setAttributeNS(xmlns, 'xmlns', svgns);
|
20421
|
+
|
20422
|
+
this._svg.setAttributeNS(xmlns, 'xmlns:xlink', metadata['xmlns:xlink']);
|
20423
|
+
|
20424
|
+
this._svg.setAttribute('version', metadata['version']);
|
20337
20425
|
|
20338
20426
|
this._svg.setAttribute('class', 'marks');
|
20339
20427
|
|
20340
20428
|
domClear(el, 1); // set the svg root group
|
20341
20429
|
|
20342
|
-
this._root = domChild(this._svg, RootIndex, 'g',
|
20430
|
+
this._root = domChild(this._svg, RootIndex, 'g', svgns);
|
20343
20431
|
setAttributes(this._root, rootAttributes); // ensure no additional child elements
|
20344
20432
|
|
20345
20433
|
domClear(this._svg, RootIndex + 1);
|
@@ -20408,7 +20496,7 @@
|
|
20408
20496
|
|
20409
20497
|
if (bg) {
|
20410
20498
|
svg.removeAttribute('style');
|
20411
|
-
node = domChild(svg, RootIndex, 'rect',
|
20499
|
+
node = domChild(svg, RootIndex, 'rect', svgns);
|
20412
20500
|
setAttributes(node, {
|
20413
20501
|
width: this._width,
|
20414
20502
|
height: this._height,
|
@@ -20647,12 +20735,12 @@
|
|
20647
20735
|
index = 0;
|
20648
20736
|
|
20649
20737
|
for (const id in defs.gradient) {
|
20650
|
-
if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs',
|
20738
|
+
if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns);
|
20651
20739
|
index = updateGradient(el, defs.gradient[id], index);
|
20652
20740
|
}
|
20653
20741
|
|
20654
20742
|
for (const id in defs.clipping) {
|
20655
|
-
if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs',
|
20743
|
+
if (!el) defs.el = el = domChild(svg, RootIndex + 1, 'defs', svgns);
|
20656
20744
|
index = updateClipping(el, defs.clipping[id], index);
|
20657
20745
|
} // clean-up
|
20658
20746
|
|
@@ -20692,7 +20780,7 @@
|
|
20692
20780
|
// coordinates, in a way that is cumbersome to replicate in canvas.
|
20693
20781
|
// We wrap the radial gradient in a pattern element, allowing us to
|
20694
20782
|
// maintain a circular gradient that matches what canvas provides.
|
20695
|
-
let pt = domChild(el, index++, 'pattern',
|
20783
|
+
let pt = domChild(el, index++, 'pattern', svgns);
|
20696
20784
|
setAttributes(pt, {
|
20697
20785
|
id: patternPrefix + grad.id,
|
20698
20786
|
viewBox: '0,0,1,1',
|
@@ -20700,13 +20788,13 @@
|
|
20700
20788
|
height: '100%',
|
20701
20789
|
preserveAspectRatio: 'xMidYMid slice'
|
20702
20790
|
});
|
20703
|
-
pt = domChild(pt, 0, 'rect',
|
20791
|
+
pt = domChild(pt, 0, 'rect', svgns);
|
20704
20792
|
setAttributes(pt, {
|
20705
20793
|
width: 1,
|
20706
20794
|
height: 1,
|
20707
20795
|
fill: "url(".concat(href(), "#").concat(grad.id, ")")
|
20708
20796
|
});
|
20709
|
-
el = domChild(el, index++, 'radialGradient',
|
20797
|
+
el = domChild(el, index++, 'radialGradient', svgns);
|
20710
20798
|
setAttributes(el, {
|
20711
20799
|
id: grad.id,
|
20712
20800
|
fx: grad.x1,
|
@@ -20717,7 +20805,7 @@
|
|
20717
20805
|
r: grad.r2
|
20718
20806
|
});
|
20719
20807
|
} else {
|
20720
|
-
el = domChild(el, index++, 'linearGradient',
|
20808
|
+
el = domChild(el, index++, 'linearGradient', svgns);
|
20721
20809
|
setAttributes(el, {
|
20722
20810
|
id: grad.id,
|
20723
20811
|
x1: grad.x1,
|
@@ -20728,7 +20816,7 @@
|
|
20728
20816
|
}
|
20729
20817
|
|
20730
20818
|
for (i = 0, n = grad.stops.length; i < n; ++i) {
|
20731
|
-
stop = domChild(el, i, 'stop',
|
20819
|
+
stop = domChild(el, i, 'stop', svgns);
|
20732
20820
|
stop.setAttribute('offset', grad.stops[i].offset);
|
20733
20821
|
stop.setAttribute('stop-color', grad.stops[i].color);
|
20734
20822
|
}
|
@@ -20740,14 +20828,14 @@
|
|
20740
20828
|
|
20741
20829
|
function updateClipping(el, clip, index) {
|
20742
20830
|
let mask;
|
20743
|
-
el = domChild(el, index, 'clipPath',
|
20831
|
+
el = domChild(el, index, 'clipPath', svgns);
|
20744
20832
|
el.setAttribute('id', clip.id);
|
20745
20833
|
|
20746
20834
|
if (clip.path) {
|
20747
|
-
mask = domChild(el, 0, 'path',
|
20835
|
+
mask = domChild(el, 0, 'path', svgns);
|
20748
20836
|
mask.setAttribute('d', clip.path);
|
20749
20837
|
} else {
|
20750
|
-
mask = domChild(el, 0, 'rect',
|
20838
|
+
mask = domChild(el, 0, 'rect', svgns);
|
20751
20839
|
setAttributes(mask, {
|
20752
20840
|
x: 0,
|
20753
20841
|
y: 0,
|
@@ -20781,7 +20869,7 @@
|
|
20781
20869
|
|
20782
20870
|
if (!node) {
|
20783
20871
|
doc = el.ownerDocument;
|
20784
|
-
node = domCreate(doc, tag,
|
20872
|
+
node = domCreate(doc, tag, svgns);
|
20785
20873
|
item._svg = node;
|
20786
20874
|
|
20787
20875
|
if (item.mark) {
|
@@ -20791,13 +20879,13 @@
|
|
20791
20879
|
}; // if group, create background, content, and foreground elements
|
20792
20880
|
|
20793
20881
|
if (tag === 'g') {
|
20794
|
-
const bg = domCreate(doc, 'path',
|
20882
|
+
const bg = domCreate(doc, 'path', svgns);
|
20795
20883
|
node.appendChild(bg);
|
20796
20884
|
bg.__data__ = item;
|
20797
|
-
const cg = domCreate(doc, 'g',
|
20885
|
+
const cg = domCreate(doc, 'g', svgns);
|
20798
20886
|
node.appendChild(cg);
|
20799
20887
|
cg.__data__ = item;
|
20800
|
-
const fg = domCreate(doc, 'path',
|
20888
|
+
const fg = domCreate(doc, 'path', svgns);
|
20801
20889
|
node.appendChild(fg);
|
20802
20890
|
fg.__data__ = item;
|
20803
20891
|
fg.__values__ = {
|
@@ -20887,7 +20975,7 @@
|
|
20887
20975
|
doc = el.ownerDocument;
|
20888
20976
|
lh = lineHeight(item);
|
20889
20977
|
value.forEach((t, i) => {
|
20890
|
-
const ts = domCreate(doc, 'tspan',
|
20978
|
+
const ts = domCreate(doc, 'tspan', svgns);
|
20891
20979
|
ts.__data__ = item; // data binding
|
20892
20980
|
|
20893
20981
|
ts.textContent = t;
|
@@ -27175,7 +27263,7 @@
|
|
27175
27263
|
stop = ex[1],
|
27176
27264
|
span = stop - start,
|
27177
27265
|
step = nice ? tickStep(start, stop, k) : span / (k + 1);
|
27178
|
-
return range$1(step, stop, step);
|
27266
|
+
return range$1(start + step, stop, step);
|
27179
27267
|
};
|
27180
27268
|
}
|
27181
27269
|
/**
|
@@ -35888,8 +35976,6 @@
|
|
35888
35976
|
resolvefilter: ResolveFilter
|
35889
35977
|
});
|
35890
35978
|
|
35891
|
-
var version = "5.16.1";
|
35892
|
-
|
35893
35979
|
const RawCode = 'RawCode';
|
35894
35980
|
const Literal = 'Literal';
|
35895
35981
|
const Property = 'Property';
|
@@ -36087,7 +36173,7 @@
|
|
36087
36173
|
} // 7.6.1.1 Keywords
|
36088
36174
|
|
36089
36175
|
|
36090
|
-
const keywords = {
|
36176
|
+
const keywords$1 = {
|
36091
36177
|
'if': 1,
|
36092
36178
|
'in': 1,
|
36093
36179
|
'do': 1,
|
@@ -36279,7 +36365,7 @@
|
|
36279
36365
|
|
36280
36366
|
if (id.length === 1) {
|
36281
36367
|
type = TokenIdentifier;
|
36282
|
-
} else if (keywords.hasOwnProperty(id)) {
|
36368
|
+
} else if (keywords$1.hasOwnProperty(id)) {
|
36283
36369
|
// eslint-disable-line no-prototype-builtins
|
36284
36370
|
type = TokenKeyword;
|
36285
36371
|
} else if (id === 'null') {
|
@@ -36433,6 +36519,10 @@
|
|
36433
36519
|
start: start,
|
36434
36520
|
end: index$1
|
36435
36521
|
};
|
36522
|
+
}
|
36523
|
+
|
36524
|
+
if (ch2 === '//') {
|
36525
|
+
throwError({}, MessageUnexpectedToken, ILLEGAL);
|
36436
36526
|
} // 1-character punctuators: < > = ! + - * % & | ^ /
|
36437
36527
|
|
36438
36528
|
|
@@ -37535,13 +37625,6 @@
|
|
37535
37625
|
utcmilliseconds: fn('getUTCMilliseconds', DATE, 0),
|
37536
37626
|
// sequence functions
|
37537
37627
|
length: fn('length', null, -1),
|
37538
|
-
join: fn('join', null),
|
37539
|
-
indexof: fn('indexOf', null),
|
37540
|
-
lastindexof: fn('lastIndexOf', null),
|
37541
|
-
slice: fn('slice', null),
|
37542
|
-
reverse: function (args) {
|
37543
|
-
return '(' + codegen(args[0]) + ').slice().reverse()';
|
37544
|
-
},
|
37545
37628
|
// STRING functions
|
37546
37629
|
parseFloat: 'parseFloat',
|
37547
37630
|
parseInt: 'parseInt',
|
@@ -37549,7 +37632,6 @@
|
|
37549
37632
|
lower: fn('toLowerCase', STRING, 0),
|
37550
37633
|
substring: fn('substring', STRING),
|
37551
37634
|
split: fn('split', STRING),
|
37552
|
-
replace: fn('replace', STRING),
|
37553
37635
|
trim: fn('trim', STRING, 0),
|
37554
37636
|
// REGEXP functions
|
37555
37637
|
regexp: REGEXP,
|
@@ -37633,7 +37715,7 @@
|
|
37633
37715
|
return isFunction(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')';
|
37634
37716
|
},
|
37635
37717
|
ArrayExpression: n => '[' + n.elements.map(visit).join(',') + ']',
|
37636
|
-
BinaryExpression: n => '(' + visit(n.left) + n.operator + visit(n.right) + ')',
|
37718
|
+
BinaryExpression: n => '(' + visit(n.left) + ' ' + n.operator + ' ' + visit(n.right) + ')',
|
37637
37719
|
UnaryExpression: n => '(' + n.operator + visit(n.argument) + ')',
|
37638
37720
|
ConditionalExpression: n => '(' + visit(n.test) + '?' + visit(n.consequent) + ':' + visit(n.alternate) + ')',
|
37639
37721
|
LogicalExpression: n => '(' + visit(n.left) + n.operator + visit(n.right) + ')',
|
@@ -37662,17 +37744,75 @@
|
|
37662
37744
|
return codegen;
|
37663
37745
|
}
|
37664
37746
|
|
37747
|
+
function ascending$3(a, b) {
|
37748
|
+
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
37749
|
+
}
|
37750
|
+
|
37751
|
+
function bisector$1(f) {
|
37752
|
+
let delta = f;
|
37753
|
+
let compare = f;
|
37754
|
+
|
37755
|
+
if (f.length === 1) {
|
37756
|
+
delta = (d, x) => f(d) - x;
|
37757
|
+
|
37758
|
+
compare = ascendingComparator$1(f);
|
37759
|
+
}
|
37760
|
+
|
37761
|
+
function left(a, x, lo, hi) {
|
37762
|
+
if (lo == null) lo = 0;
|
37763
|
+
if (hi == null) hi = a.length;
|
37764
|
+
|
37765
|
+
while (lo < hi) {
|
37766
|
+
const mid = lo + hi >>> 1;
|
37767
|
+
if (compare(a[mid], x) < 0) lo = mid + 1;else hi = mid;
|
37768
|
+
}
|
37769
|
+
|
37770
|
+
return lo;
|
37771
|
+
}
|
37772
|
+
|
37773
|
+
function right(a, x, lo, hi) {
|
37774
|
+
if (lo == null) lo = 0;
|
37775
|
+
if (hi == null) hi = a.length;
|
37776
|
+
|
37777
|
+
while (lo < hi) {
|
37778
|
+
const mid = lo + hi >>> 1;
|
37779
|
+
if (compare(a[mid], x) > 0) hi = mid;else lo = mid + 1;
|
37780
|
+
}
|
37781
|
+
|
37782
|
+
return lo;
|
37783
|
+
}
|
37784
|
+
|
37785
|
+
function center(a, x, lo, hi) {
|
37786
|
+
if (lo == null) lo = 0;
|
37787
|
+
if (hi == null) hi = a.length;
|
37788
|
+
const i = left(a, x, lo, hi - 1);
|
37789
|
+
return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
|
37790
|
+
}
|
37791
|
+
|
37792
|
+
return {
|
37793
|
+
left,
|
37794
|
+
center,
|
37795
|
+
right
|
37796
|
+
};
|
37797
|
+
}
|
37798
|
+
|
37799
|
+
function ascendingComparator$1(f) {
|
37800
|
+
return (d, x) => ascending$3(f(d), x);
|
37801
|
+
}
|
37802
|
+
|
37665
37803
|
const Intersect = 'intersect';
|
37666
37804
|
const Union = 'union';
|
37667
37805
|
const VlMulti = 'vlMulti';
|
37806
|
+
const VlPoint = 'vlPoint';
|
37668
37807
|
const Or = 'or';
|
37669
37808
|
const And = 'and';
|
37670
|
-
|
37671
|
-
|
37672
|
-
|
37673
|
-
|
37674
|
-
|
37675
|
-
|
37809
|
+
const SELECTION_ID = '_vgsid_',
|
37810
|
+
TYPE_ENUM = 'E',
|
37811
|
+
TYPE_RANGE_INC = 'R',
|
37812
|
+
TYPE_RANGE_EXC = 'R-E',
|
37813
|
+
TYPE_RANGE_LE = 'R-LE',
|
37814
|
+
TYPE_RANGE_RE = 'R-RE',
|
37815
|
+
UNIT_INDEX = 'index:unit'; // TODO: revisit date coercion?
|
37676
37816
|
|
37677
37817
|
function testPoint(datum, entry) {
|
37678
37818
|
var fields = entry.fields,
|
@@ -37770,16 +37910,59 @@
|
|
37770
37910
|
|
37771
37911
|
return n && intersect;
|
37772
37912
|
}
|
37913
|
+
|
37914
|
+
const selectionId = field(SELECTION_ID),
|
37915
|
+
bisect = bisector$1(selectionId),
|
37916
|
+
bisectLeft$1 = bisect.left,
|
37917
|
+
bisectRight$1 = bisect.right;
|
37918
|
+
|
37919
|
+
function selectionIdTest(name, datum, op) {
|
37920
|
+
const data = this.context.data[name],
|
37921
|
+
entries = data ? data.values.value : [],
|
37922
|
+
unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined,
|
37923
|
+
intersect = op === Intersect,
|
37924
|
+
value = selectionId(datum),
|
37925
|
+
index = bisectLeft$1(entries, value);
|
37926
|
+
if (index === entries.length) return false;
|
37927
|
+
if (selectionId(entries[index]) !== value) return false;
|
37928
|
+
|
37929
|
+
if (unitIdx && intersect) {
|
37930
|
+
if (unitIdx.size === 1) return true;
|
37931
|
+
if (bisectRight$1(entries, value) - index < unitIdx.size) return false;
|
37932
|
+
}
|
37933
|
+
|
37934
|
+
return true;
|
37935
|
+
}
|
37936
|
+
/**
|
37937
|
+
* Maps an array of scene graph items to an array of selection tuples.
|
37938
|
+
* @param {string} name - The name of the dataset representing the selection.
|
37939
|
+
* @param {string} unit - The name of the unit view.
|
37940
|
+
*
|
37941
|
+
* @returns {array} An array of selection entries for the given unit.
|
37942
|
+
*/
|
37943
|
+
|
37944
|
+
|
37945
|
+
function selectionTuples(array, base) {
|
37946
|
+
return array.map(x => extend({
|
37947
|
+
values: base.fields.map(f => (f.getter || (f.getter = field(f.field)))(x.datum))
|
37948
|
+
}, base));
|
37949
|
+
}
|
37773
37950
|
/**
|
37774
37951
|
* Resolves selection for use as a scale domain or reads via the API.
|
37775
37952
|
* @param {string} name - The name of the dataset representing the selection
|
37776
37953
|
* @param {string} [op='union'] - The set operation for combining selections.
|
37777
37954
|
* One of 'intersect' or 'union' (default).
|
37955
|
+
* @param {boolean} isMulti - Identifies a "multi" selection to perform more
|
37956
|
+
* expensive resolution computation.
|
37957
|
+
* @param {boolean} vl5 - With Vega-Lite v5, "multi" selections are now called "point"
|
37958
|
+
* selections, and thus the resolved tuple should reflect this name.
|
37959
|
+
* This parameter allows us to reflect this change without triggering
|
37960
|
+
* a major version bump for Vega.
|
37778
37961
|
* @returns {object} An object of selected fields and values.
|
37779
37962
|
*/
|
37780
37963
|
|
37781
37964
|
|
37782
|
-
function selectionResolve(name, op, isMulti) {
|
37965
|
+
function selectionResolve(name, op, isMulti, vl5) {
|
37783
37966
|
var data = this.context.data[name],
|
37784
37967
|
entries = data ? data.values.value : [],
|
37785
37968
|
resolved = {},
|
@@ -37834,7 +38017,8 @@
|
|
37834
38017
|
entries = Object.keys(multiRes);
|
37835
38018
|
|
37836
38019
|
if (isMulti && entries.length) {
|
37837
|
-
|
38020
|
+
const key = vl5 ? VlPoint : VlMulti;
|
38021
|
+
resolved[key] = op === Union ? {
|
37838
38022
|
[Or]: entries.reduce((acc, k) => (acc.push(...multiRes[k]), acc), [])
|
37839
38023
|
} : {
|
37840
38024
|
[And]: entries.map(k => ({
|
@@ -38234,6 +38418,46 @@
|
|
38234
38418
|
return Math.atan2(t[0].clientY - t[1].clientY, t[0].clientX - t[1].clientX);
|
38235
38419
|
}
|
38236
38420
|
|
38421
|
+
const accessors = {};
|
38422
|
+
|
38423
|
+
function pluck(data, name) {
|
38424
|
+
const accessor = accessors[name] || (accessors[name] = field(name));
|
38425
|
+
return isArray(data) ? data.map(accessor) : accessor(data);
|
38426
|
+
}
|
38427
|
+
|
38428
|
+
function array$5(seq) {
|
38429
|
+
return isArray(seq) || ArrayBuffer.isView(seq) ? seq : null;
|
38430
|
+
}
|
38431
|
+
|
38432
|
+
function sequence$1(seq) {
|
38433
|
+
return array$5(seq) || (isString(seq) ? seq : null);
|
38434
|
+
}
|
38435
|
+
|
38436
|
+
function join$1(seq, ...args) {
|
38437
|
+
return array$5(seq).join(...args);
|
38438
|
+
}
|
38439
|
+
|
38440
|
+
function indexof(seq, ...args) {
|
38441
|
+
return sequence$1(seq).indexOf(...args);
|
38442
|
+
}
|
38443
|
+
|
38444
|
+
function lastindexof(seq, ...args) {
|
38445
|
+
return sequence$1(seq).lastIndexOf(...args);
|
38446
|
+
}
|
38447
|
+
|
38448
|
+
function slice$1(seq, ...args) {
|
38449
|
+
return sequence$1(seq).slice(...args);
|
38450
|
+
}
|
38451
|
+
|
38452
|
+
function replace$1(str, pattern, repl) {
|
38453
|
+
if (isFunction(repl)) error('Function argument passed to replace.');
|
38454
|
+
return String(str).replace(pattern, repl);
|
38455
|
+
}
|
38456
|
+
|
38457
|
+
function reverse$1(seq) {
|
38458
|
+
return array$5(seq).slice().reverse();
|
38459
|
+
}
|
38460
|
+
|
38237
38461
|
function bandspace(count, paddingInner, paddingOuter) {
|
38238
38462
|
return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0);
|
38239
38463
|
}
|
@@ -38407,11 +38631,18 @@
|
|
38407
38631
|
toDate,
|
38408
38632
|
toNumber,
|
38409
38633
|
toString,
|
38634
|
+
indexof,
|
38635
|
+
join: join$1,
|
38636
|
+
lastindexof,
|
38637
|
+
replace: replace$1,
|
38638
|
+
reverse: reverse$1,
|
38639
|
+
slice: slice$1,
|
38410
38640
|
flush,
|
38411
38641
|
lerp,
|
38412
38642
|
merge: merge$3,
|
38413
38643
|
pad,
|
38414
38644
|
peek,
|
38645
|
+
pluck,
|
38415
38646
|
span,
|
38416
38647
|
inrange,
|
38417
38648
|
truncate,
|
@@ -38535,7 +38766,9 @@
|
|
38535
38766
|
expressionFunction('treeAncestors', treeAncestors, dataVisitor); // register Vega-Lite selection functions
|
38536
38767
|
|
38537
38768
|
expressionFunction('vlSelectionTest', selectionTest, selectionVisitor);
|
38769
|
+
expressionFunction('vlSelectionIdTest', selectionIdTest, selectionVisitor);
|
38538
38770
|
expressionFunction('vlSelectionResolve', selectionResolve, selectionVisitor);
|
38771
|
+
expressionFunction('vlSelectionTuples', selectionTuples);
|
38539
38772
|
|
38540
38773
|
function parser$1(expr, scope) {
|
38541
38774
|
const params = {}; // parse the expression to an abstract syntax tree (ast)
|
@@ -39473,12 +39706,8 @@
|
|
39473
39706
|
item: constant(item || {}),
|
39474
39707
|
group: group,
|
39475
39708
|
xy: xy,
|
39476
|
-
x:
|
39477
|
-
|
39478
|
-
},
|
39479
|
-
y: function (item) {
|
39480
|
-
return xy(item)[1];
|
39481
|
-
}
|
39709
|
+
x: item => xy(item)[0],
|
39710
|
+
y: item => xy(item)[1]
|
39482
39711
|
};
|
39483
39712
|
}
|
39484
39713
|
|
@@ -43389,8 +43618,8 @@
|
|
43389
43618
|
|
43390
43619
|
if (data.values) {
|
43391
43620
|
// hard-wired input data set
|
43392
|
-
if (
|
43393
|
-
// if either values or format has signal, use dynamic loader
|
43621
|
+
if (isSignal(data.values) || hasSignal(data.format)) {
|
43622
|
+
// if either values is signal or format has signal, use dynamic loader
|
43394
43623
|
output.push(load$1(scope, data));
|
43395
43624
|
output.push(source = collect());
|
43396
43625
|
} else {
|
@@ -44919,6 +45148,8 @@
|
|
44919
45148
|
// -- Transforms -----
|
44920
45149
|
extend(transforms, tx, vtx, encode, geo, force, label, tree$1, reg, voronoi, wordcloud, xf); // -- Exports -----
|
44921
45150
|
|
45151
|
+
const version$1 = pkg.version;
|
45152
|
+
|
44922
45153
|
exports.Bounds = Bounds;
|
44923
45154
|
exports.CanvasHandler = CanvasHandler;
|
44924
45155
|
exports.CanvasRenderer = CanvasRenderer;
|
@@ -45003,7 +45234,7 @@
|
|
45003
45234
|
exports.font = font;
|
45004
45235
|
exports.fontFamily = fontFamily;
|
45005
45236
|
exports.fontSize = fontSize;
|
45006
|
-
exports.format = format
|
45237
|
+
exports.format = format;
|
45007
45238
|
exports.formatLocale = numberFormatDefaultLocale;
|
45008
45239
|
exports.formats = formats;
|
45009
45240
|
exports.hasOwnProperty = has;
|
@@ -45026,6 +45257,7 @@
|
|
45026
45257
|
exports.isBoolean = isBoolean;
|
45027
45258
|
exports.isDate = isDate;
|
45028
45259
|
exports.isFunction = isFunction;
|
45260
|
+
exports.isIterable = isIterable;
|
45029
45261
|
exports.isNumber = isNumber;
|
45030
45262
|
exports.isObject = isObject;
|
45031
45263
|
exports.isRegExp = isRegExp;
|
@@ -45132,7 +45364,7 @@
|
|
45132
45364
|
exports.utcdayofyear = utcdayofyear;
|
45133
45365
|
exports.utcquarter = utcquarter;
|
45134
45366
|
exports.utcweek = utcweek;
|
45135
|
-
exports.version = version;
|
45367
|
+
exports.version = version$1;
|
45136
45368
|
exports.visitArray = visitArray;
|
45137
45369
|
exports.week = week;
|
45138
45370
|
exports.writeConfig = writeConfig;
|