vue-data-ui 2.12.6 → 2.12.7-beta.1

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.
Files changed (109) hide show
  1. package/dist/{Arrow-Bd9ZVBnX.js → Arrow-C5-RFd0F.js} +1 -1
  2. package/dist/BaseDraggableDialog-CKbomZCX.js +180 -0
  3. package/dist/{BaseIcon-CNbwMh_-.js → BaseIcon-DhWmrDAn.js} +1 -1
  4. package/dist/{ColorPicker-B_FoQwtO.js → ColorPicker-F4TctKaQ.js} +23 -24
  5. package/dist/{DataTable-Rajdtaf6.js → DataTable-Y5HbiUZU.js} +11 -11
  6. package/dist/{Legend-BxtDQCIv.js → Legend-DtTYopxf.js} +8 -8
  7. package/dist/NonSvgPenAndPaper-PC9Yu1K_.js +467 -0
  8. package/dist/PackageVersion-DaWGaZxE.js +10 -0
  9. package/dist/{PenAndPaper-BkP3J-Ft.js → PenAndPaper-C-CpE0NC.js} +8 -10
  10. package/dist/RecursiveCircles-Dn3TGoL6.js +96 -0
  11. package/dist/RecursiveLabels-NTMB9w5C.js +49 -0
  12. package/dist/RecursiveLinks-ld_gDZH4.js +64 -0
  13. package/dist/{Shape-C69a0f29.js → Shape-B6kIkp2s.js} +2 -2
  14. package/dist/{Slicer-7qFdY-bT.js → Slicer-DXpA-pZk.js} +2 -2
  15. package/dist/SparkTooltip-DcdMxgqn.js +68 -0
  16. package/dist/{Title-CzaCeCOm.js → Title-Bc66VstS.js} +2 -2
  17. package/dist/Tooltip-B07vY6jm.js +149 -0
  18. package/dist/{usePrinter-C5bLp34h.js → UserOptions-C8X2STEg.js} +172 -231
  19. package/dist/{dom-to-png-Bm0D0yPL.js → dom-to-png-DH-7H-9g.js} +1 -1
  20. package/dist/{img-BN9AzqUr.js → img-CEn9LJxg.js} +1 -1
  21. package/dist/{index-BFzQMJda.js → index-BHEd2dgu.js} +21 -21
  22. package/dist/{pdf-uTbs813M.js → pdf-BfkyEFza.js} +1 -1
  23. package/dist/style.css +1 -1
  24. package/dist/useChartAccessibility-9icAAmYg.js +12 -0
  25. package/dist/useMouse-AicQS8Vf.js +13 -0
  26. package/dist/{useNestedProp-v7KPpwuP.js → useNestedProp-CZztHZIm.js} +1 -1
  27. package/dist/{usePanZoom-CUkkqW81.js → usePanZoom-BQMvRXEQ.js} +16 -17
  28. package/dist/usePrinter-C8URL2IU.js +53 -0
  29. package/dist/vClickOutside-C6WiFswA.js +13 -0
  30. package/dist/{vue-data-ui-D1k8FeRp.js → vue-data-ui-C0tGhjs9.js} +63 -63
  31. package/dist/vue-data-ui.js +19 -19
  32. package/dist/{vue-ui-3d-bar-DoklA4DT.js → vue-ui-3d-bar-CriyJ0Da.js} +397 -402
  33. package/dist/{vue-ui-accordion-BUz4JIIX.js → vue-ui-accordion-DntThSTF.js} +3 -3
  34. package/dist/{vue-ui-age-pyramid-4kyBq-Dy.js → vue-ui-age-pyramid-BwgozppD.js} +215 -218
  35. package/dist/{vue-ui-annotator-Bq1ZeFfb.js → vue-ui-annotator-B7jNrpQ0.js} +2 -2
  36. package/dist/{vue-ui-bullet-DU10avvA.js → vue-ui-bullet-C20X1YRt.js} +137 -140
  37. package/dist/{vue-ui-candlestick-BI1t3flz.js → vue-ui-candlestick-B264jwvu.js} +265 -271
  38. package/dist/{vue-ui-carousel-table-VowLf_oc.js → vue-ui-carousel-table-ECSEPy9m.js} +137 -137
  39. package/dist/{vue-ui-chestnut-BHjV3d94.js → vue-ui-chestnut-BxjeL4B6.js} +397 -400
  40. package/dist/{vue-ui-chord-CPr7r-2_.js → vue-ui-chord-CJNnQbPC.js} +356 -364
  41. package/dist/vue-ui-circle-pack-0RLVrL7y.js +656 -0
  42. package/dist/{vue-ui-cursor-C9teAbVI.js → vue-ui-cursor-c9pZbUX7.js} +2 -2
  43. package/dist/{vue-ui-dashboard-CwDYB8tP.js → vue-ui-dashboard-DJTFcJry.js} +62 -62
  44. package/dist/{vue-ui-digits-CHmkL0hn.js → vue-ui-digits-Cwy7WTqM.js} +2 -2
  45. package/dist/vue-ui-donut-BIFf4SLq.js +1292 -0
  46. package/dist/vue-ui-donut-evolution-mc_-1JSs.js +864 -0
  47. package/dist/{vue-ui-dumbbell-DTKLLd1N.js → vue-ui-dumbbell-D50S44wU.js} +265 -270
  48. package/dist/{vue-ui-flow-BLBhsU2n.js → vue-ui-flow-CxDTjjYn.js} +291 -300
  49. package/dist/{vue-ui-funnel-CIrWdeBk.js → vue-ui-funnel-DeC0U017.js} +216 -219
  50. package/dist/{vue-ui-galaxy-ByhKyIV4.js → vue-ui-galaxy-n0MW2u-q.js} +227 -235
  51. package/dist/{vue-ui-gauge-BbfBMpng.js → vue-ui-gauge-AYMCSEtU.js} +240 -243
  52. package/dist/{vue-ui-gizmo-BM-_QfHM.js → vue-ui-gizmo-Ckz1h7XW.js} +57 -58
  53. package/dist/{vue-ui-heatmap-BA4z4hsw.js → vue-ui-heatmap-m0SgFsTu.js} +239 -242
  54. package/dist/{vue-ui-history-plot-8vM_IUy8.js → vue-ui-history-plot-BrcF_YLL.js} +257 -262
  55. package/dist/{vue-ui-kpi-D57QLK6A.js → vue-ui-kpi-DiVxDYiV.js} +29 -30
  56. package/dist/{vue-ui-mini-loader-CR4c-xJQ.js → vue-ui-mini-loader-CqbUMft8.js} +2 -2
  57. package/dist/vue-ui-molecule-BCUC8QED.js +580 -0
  58. package/dist/{vue-ui-mood-radar-Brc9cxoD.js → vue-ui-mood-radar-DrrjD9S1.js} +180 -186
  59. package/dist/{vue-ui-nested-donuts-W3Z5F--L.js → vue-ui-nested-donuts-8RTss1yH.js} +366 -374
  60. package/dist/{vue-ui-onion-BNBlGNlF.js → vue-ui-onion-CmPLnisN.js} +252 -258
  61. package/dist/{vue-ui-parallel-coordinate-plot-B5G3jyvg.js → vue-ui-parallel-coordinate-plot-BsbEUu_g.js} +292 -298
  62. package/dist/{vue-ui-quadrant-CUy9mVIA.js → vue-ui-quadrant-CdM3bVZs.js} +403 -409
  63. package/dist/{vue-ui-quick-chart-D4_8mRXU.js → vue-ui-quick-chart-C-lgCI6O.js} +611 -616
  64. package/dist/{vue-ui-radar-BUk56jGL.js → vue-ui-radar-Dq94lb99.js} +270 -277
  65. package/dist/{vue-ui-rating-B9TQl5KP.js → vue-ui-rating-DceDRLFc.js} +2 -2
  66. package/dist/vue-ui-relation-circle-DsKddA_I.js +525 -0
  67. package/dist/{vue-ui-ridgeline-Cl06bGom.js → vue-ui-ridgeline-CVR7NvJ_.js} +313 -317
  68. package/dist/{vue-ui-rings-B6bpFlFp.js → vue-ui-rings-B0soMLZ5.js} +260 -266
  69. package/dist/{vue-ui-scatter--WUuVw5G.js → vue-ui-scatter-Bq4_NUfW.js} +368 -374
  70. package/dist/{vue-ui-skeleton-B_YI7Yuc.js → vue-ui-skeleton-CG3Pn3Zg.js} +19 -19
  71. package/dist/{vue-ui-smiley-Bbam2fDz.js → vue-ui-smiley-aGKTgh42.js} +2 -2
  72. package/dist/{vue-ui-spark-trend-DavXuwGt.js → vue-ui-spark-trend--6lA4742.js} +114 -117
  73. package/dist/{vue-ui-sparkbar-9N1FU9-J.js → vue-ui-sparkbar-BXx7Vglf.js} +104 -106
  74. package/dist/{vue-ui-sparkgauge-_9ntq4EK.js → vue-ui-sparkgauge-zM4_Tgqb.js} +72 -74
  75. package/dist/{vue-ui-sparkhistogram-BEzOV4HV.js → vue-ui-sparkhistogram-BDNrZbWN.js} +93 -95
  76. package/dist/vue-ui-sparkline-CzzyDmYJ.js +459 -0
  77. package/dist/{vue-ui-sparkstackbar-BSWcs3v0.js → vue-ui-sparkstackbar-tBSUQ_09.js} +102 -105
  78. package/dist/{vue-ui-stackbar-gG5BLlAr.js → vue-ui-stackbar-BriZOfj6.js} +409 -412
  79. package/dist/{vue-ui-strip-plot-BJouRmxh.js → vue-ui-strip-plot-DzYyFp3o.js} +240 -246
  80. package/dist/{vue-ui-table-D9Ry8s4N.js → vue-ui-table-C2qosrZR.js} +3 -3
  81. package/dist/{vue-ui-table-heatmap-Bizzpi31.js → vue-ui-table-heatmap-COKfg2KT.js} +90 -90
  82. package/dist/{vue-ui-table-sparkline-Dg54Ovs2.js → vue-ui-table-sparkline-D7C5AiCp.js} +212 -212
  83. package/dist/{vue-ui-thermometer-6MSdF_Gm.js → vue-ui-thermometer-CDG6vSMm.js} +154 -157
  84. package/dist/{vue-ui-timer-ByaKokk8.js → vue-ui-timer-DOoO0CVB.js} +180 -181
  85. package/dist/vue-ui-tiremarks-BSPIy1A3.js +341 -0
  86. package/dist/vue-ui-treemap-DsMmxgin.js +947 -0
  87. package/dist/{vue-ui-vertical-bar-CE4oBwBv.js → vue-ui-vertical-bar-B2_ZHuyv.js} +381 -386
  88. package/dist/{vue-ui-waffle-DNEEnY_G.js → vue-ui-waffle-YhkwHcUX.js} +312 -318
  89. package/dist/vue-ui-wheel-CWHJwyyL.js +335 -0
  90. package/dist/vue-ui-word-cloud-BLgEqHRF.js +642 -0
  91. package/dist/{vue-ui-world-Brhq17TE.js → vue-ui-world-BQelvSLD.js} +389 -400
  92. package/dist/{vue-ui-xy-K2G7QQxG.js → vue-ui-xy-D1luVUXJ.js} +845 -846
  93. package/dist/vue-ui-xy-canvas-C7Pu9RFN.js +1206 -0
  94. package/package.json +6 -6
  95. package/dist/BaseDraggableDialog-Bzwlfmy1.js +0 -186
  96. package/dist/PackageVersion-BjrblLPQ.js +0 -10
  97. package/dist/Tooltip-CWmRmhJr.js +0 -158
  98. package/dist/useChartAccessibility-BWojgys7.js +0 -13
  99. package/dist/vue-ui-circle-pack-D_jYpsuD.js +0 -659
  100. package/dist/vue-ui-donut-WRUDvvZa.js +0 -1292
  101. package/dist/vue-ui-donut-evolution-BQxV5D_L.js +0 -871
  102. package/dist/vue-ui-molecule-Bq69N7rC.js +0 -782
  103. package/dist/vue-ui-relation-circle-T6aTibIU.js +0 -528
  104. package/dist/vue-ui-sparkline-D__GCUAz.js +0 -519
  105. package/dist/vue-ui-tiremarks-Z8pjUT1g.js +0 -344
  106. package/dist/vue-ui-treemap-pRJ3be5l.js +0 -956
  107. package/dist/vue-ui-wheel-DWPYZxdT.js +0 -338
  108. package/dist/vue-ui-word-cloud-DAR7R8F8.js +0 -648
  109. package/dist/vue-ui-xy-canvas-ml44sPHS.js +0 -1673
@@ -1,1673 +0,0 @@
1
- import { ref as c, computed as R, onMounted as ot, nextTick as Oe, onBeforeUnmount as $t, watch as _, createElementBlock as M, openBlock as w, Fragment as je, createCommentVNode as Z, normalizeStyle as N, normalizeClass as ve, createElementVNode as W, withDirectives as gt, createVNode as me, toDisplayString as Qe, unref as D, vModelText as pt, withModifiers as mt, renderList as bt, useSlots as Gt, createBlock as ie, createSlots as Zt, withCtx as A, renderSlot as P, normalizeProps as ye, guardReactiveProps as ge, createTextVNode as qt } from "vue";
2
- import { l as St, f as be, X as jt, u as Kt, c as Qt, t as _t, p as pe, a as Jt, C as Ke, b as el, D as lt, i as Le, d as xt, a1 as tl, H as ll, aj as al, o as ol, e as nl, x as kt, q as rl, r as ul, y as sl, s as Re } from "./index-BFzQMJda.js";
3
- import { d as il, t as vl, u as cl, c as dl, a as Lt, l as F, r as at, b as ne, p as wt } from "./useResponsive-JZ9xq-JV.js";
4
- import { _ as hl } from "./Tooltip-CWmRmhJr.js";
5
- import { L as fl } from "./Legend-BxtDQCIv.js";
6
- import { _ as yl } from "./Title-CzaCeCOm.js";
7
- import { S as gl } from "./Slicer-7qFdY-bT.js";
8
- import { u as pl, U as ml } from "./usePrinter-C5bLp34h.js";
9
- import bl from "./vue-ui-accordion-BUz4JIIX.js";
10
- import { D as xl } from "./DataTable-Rajdtaf6.js";
11
- import kl from "./vue-ui-skeleton-B_YI7Yuc.js";
12
- import { u as Ct } from "./useNestedProp-v7KPpwuP.js";
13
- import { u as Ll } from "./useUserOptionState-BIvW1Kz7.js";
14
- import { u as wl } from "./useChartAccessibility-BWojgys7.js";
15
- import De from "./BaseIcon-CNbwMh_-.js";
16
- import { C as Cl } from "./ColorPicker-B_FoQwtO.js";
17
- import { _ as zt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
18
- const $l = {
19
- class: /* @__PURE__ */ ve({
20
- "vue-ui-pen-and-paper-action": !0
21
- }),
22
- style: { padding: "0 !important" }
23
- }, Sl = ["disabled"], zl = ["data-mode", "xmlns", "viewBox"], Ml = ["cx", "cy", "r", "fill"], Tl = ["d", "stroke", "stroke-width"], Il = ["x", "y", "fill", "font-size"], Al = ["x", "dy"], El = ["d", "stroke", "stroke-width"], Pl = {
24
- __name: "NonSvgPenAndPaper",
25
- props: {
26
- parent: {
27
- type: HTMLElement
28
- },
29
- backgroundColor: {
30
- type: String,
31
- default: "#FFFFFF"
32
- },
33
- color: {
34
- type: String,
35
- default: "#2D353C"
36
- },
37
- active: {
38
- type: Boolean,
39
- default: !1
40
- }
41
- },
42
- emits: ["close"],
43
- setup($, { emit: _e }) {
44
- const J = $, Je = _e, k = c([]), q = c([]), re = c("0 0 0 0"), H = c(J.color), f = c(1), p = c("draw"), L = c(null), ee = c(!1), d = c(null), j = c({ x: 0, y: 0 }), K = c([""]), T = c({ row: 0, col: 0 }), B = c(16);
45
- let te = 1;
46
- function le() {
47
- return te++;
48
- }
49
- function we(s) {
50
- var l;
51
- const n = U.value;
52
- if (!n) return { x: 0, y: 0 };
53
- const a = n.createSVGPoint();
54
- let r = s.clientX, v = s.clientY;
55
- s.touches && s.touches.length && (r = s.touches[0].clientX, v = s.touches[0].clientY), a.x = r, a.y = v;
56
- const h = (l = n.getScreenCTM()) == null ? void 0 : l.inverse();
57
- return h ? a.matrixTransform(h) : { x: 0, y: 0 };
58
- }
59
- function Ce(s) {
60
- if (!L.value || p.value !== "text" || ee.value) return;
61
- const { x: n, y: a } = we(s);
62
- j.value = { x: n, y: a }, K.value = [""], T.value = { row: 0, col: 0 };
63
- const r = document.createElementNS("http://www.w3.org/2000/svg", "text");
64
- r.setAttribute("x", n), r.setAttribute("y", a), r.setAttribute("fill", H.value), r.setAttribute("font-size", B.value), r.setAttribute("font-family", "sans-serif"), r.setAttribute("class", "vue-data-ui-doodle"), r.setAttribute("dominant-baseline", "hanging"), r.setAttribute("pointer-events", "all");
65
- const v = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
66
- v.setAttribute("x", n), v.setAttribute("dy", "0"), v.textContent = "", r.appendChild(v), r.style.pointerEvents = "none", r.style.userSelect = "none", L.value.appendChild(r), d.value = r, ee.value = !0, window.addEventListener("keydown", $e), window.addEventListener("mousedown", ze, !0), ce(), Se();
67
- }
68
- function $e(s) {
69
- if (!ee.value) return;
70
- let { row: n, col: a } = T.value, r = K.value.slice(), v = !1;
71
- if (s.key === "Enter") {
72
- const h = r[n], l = h.slice(0, a), z = h.slice(a);
73
- r.splice(n, 1, l, z), n += 1, a = 0, v = !0, s.preventDefault();
74
- } else if (s.key === "Backspace") {
75
- if (a > 0)
76
- r[n] = r[n].slice(0, a - 1) + r[n].slice(a), a -= 1, v = !0;
77
- else if (n > 0) {
78
- const h = r[n - 1].length;
79
- r[n - 1] += r[n], r.splice(n, 1), n -= 1, a = h, v = !0;
80
- }
81
- s.preventDefault();
82
- } else if (s.key === "Delete")
83
- a < r[n].length ? (r[n] = r[n].slice(0, a) + r[n].slice(a + 1), v = !0) : n < r.length - 1 && (r[n] += r[n + 1], r.splice(n + 1, 1), v = !0), s.preventDefault();
84
- else if (s.key === "ArrowLeft")
85
- a > 0 ? a -= 1 : n > 0 && (n -= 1, a = r[n].length), v = !0, s.preventDefault();
86
- else if (s.key === "ArrowRight")
87
- a < r[n].length ? a += 1 : n < r.length - 1 && (n += 1, a = 0), v = !0, s.preventDefault();
88
- else if (s.key === "ArrowUp")
89
- n > 0 && (n -= 1, a = Math.min(a, r[n].length), v = !0), s.preventDefault();
90
- else if (s.key === "ArrowDown")
91
- n < r.length - 1 && (n += 1, a = Math.min(a, r[n].length), v = !0), s.preventDefault();
92
- else if (s.key.length === 1 && !s.ctrlKey && !s.metaKey && !s.altKey)
93
- r[n] = r[n].slice(0, a) + s.key + r[n].slice(a), a += 1, v = !0, s.preventDefault();
94
- else if (s.key === "Escape") {
95
- Me(!0);
96
- return;
97
- } else s.key === "Tab" && s.preventDefault();
98
- v && (K.value = r, T.value = { row: n, col: a }, ce(), Se());
99
- }
100
- function ce() {
101
- const s = d.value, { x: n, y: a } = j.value;
102
- for (; s.firstChild; ) s.removeChild(s.firstChild);
103
- K.value.forEach((r, v) => {
104
- const h = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
105
- h.setAttribute("x", n), h.setAttribute("dy", v === 0 ? "0" : `${B.value * 1.2}`), h.textContent = r.length ? r : "​", s.appendChild(h);
106
- });
107
- }
108
- function Se() {
109
- const s = L.value.querySelector(".vue-data-ui-svg-caret");
110
- s && L.value.removeChild(s);
111
- const n = d.value;
112
- if (!n) return;
113
- const { x: a, y: r } = j.value, { row: v, col: h } = T.value, l = B.value, z = n.childNodes[v];
114
- if (!z) return;
115
- let I = z.textContent.slice(0, h);
116
- I.endsWith(" ") && (I += " ");
117
- const y = document.createElementNS("http://www.w3.org/2000/svg", "text");
118
- y.setAttribute("x", a), y.setAttribute("y", r), y.setAttribute("font-size", l), y.setAttribute("font-family", "sans-serif"), y.textContent = I || "", L.value.appendChild(y);
119
- const E = y.getBBox();
120
- L.value.removeChild(y);
121
- let S = r + v * l * 1.2, g = a + E.width;
122
- const i = document.createElementNS("http://www.w3.org/2000/svg", "rect");
123
- i.setAttribute("x", g), i.setAttribute("y", S), i.setAttribute("width", 1), i.setAttribute("height", l), i.setAttribute("fill", H.value), i.setAttribute("class", "vue-data-ui-svg-caret"), L.value.appendChild(i);
124
- }
125
- function ze(s) {
126
- if (d.value && !d.value.contains(s.target)) {
127
- const n = d.value.children;
128
- n.length === 1 && (n[0].textContent === "" || n[0].textContent === "​") && d.value.remove(), Me(!1);
129
- }
130
- }
131
- function Me(s = !1) {
132
- var r;
133
- window.removeEventListener("keydown", $e), window.removeEventListener("mousedown", ze, !0);
134
- const n = (r = L.value) == null ? void 0 : r.querySelector(".vue-data-ui-svg-caret");
135
- n && L.value.removeChild(n);
136
- const a = K.value.every(
137
- (v) => !v || v === "​"
138
- );
139
- s || a || k.value.push({
140
- id: le(),
141
- type: "text",
142
- x: j.value.x,
143
- y: j.value.y,
144
- color: H.value,
145
- fontSize: B.value,
146
- lines: K.value.map((v) => v)
147
- }), d.value && L.value && L.value.contains(d.value) && L.value.removeChild(d.value), ee.value = !1, d.value = null, K.value = [""], T.value = { row: 0, col: 0 };
148
- }
149
- const Q = R(() => St(J.color, 0.6));
150
- function de({ width: s, height: n }) {
151
- re.value = `0 0 ${s} ${n}`;
152
- }
153
- const ue = c(null);
154
- ot(() => {
155
- Oe(() => {
156
- if (J.parent) {
157
- ue.value = new ResizeObserver((a) => {
158
- for (const r of a) {
159
- const { width: v, height: h } = r.contentRect;
160
- de({ width: v, height: h });
161
- }
162
- }), ue.value.observe(J.parent);
163
- const { width: s, height: n } = J.parent.getBoundingClientRect();
164
- de({ width: s, height: n });
165
- }
166
- }), L.value = U.value.querySelector("g");
167
- }), $t(() => {
168
- ue.value && ue.value.disconnect();
169
- }), _(
170
- () => J.parent,
171
- (s) => {
172
- if (!s) return;
173
- const { width: n, height: a } = J.parent.getBoundingClientRect();
174
- de({ width: n, height: a });
175
- },
176
- { immediate: !0 }
177
- ), _(p, (s) => {
178
- var n, a;
179
- s === "text" ? (n = U.value) == null || n.addEventListener("mousedown", Ce) : (a = U.value) == null || a.removeEventListener("mousedown", Ce);
180
- });
181
- const ae = c(!1), O = c(""), U = c(null);
182
- function Ne(s) {
183
- if (p.value !== "draw" || !U.value) return;
184
- ae.value = !0;
185
- const { x: n, y: a } = V(s);
186
- O.value = `M ${n} ${a}`;
187
- }
188
- function Be(s) {
189
- if (!ae.value || !U.value) return;
190
- const { x: n, y: a } = V(s);
191
- O.value += ` ${n} ${a}`;
192
- }
193
- function t(s) {
194
- const n = s.trim().split(/\s+/);
195
- if (n.length < 4)
196
- return s;
197
- const a = n.slice(1).map(Number);
198
- if (a.length % 2 !== 0)
199
- return s;
200
- const r = Te(a), v = [`M ${r[0]} ${r[1]}`];
201
- for (let z = 2; z < r.length - 2; z += 2) {
202
- const I = r[z - 2], y = r[z - 1], E = r[z], S = r[z + 1], g = (I + E) / 2, i = (y + S) / 2;
203
- v.push(`Q ${I} ${y} ${g} ${i}`);
204
- }
205
- const h = r[r.length - 2], l = r[r.length - 1];
206
- return v.push(`L ${h} ${l}`), v.join(" ");
207
- }
208
- function Te(s, n = 1) {
209
- const a = [...s];
210
- for (let r = 2; r < s.length - 2; r += 2) {
211
- const v = s[r], h = s[r + 1], l = s[r - 2], z = s[r - 1], I = s[r + 2], y = s[r + 3];
212
- a[r] = v + n * ((l + I) / 2 - v), a[r + 1] = h + n * ((z + y) / 2 - h);
213
- }
214
- return a;
215
- }
216
- function Ye(s) {
217
- const n = s.trim().split(/\s+/);
218
- let a = "", r = "", v = null, h = null;
219
- for (let l = 0; l < n.length; l += 1) {
220
- const z = n[l];
221
- if (isNaN(z)) {
222
- if (r = z, r === "M" || r === "L")
223
- v = parseFloat(n[++l]), h = parseFloat(n[++l]), a += `${r}${v} ${h}`;
224
- else if (r === "Q") {
225
- const I = parseFloat(n[++l]), y = parseFloat(n[++l]), E = parseFloat(n[++l]), S = parseFloat(n[++l]);
226
- I === v && y === h ? a += `t${E - v} ${S - h}` : a += `q${I - v} ${y - h} ${E - v} ${S - h}`, v = E, h = S;
227
- }
228
- } else {
229
- const I = parseFloat(z), y = parseFloat(n[++l]);
230
- if (r === "L") {
231
- const E = I - v, S = y - h;
232
- E === 0 ? a += `v${S}` : S === 0 ? a += `h${E}` : a += `l${E} ${S}`, v = I, h = y;
233
- } else if (r === "Q") {
234
- const E = I, S = y, g = parseFloat(n[++l]), i = parseFloat(n[++l]);
235
- E === v && S === h ? a += `t${g - v} ${i - h}` : a += `q${E - v} ${S - h} ${g - v} ${i - h}`, v = g, h = i;
236
- }
237
- }
238
- }
239
- return a;
240
- }
241
- function xe() {
242
- ae.value && (k.value.push({
243
- id: le(),
244
- strokeWidth: f.value,
245
- path: Ye(t(O.value)),
246
- color: H.value
247
- }), q.value = [], O.value = ""), ae.value = !1;
248
- }
249
- function V(s) {
250
- if (!U.value) return { x: 0, y: 0 };
251
- const n = U.value.getBoundingClientRect();
252
- let a, r;
253
- return s.touches && s.touches.length ? (a = s.touches[0].clientX, r = s.touches[0].clientY) : (a = s.clientX, r = s.clientY), {
254
- x: a - n.left,
255
- y: r - n.top
256
- };
257
- }
258
- function Xe() {
259
- if (k.value.length > 0) {
260
- const s = k.value.pop();
261
- q.value.push(s);
262
- }
263
- }
264
- function He() {
265
- if (q.value.length > 0) {
266
- const s = q.value.pop();
267
- k.value.push(s);
268
- }
269
- }
270
- function Ue() {
271
- k.value = [], q.value = [];
272
- }
273
- const Ie = c(null);
274
- return (s, n) => (w(), M(je, null, [
275
- $.active ? (w(), M("div", {
276
- key: 0,
277
- "data-dom-to-png-ignore": "",
278
- class: ve({
279
- "vue-ui-pen-and-paper-actions": !0,
280
- visible: $.active
281
- }),
282
- style: N({ backgroundColor: $.backgroundColor })
283
- }, [
284
- W("button", {
285
- class: "vue-ui-pen-and-paper-action",
286
- style: N({
287
- backgroundColor: $.backgroundColor,
288
- border: `1px solid ${Q.value}`
289
- }),
290
- onClick: n[0] || (n[0] = (a) => Je("close"))
291
- }, [
292
- me(De, {
293
- name: "close",
294
- stroke: $.color
295
- }, null, 8, ["stroke"])
296
- ], 4),
297
- W("button", $l, [
298
- me(Cl, {
299
- value: H.value,
300
- "onUpdate:value": n[1] || (n[1] = (a) => H.value = a),
301
- backgroundColor: $.backgroundColor,
302
- buttonBorderColor: Q.value
303
- }, null, 8, ["value", "backgroundColor", "buttonBorderColor"])
304
- ]),
305
- W("button", {
306
- class: ve(["vue-ui-pen-and-paper-action", { "vue-ui-pen-and-paper-action-active": p.value === "text" }]),
307
- onClick: n[2] || (n[2] = (a) => p.value = p.value === "text" ? "draw" : "text"),
308
- style: N({
309
- backgroundColor: $.backgroundColor,
310
- border: `1px solid ${Q.value}`
311
- })
312
- }, [
313
- me(De, {
314
- name: p.value === "draw" ? "annotator" : "text",
315
- stroke: $.color
316
- }, null, 8, ["name", "stroke"]),
317
- W("div", {
318
- style: N({
319
- position: "absolute",
320
- bottom: "-20px",
321
- color: Q.value,
322
- width: "100%",
323
- textAlign: "center",
324
- fontSize: "12px"
325
- })
326
- }, Qe(D(be)({
327
- v: p.value === "draw" ? f.value : B.value,
328
- s: "px",
329
- r: 1
330
- })), 5)
331
- ], 6),
332
- W("button", {
333
- class: ve({
334
- "vue-ui-pen-and-paper-action": !0,
335
- "vue-ui-pen-and-paper-action-disabled": !k.value.length
336
- }),
337
- disabled: !k.value.length,
338
- style: N({
339
- backgroundColor: $.backgroundColor,
340
- border: `1px solid ${Q.value}`,
341
- marginTop: "20px"
342
- }),
343
- onClick: Xe
344
- }, [
345
- me(De, {
346
- name: "restart",
347
- stroke: $.color
348
- }, null, 8, ["stroke"])
349
- ], 14, Sl),
350
- W("button", {
351
- class: ve({
352
- "vue-ui-pen-and-paper-action": !0,
353
- "vue-ui-pen-and-paper-action-disabled": !q.value.length
354
- }),
355
- style: N({
356
- backgroundColor: $.backgroundColor,
357
- border: `1px solid ${Q.value}`
358
- }),
359
- onClick: He
360
- }, [
361
- me(De, {
362
- name: "restart",
363
- stroke: $.color,
364
- style: { transform: "scaleX(-1)" }
365
- }, null, 8, ["stroke"])
366
- ], 6),
367
- W("button", {
368
- class: ve([{
369
- "vue-ui-pen-and-paper-action": !0,
370
- "vue-ui-pen-and-paper-action-disabled": !k.value.length
371
- }, "vue-ui-pen-and-paper-action"]),
372
- style: N({
373
- backgroundColor: $.backgroundColor,
374
- border: `1px solid ${Q.value}`
375
- }),
376
- onClick: Ue
377
- }, [
378
- me(De, {
379
- name: "trash",
380
- stroke: $.color
381
- }, null, 8, ["stroke"])
382
- ], 6),
383
- p.value === "draw" ? gt((w(), M("input", {
384
- key: 0,
385
- ref_key: "range",
386
- ref: Ie,
387
- type: "range",
388
- class: "vertical-range",
389
- min: 0.5,
390
- max: 12,
391
- step: 0.1,
392
- "onUpdate:modelValue": n[3] || (n[3] = (a) => f.value = a),
393
- style: N({ accentColor: $.color })
394
- }, null, 4)), [
395
- [pt, f.value]
396
- ]) : Z("", !0),
397
- p.value === "text" ? gt((w(), M("input", {
398
- key: 1,
399
- ref_key: "range",
400
- ref: Ie,
401
- type: "range",
402
- class: "vertical-range",
403
- min: 3,
404
- max: 48,
405
- step: 0.1,
406
- "onUpdate:modelValue": n[4] || (n[4] = (a) => B.value = a),
407
- style: N({ accentColor: $.color })
408
- }, null, 4)), [
409
- [pt, B.value]
410
- ]) : Z("", !0)
411
- ], 6)) : Z("", !0),
412
- (w(), M("svg", {
413
- "data-mode": p.value,
414
- ref_key: "svgElement",
415
- ref: U,
416
- xmlns: D(jt),
417
- viewBox: re.value,
418
- class: ve({
419
- "vue-ui-pen-and-paper": !0,
420
- inactive: !$.active
421
- }),
422
- onMousedown: Ne,
423
- onMousemove: Be,
424
- onMouseup: xe,
425
- onMouseleave: xe,
426
- onTouchstart: mt(Ne, ["prevent"]),
427
- onTouchmove: mt(Be, ["prevent"]),
428
- onTouchend: xe
429
- }, [
430
- W("g", {
431
- ref_key: "G",
432
- ref: L
433
- }, [
434
- (w(!0), M(je, null, bt(k.value, (a) => (w(), M(je, {
435
- key: a.id
436
- }, [
437
- a.path && a.path.replace("M", "").split(" ").length === 2 ? (w(), M("circle", {
438
- key: 0,
439
- cx: a.path.replace("M", "").split(" ")[0],
440
- cy: a.path.replace("M", "").split(" ")[1],
441
- r: a.strokeWidth / 2,
442
- fill: a.color
443
- }, null, 8, Ml)) : a.path ? (w(), M("path", {
444
- key: 1,
445
- class: "vue-ui-pen-and-paper-path",
446
- d: a.path,
447
- stroke: a.color,
448
- "stroke-width": a.strokeWidth,
449
- fill: "none"
450
- }, null, 8, Tl)) : a.type === "text" ? (w(), M("text", {
451
- key: 2,
452
- x: a.x,
453
- y: a.y,
454
- fill: a.color,
455
- "font-size": a.fontSize,
456
- "font-family": "sans-serif",
457
- "dominant-baseline": "hanging",
458
- class: "vue-ui-pen-and-paper-text"
459
- }, [
460
- (w(!0), M(je, null, bt(a.lines, (r, v) => (w(), M("tspan", {
461
- key: v,
462
- x: a.x,
463
- dy: v === 0 ? "0" : a.fontSize * 1.2
464
- }, Qe(r.length ? r : "​"), 9, Al))), 128))
465
- ], 8, Il)) : Z("", !0)
466
- ], 64))), 128))
467
- ], 512),
468
- ae.value ? (w(), M("path", {
469
- key: 0,
470
- class: "vue-ui-pen-and-paper-path vue-ui-pen-and-paper-path-drawing",
471
- d: t(O.value),
472
- stroke: H.value,
473
- "stroke-width": f.value * 1.1,
474
- fill: "none"
475
- }, null, 8, El)) : Z("", !0)
476
- ], 42, zl))
477
- ], 64));
478
- }
479
- }, Fl = /* @__PURE__ */ zt(Pl, [["__scopeId", "data-v-14478ba4"]]), Rl = ["id"], Dl = ["onClick"], Ol = {
480
- key: 2,
481
- class: "vue-data-ui-watermark"
482
- }, Nl = ["innerHTML"], Bl = {
483
- __name: "vue-ui-xy-canvas",
484
- props: {
485
- dataset: {
486
- type: Array,
487
- default() {
488
- return [];
489
- }
490
- },
491
- config: {
492
- type: Object,
493
- default() {
494
- return {};
495
- }
496
- }
497
- },
498
- emits: ["selectLegend"],
499
- setup($, { expose: _e, emit: J }) {
500
- const { vue_ui_xy_canvas: Je } = Kt(), k = $, q = c(Qt()), re = c(null), H = c(null), f = c(null), p = c(1), L = c(1), ee = c(!1), d = c(null), j = c(""), K = c(null), T = c([]), B = c(1), te = c(!0), le = c(!0), we = c(null), Ce = c(0), $e = c(0), ce = c(!1), Se = c(null), ze = c(null), Me = c(null), Q = c(null), de = c(0), ue = c(0), ae = c(0), O = c(null), U = R(() => !!k.dataset && k.dataset.length), Ne = J, Be = Gt();
501
- ot(() => {
502
- Be["chart-background"] && console.warn("VueUiXyCanvas does not support the #chart-background slot.");
503
- });
504
- const t = R({
505
- get: () => Xe(),
506
- set: (e) => e
507
- }), { userOptionsVisible: Te, setUserOptionsVisibility: Ye, keepUserOptionState: xe } = Ll({ config: t.value }), { svgRef: V } = wl({ config: t.value.style.chart.title });
508
- function Xe() {
509
- const e = Ct({
510
- userConfig: k.config,
511
- defaultConfig: Je
512
- });
513
- let o = {};
514
- return e.theme ? o = {
515
- ...Ct({
516
- userConfig: Jt.vue_ui_xy_canvas[e.theme] || k.config,
517
- defaultConfig: e
518
- }),
519
- customPalette: _t[e.theme] || pe
520
- } : o = e, k.config && Ke(k.config, "style.chart.scale.min") ? o.style.chart.scale.min = k.config.style.chart.scale.min : o.style.chart.scale.min = null, k.config && Ke(k.config, "style.chart.scale.max") ? o.style.chart.scale.max = k.config.style.chart.scale.max : o.style.chart.scale.max = null, k.config && Ke(k.config, "style.chart.zoom.startIndex") ? o.style.chart.zoom.startIndex = k.config.style.chart.zoom.startIndex : o.style.chart.zoom.startIndex = null, k.config && Ke(k.config, "style.chart.zoom.endIndex") ? o.style.chart.zoom.endIndex = k.config.style.chart.zoom.endIndex : o.style.chart.zoom.endIndex = null, o;
521
- }
522
- _(() => k.config, (e) => {
523
- t.value = Xe(), Te.value = !t.value.userOptions.showOnChartHover, et(), de.value += 1, ue.value += 1, ae.value += 1, a.value.showTable = t.value.table.show, a.value.showDataLabels = t.value.style.chart.dataLabels.show, a.value.stacked = t.value.style.chart.stacked, a.value.showTooltip = t.value.style.chart.tooltip.show;
524
- }, { deep: !0 }), _(() => k.dataset, () => {
525
- et(), de.value += 1, ue.value += 1, ae.value += 1;
526
- }, { deep: !0 });
527
- const He = c(t.value.style.chart.aspectRatio), { isPrinting: Ue, isImaging: Ie, generatePdf: s, generateImage: n } = pl({
528
- elementId: `xy_canvas_${q.value}`,
529
- fileName: t.value.style.chart.title.text || "vue-ui-xy-canvas",
530
- options: t.value.userOptions.print
531
- }), a = c({
532
- showTable: t.value.table.show,
533
- showDataLabels: t.value.style.chart.dataLabels.show,
534
- stacked: t.value.style.chart.stacked,
535
- showTooltip: t.value.style.chart.tooltip.show
536
- });
537
- function r(e) {
538
- ce.value = e, $e.value += 1;
539
- }
540
- const v = R(() => el(t.value.customPalette)), h = R(() => S.value ? Math.max(...S.value.filter((e, o) => !T.value.includes(e.absoluteIndex)).map((e) => e.series.length)) : 0), l = R(() => {
541
- const e = p.value - p.value * (t.value.style.chart.paddingProportions.left + t.value.style.chart.paddingProportions.right);
542
- return {
543
- canvasWidth: p.value,
544
- canvasHeight: L.value,
545
- left: p.value * t.value.style.chart.paddingProportions.left,
546
- top: L.value * t.value.style.chart.paddingProportions.top,
547
- right: p.value - p.value * t.value.style.chart.paddingProportions.right,
548
- bottom: L.value - L.value * t.value.style.chart.paddingProportions.bottom,
549
- width: e,
550
- height: L.value - L.value * (t.value.style.chart.paddingProportions.top + t.value.style.chart.paddingProportions.bottom),
551
- slot: e / (i.value.end - i.value.start)
552
- };
553
- });
554
- function z(e, o) {
555
- return e / o;
556
- }
557
- function I({ hasAutoScale: e, series: o, min: u, max: m, scale: x, yOffset: X, individualHeight: b, stackIndex: C = null }) {
558
- return o.map((he, G) => {
559
- const se = x.min < 0 ? Math.abs(x.min) : 0, fe = z(he + se, se + x.max);
560
- let Pe, Fe;
561
- e && (Pe = x.min, Fe = z(he - Pe, x.max - Pe));
562
- let oe = 0;
563
- return C === null ? oe = l.value.bottom - l.value.height * (e ? Fe : fe) : oe = l.value.bottom - X - b * (e ? Fe : fe), {
564
- x: l.value.left + l.value.slot * G + l.value.slot / 2,
565
- y: oe,
566
- value: he
567
- };
568
- });
569
- }
570
- const y = R(() => {
571
- const e = t.value.style.chart.scale.min !== null ? t.value.style.chart.scale.min : Math.min(...S.value.filter((b, C) => !T.value.includes(b.absoluteIndex)).flatMap((b) => b.series.slice(i.value.start, i.value.end))), o = t.value.style.chart.scale.max !== null ? t.value.style.chart.scale.max : Math.max(...S.value.filter((b, C) => !T.value.includes(b.absoluteIndex)).flatMap((b) => b.series.slice(i.value.start, i.value.end))), u = lt(e < 0 ? e : 0, o === e ? e + 1 < 0 ? 0 : e + 1 : o < 0 ? 0 : o, t.value.style.chart.scale.ticks), m = u.min < 0 ? Math.abs(u.min) : 0, x = l.value.bottom - l.value.height * (m / (u.max + m)), X = u.ticks.map((b) => ({
572
- y: l.value.bottom - l.value.height * ((b + m) / (u.max + m)),
573
- x: l.value.left - 8,
574
- value: b
575
- }));
576
- return {
577
- absoluteMin: m,
578
- max: o,
579
- min: e,
580
- scale: u,
581
- yLabels: X,
582
- zero: x
583
- };
584
- }), E = R(() => g.value.map((e) => `
585
- <div style="display:flex;flex-direction:row;gap:6px;align-items:center;">
586
- <svg viewBox="0 0 10 10" height="12" width="12">
587
- <circle cx="5" cy="5" r="5" fill="${e.color}"/>
588
- </svg>
589
- <span>${e.name ? e.name + ": " : ""}</span>
590
- <span>${Le(
591
- t.value.style.chart.dataLabels.formatter,
592
- e.series[d.value],
593
- be({
594
- p: e.prefix || "",
595
- v: e.series[d.value],
596
- s: e.suffix || "",
597
- r: e.rounding || 0
598
- }),
599
- { datapoint: e, seriesIndex: d.value }
600
- )}</span>
601
- </div>
602
- `)), S = R(() => k.dataset.map((e, o) => ({
603
- ...e,
604
- series: tl({
605
- data: ll(e.series),
606
- threshold: t.value.downsample.threshold
607
- }),
608
- absoluteIndex: o,
609
- color: xt(e.color || v.value[o] || pe[o] || pe[o % pe.length])
610
- })));
611
- _(h, (e) => {
612
- e && nt();
613
- });
614
- const g = R(() => al(S.value.filter((e, o) => !T.value.includes(e.absoluteIndex))).map((e, o) => ({
615
- ...e,
616
- series: e.series.slice(i.value.start, i.value.end)
617
- })).map((e, o) => {
618
- let u = [null, void 0].includes(e.scaleMin) ? Math.min(...e.series) || 0 : e.scaleMin, m = [null, void 0].includes(e.scaleMax) ? Math.max(...e.series) || 1 : e.scaleMax;
619
- u === m && (u = u >= 0 ? m - 1 : u, m = m >= 0 ? m : u + 1), e.series.filter((oe) => ![null, void 0].includes(oe)).map((oe) => (oe - u) / (m - u));
620
- const x = {
621
- valueMin: u,
622
- valueMax: m
623
- }, X = e.scaleSteps || t.value.style.chart.scale.ticks;
624
- let b;
625
- e.autoScaling ? b = lt(x.valueMin, x.valueMax, X) : b = lt(x.valueMin < 0 ? x.valueMin : 0, x.valueMax <= 0 ? 0 : x.valueMax, X);
626
- const C = a.value.stacked ? l.value.height * (1 - e.cumulatedStackRatio) : 0, he = a.value.stacked ? l.value.height / t.value.style.chart.stackGap : 0, G = a.value.stacked ? l.value.height * e.stackRatio - he : l.value.height, se = b.min < 0 ? Math.abs(b.min) : 0;
627
- let fe;
628
- e.autoScaling && a.value.stacked && m <= 0 ? fe = l.value.bottom - C - G : fe = l.value.bottom - C - G * (se / (b.max + se));
629
- const Pe = b.ticks.map((oe, Vt) => ({
630
- y: l.value.bottom - C - G * (Vt / (b.ticks.length - 1)),
631
- x: l.value.left - 8,
632
- value: oe
633
- })), Fe = I({
634
- hasAutoScale: a.value.stacked && e.autoScaling,
635
- series: e.series,
636
- min: a.value.stacked ? u : y.value.min,
637
- max: a.value.stacked ? m : y.value.max,
638
- scale: a.value.stacked ? b : y.value.scale,
639
- yOffset: C,
640
- individualHeight: G,
641
- stackIndex: a.value.stacked ? o : null
642
- });
643
- return {
644
- ...e,
645
- coordinatesLine: Fe,
646
- min: u,
647
- max: m,
648
- localScale: b,
649
- localZero: fe,
650
- localMin: se,
651
- localYLabels: Pe,
652
- yOffset: C,
653
- individualHeight: G
654
- };
655
- })), i = c({
656
- start: 0,
657
- end: h.value
658
- });
659
- function nt() {
660
- rt();
661
- }
662
- const ke = c(null);
663
- async function rt() {
664
- (t.value.style.chart.zoom.startIndex !== null || t.value.style.chart.zoom.endIndex !== null) && ke.value ? (t.value.style.chart.zoom.startIndex !== null && (await Oe(), await Oe(), ke.value && ke.value.setStartValue(t.value.style.chart.zoom.startIndex)), t.value.style.chart.zoom.endIndex !== null && (await Oe(), await Oe(), ke.value && ke.value.setEndValue(Mt(t.value.style.chart.zoom.endIndex + 1)))) : (i.value = {
665
- start: 0,
666
- end: h.value
667
- }, Ce.value += 1);
668
- }
669
- function Mt(e) {
670
- const o = h.value;
671
- return e > o ? o : e < 0 || t.value.style.chart.zoom.startIndex !== null && e < t.value.style.chart.zoom.startIndex ? t.value.style.chart.zoom.startIndex !== null ? t.value.style.chart.zoom.startIndex + 1 : 1 : e;
672
- }
673
- const Tt = R(() => g.value.filter((e) => ["line", "plot", void 0].includes(e.type))), Y = R(() => g.value.filter((e) => e.type === "bar"));
674
- function It() {
675
- if (!V.value)
676
- return;
677
- const e = H.value.offsetWidth, o = H.value.offsetHeight;
678
- V.value.width = e * B.value * 2, V.value.height = o * B.value * 2, p.value = e * B.value * 2, L.value = o * B.value * 2, f.value.scale(B.value, B.value), Ae();
679
- }
680
- function At() {
681
- if (f.value.clearRect(0, 0, 1e4, 1e4), f.value.fillStyle = t.value.style.chart.backgroundColor, f.value.fillRect(0, 0, l.value.canvasWidth, l.value.canvasHeight), a.value.stacked)
682
- t.value.style.chart.grid.y.verticalLines.show && i.value.end - i.value.start < t.value.style.chart.grid.y.verticalLines.hideUnderXLength ? g.value.forEach((e) => {
683
- for (let o = 0; o < i.value.end - i.value.start + 1; o += 1)
684
- F(
685
- f.value,
686
- [
687
- {
688
- x: l.value.left + l.value.slot * o,
689
- y: l.value.bottom - e.yOffset - e.individualHeight
690
- },
691
- {
692
- x: l.value.left + l.value.slot * o,
693
- y: l.value.bottom - e.yOffset
694
- }
695
- ],
696
- {
697
- color: t.value.style.chart.grid.y.verticalLines.color
698
- }
699
- );
700
- }) : t.value.style.chart.grid.y.verticalLines.show && i.value.end - i.value.start >= t.value.style.chart.grid.y.verticalLines.hideUnderXLength && g.value.forEach((e) => {
701
- for (let o = i.value.start; o < i.value.end; o += 1)
702
- o % Math.floor((i.value.end - i.value.start) / t.value.style.chart.grid.y.timeLabels.modulo) === 0 && F(
703
- f.value,
704
- [
705
- {
706
- x: l.value.left + l.value.slot * (o - i.value.start) + l.value.slot / 2,
707
- y: l.value.bottom - e.yOffset - e.individualHeight
708
- },
709
- {
710
- x: l.value.left + l.value.slot * (o - i.value.start) + l.value.slot / 2,
711
- y: l.value.bottom - e.yOffset
712
- }
713
- ],
714
- {
715
- color: t.value.style.chart.grid.y.verticalLines.color
716
- }
717
- );
718
- }), t.value.style.chart.grid.x.horizontalLines.show && (t.value.style.chart.grid.x.horizontalLines.alternate ? g.value.forEach((e) => {
719
- e.localYLabels.forEach((o, u) => {
720
- u < e.localYLabels.length - 1 && at(
721
- f.value,
722
- [
723
- { x: l.value.left, y: o.y },
724
- { x: l.value.right, y: o.y },
725
- { x: l.value.right, y: e.localYLabels[u + 1].y },
726
- { x: l.value.left, y: e.localYLabels[u + 1].y }
727
- ],
728
- {
729
- fillColor: u % 2 === 0 ? "transparent" : Re(t.value.style.chart.grid.x.horizontalLines.color, t.value.style.chart.grid.x.horizontalLines.opacity),
730
- strokeColor: "transparent"
731
- }
732
- );
733
- });
734
- }) : g.value.forEach((e) => {
735
- e.localYLabels.slice(i.value.start, i.value.end).forEach((o) => {
736
- F(
737
- f.value,
738
- [
739
- { x: l.value.left, y: o.y },
740
- { x: l.value.right, y: o.y }
741
- ],
742
- {
743
- color: t.value.style.chart.grid.x.horizontalLines.color
744
- }
745
- );
746
- });
747
- })), t.value.style.chart.grid.zeroLine.show && g.value.forEach((e) => {
748
- F(
749
- f.value,
750
- [
751
- { x: l.value.left, y: e.localZero },
752
- { x: l.value.right, y: e.localZero }
753
- ],
754
- {
755
- color: t.value.style.chart.grid.zeroLine.color,
756
- lineDash: t.value.style.chart.grid.zeroLine.dashed ? [10, 10] : [0, 0]
757
- }
758
- );
759
- }), t.value.style.chart.grid.y.axisLabels.show && g.value.forEach((e) => {
760
- F(
761
- f.value,
762
- [
763
- { x: l.value.left, y: l.value.bottom - e.yOffset },
764
- { x: l.value.left, y: l.value.bottom - e.yOffset - e.individualHeight }
765
- ],
766
- {
767
- color: e.color
768
- }
769
- ), F(
770
- f.value,
771
- [
772
- { x: l.value.right, y: l.value.bottom - e.yOffset },
773
- { x: l.value.right, y: l.value.bottom - e.yOffset - e.individualHeight }
774
- ],
775
- {
776
- color: e.color
777
- }
778
- );
779
- }), g.value.forEach((e) => {
780
- ne(
781
- f.value,
782
- e.name,
783
- p.value / 35,
784
- l.value.bottom - e.yOffset - e.individualHeight / 2,
785
- {
786
- align: "center",
787
- rotation: -90,
788
- color: e.color,
789
- font: `${Math.round(p.value / 40 * t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`
790
- }
791
- );
792
- });
793
- else {
794
- if (t.value.style.chart.grid.y.verticalLines.show && i.value.end - i.value.start < t.value.style.chart.grid.y.verticalLines.hideUnderXLength)
795
- for (let e = 0; e < i.value.end - i.value.start + 1; e += 1)
796
- F(
797
- f.value,
798
- [
799
- { x: l.value.left + l.value.slot * e, y: l.value.top },
800
- { x: l.value.left + l.value.slot * e, y: l.value.bottom }
801
- ],
802
- {
803
- color: t.value.style.chart.grid.y.verticalLines.color
804
- }
805
- );
806
- else if (t.value.style.chart.grid.y.verticalLines.show && i.value.end - i.value.start >= t.value.style.chart.grid.y.verticalLines.hideUnderXLength)
807
- for (let e = i.value.start; e < i.value.end; e += 1)
808
- e % Math.floor((i.value.end - i.value.start) / t.value.style.chart.grid.y.timeLabels.modulo) === 0 && F(
809
- f.value,
810
- [
811
- { x: l.value.left + l.value.slot * (e - i.value.start) + l.value.slot / 2, y: l.value.top },
812
- { x: l.value.left + l.value.slot * (e - i.value.start) + l.value.slot / 2, y: l.value.bottom }
813
- ],
814
- {
815
- color: t.value.style.chart.grid.y.verticalLines.color
816
- }
817
- );
818
- t.value.style.chart.grid.x.horizontalLines.show && (t.value.style.chart.grid.x.horizontalLines.alternate ? y.value.yLabels.forEach((e, o) => {
819
- o < y.value.yLabels.length - 1 && at(
820
- f.value,
821
- [
822
- { x: l.value.left, y: e.y },
823
- { x: l.value.right, y: e.y },
824
- { x: l.value.right, y: y.value.yLabels[o + 1].y },
825
- { x: l.value.left, y: y.value.yLabels[o + 1].y }
826
- ],
827
- {
828
- fillColor: o % 2 === 0 ? "transparent" : Re(t.value.style.chart.grid.x.horizontalLines.color, t.value.style.chart.grid.x.horizontalLines.opacity),
829
- strokeColor: "transparent"
830
- }
831
- );
832
- }) : y.value.yLabels.forEach((e) => {
833
- F(
834
- f.value,
835
- [
836
- { x: l.value.left, y: e.y },
837
- { x: l.value.right, y: e.y }
838
- ],
839
- {
840
- color: t.value.style.chart.grid.x.horizontalLines.color
841
- }
842
- );
843
- })), t.value.style.chart.grid.y.showAxis && F(
844
- f.value,
845
- [
846
- { x: l.value.left, y: l.value.top },
847
- { x: l.value.left, y: l.value.bottom }
848
- ],
849
- {
850
- color: t.value.style.chart.grid.y.axisColor,
851
- lineWidth: t.value.style.chart.grid.y.axisThickness
852
- }
853
- ), t.value.style.chart.grid.x.showAxis && F(
854
- f.value,
855
- [
856
- { x: l.value.left, y: l.value.bottom },
857
- { x: l.value.right, y: l.value.bottom }
858
- ],
859
- {
860
- color: t.value.style.chart.grid.x.axisColor,
861
- lineWidth: t.value.style.chart.grid.x.axisThickness
862
- }
863
- ), t.value.style.chart.grid.zeroLine.show && F(
864
- f.value,
865
- [
866
- { x: l.value.left, y: y.value.zero },
867
- { x: l.value.right, y: y.value.zero }
868
- ],
869
- {
870
- color: t.value.style.chart.grid.zeroLine.color,
871
- lineDash: t.value.style.chart.grid.zeroLine.dashed ? [10, 10] : [0, 0]
872
- }
873
- );
874
- }
875
- t.value.style.chart.grid.y.axisName && ne(
876
- f.value,
877
- t.value.style.chart.grid.y.axisName,
878
- p.value - p.value / 40 * t.value.style.chart.grid.y.axisLabels.fontSizeRatio * 1.2,
879
- l.value.bottom - l.value.height / 2,
880
- {
881
- font: `${t.value.style.chart.grid.y.axisLabels.bold ? "bold " : ""}${Math.round(p.value / 40 * t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,
882
- color: t.value.style.chart.color,
883
- align: "center",
884
- rotation: 90
885
- }
886
- ), t.value.style.chart.grid.x.axisName && ne(
887
- f.value,
888
- t.value.style.chart.grid.x.axisName,
889
- p.value / 2,
890
- L.value,
891
- {
892
- font: `${t.value.style.chart.grid.y.axisLabels.bold ? "bold " : ""}${Math.round(p.value / 40 * t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,
893
- color: t.value.style.chart.color,
894
- align: "center"
895
- }
896
- );
897
- }
898
- function Et(e) {
899
- for (let o = 0; o < e.coordinatesLine.length; o += 1) {
900
- const u = (d.value === o ? p.value / 150 : t.value.style.chart.line.plots.show ? p.value / 200 : 0) * t.value.style.chart.line.plots.radiusRatio;
901
- Lt(
902
- f.value,
903
- { x: e.coordinatesLine[o].x, y: e.coordinatesLine[o].y },
904
- u,
905
- {
906
- color: t.value.style.chart.backgroundColor,
907
- fillStyle: e.color
908
- }
909
- );
910
- }
911
- }
912
- function Pt() {
913
- g.value.forEach((e) => {
914
- e.showYMarker && Ee(e) && ne(
915
- f.value,
916
- Le(
917
- t.value.style.chart.dataLabels.formatter,
918
- Ee(e).value,
919
- be({
920
- p: e.prefix || t.value.style.chart.grid.y.axisLabels.prefix || "",
921
- v: Ee(e).value,
922
- s: e.suffix || t.value.style.chart.grid.y.axisLabels.suffix || "",
923
- r: e.rounding || t.value.style.chart.grid.y.axisLabels.rounding || 0
924
- }),
925
- { datapoint: Ee(e), seriesIndex: null }
926
- ),
927
- l.value.left - 8 + t.value.style.chart.grid.y.axisLabels.offsetX,
928
- Ee(e).y,
929
- {
930
- align: "right",
931
- font: `${t.value.style.chart.grid.y.axisLabels.bold ? "bold " : ""}${Math.round(p.value / 40 * t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,
932
- color: e.color
933
- }
934
- );
935
- });
936
- }
937
- function Ft() {
938
- t.value.style.chart.grid.y.axisLabels.show && (a.value.stacked ? g.value.forEach((e) => {
939
- e.localYLabels.forEach((o, u) => {
940
- ne(
941
- f.value,
942
- Le(
943
- t.value.style.chart.dataLabels.formatter,
944
- o.value,
945
- be({
946
- p: e.prefix || t.value.style.chart.grid.y.axisLabels.prefix || "",
947
- v: o.value,
948
- s: e.suffix || t.value.style.chart.grid.y.axisLabels.suffix || "",
949
- r: e.rounding || t.value.style.chart.grid.y.axisLabels.rounding || 0
950
- }),
951
- { datapoint: o, seriesIndex: u }
952
- ),
953
- o.x + t.value.style.chart.grid.y.axisLabels.offsetX,
954
- o.y,
955
- {
956
- align: "right",
957
- font: `${t.value.style.chart.grid.y.axisLabels.bold ? "bold " : ""}${Math.round(p.value / 40 * t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,
958
- color: e.color,
959
- globalAlpha: e.showYMarker && ![null, void 0].includes(d.value) ? 0.2 : 1
960
- }
961
- );
962
- });
963
- }) : y.value.yLabels.forEach((e, o) => {
964
- ne(
965
- f.value,
966
- Le(
967
- t.value.style.chart.dataLabels.formatter,
968
- e.value,
969
- be({
970
- p: t.value.style.chart.grid.y.axisLabels.prefix || "",
971
- v: e.value,
972
- s: t.value.style.chart.grid.y.axisLabels.suffix || "",
973
- r: t.value.style.chart.grid.y.axisLabels.rounding || 0
974
- }),
975
- { datapoint: e, seriesIndex: o }
976
- ),
977
- e.x + t.value.style.chart.grid.y.axisLabels.offsetX,
978
- e.y,
979
- {
980
- align: "right",
981
- font: `${t.value.style.chart.grid.y.axisLabels.bold ? "bold " : ""}${Math.round(p.value / 40 * t.value.style.chart.grid.y.axisLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,
982
- color: t.value.style.chart.grid.y.axisLabels.color,
983
- globalAlpha: g.value.some((u) => u.showYMarker) && ![null, void 0].includes(d.value) ? 0.2 : 1
984
- }
985
- );
986
- }));
987
- }
988
- function Rt(e) {
989
- for (let o = 0; o < e.coordinatesLine.length; o += 1)
990
- ne(
991
- f.value,
992
- Le(
993
- t.value.style.chart.dataLabels.formatter,
994
- e.coordinatesLine[o].value,
995
- be({
996
- p: e.prefix || "",
997
- v: e.coordinatesLine[o].value,
998
- s: e.suffix || "",
999
- r: e.rounding || 0
1000
- }),
1001
- { datapoint: e.coordinatesLine[o], seriesIndex: o }
1002
- ),
1003
- e.coordinatesLine[o].x,
1004
- e.coordinatesLine[o].y + t.value.style.chart.dataLabels.offsetY,
1005
- {
1006
- align: "center",
1007
- font: `${t.value.style.chart.dataLabels.bold ? "bold " : ""}${Math.round(p.value / 40 * t.value.style.chart.dataLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,
1008
- color: t.value.style.chart.dataLabels.useSerieColor ? e.color : t.value.style.chart.dataLabels.color
1009
- }
1010
- );
1011
- }
1012
- function Dt() {
1013
- for (let e = i.value.start; e < i.value.end; e += 1)
1014
- (i.value.end - i.value.start < t.value.style.chart.grid.y.timeLabels.modulo || i.value.end - i.value.start >= t.value.style.chart.grid.y.timeLabels.modulo && (e % Math.floor((i.value.end - i.value.start) / t.value.style.chart.grid.y.timeLabels.modulo) === 0 || e === d.value + i.value.start && t.value.style.chart.grid.y.timeLabels.showMarker)) && ne(
1015
- f.value,
1016
- t.value.style.chart.grid.y.timeLabels.values[e] || e + 1,
1017
- l.value.left + l.value.slot * (e - i.value.start) + l.value.slot / 2,
1018
- l.value.bottom + p.value / t.value.style.chart.grid.y.timeLabels.offsetY,
1019
- {
1020
- align: t.value.style.chart.grid.y.timeLabels.rotation === 0 ? "center" : t.value.style.chart.grid.y.timeLabels.rotation > 0 ? "left" : "right",
1021
- font: `${t.value.style.chart.grid.y.timeLabels.bold ? "bold " : ""}${Math.round(p.value / 40 * t.value.style.chart.grid.y.timeLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,
1022
- color: t.value.style.chart.grid.y.timeLabels.showMarker ? Re(t.value.style.chart.grid.y.timeLabels.color, d.value !== null ? d.value + i.value.start === e ? 100 : 20 : 100) : t.value.style.chart.grid.y.timeLabels.color,
1023
- rotation: t.value.style.chart.grid.y.timeLabels.rotation
1024
- }
1025
- );
1026
- }
1027
- function ut() {
1028
- F(
1029
- f.value,
1030
- [
1031
- { x: l.value.left + l.value.slot * d.value + l.value.slot / 2, y: l.value.top },
1032
- { x: l.value.left + l.value.slot * d.value + l.value.slot / 2, y: l.value.bottom }
1033
- ],
1034
- {
1035
- color: t.value.style.chart.selector.color,
1036
- lineDash: t.value.style.chart.selector.dashed ? [8, 8] : [0, 0],
1037
- lineWidth: 2
1038
- }
1039
- );
1040
- }
1041
- function Ot() {
1042
- O.value && F(
1043
- f.value,
1044
- [
1045
- { x: l.value.left, y: O.value },
1046
- { x: l.value.right, y: O.value }
1047
- ],
1048
- {
1049
- color: t.value.style.chart.selector.color,
1050
- lineDash: t.value.style.chart.selector.dashed ? [8, 8] : [0, 0],
1051
- lineWidth: 2
1052
- }
1053
- );
1054
- }
1055
- function Nt() {
1056
- Y.value.forEach((e, o) => {
1057
- for (let u = 0; u < e.coordinatesLine.length; u += 1)
1058
- at(
1059
- f.value,
1060
- [
1061
- {
1062
- x: l.value.left + l.value.slot * u + l.value.slot / 10 + (a.value.stacked ? 0 : l.value.slot / Y.value.length * o - (o === 0 ? 0 : l.value.slot / (5 * Y.value.length) * o)),
1063
- y: a.value.stacked ? e.localZero : y.value.zero
1064
- },
1065
- {
1066
- x: l.value.left + l.value.slot * u + l.value.slot / 10 + (a.value.stacked ? 0 : l.value.slot / Y.value.length * o - (o === 0 ? 0 : l.value.slot / (5 * Y.value.length) * o)) + l.value.slot * 0.8 / (a.value.stacked ? 1 : Y.value.length),
1067
- y: a.value.stacked ? e.localZero : y.value.zero
1068
- },
1069
- {
1070
- x: l.value.left + l.value.slot * u + l.value.slot / 10 + (a.value.stacked ? 0 : l.value.slot / Y.value.length * o - (o === 0 ? 0 : l.value.slot / (5 * Y.value.length) * o)) + l.value.slot * 0.8 / (a.value.stacked ? 1 : Y.value.length),
1071
- y: e.coordinatesLine[u].y
1072
- },
1073
- {
1074
- x: l.value.left + l.value.slot * u + l.value.slot / 10 + (a.value.stacked ? 0 : l.value.slot / Y.value.length * o - (o === 0 ? 0 : l.value.slot / (5 * Y.value.length) * o)),
1075
- y: e.coordinatesLine[u].y
1076
- }
1077
- ],
1078
- {
1079
- strokeColor: t.value.style.chart.backgroundColor,
1080
- gradient: {
1081
- type: "linear",
1082
- start: {
1083
- x: e.coordinatesLine[u].x,
1084
- y: e.coordinatesLine[u].y
1085
- },
1086
- end: {
1087
- x: e.coordinatesLine[u].x,
1088
- y: a.value.stacked ? e.localZero : y.value.zero
1089
- },
1090
- stops: [
1091
- { offset: 0, color: e.color },
1092
- { offset: 1, color: t.value.style.chart.bar.gradient.show ? St(e.color, 0.5) : e.color }
1093
- ]
1094
- }
1095
- }
1096
- ), a.value.showDataLabels && [!0, void 0].includes(e.dataLabels) && ne(
1097
- f.value,
1098
- Le(
1099
- t.value.style.chart.dataLabels.formatter,
1100
- e.coordinatesLine[u].value,
1101
- be({
1102
- p: e.prefix || "",
1103
- v: e.coordinatesLine[u].value,
1104
- s: e.suffix || "",
1105
- r: e.rounding || 0
1106
- }),
1107
- { datapoint: e.coordinatesLine[u], seriesIndex: u }
1108
- ),
1109
- l.value.left + l.value.slot * u + l.value.slot / 10 + (a.value.stacked ? 0 : l.value.slot / Y.value.length * o - (o === 0 ? 0 : l.value.slot / (5 * Y.value.length) * o)) + l.value.slot * 0.4 / (a.value.stacked ? 1 : Y.value.length),
1110
- (e.coordinatesLine[u].value < 0 ? a.value.stacked ? e.localZero : y.value.zero : e.coordinatesLine[u].y) + t.value.style.chart.dataLabels.offsetY,
1111
- {
1112
- align: "center",
1113
- font: `${Math.round(p.value / 40 * t.value.style.chart.dataLabels.fontSizeRatio)}px ${t.value.style.fontFamily}`,
1114
- color: t.value.style.chart.dataLabels.useSerieColor ? e.color : t.value.style.chart.dataLabels.color,
1115
- strokeColor: t.value.style.chart.backgroundColor,
1116
- lineWidth: 0.8
1117
- }
1118
- );
1119
- });
1120
- }
1121
- function Bt(e) {
1122
- e.useArea ? a.value.stacked ? wt(
1123
- f.value,
1124
- [{ x: e.coordinatesLine[0].x, y: e.localZero }, ...e.coordinatesLine, { x: e.coordinatesLine.at(-1).x, y: e.localZero }],
1125
- {
1126
- fillColor: Re(e.color, t.value.style.chart.area.opacity),
1127
- strokeColor: "transparent"
1128
- }
1129
- ) : wt(
1130
- f.value,
1131
- [{ x: e.coordinatesLine[0].x, y: y.value.zero }, ...e.coordinatesLine, { x: e.coordinatesLine.at(-1).x, y: y.value.zero }],
1132
- {
1133
- fillColor: Re(e.color, t.value.style.chart.area.opacity),
1134
- strokeColor: "transparent"
1135
- }
1136
- ) : F(f.value, e.coordinatesLine, {
1137
- color: e.color,
1138
- lineWidth: 3
1139
- });
1140
- }
1141
- function Yt() {
1142
- g.value.forEach((e, o) => {
1143
- F(
1144
- f.value,
1145
- [
1146
- { x: l.value.left, y: l.value.bottom - e.yOffset },
1147
- { x: l.value.right, y: l.value.bottom - e.yOffset }
1148
- ],
1149
- {
1150
- color: t.value.style.chart.grid.x.horizontalLines.color,
1151
- lineWidth: 1
1152
- }
1153
- );
1154
- });
1155
- }
1156
- function Ae() {
1157
- At(), te.value ? (d.value !== null && t.value.style.chart.selector.show && ut(), Nt(), a.value.stacked && t.value.style.chart.grid.x.showAxis && Yt(), Tt.value.forEach((e) => {
1158
- (e.type === "line" || !e.type) && Bt(e), le.value && (Et(e), a.value.showDataLabels && [!0, void 0].includes(e.dataLabels) && Rt(e));
1159
- }), we.value = dl(V.value)) : (we.value && (f.value.clearRect(0, 0, 1e4, 1e4), f.value.drawImage(we.value, 0, 0)), d.value !== null && t.value.style.chart.selector.show && ut(), d.value !== null && g.value.forEach((e) => {
1160
- if (e.type === "line" || !e.type || e.type === "plot") {
1161
- if (!e.coordinatesLine[d.value]) return;
1162
- e.coordinatesLine[d.value].x !== void 0 && e.coordinatesLine[d.value].y !== void 0 && Lt(
1163
- f.value,
1164
- {
1165
- x: e.coordinatesLine[d.value].x,
1166
- y: e.coordinatesLine[d.value].y
1167
- },
1168
- p.value / 150 * t.value.style.chart.line.plots.radiusRatio,
1169
- {
1170
- color: t.value.style.chart.backgroundColor,
1171
- fillStyle: e.color
1172
- }
1173
- );
1174
- }
1175
- })), t.value.style.chart.grid.y.timeLabels.show && Dt(), t.value.style.chart.selector.show && t.value.style.chart.selector.showHorizontalSelector && Ot(), Ft(), Pt(), te.value = !1;
1176
- }
1177
- const We = il(() => {
1178
- le.value = !0, It();
1179
- }, h.value > 200 ? 10 : 1, !le.value);
1180
- function Ee(e) {
1181
- if ([null, void 0].includes(d.value) || !e.coordinatesLine[d.value]) return !1;
1182
- const { y: o, value: u } = e.coordinatesLine[d.value];
1183
- return { y: o, value: u };
1184
- }
1185
- function Xt(e) {
1186
- const { left: o, top: u } = V.value.getBoundingClientRect(), m = e.clientX - o;
1187
- if (O.value = (e.clientY - u) * 2, (O.value < l.value.top || O.value > l.value.bottom) && (O.value = null), m * 2 < l.value.left || m * 2 > l.value.right) {
1188
- ee.value = !1, d.value = null;
1189
- return;
1190
- }
1191
- const x = m * 2 - l.value.left;
1192
- if (d.value = Math.floor(x / l.value.slot), ee.value = !0, !le.value) return;
1193
- let X = "";
1194
- const b = t.value.style.chart.tooltip.customFormat;
1195
- kt(b) && sl(() => b({
1196
- seriesIndex: d.value,
1197
- datapoint: g.value.map((C) => ({
1198
- shape: C.shape || null,
1199
- name: C.name,
1200
- color: C.color,
1201
- type: C.type || "line",
1202
- value: C.series.find((he, G) => G === d.value)
1203
- })),
1204
- series: g.value,
1205
- config: t.value
1206
- })) ? j.value = b({
1207
- seriesIndex: d.value,
1208
- datapoint: g.value.map((C) => ({
1209
- shape: C.shape || null,
1210
- name: C.name,
1211
- color: C.color,
1212
- type: C.type || "line",
1213
- value: C.series.find((he, G) => G === d.value)
1214
- })),
1215
- series: g.value,
1216
- config: t.value
1217
- }) : (t.value.style.chart.grid.y.timeLabels.values.slice(i.value.start, i.value.end)[d.value] && (X += `<div style="padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid ${t.value.style.chart.tooltip.borderColor}; width:100%">${t.value.style.chart.grid.y.timeLabels.values.slice(i.value.start, i.value.end)[d.value]}</div>`), X += E.value.join(""), j.value = X), le.value = !1;
1218
- }
1219
- _(() => d.value, (e) => {
1220
- We();
1221
- }), _(() => i.value, (e) => {
1222
- te.value = !0, Ae();
1223
- }, {
1224
- deep: !0
1225
- }), _(() => a.value.showDataLabels, (e) => {
1226
- te.value = !0, Ae();
1227
- }), _(() => O.value, (e) => {
1228
- e && Ae();
1229
- }), _(() => a.value.stacked, (e) => {
1230
- te.value = !0, le.value = !0, We();
1231
- });
1232
- function Ht() {
1233
- ee.value = !1, d.value = null, j.value = "", O.value = null, Ae();
1234
- }
1235
- const Ve = c(null), Ge = c(null);
1236
- ot(() => {
1237
- et();
1238
- });
1239
- function et() {
1240
- if (ol(k.dataset) ? nl({
1241
- componentName: "VueUiXyCanvas",
1242
- type: "dataset"
1243
- }) : V.value && (f.value = V.value.getContext("2d", { willReadFrequently: !0 })), t.value.responsive) {
1244
- const e = vl(() => {
1245
- const { width: o, height: u } = cl({
1246
- chart: re.value,
1247
- title: t.value.style.chart.title.text ? Se.value : null,
1248
- legend: t.value.style.chart.legend.show ? ze.value : null,
1249
- slicer: t.value.style.chart.zoom.show && h.value > 1 ? Me.value : null,
1250
- source: Q.value
1251
- });
1252
- requestAnimationFrame(() => {
1253
- He.value = `${o} / ${u}`;
1254
- });
1255
- });
1256
- Ve.value = new ResizeObserver(e), Ve.value.observe(re.value.parentNode);
1257
- }
1258
- Ge.value = new ResizeObserver((e) => {
1259
- for (const o of e)
1260
- o.contentBoxSize && H.value && (te.value = !0, We());
1261
- }), Ge.value.observe(H.value), rt();
1262
- }
1263
- $t(() => {
1264
- Ge.value && Ge.value.disconnect(), Ve.value && Ve.value.disconnect();
1265
- });
1266
- function st(e) {
1267
- Ne("selectLegend", g.value.find((o) => o.absoluteIndex === e)), T.value.includes(e) ? T.value = T.value.filter((o) => o !== e) : T.value.push(e), te.value = !0, We();
1268
- }
1269
- const it = R(() => S.value.map((e, o) => ({
1270
- ...e,
1271
- name: e.name,
1272
- color: xt(e.color) || v.value[o] || pe[o] || pe[o % pe.length],
1273
- shape: e.shape || "circle",
1274
- prefix: e.prefix || "",
1275
- suffix: e.suffix || "",
1276
- rounding: e.rounding || 0
1277
- })).map((e) => ({
1278
- ...e,
1279
- opacity: T.value.includes(e.absoluteIndex) ? 0.5 : 1,
1280
- segregate: () => st(e.absoluteIndex),
1281
- isSegregated: T.value.includes(e.absoluteIndex)
1282
- }))), Ut = R(() => ({
1283
- cy: "donut-div-legend",
1284
- backgroundColor: t.value.style.chart.legend.backgroundColor,
1285
- color: t.value.style.chart.legend.color,
1286
- fontSize: t.value.style.chart.legend.fontSize,
1287
- paddingBottom: 12,
1288
- fontWeight: t.value.style.chart.legend.bold ? "bold" : ""
1289
- })), Ze = R(() => {
1290
- const e = [""].concat(g.value.map((x) => x.name)).concat(' <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 16v2a1 1 0 0 1 -1 1h-11l6 -7l-6 -7h11a1 1 0 0 1 1 1v2" /></svg>');
1291
- let o = [];
1292
- for (let x = 0; x < h.value; x += 1) {
1293
- const X = g.value.map((b) => b.series[x] ?? 0).reduce((b, C) => b + C, 0);
1294
- o.push([t.value.style.chart.grid.y.timeLabels.values.slice(i.value.start, i.value.end)[x] ?? x + 1].concat(g.value.map((b) => (b.series[x] ?? 0).toFixed(t.value.table.rounding))).concat((X ?? 0).toFixed(t.value.table.rounding)));
1295
- }
1296
- const u = {
1297
- th: {
1298
- backgroundColor: t.value.table.th.backgroundColor,
1299
- color: t.value.table.th.color,
1300
- outline: t.value.table.th.outline
1301
- },
1302
- td: {
1303
- backgroundColor: t.value.table.td.backgroundColor,
1304
- color: t.value.table.td.color,
1305
- outline: t.value.table.td.outline
1306
- },
1307
- breakpoint: t.value.table.responsiveBreakpoint
1308
- }, m = [t.value.table.columnNames.period].concat(g.value.map((x) => x.name)).concat(t.value.table.columnNames.total);
1309
- return { head: e, body: o.slice(0, i.value.end - i.value.start), config: u, colNames: m };
1310
- }), vt = R(() => {
1311
- if (g.value.length === 0) return { head: [], body: [], config: {}, columnNames: [] };
1312
- const e = g.value.map((u) => ({
1313
- label: u.name,
1314
- color: u.color,
1315
- type: u.type
1316
- })), o = [];
1317
- for (let u = i.value.start; u < i.value.end; u += 1) {
1318
- const m = [t.value.style.chart.grid.y.timeLabels.values[u] || u + 1];
1319
- g.value.forEach((x) => {
1320
- m.push(Number((x.series[u] || 0).toFixed(t.value.table.rounding)));
1321
- }), o.push(m);
1322
- }
1323
- return { head: e, body: o };
1324
- });
1325
- function ct() {
1326
- const e = [[t.value.style.chart.title.text], [t.value.style.chart.title.subtitle.text], [""]], o = ["", ...vt.value.head.map((X) => X.label)], u = vt.value.body, m = e.concat([o]).concat(u), x = rl(m);
1327
- ul({ csvContent: x, title: t.value.style.chart.title.text || "vue-ui-xy-canvas" });
1328
- }
1329
- function Wt() {
1330
- return g.value;
1331
- }
1332
- function dt() {
1333
- a.value.showTable = !a.value.showTable;
1334
- }
1335
- function ht() {
1336
- a.value.showDataLabels = !a.value.showDataLabels;
1337
- }
1338
- function ft() {
1339
- a.value.stacked = !a.value.stacked;
1340
- }
1341
- function yt() {
1342
- a.value.showTooltip = !a.value.showTooltip;
1343
- }
1344
- const qe = c(!1);
1345
- function tt() {
1346
- qe.value = !qe.value;
1347
- }
1348
- return _e({
1349
- getData: Wt,
1350
- generateCsv: ct,
1351
- generatePdf: s,
1352
- generateImage: n,
1353
- toggleTable: dt,
1354
- toggleLabels: ht,
1355
- toggleStack: ft,
1356
- toggleTooltip: yt,
1357
- toggleAnnotator: tt
1358
- }), (e, o) => (w(), M("div", {
1359
- style: N(`width:100%; position:relative; ${t.value.responsive ? "height: 100%" : ""}`),
1360
- ref_key: "xy",
1361
- ref: re,
1362
- id: `xy_canvas_${q.value}`,
1363
- class: ve(`vue-ui-donut ${ce.value ? "vue-data-ui-wrapper-fullscreen" : ""}`),
1364
- onMouseenter: o[5] || (o[5] = () => D(Ye)(!0)),
1365
- onMouseleave: o[6] || (o[6] = () => D(Ye)(!1))
1366
- }, [
1367
- t.value.style.chart.title.text ? (w(), M("div", {
1368
- key: 0,
1369
- ref_key: "chartTitle",
1370
- ref: Se,
1371
- style: N(`width:100%;background:${t.value.style.chart.backgroundColor};`)
1372
- }, [
1373
- (w(), ie(yl, {
1374
- key: `title_${de.value}`,
1375
- config: {
1376
- title: {
1377
- cy: "xy-canvas-title",
1378
- ...t.value.style.chart.title
1379
- },
1380
- subtitle: {
1381
- cy: "xy-canvas-subtitle",
1382
- ...t.value.style.chart.title.subtitle
1383
- }
1384
- }
1385
- }, null, 8, ["config"]))
1386
- ], 4)) : Z("", !0),
1387
- t.value.userOptions.show && U.value && (D(xe) || D(Te)) ? (w(), ie(ml, {
1388
- ref: "details",
1389
- key: `user_option_${$e.value}`,
1390
- backgroundColor: t.value.style.chart.backgroundColor,
1391
- color: t.value.style.chart.color,
1392
- isPrinting: D(Ue),
1393
- isImaging: D(Ie),
1394
- uid: q.value,
1395
- hasTooltip: t.value.userOptions.buttons.tooltip && t.value.style.chart.tooltip.show,
1396
- hasPdf: t.value.userOptions.buttons.pdf,
1397
- hasImg: t.value.userOptions.buttons.img,
1398
- hasXls: t.value.userOptions.buttons.csv,
1399
- hasLabel: t.value.userOptions.buttons.labels,
1400
- hasStack: $.dataset.length > 1 && t.value.userOptions.buttons.stack,
1401
- hasFullscreen: t.value.userOptions.buttons.fullscreen,
1402
- hasTable: i.value.end - i.value.start < 200 && t.value.userOptions.buttons.table,
1403
- isFullscreen: ce.value,
1404
- isTooltip: a.value.showTooltip,
1405
- isStacked: a.value.stacked,
1406
- titles: { ...t.value.userOptions.buttonTitles },
1407
- chartElement: re.value,
1408
- position: t.value.userOptions.position,
1409
- hasAnnotator: t.value.userOptions.buttons.annotator,
1410
- isAnnotation: qe.value,
1411
- onToggleFullscreen: r,
1412
- onGeneratePdf: D(s),
1413
- onGenerateCsv: ct,
1414
- onGenerateImage: D(n),
1415
- onToggleTable: dt,
1416
- onToggleLabels: ht,
1417
- onToggleStack: ft,
1418
- onToggleTooltip: yt,
1419
- onToggleAnnotator: tt,
1420
- style: N({
1421
- visibility: D(xe) ? D(Te) ? "visible" : "hidden" : "visible"
1422
- })
1423
- }, Zt({ _: 2 }, [
1424
- e.$slots.menuIcon ? {
1425
- name: "menuIcon",
1426
- fn: A(({ isOpen: u, color: m }) => [
1427
- P(e.$slots, "menuIcon", ye(ge({ isOpen: u, color: m })), void 0, !0)
1428
- ]),
1429
- key: "0"
1430
- } : void 0,
1431
- e.$slots.optionTooltip ? {
1432
- name: "optionTooltip",
1433
- fn: A(() => [
1434
- P(e.$slots, "optionTooltip", {}, void 0, !0)
1435
- ]),
1436
- key: "1"
1437
- } : void 0,
1438
- e.$slots.optionPdf ? {
1439
- name: "optionPdf",
1440
- fn: A(() => [
1441
- P(e.$slots, "optionPdf", {}, void 0, !0)
1442
- ]),
1443
- key: "2"
1444
- } : void 0,
1445
- e.$slots.optionCsv ? {
1446
- name: "optionCsv",
1447
- fn: A(() => [
1448
- P(e.$slots, "optionCsv", {}, void 0, !0)
1449
- ]),
1450
- key: "3"
1451
- } : void 0,
1452
- e.$slots.optionImg ? {
1453
- name: "optionImg",
1454
- fn: A(() => [
1455
- P(e.$slots, "optionImg", {}, void 0, !0)
1456
- ]),
1457
- key: "4"
1458
- } : void 0,
1459
- e.$slots.optionTable ? {
1460
- name: "optionTable",
1461
- fn: A(() => [
1462
- P(e.$slots, "optionTable", {}, void 0, !0)
1463
- ]),
1464
- key: "5"
1465
- } : void 0,
1466
- e.$slots.optionLabels ? {
1467
- name: "optionLabels",
1468
- fn: A(() => [
1469
- P(e.$slots, "optionLabels", {}, void 0, !0)
1470
- ]),
1471
- key: "6"
1472
- } : void 0,
1473
- e.$slots.optionStack ? {
1474
- name: "optionStack",
1475
- fn: A(() => [
1476
- P(e.$slots, "optionStack", {}, void 0, !0)
1477
- ]),
1478
- key: "7"
1479
- } : void 0,
1480
- e.$slots.optionFullscreen ? {
1481
- name: "optionFullscreen",
1482
- fn: A(({ toggleFullscreen: u, isFullscreen: m }) => [
1483
- P(e.$slots, "optionFullscreen", ye(ge({ toggleFullscreen: u, isFullscreen: m })), void 0, !0)
1484
- ]),
1485
- key: "8"
1486
- } : void 0,
1487
- e.$slots.optionAnnotator ? {
1488
- name: "optionAnnotator",
1489
- fn: A(({ toggleAnnotator: u, isAnnotator: m }) => [
1490
- P(e.$slots, "optionAnnotator", ye(ge({ toggleAnnotator: u, isAnnotator: m })), void 0, !0)
1491
- ]),
1492
- key: "9"
1493
- } : void 0
1494
- ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasTooltip", "hasPdf", "hasImg", "hasXls", "hasLabel", "hasStack", "hasFullscreen", "hasTable", "isFullscreen", "isTooltip", "isStacked", "titles", "chartElement", "position", "hasAnnotator", "isAnnotation", "onGeneratePdf", "onGenerateImage", "style"])) : Z("", !0),
1495
- W("div", {
1496
- class: "vue-ui-xy-canvas",
1497
- style: N(`position: relative; aspect-ratio: ${He.value}`),
1498
- ref_key: "container",
1499
- ref: H
1500
- }, [
1501
- U.value ? (w(), M("canvas", {
1502
- key: 0,
1503
- ref_key: "canvas",
1504
- ref: V,
1505
- style: { width: "100%", height: "100%" },
1506
- onMousemove: o[0] || (o[0] = (u) => Xt(u)),
1507
- onMouseleave: Ht
1508
- }, null, 544)) : (w(), ie(kl, {
1509
- key: 1,
1510
- config: {
1511
- type: "line",
1512
- style: {
1513
- backgroundColor: t.value.style.chart.backgroundColor,
1514
- line: {
1515
- axis: {
1516
- color: "#CCCCCC"
1517
- },
1518
- path: {
1519
- color: "#CCCCCC",
1520
- strokeWidth: 0.5
1521
- }
1522
- }
1523
- }
1524
- }
1525
- }, null, 8, ["config"])),
1526
- me(hl, {
1527
- show: a.value.showTooltip && ee.value,
1528
- backgroundColor: t.value.style.chart.tooltip.backgroundColor,
1529
- color: t.value.style.chart.tooltip.color,
1530
- fontSize: t.value.style.chart.tooltip.fontSize,
1531
- borderRadius: t.value.style.chart.tooltip.borderRadius,
1532
- borderColor: t.value.style.chart.tooltip.borderColor,
1533
- borderWidth: t.value.style.chart.tooltip.borderWidth,
1534
- position: t.value.style.chart.tooltip.position,
1535
- offsetY: t.value.style.chart.tooltip.offsetY,
1536
- parent: D(V),
1537
- content: j.value,
1538
- isFullscreen: ce.value,
1539
- backgroundOpacity: t.value.style.chart.tooltip.backgroundOpacity,
1540
- isCustom: D(kt)(t.value.style.chart.tooltip.customFormat)
1541
- }, {
1542
- "tooltip-before": A(() => [
1543
- P(e.$slots, "tooltip-before", ye(ge({ ...K.value })), void 0, !0)
1544
- ]),
1545
- "tooltip-after": A(() => [
1546
- P(e.$slots, "tooltip-after", ye(ge({ ...K.value })), void 0, !0)
1547
- ]),
1548
- _: 3
1549
- }, 8, ["show", "backgroundColor", "color", "fontSize", "borderRadius", "borderColor", "borderWidth", "position", "offsetY", "parent", "content", "isFullscreen", "backgroundOpacity", "isCustom"])
1550
- ], 4),
1551
- W("div", {
1552
- ref_key: "chartSlicer",
1553
- ref: Me,
1554
- style: N(`width:100%;background:${t.value.style.chart.backgroundColor}`),
1555
- "data-dom-to-png-ignore": ""
1556
- }, [
1557
- t.value.style.chart.zoom.show && h.value > 1 ? (w(), ie(gl, {
1558
- ref_key: "slicerComponent",
1559
- ref: ke,
1560
- key: `slicer_${Ce.value}`,
1561
- background: t.value.style.chart.zoom.color,
1562
- borderColor: t.value.style.chart.backgroundColor,
1563
- fontSize: t.value.style.chart.zoom.fontSize,
1564
- useResetSlot: t.value.style.chart.zoom.useResetSlot,
1565
- labelLeft: t.value.style.chart.grid.y.timeLabels.values[i.value.start] ? t.value.style.chart.grid.y.timeLabels.values[i.value.start] : "",
1566
- labelRight: t.value.style.chart.grid.y.timeLabels.values[i.value.end - 1] ? t.value.style.chart.grid.y.timeLabels.values[i.value.end - 1] : "",
1567
- textColor: t.value.style.chart.color,
1568
- inputColor: t.value.style.chart.zoom.color,
1569
- selectColor: t.value.style.chart.zoom.highlightColor,
1570
- max: h.value,
1571
- min: 0,
1572
- valueStart: i.value.start,
1573
- valueEnd: i.value.end,
1574
- start: i.value.start,
1575
- "onUpdate:start": o[1] || (o[1] = (u) => i.value.start = u),
1576
- end: i.value.end,
1577
- "onUpdate:end": o[2] || (o[2] = (u) => i.value.end = u),
1578
- refreshStartPoint: t.value.style.chart.zoom.startIndex !== null ? t.value.style.chart.zoom.startIndex : 0,
1579
- refreshEndPoint: t.value.style.chart.zoom.endIndex !== null ? t.value.style.chart.zoom.endIndex + 1 : h.value,
1580
- enableRangeHandles: t.value.style.chart.zoom.enableRangeHandles,
1581
- enableSelectionDrag: t.value.style.chart.zoom.enableSelectionDrag,
1582
- onReset: nt
1583
- }, {
1584
- "reset-action": A(({ reset: u }) => [
1585
- P(e.$slots, "reset-action", ye(ge({ reset: u })), void 0, !0)
1586
- ]),
1587
- _: 3
1588
- }, 8, ["background", "borderColor", "fontSize", "useResetSlot", "labelLeft", "labelRight", "textColor", "inputColor", "selectColor", "max", "valueStart", "valueEnd", "start", "end", "refreshStartPoint", "refreshEndPoint", "enableRangeHandles", "enableSelectionDrag"])) : Z("", !0)
1589
- ], 4),
1590
- W("div", {
1591
- ref_key: "chartLegend",
1592
- ref: ze
1593
- }, [
1594
- t.value.style.chart.legend.show && U.value ? (w(), ie(fl, {
1595
- legendSet: it.value,
1596
- config: Ut.value,
1597
- key: `legend_${ae.value}`,
1598
- onClickMarker: o[3] || (o[3] = ({ i: u }) => st(u))
1599
- }, {
1600
- item: A(({ legend: u, index: m }) => [
1601
- W("div", {
1602
- onClick: (x) => u.segregate(),
1603
- style: N(`opacity:${T.value.includes(m) ? 0.5 : 1}`)
1604
- }, Qe(u.name), 13, Dl)
1605
- ]),
1606
- _: 1
1607
- }, 8, ["legendSet", "config"])) : P(e.$slots, "legend", {
1608
- key: 1,
1609
- legend: it.value
1610
- }, void 0, !0)
1611
- ], 512),
1612
- e.$slots.watermark ? (w(), M("div", Ol, [
1613
- P(e.$slots, "watermark", ye(ge({ isPrinting: D(Ue) || D(Ie) })), void 0, !0)
1614
- ])) : Z("", !0),
1615
- e.$slots.source ? (w(), M("div", {
1616
- key: 3,
1617
- ref_key: "source",
1618
- ref: Q,
1619
- dir: "auto"
1620
- }, [
1621
- P(e.$slots, "source", {}, void 0, !0)
1622
- ], 512)) : Z("", !0),
1623
- i.value.end - i.value.start < 200 ? (w(), ie(bl, {
1624
- key: 4,
1625
- hideDetails: "",
1626
- config: {
1627
- open: a.value.showTable,
1628
- maxHeight: 1e4,
1629
- body: {
1630
- backgroundColor: t.value.style.chart.backgroundColor,
1631
- color: t.value.style.chart.color
1632
- },
1633
- head: {
1634
- backgroundColor: t.value.style.chart.backgroundColor,
1635
- color: t.value.style.chart.color
1636
- }
1637
- }
1638
- }, {
1639
- content: A(() => [
1640
- (w(), ie(xl, {
1641
- key: `table_${ue.value}`,
1642
- colNames: Ze.value.colNames,
1643
- head: Ze.value.head,
1644
- body: Ze.value.body,
1645
- config: Ze.value.config,
1646
- title: `${t.value.style.chart.title.text}${t.value.style.chart.title.subtitle.text ? ` : ${t.value.style.chart.title.subtitle.text}` : ""}`,
1647
- onClose: o[4] || (o[4] = (u) => a.value.showTable = !1)
1648
- }, {
1649
- th: A(({ th: u }) => [
1650
- W("div", { innerHTML: u }, null, 8, Nl)
1651
- ]),
1652
- td: A(({ td: u }) => [
1653
- qt(Qe(u), 1)
1654
- ]),
1655
- _: 1
1656
- }, 8, ["colNames", "head", "body", "config", "title"]))
1657
- ]),
1658
- _: 1
1659
- }, 8, ["config"])) : Z("", !0),
1660
- t.value.userOptions.buttons.annotator && g.value.length ? (w(), ie(Fl, {
1661
- key: 5,
1662
- parent: re.value,
1663
- backgroundColor: t.value.style.chart.backgroundColor,
1664
- color: t.value.style.chart.color,
1665
- active: qe.value,
1666
- onClose: tt
1667
- }, null, 8, ["parent", "backgroundColor", "color", "active"])) : Z("", !0)
1668
- ], 46, Rl));
1669
- }
1670
- }, aa = /* @__PURE__ */ zt(Bl, [["__scopeId", "data-v-b8851cb8"]]);
1671
- export {
1672
- aa as default
1673
- };