vvplot 0.4.3 → 0.4.5
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 +288 -163
- package/dist/vvplot.esm.min.js +18 -18
- package/dist/vvplot.global.js +287 -162
- 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;
|
|
@@ -1683,7 +1819,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
1683
1819
|
AsisNumber.#cache.set(n, this);
|
|
1684
1820
|
}
|
|
1685
1821
|
}
|
|
1686
|
-
class Asis
|
|
1822
|
+
class Asis {
|
|
1687
1823
|
static #cache = /* @__PURE__ */ new Map();
|
|
1688
1824
|
constructor(value) {
|
|
1689
1825
|
if (typeof value === "string" || value instanceof String) {
|
|
@@ -1727,7 +1863,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
1727
1863
|
static from(x2) {
|
|
1728
1864
|
if (x2 instanceof this) return x2;
|
|
1729
1865
|
if (x2[Symbol.iterator]) {
|
|
1730
|
-
let lvl = unique(Array.from(x2).filter((x3) => !(x3 instanceof Asis)).map((x3) => String(x3))).sort((a, b) => compare(a, b, { numeric: true }));
|
|
1866
|
+
let lvl = unique(Array.from(x2).filter((x3) => !(x3 instanceof Asis) && x3 != null).map((x3) => String(x3))).sort((a, b) => compare(a, b, { numeric: true }));
|
|
1731
1867
|
return new this(...lvl);
|
|
1732
1868
|
} else if (typeof x2 === "object") {
|
|
1733
1869
|
let lvl = Object.keys(x2).map((x3) => String(x3)).sort((a, b) => compare(x2[a], x2[b]));
|
|
@@ -1781,6 +1917,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
1781
1917
|
function is_continuous(x2) {
|
|
1782
1918
|
return typeof x2 === "number" || x2 instanceof Number || x2 instanceof Date;
|
|
1783
1919
|
}
|
|
1920
|
+
function is_categorical(v) {
|
|
1921
|
+
return typeof v === "string" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "object" && v !== null && typeof v.valueOf() !== "number" && typeof v.valueOf() !== "bigint";
|
|
1922
|
+
}
|
|
1784
1923
|
function plus$1(a, b = 0) {
|
|
1785
1924
|
if (b == 0 || a == null) return a;
|
|
1786
1925
|
if (a instanceof Date) return new a.constructor(+a + b);
|
|
@@ -2031,7 +2170,16 @@ var VVPlot = (function(exports, vue) {
|
|
|
2031
2170
|
if (linetype.includes(" ")) return linetype.split(" ").map((v) => +v);
|
|
2032
2171
|
return linetype.split("").map((v) => +("0x" + v));
|
|
2033
2172
|
}
|
|
2034
|
-
|
|
2173
|
+
const unitInPx = {
|
|
2174
|
+
"": 1,
|
|
2175
|
+
"px": 1,
|
|
2176
|
+
"in": 96,
|
|
2177
|
+
"cm": 96 / 2.54,
|
|
2178
|
+
"mm": 96 / 25.4,
|
|
2179
|
+
"pt": 96 / 72,
|
|
2180
|
+
"pc": 16
|
|
2181
|
+
};
|
|
2182
|
+
function serializeSVG(svgElement, { unit: unit2 = "mm" } = {}) {
|
|
2035
2183
|
if (!(svgElement instanceof SVGElement)) return null;
|
|
2036
2184
|
function removeComments(node) {
|
|
2037
2185
|
let i = node.childNodes.length;
|
|
@@ -2065,8 +2213,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
2065
2213
|
svgClone.setAttribute("xmlns", "http://www.w3.org/2000/svg");
|
|
2066
2214
|
svgClone.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
|
|
2067
2215
|
svgClone.setAttribute("version", "1.1");
|
|
2068
|
-
|
|
2069
|
-
svgClone.setAttribute("
|
|
2216
|
+
if (!unitInPx[unit2]) unit2 = "";
|
|
2217
|
+
svgClone.setAttribute("width", svgElement.scrollWidth / unitInPx[unit2] + unit2);
|
|
2218
|
+
svgClone.setAttribute("height", svgElement.scrollHeight / unitInPx[unit2] + unit2);
|
|
2070
2219
|
svgClone.setAttribute("viewBox", `0 0 ${svgElement.scrollWidth} ${svgElement.scrollHeight}`);
|
|
2071
2220
|
const serializer = new XMLSerializer();
|
|
2072
2221
|
return serializer.serializeToString(svgClone);
|
|
@@ -2362,7 +2511,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
2362
2511
|
y2,
|
|
2363
2512
|
ds.outliers ?? [],
|
|
2364
2513
|
xnudge
|
|
2365
|
-
), $xmin = psum$a(ds.
|
|
2514
|
+
), $xmin = psum$a(ds.min, xnudge), $xmax = psum$a(ds.max, xnudge);
|
|
2366
2515
|
return {
|
|
2367
2516
|
y: y2,
|
|
2368
2517
|
ymin,
|
|
@@ -2662,8 +2811,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
2662
2811
|
let missingAes = ["x", "y"].filter((a) => data[a] == null);
|
|
2663
2812
|
if (missingAes.length > 0)
|
|
2664
2813
|
throw new Error(`Missing aesthetics for "StatBoxplot": "${missingAes.join('", "')}"`);
|
|
2665
|
-
let isXdiscrete = data.x.some(
|
|
2666
|
-
let isYdiscrete = data.y.some(
|
|
2814
|
+
let isXdiscrete = data.x.some(is_categorical);
|
|
2815
|
+
let isYdiscrete = data.y.some(is_categorical);
|
|
2667
2816
|
if (isXdiscrete && isYdiscrete)
|
|
2668
2817
|
throw new Error(`Both "x" and "y" are discrete, "StatBoxplot" requires one continuous and one discrete aesthetic`);
|
|
2669
2818
|
if (!isXdiscrete && !isYdiscrete)
|
|
@@ -6647,9 +6796,6 @@ var VVPlot = (function(exports, vue) {
|
|
|
6647
6796
|
if (obj == null) return {};
|
|
6648
6797
|
return Object.fromEntries(Object.entries(obj).map(([k, v]) => [k, expr(k, v)]));
|
|
6649
6798
|
}
|
|
6650
|
-
function is_categorical(v) {
|
|
6651
|
-
return typeof v === "string" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "object" && v !== null && typeof v.valueOf() !== "number" && typeof v.valueOf() !== "bigint";
|
|
6652
|
-
}
|
|
6653
6799
|
class GLayer {
|
|
6654
6800
|
/**
|
|
6655
6801
|
* Create a graphic layer from schema
|
|
@@ -14832,7 +14978,6 @@ var VVPlot = (function(exports, vue) {
|
|
|
14832
14978
|
pointermove(e) {
|
|
14833
14979
|
emit("pointermove", e, getPosition(e));
|
|
14834
14980
|
},
|
|
14835
|
-
pointerdown: axisMovePointerdown,
|
|
14836
14981
|
wheel: axisWheel
|
|
14837
14982
|
};
|
|
14838
14983
|
return (_ctx, _cache) => {
|
|
@@ -14870,27 +15015,26 @@ var VVPlot = (function(exports, vue) {
|
|
|
14870
15015
|
height: 10,
|
|
14871
15016
|
y: -5
|
|
14872
15017
|
}, vue.toHandlers(axisVOn, true), {
|
|
15018
|
+
onPointerdown: axisMovePointerdown,
|
|
14873
15019
|
cursor: __props.action.some?.((a) => a.action == "move") ? "grab" : null
|
|
14874
15020
|
}), null, 16, _hoisted_4$3)
|
|
14875
15021
|
]),
|
|
14876
15022
|
_cache[4] || (_cache[4] = vue.createTextVNode()),
|
|
14877
15023
|
__props.action.some?.((a) => a.action == "rescale") ? (vue.openBlock(), vue.createElementBlock("g", _hoisted_5$2, [
|
|
14878
|
-
vue.createElementVNode("rect", {
|
|
15024
|
+
vue.createElementVNode("rect", vue.mergeProps({
|
|
14879
15025
|
width: 20,
|
|
14880
15026
|
height: 10,
|
|
14881
15027
|
y: -5,
|
|
14882
|
-
style: { "cursor": "ew-resize" }
|
|
14883
|
-
|
|
14884
|
-
}, null, 32),
|
|
15028
|
+
style: { "cursor": "ew-resize" }
|
|
15029
|
+
}, vue.toHandlers(axisVOn, true), { onPointerdown: axisRescaleLeftPointerdown }), null, 16),
|
|
14885
15030
|
_cache[0] || (_cache[0] = vue.createTextVNode()),
|
|
14886
|
-
vue.createElementVNode("rect", {
|
|
15031
|
+
vue.createElementVNode("rect", vue.mergeProps({
|
|
14887
15032
|
width: 20,
|
|
14888
15033
|
height: 10,
|
|
14889
15034
|
y: -5,
|
|
14890
15035
|
x: width.value - 20,
|
|
14891
|
-
style: { "cursor": "ew-resize" }
|
|
14892
|
-
|
|
14893
|
-
}, null, 40, _hoisted_6$2)
|
|
15036
|
+
style: { "cursor": "ew-resize" }
|
|
15037
|
+
}, vue.toHandlers(axisVOn, true), { onPointerdown: axisRescaleRightPointerdown }), null, 16, _hoisted_6$2)
|
|
14894
15038
|
])) : vue.createCommentVNode("", true),
|
|
14895
15039
|
_cache[5] || (_cache[5] = vue.createTextVNode()),
|
|
14896
15040
|
axisTitle.value.text ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
@@ -15259,7 +15403,6 @@ var VVPlot = (function(exports, vue) {
|
|
|
15259
15403
|
pointermove(e) {
|
|
15260
15404
|
emit("pointermove", e, getPosition(e));
|
|
15261
15405
|
},
|
|
15262
|
-
pointerdown: axisMovePointerdown,
|
|
15263
15406
|
wheel: axisWheel
|
|
15264
15407
|
};
|
|
15265
15408
|
return (_ctx, _cache) => {
|
|
@@ -15297,27 +15440,26 @@ var VVPlot = (function(exports, vue) {
|
|
|
15297
15440
|
height: height.value,
|
|
15298
15441
|
x: -5
|
|
15299
15442
|
}, vue.toHandlers(axisVOn, true), {
|
|
15443
|
+
onPointerdown: axisMovePointerdown,
|
|
15300
15444
|
cursor: __props.action.some?.((a) => a.action == "move") ? "grab" : null
|
|
15301
15445
|
}), null, 16, _hoisted_4$2)
|
|
15302
15446
|
]),
|
|
15303
15447
|
_cache[4] || (_cache[4] = vue.createTextVNode()),
|
|
15304
15448
|
__props.action.some?.((a) => a.action == "rescale") ? (vue.openBlock(), vue.createElementBlock("g", _hoisted_5$1, [
|
|
15305
|
-
vue.createElementVNode("rect", {
|
|
15449
|
+
vue.createElementVNode("rect", vue.mergeProps({
|
|
15306
15450
|
width: 10,
|
|
15307
15451
|
height: 20,
|
|
15308
15452
|
x: -5,
|
|
15309
|
-
style: { "cursor": "ns-resize" }
|
|
15310
|
-
|
|
15311
|
-
}, null, 32),
|
|
15453
|
+
style: { "cursor": "ns-resize" }
|
|
15454
|
+
}, vue.toHandlers(axisVOn, true), { onPointerdown: axisRescaleTopPointerdown }), null, 16),
|
|
15312
15455
|
_cache[0] || (_cache[0] = vue.createTextVNode()),
|
|
15313
|
-
vue.createElementVNode("rect", {
|
|
15456
|
+
vue.createElementVNode("rect", vue.mergeProps({
|
|
15314
15457
|
width: 10,
|
|
15315
15458
|
height: 20,
|
|
15316
15459
|
x: -5,
|
|
15317
15460
|
y: height.value - 20,
|
|
15318
|
-
style: { "cursor": "ns-resize" }
|
|
15319
|
-
|
|
15320
|
-
}, null, 40, _hoisted_6$1)
|
|
15461
|
+
style: { "cursor": "ns-resize" }
|
|
15462
|
+
}, vue.toHandlers(axisVOn, true), { onPointerdown: axisRescaleBottomPointerdown }), null, 16, _hoisted_6$1)
|
|
15321
15463
|
])) : vue.createCommentVNode("", true),
|
|
15322
15464
|
_cache[5] || (_cache[5] = vue.createTextVNode()),
|
|
15323
15465
|
axisTitle.value.text ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
@@ -15502,7 +15644,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15502
15644
|
data: Object,
|
|
15503
15645
|
coord2pos: Function,
|
|
15504
15646
|
getCoord: Function,
|
|
15505
|
-
layout: Object
|
|
15647
|
+
layout: Object,
|
|
15648
|
+
dpi: { type: Number, default: 96 }
|
|
15506
15649
|
},
|
|
15507
15650
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15508
15651
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15518,10 +15661,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15518
15661
|
const layerCanvas = vue.computed(() => {
|
|
15519
15662
|
if (containerRef.value == null) return;
|
|
15520
15663
|
const canvas2 = document.createElement("canvas");
|
|
15521
|
-
canvas2.width =
|
|
15522
|
-
canvas2.height =
|
|
15664
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
15665
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
15666
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
15667
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15523
15668
|
const ctx = canvas2.getContext("2d");
|
|
15524
15669
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
15670
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15525
15671
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15526
15672
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15527
15673
|
for (const group of __props.data) {
|
|
@@ -15645,7 +15791,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15645
15791
|
data: Object,
|
|
15646
15792
|
coord2pos: Function,
|
|
15647
15793
|
getCoord: Function,
|
|
15648
|
-
layout: Object
|
|
15794
|
+
layout: Object,
|
|
15795
|
+
dpi: { type: Number, default: 96 }
|
|
15649
15796
|
},
|
|
15650
15797
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15651
15798
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15661,10 +15808,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15661
15808
|
const layerCanvas = vue.computed(() => {
|
|
15662
15809
|
if (containerRef.value == null) return;
|
|
15663
15810
|
const canvas2 = document.createElement("canvas");
|
|
15664
|
-
canvas2.width =
|
|
15665
|
-
canvas2.height =
|
|
15811
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
15812
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
15813
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
15814
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15666
15815
|
const ctx = canvas2.getContext("2d");
|
|
15667
15816
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
15817
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15668
15818
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15669
15819
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15670
15820
|
for (const group of __props.data) {
|
|
@@ -15747,7 +15897,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15747
15897
|
data: Object,
|
|
15748
15898
|
coord2pos: Function,
|
|
15749
15899
|
getCoord: Function,
|
|
15750
|
-
layout: Object
|
|
15900
|
+
layout: Object,
|
|
15901
|
+
dpi: { type: Number, default: 96 }
|
|
15751
15902
|
},
|
|
15752
15903
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15753
15904
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15763,10 +15914,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15763
15914
|
const layerCanvas = vue.computed(() => {
|
|
15764
15915
|
if (containerRef.value == null) return;
|
|
15765
15916
|
const canvas2 = document.createElement("canvas");
|
|
15766
|
-
canvas2.width =
|
|
15767
|
-
canvas2.height =
|
|
15917
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
15918
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
15919
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
15920
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15768
15921
|
const ctx = canvas2.getContext("2d");
|
|
15769
15922
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
15923
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15770
15924
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15771
15925
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15772
15926
|
for (const group of __props.data) {
|
|
@@ -15787,14 +15941,14 @@ var VVPlot = (function(exports, vue) {
|
|
|
15787
15941
|
} of group) {
|
|
15788
15942
|
let dx = Math.sqrt(C / (A * C - B * B)), dy = Math.sqrt(A / (A * C - B * B));
|
|
15789
15943
|
const { h: ch, v: cv } = __props.coord2pos({ x: cx, y: cy });
|
|
15790
|
-
let {
|
|
15791
|
-
let scaleX = (
|
|
15944
|
+
let { h: h1, v: v1 } = __props.coord2pos({ x: cx - dx, y: cy - dy }), { h: h2, v: v2 } = __props.coord2pos({ x: cx + dx, y: cy + dy });
|
|
15945
|
+
let scaleX = (h2 - h1) / (2 * dx), scaleY = (v2 - v1) / (2 * dy);
|
|
15792
15946
|
A /= scaleX * scaleX;
|
|
15793
15947
|
B /= scaleX * scaleY;
|
|
15794
15948
|
C /= scaleY * scaleY;
|
|
15795
15949
|
const tr = A + C, det = A * C - B * B;
|
|
15796
15950
|
const disc = Math.sqrt(Math.max(0, tr * tr / 4 - det));
|
|
15797
|
-
let rx2 = 1 / Math.sqrt(tr / 2 + disc), ry = 1 / Math.sqrt(tr / 2 - disc), angle2 =
|
|
15951
|
+
let rx2 = 1 / Math.sqrt(tr / 2 + disc), ry = 1 / Math.sqrt(tr / 2 - disc), angle2 = Math.atan2(2 * B, A - C) / 2;
|
|
15798
15952
|
const path2d = new Path2D();
|
|
15799
15953
|
path2d.ellipse(ch + translateX, cv + translateY, rx2, ry, angle2, 0, 2 * Math.PI);
|
|
15800
15954
|
_path_data.set(path2d, $raw);
|
|
@@ -15848,7 +16002,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15848
16002
|
data: Object,
|
|
15849
16003
|
coord2pos: Function,
|
|
15850
16004
|
getCoord: Function,
|
|
15851
|
-
layout: Object
|
|
16005
|
+
layout: Object,
|
|
16006
|
+
dpi: { type: Number, default: 96 }
|
|
15852
16007
|
},
|
|
15853
16008
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15854
16009
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15864,10 +16019,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15864
16019
|
const layerCanvas = vue.computed(() => {
|
|
15865
16020
|
if (containerRef.value == null) return;
|
|
15866
16021
|
const canvas2 = document.createElement("canvas");
|
|
15867
|
-
canvas2.width =
|
|
15868
|
-
canvas2.height =
|
|
16022
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16023
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16024
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16025
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15869
16026
|
const ctx = canvas2.getContext("2d");
|
|
15870
16027
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16028
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15871
16029
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15872
16030
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15873
16031
|
for (const group of __props.data) {
|
|
@@ -15937,7 +16095,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
15937
16095
|
data: Object,
|
|
15938
16096
|
coord2pos: Function,
|
|
15939
16097
|
getCoord: Function,
|
|
15940
|
-
layout: Object
|
|
16098
|
+
layout: Object,
|
|
16099
|
+
dpi: { type: Number, default: 96 }
|
|
15941
16100
|
},
|
|
15942
16101
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
15943
16102
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -15960,10 +16119,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
15960
16119
|
const layerCanvas = vue.computed(() => {
|
|
15961
16120
|
if (containerRef.value == null) return;
|
|
15962
16121
|
const canvas2 = document.createElement("canvas");
|
|
15963
|
-
canvas2.width =
|
|
15964
|
-
canvas2.height =
|
|
16122
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16123
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16124
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16125
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
15965
16126
|
const ctx = canvas2.getContext("2d");
|
|
15966
16127
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16128
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
15967
16129
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
15968
16130
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
15969
16131
|
for (const group of __props.data) {
|
|
@@ -16048,7 +16210,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
16048
16210
|
data: Object,
|
|
16049
16211
|
coord2pos: Function,
|
|
16050
16212
|
getCoord: Function,
|
|
16051
|
-
layout: Object
|
|
16213
|
+
layout: Object,
|
|
16214
|
+
dpi: { type: Number, default: 96 }
|
|
16052
16215
|
},
|
|
16053
16216
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16054
16217
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16064,10 +16227,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
16064
16227
|
const layerCanvas = vue.computed(() => {
|
|
16065
16228
|
if (containerRef.value == null) return;
|
|
16066
16229
|
const canvas2 = document.createElement("canvas");
|
|
16067
|
-
canvas2.width =
|
|
16068
|
-
canvas2.height =
|
|
16230
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16231
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16232
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16233
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16069
16234
|
const ctx = canvas2.getContext("2d");
|
|
16070
16235
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16236
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16071
16237
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16072
16238
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16073
16239
|
for (const group of __props.data) {
|
|
@@ -16141,7 +16307,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
16141
16307
|
data: Object,
|
|
16142
16308
|
coord2pos: Function,
|
|
16143
16309
|
getCoord: Function,
|
|
16144
|
-
layout: Object
|
|
16310
|
+
layout: Object,
|
|
16311
|
+
dpi: { type: Number, default: 96 }
|
|
16145
16312
|
},
|
|
16146
16313
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16147
16314
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16157,10 +16324,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
16157
16324
|
const layerCanvas = vue.computed(() => {
|
|
16158
16325
|
if (containerRef.value == null) return;
|
|
16159
16326
|
const canvas2 = document.createElement("canvas");
|
|
16160
|
-
canvas2.width =
|
|
16161
|
-
canvas2.height =
|
|
16327
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16328
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16329
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16330
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16162
16331
|
const ctx = canvas2.getContext("2d");
|
|
16163
16332
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16333
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16164
16334
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16165
16335
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16166
16336
|
for (const group of __props.data) {
|
|
@@ -16232,7 +16402,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
16232
16402
|
data: Object,
|
|
16233
16403
|
coord2pos: Function,
|
|
16234
16404
|
getCoord: Function,
|
|
16235
|
-
layout: Object
|
|
16405
|
+
layout: Object,
|
|
16406
|
+
dpi: { type: Number, default: 96 }
|
|
16236
16407
|
},
|
|
16237
16408
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16238
16409
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16248,10 +16419,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
16248
16419
|
const layerCanvas = vue.computed(() => {
|
|
16249
16420
|
if (containerRef.value == null) return;
|
|
16250
16421
|
const canvas2 = document.createElement("canvas");
|
|
16251
|
-
canvas2.width =
|
|
16252
|
-
canvas2.height =
|
|
16422
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16423
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16424
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16425
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16253
16426
|
const ctx = canvas2.getContext("2d");
|
|
16254
16427
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16428
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16255
16429
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16256
16430
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16257
16431
|
for (const group of __props.data) {
|
|
@@ -16358,7 +16532,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
16358
16532
|
data: Object,
|
|
16359
16533
|
coord2pos: Function,
|
|
16360
16534
|
getCoord: Function,
|
|
16361
|
-
layout: Object
|
|
16535
|
+
layout: Object,
|
|
16536
|
+
dpi: { type: Number, default: 96 }
|
|
16362
16537
|
},
|
|
16363
16538
|
emits: ["click", "contextmenu", "singleclick", "dblclick", "pointermove", "pointerdown", "pointerup", "wheel"],
|
|
16364
16539
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -16374,10 +16549,13 @@ var VVPlot = (function(exports, vue) {
|
|
|
16374
16549
|
const layerCanvas = vue.computed(() => {
|
|
16375
16550
|
if (containerRef.value == null) return;
|
|
16376
16551
|
const canvas2 = document.createElement("canvas");
|
|
16377
|
-
canvas2.width =
|
|
16378
|
-
canvas2.height =
|
|
16552
|
+
canvas2.style.width = vBind.value.width + "px";
|
|
16553
|
+
canvas2.style.height = vBind.value.height + "px";
|
|
16554
|
+
canvas2.width = vBind.value.width * __props.dpi / 96;
|
|
16555
|
+
canvas2.height = vBind.value.height * __props.dpi / 96;
|
|
16379
16556
|
const ctx = canvas2.getContext("2d");
|
|
16380
16557
|
ctx.clearRect(0, 0, canvas2.width, canvas2.height);
|
|
16558
|
+
ctx.scale(__props.dpi / 96, __props.dpi / 96);
|
|
16381
16559
|
ctx.translate(__props.layout.l + __props.layout.fullWidth * __props.extendX, __props.layout.t + __props.layout.fullHeight * __props.extendY);
|
|
16382
16560
|
let _path_data = /* @__PURE__ */ new Map(), path_data = /* @__PURE__ */ new Map();
|
|
16383
16561
|
for (const group of __props.data) {
|
|
@@ -16540,7 +16718,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
16540
16718
|
data: Object,
|
|
16541
16719
|
coord2pos: Function,
|
|
16542
16720
|
getCoord: Function,
|
|
16543
|
-
layout: Object
|
|
16721
|
+
layout: Object,
|
|
16722
|
+
groupClass: null,
|
|
16723
|
+
groupStyle: null
|
|
16544
16724
|
},
|
|
16545
16725
|
emits: ["click", "contextmenu", "pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup"],
|
|
16546
16726
|
setup(__props, { emit: __emit }) {
|
|
@@ -17069,9 +17249,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
17069
17249
|
}) => {
|
|
17070
17250
|
let dx = Math.sqrt(C / (A * C - B * B)), dy = Math.sqrt(A / (A * C - B * B));
|
|
17071
17251
|
const { h: ch, v: cv } = __props.coord2pos({ x: cx, y: cy });
|
|
17072
|
-
let {
|
|
17073
|
-
if (
|
|
17074
|
-
let scaleX = (
|
|
17252
|
+
let { h: h1, v: v1 } = __props.coord2pos({ x: cx - dx, y: cy - dy }), { h: h2, v: v2 } = __props.coord2pos({ x: cx + dx, y: cy + dy });
|
|
17253
|
+
if (h1 < xlim_min && h2 < xlim_min || h2 > xlim_max && h1 > xlim_max || v1 < ylim_min && v2 < ylim_min || v2 > ylim_max && v1 > ylim_max) return null;
|
|
17254
|
+
let scaleX = (h2 - h1) / (2 * dx), scaleY = (v2 - v1) / (2 * dy);
|
|
17075
17255
|
A /= scaleX * scaleX;
|
|
17076
17256
|
B /= scaleX * scaleY;
|
|
17077
17257
|
C /= scaleY * scaleY;
|
|
@@ -17082,7 +17262,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
17082
17262
|
cy: cv,
|
|
17083
17263
|
rx: 1 / Math.sqrt(tr / 2 + disc) || 0,
|
|
17084
17264
|
ry: 1 / Math.sqrt(tr / 2 - disc) || 0,
|
|
17085
|
-
angle:
|
|
17265
|
+
angle: Math.atan2(2 * B, A - C) / 2 * 180 / Math.PI || 0,
|
|
17086
17266
|
fill,
|
|
17087
17267
|
color: color2,
|
|
17088
17268
|
linetype,
|
|
@@ -17311,6 +17491,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
17311
17491
|
alpha: alpha2,
|
|
17312
17492
|
"translate-x": translateX = 0,
|
|
17313
17493
|
"translate-y": translateY = 0,
|
|
17494
|
+
"anchor-x": anchorX,
|
|
17495
|
+
"anchor-y": anchorY = 0.5,
|
|
17314
17496
|
"font-family": fontFamily = "sans-serif",
|
|
17315
17497
|
"text-align": textAlign = "start",
|
|
17316
17498
|
inset = 0,
|
|
@@ -17324,140 +17506,72 @@ var VVPlot = (function(exports, vue) {
|
|
|
17324
17506
|
if (x1 < xlim_min && x22 < xlim_min || x1 > xlim_max && x22 > xlim_max || y1 < ylim_min && y22 < ylim_min || y1 > ylim_max && y22 > ylim_max) return null;
|
|
17325
17507
|
let radian = Math.atan2(y22 - y1, x22 - x1);
|
|
17326
17508
|
let vbind = {
|
|
17327
|
-
|
|
17328
|
-
|
|
17329
|
-
|
|
17330
|
-
|
|
17331
|
-
|
|
17332
|
-
|
|
17333
|
-
|
|
17334
|
-
|
|
17335
|
-
|
|
17509
|
+
text: String(label),
|
|
17510
|
+
title: String(title ?? label),
|
|
17511
|
+
color: color2,
|
|
17512
|
+
alpha: alpha2,
|
|
17513
|
+
size,
|
|
17514
|
+
stroke,
|
|
17515
|
+
linewidth,
|
|
17516
|
+
linetype,
|
|
17517
|
+
fontFamily,
|
|
17336
17518
|
class: className,
|
|
17337
17519
|
style
|
|
17338
17520
|
};
|
|
17339
17521
|
let von = Object.fromEntries(
|
|
17340
17522
|
events.map((evt) => [evt, (e) => emit(evt, Object.assign(e, { _vhandled: true }), __props.getCoord(e), $raw)])
|
|
17341
17523
|
);
|
|
17342
|
-
let tx, ty
|
|
17524
|
+
let tx, ty;
|
|
17343
17525
|
switch (textAlign) {
|
|
17344
17526
|
case "stretch":
|
|
17345
17527
|
tx = (x1 + x22) / 2;
|
|
17346
17528
|
ty = (y1 + y22) / 2;
|
|
17347
|
-
|
|
17529
|
+
anchorX = 0.5;
|
|
17348
17530
|
vbind.textLength = Math.hypot(x22 - x1 || 0, y22 - y1 || 0);
|
|
17349
|
-
vbind.lengthAdjust = "spacingAndGlyphs";
|
|
17350
17531
|
break;
|
|
17351
17532
|
case "center":
|
|
17352
17533
|
tx = (x1 + x22) / 2;
|
|
17353
17534
|
ty = (y1 + y22) / 2;
|
|
17354
|
-
|
|
17535
|
+
anchorX ??= 0.5;
|
|
17355
17536
|
break;
|
|
17356
17537
|
case "pre":
|
|
17357
17538
|
tx = x1;
|
|
17358
17539
|
ty = y1;
|
|
17359
17540
|
translateX -= Math.cos(radian) * inset;
|
|
17360
17541
|
translateY -= Math.sin(radian) * inset;
|
|
17361
|
-
|
|
17542
|
+
anchorX ??= 1;
|
|
17362
17543
|
break;
|
|
17363
17544
|
case "end":
|
|
17364
17545
|
tx = x22;
|
|
17365
17546
|
ty = y22;
|
|
17366
17547
|
translateX -= Math.cos(radian) * inset;
|
|
17367
17548
|
translateY -= Math.sin(radian) * inset;
|
|
17368
|
-
|
|
17549
|
+
anchorX ??= 1;
|
|
17369
17550
|
break;
|
|
17370
17551
|
case "post":
|
|
17371
17552
|
tx = x22;
|
|
17372
17553
|
ty = y22;
|
|
17373
17554
|
translateX += Math.cos(radian) * inset;
|
|
17374
17555
|
translateY += Math.sin(radian) * inset;
|
|
17375
|
-
|
|
17556
|
+
anchorX ??= 0;
|
|
17376
17557
|
break;
|
|
17377
17558
|
default:
|
|
17378
17559
|
tx = x1;
|
|
17379
17560
|
ty = y1;
|
|
17380
17561
|
translateX += Math.cos(radian) * inset;
|
|
17381
17562
|
translateY += Math.sin(radian) * inset;
|
|
17382
|
-
|
|
17563
|
+
anchorX ??= 0;
|
|
17383
17564
|
}
|
|
17384
|
-
|
|
17385
|
-
|
|
17386
|
-
if (radian) transform.push(`rotate(${radian * 180 / Math.PI})`);
|
|
17387
|
-
Object.assign(vbind, {
|
|
17388
|
-
x: tx,
|
|
17389
|
-
y: ty,
|
|
17390
|
-
"dominant-baseline": "central",
|
|
17391
|
-
"transform-origin": `${tx} ${ty}`,
|
|
17392
|
-
transform: transform.join(" ") || null
|
|
17393
|
-
});
|
|
17394
|
-
return [vbind, von, content, String(title ?? String(label).replace(/\x01|\x02/g, ""))];
|
|
17565
|
+
Object.assign(vbind, { x: tx, y: ty, translateX, translateY, anchorX, anchorY, angle: radian * 180 / Math.PI });
|
|
17566
|
+
return [vbind, von];
|
|
17395
17567
|
}).filter((x2) => x2 != null));
|
|
17396
17568
|
});
|
|
17397
|
-
const parser = new Parser();
|
|
17398
|
-
function parseMarkdownInline(markdown2) {
|
|
17399
|
-
const walker = parser.parse(markdown2).walker();
|
|
17400
|
-
const fragments = [];
|
|
17401
|
-
let stack2 = [], scales = [1], offset = 0;
|
|
17402
|
-
let ev;
|
|
17403
|
-
while (ev = walker.next()) {
|
|
17404
|
-
let { node: { type, literal }, entering } = ev;
|
|
17405
|
-
let scale = scales.at(-1);
|
|
17406
|
-
if (entering) {
|
|
17407
|
-
if (type === "text" || type === "code") {
|
|
17408
|
-
const vbind = Object.assign({
|
|
17409
|
-
dy: str_c(offset || null, "em")
|
|
17410
|
-
}, ...stack2, {
|
|
17411
|
-
"font-family": type === "code" ? "monospace" : null,
|
|
17412
|
-
"font-size": scale === 1 ? null : `${scale}em`
|
|
17413
|
-
});
|
|
17414
|
-
offset = 0;
|
|
17415
|
-
fragments.push({ text: literal, vbind });
|
|
17416
|
-
} else if (type === "strong") {
|
|
17417
|
-
stack2.push({ "font-weight": "bold" });
|
|
17418
|
-
} else if (type === "emph") {
|
|
17419
|
-
stack2.push({ "font-style": "italic" });
|
|
17420
|
-
} else if (type === "softbreak" || type === "paragraph") {
|
|
17421
|
-
fragments.push({ text: " " });
|
|
17422
|
-
} else if (type === "html_inline") {
|
|
17423
|
-
const tag2 = literal;
|
|
17424
|
-
if (tag2.includes("color=")) {
|
|
17425
|
-
const fill = tag2.match(/color=(['"])(.*?)\1/i)?.[2] ?? tag2.match(/color=(\S*)/)?.[1];
|
|
17426
|
-
if (fill) stack2.push({ fill });
|
|
17427
|
-
} else if (tag2.includes("</font>")) {
|
|
17428
|
-
stack2.pop();
|
|
17429
|
-
} else if (tag2.includes("<sup>")) {
|
|
17430
|
-
offset -= 0.4 * scale;
|
|
17431
|
-
scales.push(scale * 0.7);
|
|
17432
|
-
} else if (tag2.includes("</sup>")) {
|
|
17433
|
-
offset += 0.4 * scales.at(-1);
|
|
17434
|
-
scales.pop();
|
|
17435
|
-
} else if (tag2.includes("<sub>")) {
|
|
17436
|
-
offset += 0.25 * scale;
|
|
17437
|
-
scales.push(scale * 0.7);
|
|
17438
|
-
} else if (tag2.includes("</sub>")) {
|
|
17439
|
-
offset -= 0.25 * scales.at(-1);
|
|
17440
|
-
scales.pop();
|
|
17441
|
-
}
|
|
17442
|
-
}
|
|
17443
|
-
} else {
|
|
17444
|
-
if (["strong", "emph"].includes(type)) stack2.pop();
|
|
17445
|
-
}
|
|
17446
|
-
}
|
|
17447
|
-
return fragments;
|
|
17448
|
-
}
|
|
17449
17569
|
return (_ctx, _cache) => {
|
|
17450
17570
|
return vue.openBlock(), vue.createElementBlock("g", null, [
|
|
17451
17571
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(binds.value, (group) => {
|
|
17452
17572
|
return vue.openBlock(), vue.createElementBlock("g", vue.mergeProps({ ref_for: true }, { class: __props.groupClass, style: __props.groupStyle }), [
|
|
17453
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(group, ([vbind, von
|
|
17454
|
-
return vue.openBlock(), vue.
|
|
17455
|
-
vue.createElementVNode("title", null, vue.toDisplayString(title), 1),
|
|
17456
|
-
_cache[0] || (_cache[0] = vue.createTextVNode()),
|
|
17457
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(textFragments, (tspan) => {
|
|
17458
|
-
return vue.openBlock(), vue.createElementBlock("tspan", vue.mergeProps({ ref_for: true }, tspan.vbind), vue.toDisplayString(tspan.text), 17);
|
|
17459
|
-
}), 256))
|
|
17460
|
-
], 16);
|
|
17573
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(group, ([vbind, von]) => {
|
|
17574
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$12, vue.mergeProps({ ref_for: true }, vbind, vue.toHandlers(von)), null, 16);
|
|
17461
17575
|
}), 256))
|
|
17462
17576
|
], 16);
|
|
17463
17577
|
}), 256))
|
|
@@ -18006,7 +18120,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
18006
18120
|
data: Object,
|
|
18007
18121
|
geom: String,
|
|
18008
18122
|
render: String,
|
|
18009
|
-
defaultRender: { type: String, default: "auto" }
|
|
18123
|
+
defaultRender: { type: String, default: "auto" },
|
|
18124
|
+
dpi: Number,
|
|
18125
|
+
defaultDpi: Number
|
|
18010
18126
|
},
|
|
18011
18127
|
setup(__props, { expose: __expose }) {
|
|
18012
18128
|
const geoms = { svg, canvas };
|
|
@@ -18025,13 +18141,15 @@ var VVPlot = (function(exports, vue) {
|
|
|
18025
18141
|
render: rend,
|
|
18026
18142
|
dispatchEvent: (e) => layer.value?.dispatchEvent?.(e)
|
|
18027
18143
|
});
|
|
18144
|
+
const dpi = vue.computed(() => rend.value === "canvas" ? __props.dpi ?? __props.defaultDpi : void 0);
|
|
18028
18145
|
return (_ctx, _cache) => {
|
|
18029
18146
|
return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(geoms[rend.value][__props.geom]), {
|
|
18030
18147
|
ref_key: "layer",
|
|
18031
18148
|
ref: layer,
|
|
18032
18149
|
style: vue.normalizeStyle(style.value),
|
|
18033
|
-
data: __props.data
|
|
18034
|
-
|
|
18150
|
+
data: __props.data,
|
|
18151
|
+
dpi: dpi.value
|
|
18152
|
+
}, null, 8, ["style", "data", "dpi"]);
|
|
18035
18153
|
};
|
|
18036
18154
|
}
|
|
18037
18155
|
};
|
|
@@ -18571,6 +18689,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
18571
18689
|
theme: Object,
|
|
18572
18690
|
render: String,
|
|
18573
18691
|
clip: Boolean,
|
|
18692
|
+
dpi: Number,
|
|
18574
18693
|
action: { type: Array, default: () => [] },
|
|
18575
18694
|
selections: { type: Array, default: () => [] },
|
|
18576
18695
|
legendTeleport: null
|
|
@@ -19284,8 +19403,9 @@ var VVPlot = (function(exports, vue) {
|
|
|
19284
19403
|
geom: layer.geom,
|
|
19285
19404
|
coord2pos,
|
|
19286
19405
|
getCoord,
|
|
19287
|
-
"default-render": props.render
|
|
19288
|
-
|
|
19406
|
+
"default-render": props.render,
|
|
19407
|
+
"default-dpi": props.dpi
|
|
19408
|
+
}), null, 16, ["data", "layout", "geom", "default-render", "default-dpi"]);
|
|
19289
19409
|
}), 256))
|
|
19290
19410
|
], 16),
|
|
19291
19411
|
_cache[3] || (_cache[3] = vue.createTextVNode()),
|
|
@@ -19572,7 +19692,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
19572
19692
|
flip: Boolean,
|
|
19573
19693
|
clip: { type: Boolean, default: true },
|
|
19574
19694
|
resize: null,
|
|
19575
|
-
legendTeleport: null
|
|
19695
|
+
legendTeleport: null,
|
|
19696
|
+
dpi: Number
|
|
19576
19697
|
}, {
|
|
19577
19698
|
"selectionPreview": { default: () => ({}) },
|
|
19578
19699
|
"selectionPreviewModifiers": {},
|
|
@@ -19680,6 +19801,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
19680
19801
|
let arr = Array.isArray($attrs[key]) ? $attrs[key] : [$attrs[key]];
|
|
19681
19802
|
plot[key] = arr.filter((f) => typeof f === "function");
|
|
19682
19803
|
wrapper[key] = arr.filter((f) => typeof f !== "function");
|
|
19804
|
+
} else if (key.startsWith("svg-")) {
|
|
19805
|
+
plot[key.slice(4)] = $attrs[key];
|
|
19683
19806
|
} else {
|
|
19684
19807
|
wrapper[key] = $attrs[key];
|
|
19685
19808
|
}
|
|
@@ -19760,7 +19883,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
19760
19883
|
aes[key] = etc[key];
|
|
19761
19884
|
}
|
|
19762
19885
|
} else {
|
|
19763
|
-
if (["class", "style", "group-class", "group-style", "render"].includes(key)) {
|
|
19886
|
+
if (["class", "style", "group-class", "group-style", "dpi", "render"].includes(key)) {
|
|
19764
19887
|
vBind2[key] = etc[key];
|
|
19765
19888
|
} else if (["item-class", "item-style"].includes(key)) {
|
|
19766
19889
|
attrs2[key.slice(5)] = etc[key];
|
|
@@ -20059,6 +20182,7 @@ var VVPlot = (function(exports, vue) {
|
|
|
20059
20182
|
};
|
|
20060
20183
|
});
|
|
20061
20184
|
});
|
|
20185
|
+
const { pixelRatio } = /* @__PURE__ */ useDevicePixelRatio();
|
|
20062
20186
|
const wrapperRef = vue.useTemplateRef("wrapper");
|
|
20063
20187
|
const plotRef = vue.useTemplateRef("plot");
|
|
20064
20188
|
const width = vue.useModel(__props, "width");
|
|
@@ -20105,8 +20229,8 @@ var VVPlot = (function(exports, vue) {
|
|
|
20105
20229
|
get svg() {
|
|
20106
20230
|
return plotRef.value.svg;
|
|
20107
20231
|
},
|
|
20108
|
-
serialize() {
|
|
20109
|
-
return serializeSVG(plotRef.value.svg);
|
|
20232
|
+
serialize(options) {
|
|
20233
|
+
return serializeSVG(plotRef.value.svg, options);
|
|
20110
20234
|
}
|
|
20111
20235
|
});
|
|
20112
20236
|
return (_ctx, _cache) => {
|
|
@@ -20141,9 +20265,10 @@ var VVPlot = (function(exports, vue) {
|
|
|
20141
20265
|
action: action.value,
|
|
20142
20266
|
clip: __props.clip,
|
|
20143
20267
|
render: __props.render,
|
|
20268
|
+
dpi: __props.dpi ?? 96 * vue.unref(pixelRatio),
|
|
20144
20269
|
legendTeleport: __props.legendTeleport,
|
|
20145
20270
|
onSelect: _cache[3] || (_cache[3] = (d, e) => emit("select", d, e))
|
|
20146
|
-
}), 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"]),
|
|
20271
|
+
}), 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"]),
|
|
20147
20272
|
_cache[4] || (_cache[4] = vue.createTextVNode()),
|
|
20148
20273
|
vue.createElementVNode("div", {
|
|
20149
20274
|
class: "vvplot-panel-container",
|