vvplot 0.4.2 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -7
- package/dist/style.css +1 -0
- package/dist/vvplot.esm.js +326 -82
- package/dist/vvplot.esm.min.js +18 -18
- package/dist/vvplot.global.js +325 -81
- package/dist/vvplot.global.min.js +18 -18
- package/package.json +1 -1
package/dist/vvplot.global.js
CHANGED
|
@@ -7,6 +7,17 @@ var VVPlot = (function(exports, vue) {
|
|
|
7
7
|
}
|
|
8
8
|
return false;
|
|
9
9
|
}
|
|
10
|
+
const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
|
|
11
|
+
const injectLocal = /* @__NO_SIDE_EFFECTS__ */ (...args) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const key = args[0];
|
|
14
|
+
const instance = (_a = vue.getCurrentInstance()) == null ? void 0 : _a.proxy;
|
|
15
|
+
if (instance == null && !vue.hasInjectionContext())
|
|
16
|
+
throw new Error("injectLocal must be called in setup");
|
|
17
|
+
if (instance && localProvidedStateMap.has(instance) && key in localProvidedStateMap.get(instance))
|
|
18
|
+
return localProvidedStateMap.get(instance)[key];
|
|
19
|
+
return vue.inject(...args);
|
|
20
|
+
};
|
|
10
21
|
function toReactive(objectRef) {
|
|
11
22
|
if (!vue.isRef(objectRef))
|
|
12
23
|
return vue.reactive(objectRef);
|
|
@@ -44,12 +55,79 @@ var VVPlot = (function(exports, vue) {
|
|
|
44
55
|
}
|
|
45
56
|
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
46
57
|
typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
58
|
+
const toString = Object.prototype.toString;
|
|
59
|
+
const isObject = (val) => toString.call(val) === "[object Object]";
|
|
60
|
+
const noop$1 = () => {
|
|
61
|
+
};
|
|
62
|
+
function pxValue(px) {
|
|
63
|
+
return px.endsWith("rem") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);
|
|
64
|
+
}
|
|
65
|
+
function toArray(value) {
|
|
66
|
+
return Array.isArray(value) ? value : [value];
|
|
67
|
+
}
|
|
68
|
+
function watchImmediate(source, cb, options) {
|
|
69
|
+
return vue.watch(
|
|
70
|
+
source,
|
|
71
|
+
cb,
|
|
72
|
+
{
|
|
73
|
+
...options,
|
|
74
|
+
immediate: true
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
47
78
|
const defaultWindow = isClient ? window : void 0;
|
|
48
79
|
function unrefElement(elRef) {
|
|
49
80
|
var _a;
|
|
50
81
|
const plain = vue.toValue(elRef);
|
|
51
82
|
return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
|
|
52
83
|
}
|
|
84
|
+
function useEventListener(...args) {
|
|
85
|
+
const cleanups = [];
|
|
86
|
+
const cleanup = () => {
|
|
87
|
+
cleanups.forEach((fn) => fn());
|
|
88
|
+
cleanups.length = 0;
|
|
89
|
+
};
|
|
90
|
+
const register = (el2, event, listener, options) => {
|
|
91
|
+
el2.addEventListener(event, listener, options);
|
|
92
|
+
return () => el2.removeEventListener(event, listener, options);
|
|
93
|
+
};
|
|
94
|
+
const firstParamTargets = vue.computed(() => {
|
|
95
|
+
const test = toArray(vue.toValue(args[0])).filter((e) => e != null);
|
|
96
|
+
return test.every((e) => typeof e !== "string") ? test : void 0;
|
|
97
|
+
});
|
|
98
|
+
const stopWatch = watchImmediate(
|
|
99
|
+
() => {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
return [
|
|
102
|
+
(_b = (_a = firstParamTargets.value) == null ? void 0 : _a.map((e) => unrefElement(e))) != null ? _b : [defaultWindow].filter((e) => e != null),
|
|
103
|
+
toArray(vue.toValue(firstParamTargets.value ? args[1] : args[0])),
|
|
104
|
+
toArray(vue.unref(firstParamTargets.value ? args[2] : args[1])),
|
|
105
|
+
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
106
|
+
vue.toValue(firstParamTargets.value ? args[3] : args[2])
|
|
107
|
+
];
|
|
108
|
+
},
|
|
109
|
+
([raw_targets, raw_events, raw_listeners, raw_options]) => {
|
|
110
|
+
cleanup();
|
|
111
|
+
if (!(raw_targets == null ? void 0 : raw_targets.length) || !(raw_events == null ? void 0 : raw_events.length) || !(raw_listeners == null ? void 0 : raw_listeners.length))
|
|
112
|
+
return;
|
|
113
|
+
const optionsClone = isObject(raw_options) ? { ...raw_options } : raw_options;
|
|
114
|
+
cleanups.push(
|
|
115
|
+
...raw_targets.flatMap(
|
|
116
|
+
(el2) => raw_events.flatMap(
|
|
117
|
+
(event) => raw_listeners.map((listener) => register(el2, event, listener, optionsClone))
|
|
118
|
+
)
|
|
119
|
+
)
|
|
120
|
+
);
|
|
121
|
+
},
|
|
122
|
+
{ flush: "post" }
|
|
123
|
+
);
|
|
124
|
+
const stop = () => {
|
|
125
|
+
stopWatch();
|
|
126
|
+
cleanup();
|
|
127
|
+
};
|
|
128
|
+
tryOnScopeDispose(cleanup);
|
|
129
|
+
return stop;
|
|
130
|
+
}
|
|
53
131
|
// @__NO_SIDE_EFFECTS__
|
|
54
132
|
function useMounted() {
|
|
55
133
|
const isMounted = vue.shallowRef(false);
|
|
@@ -69,6 +147,64 @@ var VVPlot = (function(exports, vue) {
|
|
|
69
147
|
return Boolean(callback());
|
|
70
148
|
});
|
|
71
149
|
}
|
|
150
|
+
const ssrWidthSymbol = /* @__PURE__ */ Symbol("vueuse-ssr-width");
|
|
151
|
+
// @__NO_SIDE_EFFECTS__
|
|
152
|
+
function useSSRWidth() {
|
|
153
|
+
const ssrWidth = vue.hasInjectionContext() ? /* @__PURE__ */ injectLocal(ssrWidthSymbol, null) : null;
|
|
154
|
+
return typeof ssrWidth === "number" ? ssrWidth : void 0;
|
|
155
|
+
}
|
|
156
|
+
function useMediaQuery(query, options = {}) {
|
|
157
|
+
const { window: window2 = defaultWindow, ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
|
|
158
|
+
const isSupported = /* @__PURE__ */ useSupported(() => window2 && "matchMedia" in window2 && typeof window2.matchMedia === "function");
|
|
159
|
+
const ssrSupport = vue.shallowRef(typeof ssrWidth === "number");
|
|
160
|
+
const mediaQuery = vue.shallowRef();
|
|
161
|
+
const matches = vue.shallowRef(false);
|
|
162
|
+
const handler = (event) => {
|
|
163
|
+
matches.value = event.matches;
|
|
164
|
+
};
|
|
165
|
+
vue.watchEffect(() => {
|
|
166
|
+
if (ssrSupport.value) {
|
|
167
|
+
ssrSupport.value = !isSupported.value;
|
|
168
|
+
const queryStrings = vue.toValue(query).split(",");
|
|
169
|
+
matches.value = queryStrings.some((queryString) => {
|
|
170
|
+
const not2 = queryString.includes("not all");
|
|
171
|
+
const minWidth = queryString.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
172
|
+
const maxWidth = queryString.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
|
|
173
|
+
let res = Boolean(minWidth || maxWidth);
|
|
174
|
+
if (minWidth && res) {
|
|
175
|
+
res = ssrWidth >= pxValue(minWidth[1]);
|
|
176
|
+
}
|
|
177
|
+
if (maxWidth && res) {
|
|
178
|
+
res = ssrWidth <= pxValue(maxWidth[1]);
|
|
179
|
+
}
|
|
180
|
+
return not2 ? !res : res;
|
|
181
|
+
});
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (!isSupported.value)
|
|
185
|
+
return;
|
|
186
|
+
mediaQuery.value = window2.matchMedia(vue.toValue(query));
|
|
187
|
+
matches.value = mediaQuery.value.matches;
|
|
188
|
+
});
|
|
189
|
+
useEventListener(mediaQuery, "change", handler, { passive: true });
|
|
190
|
+
return vue.computed(() => matches.value);
|
|
191
|
+
}
|
|
192
|
+
// @__NO_SIDE_EFFECTS__
|
|
193
|
+
function useDevicePixelRatio(options = {}) {
|
|
194
|
+
const {
|
|
195
|
+
window: window2 = defaultWindow
|
|
196
|
+
} = options;
|
|
197
|
+
const pixelRatio = vue.shallowRef(1);
|
|
198
|
+
const query = useMediaQuery(() => `(resolution: ${pixelRatio.value}dppx)`, options);
|
|
199
|
+
let stop = noop$1;
|
|
200
|
+
if (window2) {
|
|
201
|
+
stop = watchImmediate(query, () => pixelRatio.value = window2.devicePixelRatio);
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
pixelRatio: vue.readonly(pixelRatio),
|
|
205
|
+
stop
|
|
206
|
+
};
|
|
207
|
+
}
|
|
72
208
|
function useResizeObserver(target2, callback, options = {}) {
|
|
73
209
|
const { window: window2 = defaultWindow, ...observerOptions } = options;
|
|
74
210
|
let observer;
|
|
@@ -1661,7 +1797,44 @@ var VVPlot = (function(exports, vue) {
|
|
|
1661
1797
|
new RegExp(
|
|
1662
1798
|
"\\b" + "arguments,await,break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,let,new,return,super,switch,throw,try,var,void,while,with,yield".split(",").join("\\b|\\b") + "\\b"
|
|
1663
1799
|
);
|
|
1664
|
-
class
|
|
1800
|
+
class AsisString extends String {
|
|
1801
|
+
static #cache = /* @__PURE__ */ new Map();
|
|
1802
|
+
constructor(str) {
|
|
1803
|
+
const s = String(str);
|
|
1804
|
+
if (AsisString.#cache.has(s)) {
|
|
1805
|
+
return AsisString.#cache.get(s);
|
|
1806
|
+
}
|
|
1807
|
+
super(s);
|
|
1808
|
+
AsisString.#cache.set(s, this);
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
class AsisNumber extends Number {
|
|
1812
|
+
static #cache = /* @__PURE__ */ new Map();
|
|
1813
|
+
constructor(num2) {
|
|
1814
|
+
const n = Number(num2);
|
|
1815
|
+
if (AsisNumber.#cache.has(n)) {
|
|
1816
|
+
return AsisNumber.#cache.get(n);
|
|
1817
|
+
}
|
|
1818
|
+
super(n);
|
|
1819
|
+
AsisNumber.#cache.set(n, this);
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
class Asis extends String {
|
|
1823
|
+
static #cache = /* @__PURE__ */ new Map();
|
|
1824
|
+
constructor(value) {
|
|
1825
|
+
if (typeof value === "string" || value instanceof String) {
|
|
1826
|
+
return new AsisString(value);
|
|
1827
|
+
}
|
|
1828
|
+
if (typeof value === "number" || value instanceof Number) {
|
|
1829
|
+
return new AsisNumber(value);
|
|
1830
|
+
}
|
|
1831
|
+
throw new Error("Unsupported type");
|
|
1832
|
+
}
|
|
1833
|
+
static [Symbol.hasInstance](obj) {
|
|
1834
|
+
return obj instanceof AsisString || obj instanceof AsisNumber;
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
class EnumElement {
|
|
1665
1838
|
constructor(label, value, level) {
|
|
1666
1839
|
this.label = label;
|
|
1667
1840
|
this.value = value;
|
|
@@ -1677,20 +1850,20 @@ var VVPlot = (function(exports, vue) {
|
|
|
1677
1850
|
return this.label;
|
|
1678
1851
|
}
|
|
1679
1852
|
}
|
|
1680
|
-
class
|
|
1853
|
+
class EnumLevel extends Array {
|
|
1681
1854
|
/**
|
|
1682
1855
|
* return:
|
|
1683
|
-
* x if x is a
|
|
1684
|
-
* new
|
|
1685
|
-
* new
|
|
1856
|
+
* x if x is a EnumLevel
|
|
1857
|
+
* new EnumLevel from distinct values of x, ordered by natural order, if x is iterable
|
|
1858
|
+
* new EnumLevel from keys of x, orderd by coresponing values, if x is an object
|
|
1686
1859
|
* @param {*} x
|
|
1687
1860
|
* @param {function} [sortkey]
|
|
1688
|
-
* @returns {
|
|
1861
|
+
* @returns {EnumLevel}
|
|
1689
1862
|
*/
|
|
1690
1863
|
static from(x2) {
|
|
1691
1864
|
if (x2 instanceof this) return x2;
|
|
1692
1865
|
if (x2[Symbol.iterator]) {
|
|
1693
|
-
let lvl = unique(Array.from(x2).map((x3) => String(x3))).sort((a, b) => compare(a, b, { numeric: true }));
|
|
1866
|
+
let lvl = unique(Array.from(x2).filter((x3) => !(x3 instanceof Asis)).map((x3) => String(x3))).sort((a, b) => compare(a, b, { numeric: true }));
|
|
1694
1867
|
return new this(...lvl);
|
|
1695
1868
|
} else if (typeof x2 === "object") {
|
|
1696
1869
|
let lvl = Object.keys(x2).map((x3) => String(x3)).sort((a, b) => compare(x2[a], x2[b]));
|
|
@@ -1699,7 +1872,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
1699
1872
|
throw new Error(`Invalid level values: ${x2}`);
|
|
1700
1873
|
}
|
|
1701
1874
|
/**
|
|
1702
|
-
* Check if two
|
|
1875
|
+
* Check if two EnumLevel are equal, i.e. they have the same labels in the same order
|
|
1703
1876
|
* @param {string[]} level
|
|
1704
1877
|
*/
|
|
1705
1878
|
static isEqual(a, b) {
|
|
@@ -1708,20 +1881,20 @@ var VVPlot = (function(exports, vue) {
|
|
|
1708
1881
|
}
|
|
1709
1882
|
}
|
|
1710
1883
|
/**
|
|
1711
|
-
* build a
|
|
1884
|
+
* build a EnumLevel
|
|
1712
1885
|
* @param {string[]} level
|
|
1713
1886
|
*/
|
|
1714
1887
|
constructor(...level) {
|
|
1715
|
-
level = level.map((x2, i) => new
|
|
1888
|
+
level = level.map((x2, i) => new EnumElement(String(x2), i));
|
|
1716
1889
|
level.forEach((l) => l.level = level);
|
|
1717
1890
|
level.mapping = Object.fromEntries(level.map((fct) => [fct, fct]));
|
|
1718
|
-
Object.setPrototypeOf(level,
|
|
1891
|
+
Object.setPrototypeOf(level, EnumLevel.prototype);
|
|
1719
1892
|
return level;
|
|
1720
1893
|
}
|
|
1721
1894
|
/**
|
|
1722
1895
|
* get the level instance by index or key
|
|
1723
1896
|
* @param {(number|string)} idx
|
|
1724
|
-
* @returns {
|
|
1897
|
+
* @returns {EnumElement}
|
|
1725
1898
|
*/
|
|
1726
1899
|
getItem(idx) {
|
|
1727
1900
|
if (typeof idx === "number" || idx instanceof Number) {
|
|
@@ -1733,15 +1906,15 @@ var VVPlot = (function(exports, vue) {
|
|
|
1733
1906
|
/**
|
|
1734
1907
|
* convert an array to a GEnum array
|
|
1735
1908
|
* @param {string[]} arr array to be converted, preferably a string array (items of other types will be converted to string)
|
|
1736
|
-
* @returns {
|
|
1909
|
+
* @returns {EnumElement[]}
|
|
1737
1910
|
*/
|
|
1738
1911
|
apply(arr) {
|
|
1739
|
-
let result = arr.map((x2) => this.mapping[x2]);
|
|
1912
|
+
let result = arr.map((x2) => x2 instanceof Asis ? x2 : this.mapping[x2]);
|
|
1740
1913
|
result.level = this;
|
|
1741
1914
|
return result;
|
|
1742
1915
|
}
|
|
1743
1916
|
}
|
|
1744
|
-
function
|
|
1917
|
+
function is_continuous(x2) {
|
|
1745
1918
|
return typeof x2 === "number" || x2 instanceof Number || x2 instanceof Date;
|
|
1746
1919
|
}
|
|
1747
1920
|
function plus$1(a, b = 0) {
|
|
@@ -1751,30 +1924,30 @@ var VVPlot = (function(exports, vue) {
|
|
|
1751
1924
|
}
|
|
1752
1925
|
const numutils = {
|
|
1753
1926
|
min(arr, { na_rm = true, infinity_rm = true } = {}) {
|
|
1754
|
-
if (na_rm) arr = arr.filter(
|
|
1927
|
+
if (na_rm) arr = arr.filter(is_continuous);
|
|
1755
1928
|
if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
|
|
1756
1929
|
return Array.from(arr).reduce((a, b) => a < b ? a : b, Infinity);
|
|
1757
1930
|
},
|
|
1758
1931
|
max(arr, { na_rm = true, infinity_rm = true } = {}) {
|
|
1759
|
-
if (na_rm) arr = arr.filter(
|
|
1932
|
+
if (na_rm) arr = arr.filter(is_continuous);
|
|
1760
1933
|
if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
|
|
1761
1934
|
return Array.from(arr).reduce((a, b) => a > b ? a : b, -Infinity);
|
|
1762
1935
|
},
|
|
1763
1936
|
mean(arr, { na_rm = true, infinity_rm = true } = {}) {
|
|
1764
|
-
if (na_rm) arr = arr.filter(
|
|
1937
|
+
if (na_rm) arr = arr.filter(is_continuous);
|
|
1765
1938
|
if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
|
|
1766
1939
|
if (arr.length == 0) return NaN;
|
|
1767
1940
|
return Array.from(arr).reduce((a, v) => a + v, 0) / arr.length;
|
|
1768
1941
|
},
|
|
1769
1942
|
sd(arr, { na_rm = true, infinity_rm = true } = {}) {
|
|
1770
|
-
if (na_rm) arr = arr.filter(
|
|
1943
|
+
if (na_rm) arr = arr.filter(is_continuous);
|
|
1771
1944
|
if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
|
|
1772
1945
|
if (arr.length <= 1) return NaN;
|
|
1773
1946
|
let mean = Array.from(arr).reduce((a, v) => a + v, 0) / arr.length;
|
|
1774
1947
|
return Math.sqrt(Array.from(arr).reduce((a, v) => a + (v - mean) ** 2, 0) / (arr.length - 1));
|
|
1775
1948
|
},
|
|
1776
1949
|
quantile(arr, p, { na_rm = true, infinity_rm = true } = {}) {
|
|
1777
|
-
if (na_rm) arr = arr.filter(
|
|
1950
|
+
if (na_rm) arr = arr.filter(is_continuous);
|
|
1778
1951
|
if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
|
|
1779
1952
|
if (arr.length == 0) return NaN;
|
|
1780
1953
|
arr = Array.from(arr).sort((a, b) => a - b);
|
|
@@ -1783,7 +1956,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
1783
1956
|
return arr[lo] * (hi - idx) + arr[hi] * (idx - lo);
|
|
1784
1957
|
},
|
|
1785
1958
|
extent(arr, { na_rm = true, infinity_rm = true } = {}) {
|
|
1786
|
-
if (na_rm) arr = arr.filter(
|
|
1959
|
+
if (na_rm) arr = arr.filter(is_continuous);
|
|
1787
1960
|
if (infinity_rm) arr = arr.filter((x2) => isFinite(x2));
|
|
1788
1961
|
if (arr.length == 0) return new Array(2);
|
|
1789
1962
|
let min = Array.from(arr).reduce((a, b) => a < b ? a : b, Infinity), max = Array.from(arr).reduce((a, b) => a > b ? a : b, -Infinity);
|
|
@@ -1994,7 +2167,16 @@ var VVPlot = (function(exports, vue) {
|
|
|
1994
2167
|
if (linetype.includes(" ")) return linetype.split(" ").map((v) => +v);
|
|
1995
2168
|
return linetype.split("").map((v) => +("0x" + v));
|
|
1996
2169
|
}
|
|
1997
|
-
|
|
2170
|
+
const unitInPx = {
|
|
2171
|
+
"": 1,
|
|
2172
|
+
"px": 1,
|
|
2173
|
+
"in": 96,
|
|
2174
|
+
"cm": 96 / 2.54,
|
|
2175
|
+
"mm": 96 / 25.4,
|
|
2176
|
+
"pt": 96 / 72,
|
|
2177
|
+
"pc": 16
|
|
2178
|
+
};
|
|
2179
|
+
function serializeSVG(svgElement, { unit: unit2 = "mm" } = {}) {
|
|
1998
2180
|
if (!(svgElement instanceof SVGElement)) return null;
|
|
1999
2181
|
function removeComments(node) {
|
|
2000
2182
|
let i = node.childNodes.length;
|
|
@@ -2028,8 +2210,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
2028
2210
|
svgClone.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
2029
2211
|
svgClone.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
|
|
2030
2212
|
svgClone.setAttribute("version", "1.1");
|
|
2031
|
-
|
|
2032
|
-
svgClone.setAttribute("
|
|
2213
|
+
if (!unitInPx[unit2]) unit2 = "";
|
|
2214
|
+
svgClone.setAttribute("width", svgElement.scrollWidth / unitInPx[unit2] + unit2);
|
|
2215
|
+
svgClone.setAttribute("height", svgElement.scrollHeight / unitInPx[unit2] + unit2);
|
|
2033
2216
|
svgClone.setAttribute("viewBox", `0 0 ${svgElement.scrollWidth} ${svgElement.scrollHeight}`);
|
|
2034
2217
|
const serializer = new XMLSerializer();
|
|
2035
2218
|
return serializer.serializeToString(svgClone);
|
|
@@ -6591,7 +6774,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
6591
6774
|
function format_auto(opts) {
|
|
6592
6775
|
let formatter_number = format_number(opts), formatter_datetime = format_datetime(opts);
|
|
6593
6776
|
return function(x2, i, arr = [x2]) {
|
|
6594
|
-
if (x2 instanceof
|
|
6777
|
+
if (x2 instanceof EnumElement) return String(x2);
|
|
6595
6778
|
if (x2 instanceof Date) return formatter_datetime(x2, i, arr);
|
|
6596
6779
|
return formatter_number(x2, i, arr);
|
|
6597
6780
|
};
|
|
@@ -6672,7 +6855,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
6672
6855
|
this.$fnames = {};
|
|
6673
6856
|
for (const aes in $$aes) {
|
|
6674
6857
|
this.$fnames[aes] = String($$aes[aes]);
|
|
6675
|
-
data[aes] = $$data.map($$aes[aes]);
|
|
6858
|
+
data[aes] = $$data.map($$aes[aes]).map((x2) => x2 instanceof String || x2 instanceof Number ? new Asis(x2) : x2);
|
|
6676
6859
|
}
|
|
6677
6860
|
data.$raw = $$data;
|
|
6678
6861
|
let core_aes = stat?.core_attrs ?? ["x", "y", "xnudge", "ynudge"];
|
|
@@ -6723,9 +6906,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
6723
6906
|
if ($$levels?.[aes] != null) {
|
|
6724
6907
|
scale.level = $$levels[aes];
|
|
6725
6908
|
} else if (values.some(is_categorical)) {
|
|
6726
|
-
scale.level =
|
|
6909
|
+
scale.level = EnumLevel.from(values);
|
|
6727
6910
|
} else {
|
|
6728
|
-
scale.extent = numutils.extent(values);
|
|
6911
|
+
scale.extent = numutils.extent(values.filter((v) => !(v instanceof Asis)));
|
|
6729
6912
|
}
|
|
6730
6913
|
}
|
|
6731
6914
|
this.applyScale(aes, scale);
|
|
@@ -6755,7 +6938,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
6755
6938
|
if (scale.level) values = scale.level.apply(values);
|
|
6756
6939
|
if (scale.limits) values.extent = scale.limits;
|
|
6757
6940
|
scale.aes = aes;
|
|
6758
|
-
|
|
6941
|
+
let scaled = scale(values);
|
|
6942
|
+
this.data[aes] = values.map((v, i) => v instanceof Asis ? v.valueOf() : scaled[i]);
|
|
6759
6943
|
this.scales[aes] = scale;
|
|
6760
6944
|
}
|
|
6761
6945
|
applyCoordScale(coord_levels) {
|
|
@@ -6790,9 +6974,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
6790
6974
|
if (levels?.[aes] != null) {
|
|
6791
6975
|
scale.level = levels[aes];
|
|
6792
6976
|
} else if (values.some(is_categorical)) {
|
|
6793
|
-
scale.level =
|
|
6977
|
+
scale.level = EnumLevel.from(values);
|
|
6794
6978
|
} else {
|
|
6795
|
-
scale.extent = numutils.extent(values);
|
|
6979
|
+
scale.extent = numutils.extent(values.filter((v) => !(v instanceof Asis)));
|
|
6796
6980
|
}
|
|
6797
6981
|
}
|
|
6798
6982
|
scale._title = this.layers.reduce((v, layer) => v ?? layer.$fnames?.[aes], null);
|
|
@@ -6824,17 +7008,17 @@ var VVPlot = (function(exports, vue) {
|
|
|
6824
7008
|
useCoordLevels(levels = {}) {
|
|
6825
7009
|
for (const aes of ["x", "y"]) {
|
|
6826
7010
|
if (levels[aes]) {
|
|
6827
|
-
this.levels[aes] = new
|
|
7011
|
+
this.levels[aes] = new EnumLevel(...levels[aes]);
|
|
6828
7012
|
} else {
|
|
6829
7013
|
let values = this.layers.flatMap((layer) => {
|
|
6830
7014
|
let fn = vvgeom[layer.geom].get_values ?? vvgeom[layer.geom].get_range;
|
|
6831
7015
|
return fn?.(layer.$data, aes);
|
|
6832
7016
|
});
|
|
6833
7017
|
if (values.some(is_categorical)) {
|
|
6834
|
-
this.levels[aes] =
|
|
7018
|
+
this.levels[aes] = EnumLevel.from(values);
|
|
6835
7019
|
} else {
|
|
6836
7020
|
values = this.layers.flatMap((layer) => vvgeom[layer.geom].get_range?.(layer.$data, aes)).filter((v) => !isNaN(v));
|
|
6837
|
-
this.extents[aes] = numutils.extent(values);
|
|
7021
|
+
this.extents[aes] = numutils.extent(values.filter((v) => !(v instanceof Asis)));
|
|
6838
7022
|
}
|
|
6839
7023
|
}
|
|
6840
7024
|
}
|
|
@@ -15464,7 +15648,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15464
15648
|
data: Object,
|
|
15465
15649
|
coord2pos: Function,
|
|
15466
15650
|
getCoord: Function,
|
|
15467
|
-
layout: Object
|
|
15651
|
+
layout: Object,
|
|
15652
|
+
dpi: { type: Number, default: 96 }
|
|
15468
15653
|
},
|
|
15469
15654
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15470
15655
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15480,10 +15665,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15480
15665
|
const layerCanvas = vue.computed(() => {
|
|
15481
15666
|
if (containerRef.value == null) return;
|
|
15482
15667
|
const canvas2 = document.createElement("canvas");
|
|
15483
|
-
canvas2.width =
|
|
15484
|
-
canvas2.height =
|
|
15668
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
15669
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
15670
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
15671
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15485
15672
|
const ctx = canvas2.getContext("2d");
|
|
15486
15673
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
15674
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15487
15675
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15488
15676
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15489
15677
|
for (const group of __props.data) {
|
|
@@ -15607,7 +15795,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15607
15795
|
data: Object,
|
|
15608
15796
|
coord2pos: Function,
|
|
15609
15797
|
getCoord: Function,
|
|
15610
|
-
layout: Object
|
|
15798
|
+
layout: Object,
|
|
15799
|
+
dpi: { type: Number, default: 96 }
|
|
15611
15800
|
},
|
|
15612
15801
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15613
15802
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15623,10 +15812,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15623
15812
|
const layerCanvas = vue.computed(() => {
|
|
15624
15813
|
if (containerRef.value == null) return;
|
|
15625
15814
|
const canvas2 = document.createElement("canvas");
|
|
15626
|
-
canvas2.width =
|
|
15627
|
-
canvas2.height =
|
|
15815
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
15816
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
15817
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
15818
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15628
15819
|
const ctx = canvas2.getContext("2d");
|
|
15629
15820
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
15821
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15630
15822
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15631
15823
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15632
15824
|
for (const group of __props.data) {
|
|
@@ -15709,7 +15901,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15709
15901
|
data: Object,
|
|
15710
15902
|
coord2pos: Function,
|
|
15711
15903
|
getCoord: Function,
|
|
15712
|
-
layout: Object
|
|
15904
|
+
layout: Object,
|
|
15905
|
+
dpi: { type: Number, default: 96 }
|
|
15713
15906
|
},
|
|
15714
15907
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15715
15908
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15725,10 +15918,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15725
15918
|
const layerCanvas = vue.computed(() => {
|
|
15726
15919
|
if (containerRef.value == null) return;
|
|
15727
15920
|
const canvas2 = document.createElement("canvas");
|
|
15728
|
-
canvas2.width =
|
|
15729
|
-
canvas2.height =
|
|
15921
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
15922
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
15923
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
15924
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15730
15925
|
const ctx = canvas2.getContext("2d");
|
|
15731
15926
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
15927
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15732
15928
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15733
15929
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15734
15930
|
for (const group of __props.data) {
|
|
@@ -15810,7 +16006,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15810
16006
|
data: Object,
|
|
15811
16007
|
coord2pos: Function,
|
|
15812
16008
|
getCoord: Function,
|
|
15813
|
-
layout: Object
|
|
16009
|
+
layout: Object,
|
|
16010
|
+
dpi: { type: Number, default: 96 }
|
|
15814
16011
|
},
|
|
15815
16012
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15816
16013
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15826,10 +16023,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15826
16023
|
const layerCanvas = vue.computed(() => {
|
|
15827
16024
|
if (containerRef.value == null) return;
|
|
15828
16025
|
const canvas2 = document.createElement("canvas");
|
|
15829
|
-
canvas2.width =
|
|
15830
|
-
canvas2.height =
|
|
16026
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16027
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16028
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16029
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15831
16030
|
const ctx = canvas2.getContext("2d");
|
|
15832
16031
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16032
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15833
16033
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15834
16034
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15835
16035
|
for (const group of __props.data) {
|
|
@@ -15899,7 +16099,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15899
16099
|
data: Object,
|
|
15900
16100
|
coord2pos: Function,
|
|
15901
16101
|
getCoord: Function,
|
|
15902
|
-
layout: Object
|
|
16102
|
+
layout: Object,
|
|
16103
|
+
dpi: { type: Number, default: 96 }
|
|
15903
16104
|
},
|
|
15904
16105
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15905
16106
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15922,10 +16123,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15922
16123
|
const layerCanvas = vue.computed(() => {
|
|
15923
16124
|
if (containerRef.value == null) return;
|
|
15924
16125
|
const canvas2 = document.createElement("canvas");
|
|
15925
|
-
canvas2.width =
|
|
15926
|
-
canvas2.height =
|
|
16126
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16127
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16128
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16129
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15927
16130
|
const ctx = canvas2.getContext("2d");
|
|
15928
16131
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16132
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15929
16133
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15930
16134
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15931
16135
|
for (const group of __props.data) {
|
|
@@ -16010,7 +16214,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
16010
16214
|
data: Object,
|
|
16011
16215
|
coord2pos: Function,
|
|
16012
16216
|
getCoord: Function,
|
|
16013
|
-
layout: Object
|
|
16217
|
+
layout: Object,
|
|
16218
|
+
dpi: { type: Number, default: 96 }
|
|
16014
16219
|
},
|
|
16015
16220
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16016
16221
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16026,10 +16231,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
16026
16231
|
const layerCanvas = vue.computed(() => {
|
|
16027
16232
|
if (containerRef.value == null) return;
|
|
16028
16233
|
const canvas2 = document.createElement("canvas");
|
|
16029
|
-
canvas2.width =
|
|
16030
|
-
canvas2.height =
|
|
16234
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16235
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16236
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16237
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16031
16238
|
const ctx = canvas2.getContext("2d");
|
|
16032
16239
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16240
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16033
16241
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16034
16242
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16035
16243
|
for (const group of __props.data) {
|
|
@@ -16103,7 +16311,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
16103
16311
|
data: Object,
|
|
16104
16312
|
coord2pos: Function,
|
|
16105
16313
|
getCoord: Function,
|
|
16106
|
-
layout: Object
|
|
16314
|
+
layout: Object,
|
|
16315
|
+
dpi: { type: Number, default: 96 }
|
|
16107
16316
|
},
|
|
16108
16317
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16109
16318
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16119,10 +16328,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
16119
16328
|
const layerCanvas = vue.computed(() => {
|
|
16120
16329
|
if (containerRef.value == null) return;
|
|
16121
16330
|
const canvas2 = document.createElement("canvas");
|
|
16122
|
-
canvas2.width =
|
|
16123
|
-
canvas2.height =
|
|
16331
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16332
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16333
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16334
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16124
16335
|
const ctx = canvas2.getContext("2d");
|
|
16125
16336
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16337
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16126
16338
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16127
16339
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16128
16340
|
for (const group of __props.data) {
|
|
@@ -16194,7 +16406,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
16194
16406
|
data: Object,
|
|
16195
16407
|
coord2pos: Function,
|
|
16196
16408
|
getCoord: Function,
|
|
16197
|
-
layout: Object
|
|
16409
|
+
layout: Object,
|
|
16410
|
+
dpi: { type: Number, default: 96 }
|
|
16198
16411
|
},
|
|
16199
16412
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16200
16413
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16210,10 +16423,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
16210
16423
|
const layerCanvas = vue.computed(() => {
|
|
16211
16424
|
if (containerRef.value == null) return;
|
|
16212
16425
|
const canvas2 = document.createElement("canvas");
|
|
16213
|
-
canvas2.width =
|
|
16214
|
-
canvas2.height =
|
|
16426
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16427
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16428
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16429
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16215
16430
|
const ctx = canvas2.getContext("2d");
|
|
16216
16431
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16432
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16217
16433
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16218
16434
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16219
16435
|
for (const group of __props.data) {
|
|
@@ -16320,7 +16536,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
16320
16536
|
data: Object,
|
|
16321
16537
|
coord2pos: Function,
|
|
16322
16538
|
getCoord: Function,
|
|
16323
|
-
layout: Object
|
|
16539
|
+
layout: Object,
|
|
16540
|
+
dpi: { type: Number, default: 96 }
|
|
16324
16541
|
},
|
|
16325
16542
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16326
16543
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16336,10 +16553,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
16336
16553
|
const layerCanvas = vue.computed(() => {
|
|
16337
16554
|
if (containerRef.value == null) return;
|
|
16338
16555
|
const canvas2 = document.createElement("canvas");
|
|
16339
|
-
canvas2.width =
|
|
16340
|
-
canvas2.height =
|
|
16556
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16557
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16558
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16559
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16341
16560
|
const ctx = canvas2.getContext("2d");
|
|
16342
16561
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16562
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16343
16563
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16344
16564
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16345
16565
|
for (const group of __props.data) {
|
|
@@ -16502,7 +16722,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
16502
16722
|
data: Object,
|
|
16503
16723
|
coord2pos: Function,
|
|
16504
16724
|
getCoord: Function,
|
|
16505
|
-
layout: Object
|
|
16725
|
+
layout: Object,
|
|
16726
|
+
groupClass: null,
|
|
16727
|
+
groupStyle: null
|
|
16506
16728
|
},
|
|
16507
16729
|
emits: ["click", "contextmenu", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup"],
|
|
16508
16730
|
setup(__props, { emit: __emit }) {
|
|
@@ -17968,7 +18190,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
17968
18190
|
data: Object,
|
|
17969
18191
|
geom: String,
|
|
17970
18192
|
render: String,
|
|
17971
|
-
defaultRender: { type: String, default: "auto" }
|
|
18193
|
+
defaultRender: { type: String, default: "auto" },
|
|
18194
|
+
dpi: Number,
|
|
18195
|
+
defaultDpi: Number
|
|
17972
18196
|
},
|
|
17973
18197
|
setup(__props, { expose: __expose }) {
|
|
17974
18198
|
const geoms = { svg, canvas };
|
|
@@ -17987,13 +18211,15 @@ var VVPlot = (function(exports, vue) {
|
|
|
17987
18211
|
render: rend,
|
|
17988
18212
|
dispatchEvent: (e) => layer.value?.dispatchEvent?.(e)
|
|
17989
18213
|
});
|
|
18214
|
+
const dpi = vue.computed(() => rend.value === "canvas" ? __props.dpi ?? __props.defaultDpi : void 0);
|
|
17990
18215
|
return (_ctx, _cache) => {
|
|
17991
18216
|
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(geoms[rend.value][__props.geom]), {
|
|
17992
18217
|
ref_key: "layer",
|
|
17993
18218
|
ref: layer,
|
|
17994
18219
|
style: vue.normalizeStyle(style.value),
|
|
17995
|
-
data: __props.data
|
|
17996
|
-
|
|
18220
|
+
data: __props.data,
|
|
18221
|
+
dpi: dpi.value
|
|
18222
|
+
}, null, 8, ["style", "data", "dpi"]);
|
|
17997
18223
|
};
|
|
17998
18224
|
}
|
|
17999
18225
|
};
|
|
@@ -18033,12 +18259,22 @@ var VVPlot = (function(exports, vue) {
|
|
|
18033
18259
|
setup(__props, { emit: __emit }) {
|
|
18034
18260
|
const model = vue.useModel(__props, "modelValue");
|
|
18035
18261
|
const config = vue.createPropsRestProxy(__props, ["coord2pos", "pos2coord", "layout", "theme", "flip", "activeTransform", "transition"]);
|
|
18262
|
+
function normalize2({ xmin, xmax, ymin, ymax, xreverse = false, yreverse = false } = {}) {
|
|
18263
|
+
if ([xmin, xmax, ymin, ymax].every((v) => v == null)) return null;
|
|
18264
|
+
if (xmin != null && xmax != null && xmin > xmax) [xmin, xmax, xreverse] = [xmax, xmin, !xreverse];
|
|
18265
|
+
if (ymin != null && ymax != null && ymin > ymax) [ymin, ymax, yreverse] = [ymax, ymin, !yreverse];
|
|
18266
|
+
let coord = { xreverse, yreverse };
|
|
18267
|
+
if (xmin != null && isFinite(xmin)) coord.xmin = xmin;
|
|
18268
|
+
if (xmax != null && isFinite(xmax)) coord.xmax = xmax;
|
|
18269
|
+
if (ymin != null && isFinite(ymin)) coord.ymin = ymin;
|
|
18270
|
+
if (ymax != null && isFinite(ymax)) coord.ymax = ymax;
|
|
18271
|
+
return coord;
|
|
18272
|
+
}
|
|
18036
18273
|
const position = vue.computed(() => {
|
|
18037
18274
|
if (model.value == null || model.value.hidden) return null;
|
|
18038
|
-
|
|
18039
|
-
|
|
18040
|
-
|
|
18041
|
-
if (vmin != null && vmax != null) [vmin, vmax] = [vmin, vmax].sort((a, b) => a - b);
|
|
18275
|
+
let coord = normalize2(model.value);
|
|
18276
|
+
if (coord == null) return null;
|
|
18277
|
+
let { hmin, hmax, vmin, vmax } = __props.coord2pos(coord, { limited: true }), pos = __props.coord2pos(coord);
|
|
18042
18278
|
return { hmin, hmax, vmin, vmax, pos };
|
|
18043
18279
|
});
|
|
18044
18280
|
const transform = vue.computed(() => {
|
|
@@ -18151,7 +18387,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
18151
18387
|
e.stopPropagation();
|
|
18152
18388
|
e.preventDefault();
|
|
18153
18389
|
e.target.setPointerCapture(e.pointerId);
|
|
18154
|
-
let
|
|
18390
|
+
let { xreverse: $xreverse, yreverse: $yreverse, ...coord0 } = normalize2(model.value);
|
|
18391
|
+
let pos0 = __props.coord2pos(coord0);
|
|
18155
18392
|
let { h: coordL, v: coordT } = __props.pos2coord({ h: pos0.hmin, v: pos0.vmin }), { h: coordR, v: coordB } = __props.pos2coord({ h: pos0.hmax, v: pos0.vmax });
|
|
18156
18393
|
let { hmin: hmin0, hmax: hmax0, vmin: vmin0, vmax: vmax0 } = pos0;
|
|
18157
18394
|
let pointerMoved = false;
|
|
@@ -18218,10 +18455,10 @@ var VVPlot = (function(exports, vue) {
|
|
|
18218
18455
|
let res = {
|
|
18219
18456
|
xmin,
|
|
18220
18457
|
xmax,
|
|
18221
|
-
xreverse: Boolean(xreverse ^
|
|
18458
|
+
xreverse: Boolean(xreverse ^ $xreverse),
|
|
18222
18459
|
ymin,
|
|
18223
18460
|
ymax,
|
|
18224
|
-
yreverse: Boolean(yreverse ^
|
|
18461
|
+
yreverse: Boolean(yreverse ^ $yreverse)
|
|
18225
18462
|
}, event = new PointerEvent("select", e);
|
|
18226
18463
|
model.value = dropNull(res);
|
|
18227
18464
|
emit("selectend");
|
|
@@ -18460,13 +18697,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
18460
18697
|
},
|
|
18461
18698
|
setup(__props) {
|
|
18462
18699
|
const guides = vue.computed(() => {
|
|
18463
|
-
let guide_scales = new Map(Array.from(__props.scales).filter(([fn]) => fn.legend !== false));
|
|
18700
|
+
let guide_scales = new Map(Array.from(__props.scales).filter(([fn]) => fn.legend !== false && fn.limits?.min != fn.limits?.max));
|
|
18464
18701
|
let scale_fns = Array.from(guide_scales.keys());
|
|
18465
18702
|
let keys = scale_fns.map((s) => s.key);
|
|
18466
18703
|
let n = 1;
|
|
18467
18704
|
for (let i = 0; i < keys.length; i++) {
|
|
18468
18705
|
while (keys.includes("_guide_" + n)) n++;
|
|
18469
|
-
keys[i] ??= keys.find((_, j) => keys[j] != null &&
|
|
18706
|
+
keys[i] ??= keys.find((_, j) => keys[j] != null && EnumLevel.isEqual(scale_fns[j].level, scale_fns[i].level)) ?? "_guide_" + n;
|
|
18470
18707
|
}
|
|
18471
18708
|
let types = scale_fns.map((s) => getGuideType(s));
|
|
18472
18709
|
let groups = interaction(keys, types);
|
|
@@ -18522,6 +18759,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
18522
18759
|
theme: Object,
|
|
18523
18760
|
render: String,
|
|
18524
18761
|
clip: Boolean,
|
|
18762
|
+
dpi: Number,
|
|
18525
18763
|
action: { type: Array, default: () => [] },
|
|
18526
18764
|
selections: { type: Array, default: () => [] },
|
|
18527
18765
|
legendTeleport: null
|
|
@@ -19235,8 +19473,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
19235
19473
|
geom: layer.geom,
|
|
19236
19474
|
coord2pos,
|
|
19237
19475
|
getCoord,
|
|
19238
|
-
"default-render": props.render
|
|
19239
|
-
|
|
19476
|
+
"default-render": props.render,
|
|
19477
|
+
"default-dpi": props.dpi
|
|
19478
|
+
}), null, 16, ["data", "layout", "geom", "default-render", "default-dpi"]);
|
|
19240
19479
|
}), 256))
|
|
19241
19480
|
], 16),
|
|
19242
19481
|
_cache[3] || (_cache[3] = vue.createTextVNode()),
|
|
@@ -19523,7 +19762,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
19523
19762
|
flip: Boolean,
|
|
19524
19763
|
clip: { type: Boolean, default: true },
|
|
19525
19764
|
resize: null,
|
|
19526
|
-
legendTeleport: null
|
|
19765
|
+
legendTeleport: null,
|
|
19766
|
+
dpi: Number
|
|
19527
19767
|
}, {
|
|
19528
19768
|
"selectionPreview": { default: () => ({}) },
|
|
19529
19769
|
"selectionPreviewModifiers": {},
|
|
@@ -19631,6 +19871,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
19631
19871
|
let arr = Array.isArray($attrs[key]) ? $attrs[key] : [$attrs[key]];
|
|
19632
19872
|
plot[key] = arr.filter((f) => typeof f === "function");
|
|
19633
19873
|
wrapper[key] = arr.filter((f) => typeof f !== "function");
|
|
19874
|
+
} else if (key.startsWith("svg-")) {
|
|
19875
|
+
plot[key.slice(4)] = $attrs[key];
|
|
19634
19876
|
} else {
|
|
19635
19877
|
wrapper[key] = $attrs[key];
|
|
19636
19878
|
}
|
|
@@ -19711,7 +19953,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
19711
19953
|
aes[key] = etc[key];
|
|
19712
19954
|
}
|
|
19713
19955
|
} else {
|
|
19714
|
-
if (["class", "style", "group-class", "group-style", "render"].includes(key)) {
|
|
19956
|
+
if (["class", "style", "group-class", "group-style", "dpi", "render"].includes(key)) {
|
|
19715
19957
|
vBind2[key] = etc[key];
|
|
19716
19958
|
} else if (["item-class", "item-style"].includes(key)) {
|
|
19717
19959
|
attrs2[key.slice(5)] = etc[key];
|
|
@@ -20010,6 +20252,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
20010
20252
|
};
|
|
20011
20253
|
});
|
|
20012
20254
|
});
|
|
20255
|
+
const { pixelRatio } = /* @__PURE__ */ useDevicePixelRatio();
|
|
20013
20256
|
const wrapperRef = vue.useTemplateRef("wrapper");
|
|
20014
20257
|
const plotRef = vue.useTemplateRef("plot");
|
|
20015
20258
|
const width = vue.useModel(__props, "width");
|
|
@@ -20056,8 +20299,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
20056
20299
|
get svg() {
|
|
20057
20300
|
return plotRef.value.svg;
|
|
20058
20301
|
},
|
|
20059
|
-
serialize() {
|
|
20060
|
-
return serializeSVG(plotRef.value.svg);
|
|
20302
|
+
serialize(options) {
|
|
20303
|
+
return serializeSVG(plotRef.value.svg, options);
|
|
20061
20304
|
}
|
|
20062
20305
|
});
|
|
20063
20306
|
return (_ctx, _cache) => {
|
|
@@ -20092,9 +20335,10 @@ var VVPlot = (function(exports, vue) {
|
|
|
20092
20335
|
action: action.value,
|
|
20093
20336
|
clip: __props.clip,
|
|
20094
20337
|
render: __props.render,
|
|
20338
|
+
dpi: __props.dpi ?? 96 * vue.unref(pixelRatio),
|
|
20095
20339
|
legendTeleport: __props.legendTeleport,
|
|
20096
20340
|
onSelect: _cache[3] || (_cache[3] = (d, e) => emit("select", d, e))
|
|
20097
|
-
}), null, 16, ["paddings", "schema", "layers", "min-range", "expand-add", "expand-mult", "reverse", "flip", "coord-levels", "levels", "scales", "axes", "theme", "selections", "transition", "selection-preview", "selection-preview-theme", "action", "clip", "render", "legendTeleport"]),
|
|
20341
|
+
}), null, 16, ["paddings", "schema", "layers", "min-range", "expand-add", "expand-mult", "reverse", "flip", "coord-levels", "levels", "scales", "axes", "theme", "selections", "transition", "selection-preview", "selection-preview-theme", "action", "clip", "render", "dpi", "legendTeleport"]),
|
|
20098
20342
|
_cache[4] || (_cache[4] = vue.createTextVNode()),
|
|
20099
20343
|
vue.createElementVNode("div", {
|
|
20100
20344
|
class: "vvplot-panel-container",
|