vue-data-ui 2.4.60 → 2.4.62
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/dist/{Arrow-BoAS4IQq.cjs → Arrow-C0lmBG2-.cjs} +1 -1
- package/dist/{Arrow-BLYi22nR.js → Arrow-E7FjAwN-.js} +1 -1
- package/dist/{BaseIcon-BHIQREMO.cjs → BaseIcon-DK3C9OCq.cjs} +1 -1
- package/dist/{BaseIcon-EWtqg17H.js → BaseIcon-DRLxlrSt.js} +1 -1
- package/dist/{DataTable-DO8KGCcE.js → DataTable-BANy6PnS.js} +2 -2
- package/dist/{DataTable-Dtq94CxH.cjs → DataTable-BLSMgcEN.cjs} +1 -1
- package/dist/{Legend-CMyzYtIb.cjs → Legend-CAgxjrra.cjs} +1 -1
- package/dist/{Legend-DGWOCyLt.js → Legend-pWq2tKCl.js} +1 -1
- package/dist/{PackageVersion-BSLNI6kk.js → PackageVersion-1NslmM8M.js} +1 -1
- package/dist/{PackageVersion-B_1OHk5A.cjs → PackageVersion-D3dK8oA3.cjs} +1 -1
- package/dist/{PenAndPaper-DhXsAnuf.cjs → PenAndPaper-CYFIR9j7.cjs} +1 -1
- package/dist/{PenAndPaper-CxMtGtJt.js → PenAndPaper-CdXSbSZY.js} +3 -3
- package/dist/{Shape-DnqZey62.js → Shape-BtKtwV0v.js} +1 -1
- package/dist/{Shape-y66NSXKp.cjs → Shape-DPztPWor.cjs} +1 -1
- package/dist/{Slicer-CkI4c7ft.cjs → Slicer-BggxvZRw.cjs} +1 -1
- package/dist/{Slicer-D9bKLcPd.js → Slicer-p4IqkHkJ.js} +2 -2
- package/dist/{Title-DjAOcuWO.cjs → Title-BhL7TMa_.cjs} +1 -1
- package/dist/{Title-CSqO5Y62.js → Title-DPefeOY7.js} +1 -1
- package/dist/{Tooltip-AHTiRuWB.cjs → Tooltip-C5qSWrXO.cjs} +1 -1
- package/dist/{Tooltip-D_6iYZSH.js → Tooltip-C72f83eg.js} +1 -1
- package/dist/{index-D7dTQAhm.js → index-B-k71vpj.js} +4 -1
- package/dist/index-CC7tVh7F.cjs +9 -0
- package/dist/style.css +1 -1
- package/dist/types/vue-data-ui.d.cts +3 -0
- package/dist/types/vue-data-ui.d.ts +3 -0
- package/dist/{useNestedProp-Dqsj7eUX.js → useNestedProp-BeXDUo1v.js} +1 -1
- package/dist/{useNestedProp-BxCE3J3Z.cjs → useNestedProp-CxwPeWts.cjs} +1 -1
- package/dist/{usePrinter-B_Ihuvge.js → usePrinter-BK-n-gRN.js} +1 -1
- package/dist/{usePrinter-sTw1FdN_.cjs → usePrinter-CMvfTteH.cjs} +1 -1
- package/dist/{vue-data-ui-BttN99Pm.cjs → vue-data-ui-CG-HnqKG.cjs} +1 -1
- package/dist/{vue-data-ui-CcmpjOfT.js → vue-data-ui-fOomZU3e.js} +60 -60
- package/dist/vue-data-ui.cjs +1 -1
- package/dist/vue-data-ui.js +1 -1
- package/dist/{vue-ui-3d-bar-TVrDBG5I.js → vue-ui-3d-bar-C95HBkYv.js} +9 -9
- package/dist/{vue-ui-3d-bar-8ewYobNj.cjs → vue-ui-3d-bar-DLrJ9TM8.cjs} +1 -1
- package/dist/{vue-ui-accordion-lCiFhb8k.js → vue-ui-accordion-DWAg7tbw.js} +3 -3
- package/dist/{vue-ui-accordion-BZH6cz4t.cjs → vue-ui-accordion-IZgkGqto.cjs} +1 -1
- package/dist/{vue-ui-age-pyramid-BqL8zDjt.cjs → vue-ui-age-pyramid-BSKXGW3a.cjs} +1 -1
- package/dist/{vue-ui-age-pyramid-rHtMf5-R.js → vue-ui-age-pyramid-BxBU5CCr.js} +10 -10
- package/dist/{vue-ui-annotator-DHgSReIY.js → vue-ui-annotator-DupDeVZx.js} +1 -1
- package/dist/{vue-ui-annotator-fZIPfk7y.cjs → vue-ui-annotator-GSRzlJ-N.cjs} +1 -1
- package/dist/{vue-ui-bullet-48af9PqJ.cjs → vue-ui-bullet-BD0MrIvY.cjs} +1 -1
- package/dist/{vue-ui-bullet-BwhlvcvA.js → vue-ui-bullet-Dgr-mCAc.js} +8 -8
- package/dist/{vue-ui-candlestick-dMIrnPD6.js → vue-ui-candlestick-DYupl4j5.js} +11 -11
- package/dist/{vue-ui-candlestick-Ce3tBGpX.cjs → vue-ui-candlestick-DpcBRWha.cjs} +1 -1
- package/dist/{vue-ui-carousel-table-ZhjRbt5-.cjs → vue-ui-carousel-table-CNS6ZzTc.cjs} +1 -1
- package/dist/{vue-ui-carousel-table-EcwgqGoI.js → vue-ui-carousel-table-DNwWV8de.js} +4 -4
- package/dist/{vue-ui-chestnut-VbrVVUon.cjs → vue-ui-chestnut-AVSIntNp.cjs} +1 -1
- package/dist/{vue-ui-chestnut-vnOyc43k.js → vue-ui-chestnut-OaTraMv4.js} +8 -8
- package/dist/{vue-ui-cursor-BdXcdH2e.cjs → vue-ui-cursor-CJJ78nNY.cjs} +1 -1
- package/dist/{vue-ui-cursor-nMbvzf_R.js → vue-ui-cursor-Dlo68AuK.js} +2 -2
- package/dist/{vue-ui-dashboard-BtaQn50h.js → vue-ui-dashboard-CzF8PeC6.js} +2 -2
- package/dist/{vue-ui-dashboard-CboN2WC8.cjs → vue-ui-dashboard-fYhjRzSY.cjs} +1 -1
- package/dist/{vue-ui-digits-CVfceh4-.js → vue-ui-digits-BHkW0Bi1.js} +2 -2
- package/dist/{vue-ui-digits-CUvrlpPz.cjs → vue-ui-digits-BSE3CEuv.cjs} +1 -1
- package/dist/{vue-ui-donut-CgYNthls.js → vue-ui-donut-CeestESD.js} +11 -11
- package/dist/{vue-ui-donut-BckYXDZJ.cjs → vue-ui-donut-DxH9EkK_.cjs} +1 -1
- package/dist/{vue-ui-donut-evolution-BhlBp6R-.cjs → vue-ui-donut-evolution-BDwV-Ncf.cjs} +1 -1
- package/dist/{vue-ui-donut-evolution-Bose25D6.js → vue-ui-donut-evolution-DGl_J0JB.js} +11 -11
- package/dist/{vue-ui-dumbbell-C2iT17s8.cjs → vue-ui-dumbbell-ChipHJ9p.cjs} +1 -1
- package/dist/{vue-ui-dumbbell-CzSlukSu.js → vue-ui-dumbbell-DlELQHtq.js} +10 -10
- package/dist/{vue-ui-flow-DoDWK84L.js → vue-ui-flow-BZIiidbF.js} +9 -9
- package/dist/{vue-ui-flow-DDlFrtkk.cjs → vue-ui-flow-BowAWyMA.cjs} +1 -1
- package/dist/{vue-ui-funnel-CM_ixf98.js → vue-ui-funnel-Bc7BrgHa.js} +9 -9
- package/dist/{vue-ui-funnel-BfJoFIfh.cjs → vue-ui-funnel-DLzHnLhb.cjs} +1 -1
- package/dist/{vue-ui-galaxy-CP71UAF5.cjs → vue-ui-galaxy-DesiP-Ev.cjs} +1 -1
- package/dist/{vue-ui-galaxy-DlwjTJCx.js → vue-ui-galaxy-t5R2Vz1t.js} +11 -11
- package/dist/{vue-ui-gauge-ByfGCK6z.js → vue-ui-gauge-CYx4jt71.js} +7 -7
- package/dist/{vue-ui-gauge-LqhfOqH-.cjs → vue-ui-gauge-_-1DxTe0.cjs} +1 -1
- package/dist/{vue-ui-gizmo-D8Rq5vzL.js → vue-ui-gizmo-DVcY_OyD.js} +3 -3
- package/dist/{vue-ui-gizmo-DFnOaVHf.cjs → vue-ui-gizmo-DeO_vFhP.cjs} +1 -1
- package/dist/{vue-ui-heatmap-A8qDlc58.cjs → vue-ui-heatmap-CWqJiKrJ.cjs} +1 -1
- package/dist/{vue-ui-heatmap-BLjVXXW4.js → vue-ui-heatmap-wLcx9ex3.js} +10 -10
- package/dist/{vue-ui-history-plot-DXoNlRFZ.js → vue-ui-history-plot-D7VjQwLk.js} +11 -11
- package/dist/{vue-ui-history-plot-Bxi5QRP8.cjs → vue-ui-history-plot-FJnUgshF.cjs} +1 -1
- package/dist/{vue-ui-kpi-Bbot_WSI.js → vue-ui-kpi-C4tl3luu.js} +3 -3
- package/dist/{vue-ui-kpi-5cGZ0OBJ.cjs → vue-ui-kpi-DcGp2H4d.cjs} +1 -1
- package/dist/{vue-ui-mini-loader-DWX9tRhG.cjs → vue-ui-mini-loader-B41vyg7t.cjs} +1 -1
- package/dist/{vue-ui-mini-loader-DOE9WO73.js → vue-ui-mini-loader-DZ-Rxr07.js} +2 -2
- package/dist/{vue-ui-molecule-0TReXB2j.js → vue-ui-molecule-51NSY4Z8.js} +11 -11
- package/dist/{vue-ui-molecule-CxeFzXS5.cjs → vue-ui-molecule-CUiAEOC9.cjs} +1 -1
- package/dist/{vue-ui-mood-radar-BMFn685U.js → vue-ui-mood-radar-DG3MA8BZ.js} +11 -11
- package/dist/{vue-ui-mood-radar-1jLzXLXZ.cjs → vue-ui-mood-radar-DkXzwU8x.cjs} +1 -1
- package/dist/{vue-ui-nested-donuts-B9rWg9V8.js → vue-ui-nested-donuts-Be9FYX8F.js} +11 -11
- package/dist/{vue-ui-nested-donuts-4FVj04vI.cjs → vue-ui-nested-donuts-Cerc7ILW.cjs} +1 -1
- package/dist/{vue-ui-onion-CnIF_tv7.js → vue-ui-onion-BhNd2hbK.js} +11 -11
- package/dist/{vue-ui-onion-Br97OxbL.cjs → vue-ui-onion-BpIopgzq.cjs} +1 -1
- package/dist/{vue-ui-parallel-coordinate-plot-D9iHCwiA.js → vue-ui-parallel-coordinate-plot-CSll-Vtd.js} +12 -12
- package/dist/{vue-ui-parallel-coordinate-plot-Bi_h0H7e.cjs → vue-ui-parallel-coordinate-plot-D1z9zPyF.cjs} +1 -1
- package/dist/{vue-ui-quadrant-DHDToQ9a.cjs → vue-ui-quadrant-303aQCVj.cjs} +1 -1
- package/dist/{vue-ui-quadrant-4wjbqumK.js → vue-ui-quadrant-mw0cCB8b.js} +12 -12
- package/dist/{vue-ui-quick-chart-s6FHOZf8.js → vue-ui-quick-chart-6sXw4LvX.js} +9 -9
- package/dist/{vue-ui-quick-chart-CJKM6r9X.cjs → vue-ui-quick-chart-DJfdl_Oc.cjs} +1 -1
- package/dist/{vue-ui-radar-DBR2qBM5.cjs → vue-ui-radar-B5c80iuj.cjs} +1 -1
- package/dist/{vue-ui-radar-DpT9w1N-.js → vue-ui-radar-DT2PXZ3W.js} +12 -12
- package/dist/{vue-ui-rating-D1Mbw1G8.cjs → vue-ui-rating-RKyIWluu.cjs} +1 -1
- package/dist/{vue-ui-rating-D31vSe7a.js → vue-ui-rating-x4INc3T_.js} +2 -2
- package/dist/{vue-ui-relation-circle-DfP6BpVn.js → vue-ui-relation-circle-OTUjuy7-.js} +7 -7
- package/dist/{vue-ui-relation-circle-BNJbqK_A.cjs → vue-ui-relation-circle-T_cM-vkm.cjs} +1 -1
- package/dist/{vue-ui-rings-ChcGuwL9.js → vue-ui-rings-B1c_TNA0.js} +11 -11
- package/dist/{vue-ui-rings-CjB8a3kO.cjs → vue-ui-rings-CEdur365.cjs} +1 -1
- package/dist/{vue-ui-scatter-jk0N3EwD.cjs → vue-ui-scatter-BM6iF4yl.cjs} +1 -1
- package/dist/{vue-ui-scatter-wUZ2CBpp.js → vue-ui-scatter-CjI7xkJm.js} +12 -12
- package/dist/{vue-ui-screenshot-Blg3Suvg.js → vue-ui-screenshot-DoMe-dMI.js} +1 -1
- package/dist/{vue-ui-screenshot-DAFpjSWg.cjs → vue-ui-screenshot-wadHKtkZ.cjs} +1 -1
- package/dist/{vue-ui-skeleton-m4l9jfqA.cjs → vue-ui-skeleton-BgEjqaz9.cjs} +1 -1
- package/dist/{vue-ui-skeleton-BObG0eVD.js → vue-ui-skeleton-DSXzxNMC.js} +3 -3
- package/dist/{vue-ui-smiley-rh3J3TRY.cjs → vue-ui-smiley-D5KYgUQi.cjs} +1 -1
- package/dist/{vue-ui-smiley-DuQ3M02e.js → vue-ui-smiley-DgfHBeGm.js} +2 -2
- package/dist/{vue-ui-spark-trend-SMpnQ3VV.js → vue-ui-spark-trend-CEU0TB9l.js} +5 -5
- package/dist/{vue-ui-spark-trend-DlNNTu2c.cjs → vue-ui-spark-trend-DhPXSFpU.cjs} +1 -1
- package/dist/{vue-ui-sparkbar-chnu8aw9.cjs → vue-ui-sparkbar-8vDQ9r97.cjs} +1 -1
- package/dist/{vue-ui-sparkbar-BB6fvRXK.js → vue-ui-sparkbar-C8TB_YCv.js} +4 -4
- package/dist/{vue-ui-sparkgauge-Bk_78-YB.js → vue-ui-sparkgauge-DCXX3ZDS.js} +4 -4
- package/dist/{vue-ui-sparkgauge-FONvy7z9.cjs → vue-ui-sparkgauge-DnYyNQQn.cjs} +1 -1
- package/dist/{vue-ui-sparkhistogram--uyRru2f.cjs → vue-ui-sparkhistogram-BQGAFZWZ.cjs} +1 -1
- package/dist/{vue-ui-sparkhistogram-CIsN7kQ2.js → vue-ui-sparkhistogram-CEmGA3kW.js} +5 -5
- package/dist/vue-ui-sparkline-BXvaVl-R.js +423 -0
- package/dist/vue-ui-sparkline-HQaxAzTw.cjs +1 -0
- package/dist/{vue-ui-sparkstackbar-DDMsCq0l.js → vue-ui-sparkstackbar-CI0uvrlh.js} +5 -5
- package/dist/{vue-ui-sparkstackbar-1RvV2xwt.cjs → vue-ui-sparkstackbar-DbtbyF5W.cjs} +1 -1
- package/dist/{vue-ui-stackbar-CQgtC1I4.cjs → vue-ui-stackbar-CYJLXaU0.cjs} +1 -1
- package/dist/{vue-ui-stackbar-BSo9t-88.js → vue-ui-stackbar-D-_Fp5r4.js} +12 -12
- package/dist/{vue-ui-strip-plot-BOSoKxsk.cjs → vue-ui-strip-plot-DUBjl9cR.cjs} +1 -1
- package/dist/{vue-ui-strip-plot-C99LsMeZ.js → vue-ui-strip-plot-pJsObuy6.js} +11 -11
- package/dist/{vue-ui-table-M-6G46br.cjs → vue-ui-table-CbvpwN05.cjs} +1 -1
- package/dist/{vue-ui-table-heatmap-BuYlqsq9.js → vue-ui-table-heatmap-BAlngE3L.js} +4 -4
- package/dist/{vue-ui-table-heatmap-CoozQ9bU.cjs → vue-ui-table-heatmap-sAuA3lIc.cjs} +1 -1
- package/dist/{vue-ui-table-3M-aoEc7.js → vue-ui-table-s7IHsGac.js} +1 -1
- package/dist/{vue-ui-table-sparkline-u0a2YCwp.cjs → vue-ui-table-sparkline-CjaF-Zjq.cjs} +1 -1
- package/dist/{vue-ui-table-sparkline-Dm5kErGp.js → vue-ui-table-sparkline-ClrZ-BC3.js} +5 -5
- package/dist/{vue-ui-thermometer-DrY5FsCD.js → vue-ui-thermometer-C_sqnPkS.js} +7 -7
- package/dist/{vue-ui-thermometer-DAz_NjaN.cjs → vue-ui-thermometer-fcy4HsN6.cjs} +1 -1
- package/dist/{vue-ui-timer-dCCTsApx.cjs → vue-ui-timer-B0lLVb4J.cjs} +1 -1
- package/dist/{vue-ui-timer-meFVXDUZ.js → vue-ui-timer-DeRjcfir.js} +5 -5
- package/dist/{vue-ui-tiremarks-CRKQklZh.cjs → vue-ui-tiremarks-CBnEObhg.cjs} +1 -1
- package/dist/{vue-ui-tiremarks-PaZ-lr2D.js → vue-ui-tiremarks-DCOJWvBx.js} +7 -7
- package/dist/{vue-ui-treemap-Bce1C9jk.cjs → vue-ui-treemap-SPe7NLHg.cjs} +1 -1
- package/dist/{vue-ui-treemap-RjHcVtc6.js → vue-ui-treemap-UU9kd93i.js} +11 -11
- package/dist/{vue-ui-vertical-bar-C8rC-QBl.js → vue-ui-vertical-bar-Do1beV1x.js} +11 -11
- package/dist/{vue-ui-vertical-bar-e7zR_v0M.cjs → vue-ui-vertical-bar-DtPjSOTd.cjs} +1 -1
- package/dist/{vue-ui-waffle-BT8Yn0cl.js → vue-ui-waffle-B1XP-Qon.js} +11 -11
- package/dist/{vue-ui-waffle-BZLPoVht.cjs → vue-ui-waffle-CCWlLaex.cjs} +1 -1
- package/dist/{vue-ui-wheel-CT6r7EQR.cjs → vue-ui-wheel-BHVTUvG3.cjs} +1 -1
- package/dist/{vue-ui-wheel-Bq75N1i7.js → vue-ui-wheel-D6IUmaVZ.js} +7 -7
- package/dist/{vue-ui-word-cloud-BGh6DY8P.js → vue-ui-word-cloud-AubuQjfw.js} +10 -10
- package/dist/{vue-ui-word-cloud-PcOI8TCE.cjs → vue-ui-word-cloud-BvjWoqnE.cjs} +1 -1
- package/dist/{vue-ui-xy-DuCsguVf.js → vue-ui-xy-BMJpPJeS.js} +14 -14
- package/dist/{vue-ui-xy-BmNqzUPR.cjs → vue-ui-xy-CTLJncUe.cjs} +1 -1
- package/dist/{vue-ui-xy-canvas-6qf3rgfa.js → vue-ui-xy-canvas-DHU2wBAP.js} +11 -11
- package/dist/{vue-ui-xy-canvas-BnJBE19B.cjs → vue-ui-xy-canvas-De-MHu0Y.cjs} +1 -1
- package/package.json +1 -1
- package/dist/index-CgZGelSi.cjs +0 -9
- package/dist/vue-ui-sparkline-CFvUW--O.js +0 -419
- package/dist/vue-ui-sparkline-i6LHjMJR.cjs +0 -1
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import { computed as v, ref as k, watch as U, onMounted as ne, openBlock as r, createElementBlock as i, normalizeStyle as C, renderSlot as M, normalizeProps as re, guardReactiveProps as ie, createElementVNode as f, toDisplayString as X, createCommentVNode as c, unref as h, createVNode as de, Fragment as D, renderList as P, createBlock as ve } from "vue";
|
|
2
|
+
import { u as ce, c as he, t as ye, C as Z, _ as T, o as fe, e as q, g as pe, w as I, $ as ge, a0 as me, X as ke, s as V, R as H, i as Y, f as J } from "./index-B-k71vpj.js";
|
|
3
|
+
import { u as K } from "./useNestedProp-BeXDUo1v.js";
|
|
4
|
+
import be from "./vue-ui-skeleton-DSXzxNMC.js";
|
|
5
|
+
import { t as _e, u as xe } from "./useResponsive-CoxXLe23.js";
|
|
6
|
+
import { _ as we } from "./PackageVersion-1NslmM8M.js";
|
|
7
|
+
import { _ as $e } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
8
|
+
const Le = ["id"], Ne = ["xmlns", "viewBox"], Ce = ["width", "height"], Me = ["id"], Ie = ["stop-color"], Ve = ["stop-color"], ze = ["id"], Se = ["stop-color"], We = ["stop-color"], Ae = ["id"], De = ["stop-color"], Pe = ["stop-color"], Te = { key: 1 }, Oe = ["d", "fill"], Be = ["d", "fill"], Ee = ["d", "stroke", "stroke-width"], Fe = ["x1", "x2", "y1", "y2", "stroke", "stroke-width"], Ge = ["x", "y", "width", "height", "fill", "rx"], Re = ["x1", "x2", "y1", "y2", "stroke", "stroke-width", "stroke-dasharray"], je = ["x1", "x2", "y1", "y2", "stroke", "stroke-dasharray", "stroke-width"], Ue = ["cx", "cy", "r", "fill", "stroke", "stroke-width"], Xe = ["x", "y", "font-size", "font-weight", "fill"], Ze = ["x", "y", "height", "width", "onMouseenter", "onClick"], qe = {
|
|
9
|
+
__name: "vue-ui-sparkline",
|
|
10
|
+
props: {
|
|
11
|
+
config: {
|
|
12
|
+
type: Object,
|
|
13
|
+
default() {
|
|
14
|
+
return {};
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
dataset: {
|
|
18
|
+
type: Array,
|
|
19
|
+
default() {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
showInfo: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: !0
|
|
26
|
+
},
|
|
27
|
+
selectedIndex: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default: void 0
|
|
30
|
+
},
|
|
31
|
+
heightRatio: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 1
|
|
34
|
+
},
|
|
35
|
+
forcedPadding: {
|
|
36
|
+
type: Number,
|
|
37
|
+
default: 30
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
emits: ["hoverIndex", "selectDatapoint"],
|
|
41
|
+
setup(_, { emit: z }) {
|
|
42
|
+
const s = _, { vue_ui_sparkline: Q } = ce(), $ = v(() => !!s.dataset && s.dataset.length), p = k(he()), S = k(null), O = k(null), B = k(null), e = v({
|
|
43
|
+
get: () => E(),
|
|
44
|
+
set: (t) => t
|
|
45
|
+
});
|
|
46
|
+
function E() {
|
|
47
|
+
const t = K({
|
|
48
|
+
userConfig: s.config,
|
|
49
|
+
defaultConfig: Q
|
|
50
|
+
});
|
|
51
|
+
let l = {};
|
|
52
|
+
return t.theme ? l = {
|
|
53
|
+
...K({
|
|
54
|
+
userConfig: ye.vue_ui_sparkline[t.theme] || s.config,
|
|
55
|
+
defaultConfig: t
|
|
56
|
+
})
|
|
57
|
+
} : l = t, s.config && Z(s.config, "style.scaleMin") ? l.style.scaleMin = s.config.style.scaleMin : l.style.scaleMin = null, s.config && Z(s.config, "style.scaleMax") ? l.style.scaleMax = s.config.style.scaleMax : l.style.scaleMax = null, l;
|
|
58
|
+
}
|
|
59
|
+
const L = v(() => T({
|
|
60
|
+
data: s.dataset,
|
|
61
|
+
threshold: e.value.downsample.threshold
|
|
62
|
+
}));
|
|
63
|
+
U(() => s.config, (t) => {
|
|
64
|
+
e.value = E(), G(), u.value.chartWidth = e.value.style.chartWidth;
|
|
65
|
+
}, { deep: !0 }), U(() => s.dataset, (t) => {
|
|
66
|
+
b.value = T({
|
|
67
|
+
data: s.dataset.map((l) => ({
|
|
68
|
+
...l,
|
|
69
|
+
value: [void 0].includes(l.value) ? null : l.value
|
|
70
|
+
})),
|
|
71
|
+
threshold: e.value.downsample.threshold
|
|
72
|
+
});
|
|
73
|
+
}, { deep: !0 });
|
|
74
|
+
const b = k(ee());
|
|
75
|
+
function ee() {
|
|
76
|
+
return T({
|
|
77
|
+
data: s.dataset.map((t) => e.value.style.animation.show ? {
|
|
78
|
+
...t,
|
|
79
|
+
value: null
|
|
80
|
+
} : {
|
|
81
|
+
...t,
|
|
82
|
+
value: [void 0].includes(t.value) ? null : t.value
|
|
83
|
+
}),
|
|
84
|
+
threshold: e.value.downsample.threshold
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const F = k(null);
|
|
88
|
+
ne(() => {
|
|
89
|
+
if (G(), e.value.style.animation.show && s.dataset.length > 1) {
|
|
90
|
+
let a = function() {
|
|
91
|
+
l < L.value.length ? (b.value.push(L.value[l]), setTimeout(() => {
|
|
92
|
+
requestAnimationFrame(a);
|
|
93
|
+
}, t)) : b.value = L.value, l += 1;
|
|
94
|
+
};
|
|
95
|
+
b.value = [];
|
|
96
|
+
const t = e.value.style.animation.animationFrames / s.dataset.length;
|
|
97
|
+
let l = 0;
|
|
98
|
+
a();
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
function G() {
|
|
102
|
+
if (fe(s.dataset) ? q({
|
|
103
|
+
componentName: "VueUiSparkline",
|
|
104
|
+
type: "dataset"
|
|
105
|
+
}) : s.dataset.forEach((t, l) => {
|
|
106
|
+
pe({
|
|
107
|
+
datasetObject: t,
|
|
108
|
+
requiredAttributes: ["period", "value"]
|
|
109
|
+
}).forEach((a) => {
|
|
110
|
+
q({
|
|
111
|
+
componentName: "VueUiSparkline",
|
|
112
|
+
type: "datasetSerieAttribute",
|
|
113
|
+
property: a,
|
|
114
|
+
index: l
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}), e.value.responsive) {
|
|
118
|
+
const t = _e(() => {
|
|
119
|
+
const { width: l, height: a } = xe({
|
|
120
|
+
chart: S.value,
|
|
121
|
+
title: e.value.style.title.show && s.showInfo ? O.value : null,
|
|
122
|
+
source: B.value
|
|
123
|
+
});
|
|
124
|
+
u.value.width = l, u.value.height = a, u.value.chartWidth = e.value.style.chartWidth / 500 * l, u.value.padding = s.forcedPadding / 500 * l;
|
|
125
|
+
});
|
|
126
|
+
F.value = new ResizeObserver(t), F.value.observe(S.value.parentNode);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const u = k({
|
|
130
|
+
height: 80 * s.heightRatio,
|
|
131
|
+
width: 500,
|
|
132
|
+
chartWidth: e.value.style.chartWidth,
|
|
133
|
+
padding: s.forcedPadding
|
|
134
|
+
}), o = v(() => {
|
|
135
|
+
const { top: t, right: l, bottom: a, left: n } = e.value.style.padding;
|
|
136
|
+
return {
|
|
137
|
+
top: t,
|
|
138
|
+
left: n,
|
|
139
|
+
right: u.value.width - l,
|
|
140
|
+
bottom: u.value.height - a,
|
|
141
|
+
start: s.showInfo && e.value.style.dataLabel.show && e.value.style.dataLabel.position === "left" ? u.value.width - u.value.chartWidth + n : u.value.padding + n,
|
|
142
|
+
width: s.showInfo && e.value.style.dataLabel.show ? u.value.chartWidth - n - l : u.value.width - u.value.padding - n - l,
|
|
143
|
+
height: u.value.height - t - a
|
|
144
|
+
};
|
|
145
|
+
}), W = v(() => [null, void 0].includes(e.value.style.scaleMin) ? Math.min(...b.value.map((t) => isNaN(t.value) || [void 0, null, "NaN", NaN, 1 / 0, -1 / 0].includes(t.value) ? 0 : t.value || 0)) : e.value.style.scaleMin), te = v(() => [null, void 0].includes(e.value.style.scaleMax) ? Math.max(...b.value.map((t) => isNaN(t.value) || [void 0, null, "NaN", NaN, 1 / 0, -1 / 0].includes(t.value) ? 0 : t.value || 0)) : e.value.style.scaleMax), x = v(() => {
|
|
146
|
+
const t = W.value >= 0 ? 0 : W.value;
|
|
147
|
+
return Math.abs(t);
|
|
148
|
+
}), ae = v(() => te.value + x.value), N = v(() => o.value.bottom - o.value.height * A(x.value));
|
|
149
|
+
function A(t) {
|
|
150
|
+
return t / ae.value;
|
|
151
|
+
}
|
|
152
|
+
const g = v(() => L.value.length - 1), d = v(() => b.value.map((t, l) => {
|
|
153
|
+
const a = isNaN(t.value) || [void 0, null, "NaN", NaN, 1 / 0, -1 / 0].includes(t.value) ? 0 : t.value || 0;
|
|
154
|
+
return {
|
|
155
|
+
absoluteValue: a,
|
|
156
|
+
period: t.period,
|
|
157
|
+
plotValue: a + x.value,
|
|
158
|
+
toMax: A(a + x.value),
|
|
159
|
+
x: o.value.start + l * (o.value.width / (g.value + 1) > u.padding ? u.padding : o.value.width / (g.value + 1)),
|
|
160
|
+
y: o.value.bottom - o.value.height * A(a + x.value),
|
|
161
|
+
id: `plot_${p.value}_${l}`,
|
|
162
|
+
color: w.value ? e.value.style.bar.color : e.value.style.area.useGradient ? I(e.value.style.line.color, 0.05 * (1 - l / g.value)) : e.value.style.line.color,
|
|
163
|
+
width: o.value.width / (g.value + 1) > u.padding ? u.padding : o.value.width / (g.value + 1)
|
|
164
|
+
};
|
|
165
|
+
})), le = v(() => {
|
|
166
|
+
const t = { x: d.value[0].x, y: u.value.height - 6 }, l = { x: d.value[d.value.length - 1].x, y: u.value.height - 6 }, a = [];
|
|
167
|
+
return d.value.forEach((n) => {
|
|
168
|
+
a.push(`${n.x},${n.y} `);
|
|
169
|
+
}), [t.x, t.y, ...a, l.x, l.y].toString();
|
|
170
|
+
}), y = k(void 0);
|
|
171
|
+
function ue(t, l) {
|
|
172
|
+
y.value = t, z("hoverIndex", { index: l });
|
|
173
|
+
}
|
|
174
|
+
function se() {
|
|
175
|
+
y.value = void 0, z("hoverIndex", { index: void 0 });
|
|
176
|
+
}
|
|
177
|
+
const m = v(() => {
|
|
178
|
+
if ($.value) {
|
|
179
|
+
const t = d.value.map((a) => a.absoluteValue), l = t.reduce((a, n) => a + n, 0);
|
|
180
|
+
return {
|
|
181
|
+
latest: d.value[d.value.length - 1].absoluteValue,
|
|
182
|
+
sum: l,
|
|
183
|
+
average: l / d.value.length,
|
|
184
|
+
median: ge(t),
|
|
185
|
+
trend: me(d.value.map(({ x: a, y: n, absoluteValue: j }) => ({
|
|
186
|
+
x: a,
|
|
187
|
+
y: n,
|
|
188
|
+
value: j
|
|
189
|
+
}))).trend
|
|
190
|
+
};
|
|
191
|
+
} else
|
|
192
|
+
return {
|
|
193
|
+
latest: null,
|
|
194
|
+
sum: null,
|
|
195
|
+
average: null,
|
|
196
|
+
median: null,
|
|
197
|
+
trend: null
|
|
198
|
+
};
|
|
199
|
+
}), R = v(() => $.value ? e.value.style.dataLabel.valueType === "latest" ? m.value.latest : e.value.style.dataLabel.valueType === "sum" ? m.value.sum : e.value.style.dataLabel.valueType === "average" ? m.value.average : 0 : 0), w = v(() => e.value.type && e.value.type === "bar");
|
|
200
|
+
function oe(t, l) {
|
|
201
|
+
z("selectDatapoint", { datapoint: t, index: l });
|
|
202
|
+
}
|
|
203
|
+
return (t, l) => (r(), i("div", {
|
|
204
|
+
ref_key: "sparklineChart",
|
|
205
|
+
ref: S,
|
|
206
|
+
class: "vue-ui-sparkline",
|
|
207
|
+
id: p.value,
|
|
208
|
+
style: C(`width:100%;font-family:${e.value.style.fontFamily};`)
|
|
209
|
+
}, [
|
|
210
|
+
M(t.$slots, "before", re(ie({
|
|
211
|
+
selected: y.value,
|
|
212
|
+
latest: m.value.latest,
|
|
213
|
+
sum: m.value.sum,
|
|
214
|
+
average: m.value.average,
|
|
215
|
+
median: m.value.median,
|
|
216
|
+
trend: m.value.trend
|
|
217
|
+
})), void 0, !0),
|
|
218
|
+
e.value.style.title.show && _.showInfo ? (r(), i("div", {
|
|
219
|
+
key: 0,
|
|
220
|
+
ref_key: "chartTitle",
|
|
221
|
+
ref: O,
|
|
222
|
+
class: "vue-ui-sparkline-title",
|
|
223
|
+
style: C(`display:flex;align-items:center;width:100%;color:${e.value.style.title.color};background:${e.value.style.backgroundColor};justify-content:${e.value.style.title.textAlign === "left" ? "flex-start" : e.value.style.title.textAlign === "right" ? "flex-end" : "center"};height:${e.value.style.title.fontSize * 2}px;font-size:${e.value.style.title.fontSize}px;font-weight:${e.value.style.title.bold ? "bold" : "normal"};`)
|
|
224
|
+
}, [
|
|
225
|
+
f("span", {
|
|
226
|
+
style: C(`padding:${e.value.style.title.textAlign === "left" ? "0 0 0 12px" : e.value.style.title.textAlign === "right" ? "0 12px 0 0" : "0"}`)
|
|
227
|
+
}, X(y.value ? y.value.period : e.value.style.title.text), 5)
|
|
228
|
+
], 4)) : c("", !0),
|
|
229
|
+
$.value ? (r(), i("svg", {
|
|
230
|
+
key: 1,
|
|
231
|
+
xmlns: h(ke),
|
|
232
|
+
viewBox: `0 0 ${u.value.width} ${u.value.height}`,
|
|
233
|
+
style: C(`background:${e.value.style.backgroundColor};overflow:visible`)
|
|
234
|
+
}, [
|
|
235
|
+
de(we),
|
|
236
|
+
t.$slots["chart-background"] ? (r(), i("foreignObject", {
|
|
237
|
+
key: 0,
|
|
238
|
+
x: 0,
|
|
239
|
+
y: 0,
|
|
240
|
+
width: u.value.width <= 0 ? 10 : u.value.width,
|
|
241
|
+
height: u.value.height <= 0 ? 10 : u.value.height,
|
|
242
|
+
style: {
|
|
243
|
+
pointerEvents: "none"
|
|
244
|
+
}
|
|
245
|
+
}, [
|
|
246
|
+
M(t.$slots, "chart-background", {}, void 0, !0)
|
|
247
|
+
], 8, Ce)) : c("", !0),
|
|
248
|
+
f("defs", null, [
|
|
249
|
+
f("linearGradient", {
|
|
250
|
+
x1: "0%",
|
|
251
|
+
y1: "0%",
|
|
252
|
+
x2: "100%",
|
|
253
|
+
y2: "0%",
|
|
254
|
+
id: `sparkline_gradient_${p.value}`
|
|
255
|
+
}, [
|
|
256
|
+
f("stop", {
|
|
257
|
+
offset: "0%",
|
|
258
|
+
"stop-color": h(V)(h(I)(e.value.style.area.color, 0.05), e.value.style.area.opacity)
|
|
259
|
+
}, null, 8, Ie),
|
|
260
|
+
f("stop", {
|
|
261
|
+
offset: "100%",
|
|
262
|
+
"stop-color": h(V)(e.value.style.area.color, e.value.style.area.opacity)
|
|
263
|
+
}, null, 8, Ve)
|
|
264
|
+
], 8, Me),
|
|
265
|
+
f("linearGradient", {
|
|
266
|
+
x2: "0%",
|
|
267
|
+
y2: "100%",
|
|
268
|
+
id: `sparkline_bar_gradient_pos_${p.value}`
|
|
269
|
+
}, [
|
|
270
|
+
f("stop", {
|
|
271
|
+
offset: "0%",
|
|
272
|
+
"stop-color": e.value.style.bar.color
|
|
273
|
+
}, null, 8, Se),
|
|
274
|
+
f("stop", {
|
|
275
|
+
offset: "100%",
|
|
276
|
+
"stop-color": h(I)(e.value.style.bar.color, 0.05)
|
|
277
|
+
}, null, 8, We)
|
|
278
|
+
], 8, ze),
|
|
279
|
+
f("linearGradient", {
|
|
280
|
+
x2: "0%",
|
|
281
|
+
y2: "100%",
|
|
282
|
+
id: `sparkline_bar_gradient_neg_${p.value}`
|
|
283
|
+
}, [
|
|
284
|
+
f("stop", {
|
|
285
|
+
offset: "0%",
|
|
286
|
+
"stop-color": h(I)(e.value.style.bar.color, 0.05)
|
|
287
|
+
}, null, 8, De),
|
|
288
|
+
f("stop", {
|
|
289
|
+
offset: "100%",
|
|
290
|
+
"stop-color": e.value.style.bar.color
|
|
291
|
+
}, null, 8, Pe)
|
|
292
|
+
], 8, Ae)
|
|
293
|
+
]),
|
|
294
|
+
e.value.style.area.show && !w.value && d.value[0] ? (r(), i("g", Te, [
|
|
295
|
+
e.value.style.line.smooth ? (r(), i("path", {
|
|
296
|
+
key: 0,
|
|
297
|
+
d: `M ${d.value[0].x},${o.value.bottom} ${h(H)(d.value)} L ${d.value.at(-1).x},${o.value.bottom} Z`,
|
|
298
|
+
fill: e.value.style.area.useGradient ? `url(#sparkline_gradient_${p.value})` : h(V)(e.value.style.area.color, e.value.style.area.opacity)
|
|
299
|
+
}, null, 8, Oe)) : (r(), i("path", {
|
|
300
|
+
key: 1,
|
|
301
|
+
d: `M${le.value}Z`,
|
|
302
|
+
fill: e.value.style.area.useGradient ? `url(#sparkline_gradient_${p.value})` : h(V)(e.value.style.area.color, e.value.style.area.opacity)
|
|
303
|
+
}, null, 8, Be))
|
|
304
|
+
])) : c("", !0),
|
|
305
|
+
e.value.style.line.smooth && !w.value ? (r(), i("path", {
|
|
306
|
+
key: 2,
|
|
307
|
+
d: `M ${h(H)(d.value)}`,
|
|
308
|
+
stroke: e.value.style.line.color,
|
|
309
|
+
fill: "none",
|
|
310
|
+
"stroke-width": e.value.style.line.strokeWidth,
|
|
311
|
+
"stroke-linecap": "round"
|
|
312
|
+
}, null, 8, Ee)) : c("", !0),
|
|
313
|
+
(r(!0), i(D, null, P(d.value, (a, n) => (r(), i("g", null, [
|
|
314
|
+
n < d.value.length - 1 && !e.value.style.line.smooth && !w.value ? (r(), i("line", {
|
|
315
|
+
key: 0,
|
|
316
|
+
x1: a.x,
|
|
317
|
+
x2: d.value[n + 1].x,
|
|
318
|
+
y1: a.y,
|
|
319
|
+
y2: d.value[n + 1].y,
|
|
320
|
+
stroke: a.color,
|
|
321
|
+
"stroke-width": e.value.style.line.strokeWidth,
|
|
322
|
+
"stroke-linecap": "round",
|
|
323
|
+
"stroke-linejoin": "round",
|
|
324
|
+
"shape-rendering": "geometricPrecision"
|
|
325
|
+
}, null, 8, Fe)) : c("", !0),
|
|
326
|
+
w.value ? (r(), i("rect", {
|
|
327
|
+
key: 1,
|
|
328
|
+
x: a.x - a.width / 2,
|
|
329
|
+
y: a.absoluteValue > 0 ? a.y : N.value,
|
|
330
|
+
width: a.width,
|
|
331
|
+
height: Math.abs(a.y - N.value),
|
|
332
|
+
fill: a.absoluteValue > 0 ? `url(#sparkline_bar_gradient_pos_${p.value})` : `url(#sparkline_bar_gradient_neg_${p.value})`,
|
|
333
|
+
rx: e.value.style.bar.borderRadius
|
|
334
|
+
}, null, 8, Ge)) : c("", !0),
|
|
335
|
+
e.value.style.verticalIndicator.show && (y.value && a.id === y.value.id || _.selectedIndex === n) ? (r(), i("line", {
|
|
336
|
+
key: 2,
|
|
337
|
+
x1: a.x,
|
|
338
|
+
x2: a.x,
|
|
339
|
+
y1: o.value.top - 6,
|
|
340
|
+
y2: o.value.bottom,
|
|
341
|
+
stroke: e.value.style.verticalIndicator.color || a.color,
|
|
342
|
+
"stroke-width": e.value.style.verticalIndicator.strokeWidth,
|
|
343
|
+
"stroke-linecap": "round",
|
|
344
|
+
"stroke-dasharray": e.value.style.verticalIndicator.strokeDasharray || 0
|
|
345
|
+
}, null, 8, Re)) : c("", !0)
|
|
346
|
+
]))), 256)),
|
|
347
|
+
W.value < 0 ? (r(), i("line", {
|
|
348
|
+
key: 3,
|
|
349
|
+
x1: o.value.start,
|
|
350
|
+
x2: o.value.start + o.value.width - 16,
|
|
351
|
+
y1: N.value,
|
|
352
|
+
y2: N.value,
|
|
353
|
+
stroke: e.value.style.zeroLine.color,
|
|
354
|
+
"stroke-dasharray": e.value.style.zeroLine.strokeWidth * 2,
|
|
355
|
+
"stroke-width": e.value.style.zeroLine.strokeWidth,
|
|
356
|
+
"stroke-linecap": "round"
|
|
357
|
+
}, null, 8, je)) : c("", !0),
|
|
358
|
+
e.value.style.plot.show ? (r(!0), i(D, { key: 4 }, P(d.value, (a, n) => (r(), i("g", null, [
|
|
359
|
+
y.value && a.id === y.value.id || _.selectedIndex === n ? (r(), i("circle", {
|
|
360
|
+
key: 0,
|
|
361
|
+
cx: a.x,
|
|
362
|
+
cy: a.y,
|
|
363
|
+
r: e.value.style.plot.radius,
|
|
364
|
+
fill: a.color,
|
|
365
|
+
stroke: e.value.style.plot.stroke,
|
|
366
|
+
"stroke-width": e.value.style.plot.strokeWidth
|
|
367
|
+
}, null, 8, Ue)) : c("", !0)
|
|
368
|
+
]))), 256)) : c("", !0),
|
|
369
|
+
_.showInfo && e.value.style.dataLabel.show ? (r(), i("text", {
|
|
370
|
+
key: 5,
|
|
371
|
+
x: e.value.style.dataLabel.position === "left" ? 12 + e.value.style.dataLabel.offsetX : o.value.width + 12 + e.value.style.dataLabel.offsetX,
|
|
372
|
+
y: u.value.height / 2 + e.value.style.dataLabel.fontSize / 2.5 + e.value.style.dataLabel.offsetY,
|
|
373
|
+
"font-size": e.value.style.dataLabel.fontSize,
|
|
374
|
+
"font-weight": e.value.style.dataLabel.bold ? "bold" : "normal",
|
|
375
|
+
fill: e.value.style.dataLabel.color
|
|
376
|
+
}, X(y.value ? h(Y)(
|
|
377
|
+
e.value.style.dataLabel.formatter,
|
|
378
|
+
y.value.absoluteValue,
|
|
379
|
+
h(J)({ p: e.value.style.dataLabel.prefix, v: y.value.absoluteValue, s: e.value.style.dataLabel.suffix, r: e.value.style.dataLabel.roundingValue }),
|
|
380
|
+
{ datapoint: y.value }
|
|
381
|
+
) : h(Y)(
|
|
382
|
+
e.value.style.dataLabel.formatter,
|
|
383
|
+
R.value,
|
|
384
|
+
h(J)({ p: e.value.style.dataLabel.prefix, v: R.value, s: e.value.style.dataLabel.suffix, r: e.value.style.dataLabel.roundingValue })
|
|
385
|
+
)), 9, Xe)) : c("", !0),
|
|
386
|
+
(r(!0), i(D, null, P(d.value, (a, n) => (r(), i("rect", {
|
|
387
|
+
x: a.x - (o.value.width / (g.value + 1) > u.value.padding ? u.value.padding : o.value.width / (g.value + 1)) / 2,
|
|
388
|
+
y: o.value.top - 6,
|
|
389
|
+
height: o.value.height + 6,
|
|
390
|
+
width: o.value.width / (g.value + 1) > u.value.padding ? u.value.padding : o.value.width / (g.value + 1),
|
|
391
|
+
fill: "transparent",
|
|
392
|
+
onMouseenter: (j) => ue(a, n),
|
|
393
|
+
onMouseleave: se,
|
|
394
|
+
onClick: () => oe(a, n)
|
|
395
|
+
}, null, 40, Ze))), 256)),
|
|
396
|
+
M(t.$slots, "svg", { svg: u.value }, void 0, !0)
|
|
397
|
+
], 12, Ne)) : c("", !0),
|
|
398
|
+
t.$slots.source ? (r(), i("div", {
|
|
399
|
+
key: 2,
|
|
400
|
+
ref_key: "source",
|
|
401
|
+
ref: B,
|
|
402
|
+
dir: "auto"
|
|
403
|
+
}, [
|
|
404
|
+
M(t.$slots, "source", {}, void 0, !0)
|
|
405
|
+
], 512)) : c("", !0),
|
|
406
|
+
$.value ? c("", !0) : (r(), ve(be, {
|
|
407
|
+
key: 3,
|
|
408
|
+
config: {
|
|
409
|
+
type: "sparkline",
|
|
410
|
+
style: {
|
|
411
|
+
backgroundColor: e.value.style.backgroundColor,
|
|
412
|
+
sparkline: {
|
|
413
|
+
color: "#CCCCCC"
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}, null, 8, ["config"]))
|
|
418
|
+
], 12, Le));
|
|
419
|
+
}
|
|
420
|
+
}, at = /* @__PURE__ */ $e(qe, [["__scopeId", "data-v-792e1bb5"]]);
|
|
421
|
+
export {
|
|
422
|
+
at as default
|
|
423
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=require("./index-CC7tVh7F.cjs"),S=require("./useNestedProp-CxwPeWts.cjs"),q=require("./vue-ui-skeleton-BgEjqaz9.cjs"),P=require("./useResponsive-BJ7DTGpm.cjs"),G=require("./PackageVersion-D3dK8oA3.cjs"),R=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),H=["id"],U=["xmlns","viewBox"],X=["width","height"],Z=["id"],Y=["stop-color"],J=["stop-color"],K=["id"],Q=["stop-color"],ee=["stop-color"],te=["id"],le=["stop-color"],ae=["stop-color"],oe={key:1},ne=["d","fill"],re=["d","fill"],ue=["d","stroke","stroke-width"],se=["x1","x2","y1","y2","stroke","stroke-width"],ie=["x","y","width","height","fill","rx"],de=["x1","x2","y1","y2","stroke","stroke-width","stroke-dasharray"],ce=["x1","x2","y1","y2","stroke","stroke-dasharray","stroke-width"],ve=["cx","cy","r","fill","stroke","stroke-width"],he=["x","y","font-size","font-weight","fill"],ye=["x","y","height","width","onMouseenter","onClick"],fe={__name:"vue-ui-sparkline",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}},showInfo:{type:Boolean,default:!0},selectedIndex:{type:Number,default:void 0},heightRatio:{type:Number,default:1},forcedPadding:{type:Number,default:30}},emits:["hoverIndex","selectDatapoint"],setup(p,{emit:x}){const u=p,{vue_ui_sparkline:z}=r.useConfig(),k=e.computed(()=>!!u.dataset&&u.dataset.length),v=e.ref(r.createUid()),w=e.ref(null),C=e.ref(null),L=e.ref(null),t=e.computed({get:()=>V(),set:l=>l});function V(){const l=S.useNestedProp({userConfig:u.config,defaultConfig:z});let o={};return l.theme?o={...S.useNestedProp({userConfig:r.themes.vue_ui_sparkline[l.theme]||u.config,defaultConfig:l})}:o=l,u.config&&r.hasDeepProperty(u.config,"style.scaleMin")?o.style.scaleMin=u.config.style.scaleMin:o.style.scaleMin=null,u.config&&r.hasDeepProperty(u.config,"style.scaleMax")?o.style.scaleMax=u.config.style.scaleMax:o.style.scaleMax=null,o}const b=e.computed(()=>r.largestTriangleThreeBucketsArrayObjects({data:u.dataset,threshold:t.value.downsample.threshold}));e.watch(()=>u.config,l=>{t.value=V(),$(),n.value.chartWidth=t.value.style.chartWidth},{deep:!0}),e.watch(()=>u.dataset,l=>{f.value=r.largestTriangleThreeBucketsArrayObjects({data:u.dataset.map(o=>({...o,value:[void 0].includes(o.value)?null:o.value})),threshold:t.value.downsample.threshold})},{deep:!0});const f=e.ref(D());function D(){return r.largestTriangleThreeBucketsArrayObjects({data:u.dataset.map(l=>t.value.style.animation.show?{...l,value:null}:{...l,value:[void 0].includes(l.value)?null:l.value}),threshold:t.value.downsample.threshold})}const E=e.ref(null);e.onMounted(()=>{if($(),t.value.style.animation.show&&u.dataset.length>1){let a=function(){o<b.value.length?(f.value.push(b.value[o]),setTimeout(()=>{requestAnimationFrame(a)},l)):f.value=b.value,o+=1};f.value=[];const l=t.value.style.animation.animationFrames/u.dataset.length;let o=0;a()}});function $(){if(r.objectIsEmpty(u.dataset)?r.error({componentName:"VueUiSparkline",type:"dataset"}):u.dataset.forEach((l,o)=>{r.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["period","value"]}).forEach(a=>{r.error({componentName:"VueUiSparkline",type:"datasetSerieAttribute",property:a,index:o})})}),t.value.responsive){const l=P.throttle(()=>{const{width:o,height:a}=P.useResponsive({chart:w.value,title:t.value.style.title.show&&u.showInfo?C.value:null,source:L.value});n.value.width=o,n.value.height=a,n.value.chartWidth=t.value.style.chartWidth/500*o,n.value.padding=u.forcedPadding/500*o});E.value=new ResizeObserver(l),E.value.observe(w.value.parentNode)}}const n=e.ref({height:80*u.heightRatio,width:500,chartWidth:t.value.style.chartWidth,padding:u.forcedPadding}),s=e.computed(()=>{const{top:l,right:o,bottom:a,left:i}=t.value.style.padding;return{top:l,left:i,right:n.value.width-o,bottom:n.value.height-a,start:u.showInfo&&t.value.style.dataLabel.show&&t.value.style.dataLabel.position==="left"?n.value.width-n.value.chartWidth+i:n.value.padding+i,width:u.showInfo&&t.value.style.dataLabel.show?n.value.chartWidth-i-o:n.value.width-n.value.padding-i-o,height:n.value.height-l-a}}),N=e.computed(()=>[null,void 0].includes(t.value.style.scaleMin)?Math.min(...f.value.map(l=>isNaN(l.value)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l.value)?0:l.value||0)):t.value.style.scaleMin),A=e.computed(()=>[null,void 0].includes(t.value.style.scaleMax)?Math.max(...f.value.map(l=>isNaN(l.value)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l.value)?0:l.value||0)):t.value.style.scaleMax),m=e.computed(()=>{const l=N.value>=0?0:N.value;return Math.abs(l)}),O=e.computed(()=>A.value+m.value),_=e.computed(()=>s.value.bottom-s.value.height*B(m.value));function B(l){return l/O.value}const h=e.computed(()=>b.value.length-1),d=e.computed(()=>f.value.map((l,o)=>{const a=isNaN(l.value)||[void 0,null,"NaN",NaN,1/0,-1/0].includes(l.value)?0:l.value||0;return{absoluteValue:a,period:l.period,plotValue:a+m.value,toMax:B(a+m.value),x:s.value.start+o*(s.value.width/(h.value+1)>n.padding?n.padding:s.value.width/(h.value+1)),y:s.value.bottom-s.value.height*B(a+m.value),id:`plot_${v.value}_${o}`,color:g.value?t.value.style.bar.color:t.value.style.area.useGradient?r.shiftHue(t.value.style.line.color,.05*(1-o/h.value)):t.value.style.line.color,width:s.value.width/(h.value+1)>n.padding?n.padding:s.value.width/(h.value+1)}})),T=e.computed(()=>{const l={x:d.value[0].x,y:n.value.height-6},o={x:d.value[d.value.length-1].x,y:n.value.height-6},a=[];return d.value.forEach(i=>{a.push(`${i.x},${i.y} `)}),[l.x,l.y,...a,o.x,o.y].toString()}),c=e.ref(void 0);function W(l,o){c.value=l,x("hoverIndex",{index:o})}function j(){c.value=void 0,x("hoverIndex",{index:void 0})}const y=e.computed(()=>{if(k.value){const l=d.value.map(a=>a.absoluteValue),o=l.reduce((a,i)=>a+i,0);return{latest:d.value[d.value.length-1].absoluteValue,sum:o,average:o/d.value.length,median:r.calcMedian(l),trend:r.calcLinearProgression(d.value.map(({x:a,y:i,absoluteValue:I})=>({x:a,y:i,value:I}))).trend}}else return{latest:null,sum:null,average:null,median:null,trend:null}}),M=e.computed(()=>k.value?t.value.style.dataLabel.valueType==="latest"?y.value.latest:t.value.style.dataLabel.valueType==="sum"?y.value.sum:t.value.style.dataLabel.valueType==="average"?y.value.average:0:0),g=e.computed(()=>t.value.type&&t.value.type==="bar");function F(l,o){x("selectDatapoint",{datapoint:l,index:o})}return(l,o)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"sparklineChart",ref:w,class:"vue-ui-sparkline",id:v.value,style:e.normalizeStyle(`width:100%;font-family:${t.value.style.fontFamily};`)},[e.renderSlot(l.$slots,"before",e.normalizeProps(e.guardReactiveProps({selected:c.value,latest:y.value.latest,sum:y.value.sum,average:y.value.average,median:y.value.median,trend:y.value.trend})),void 0,!0),t.value.style.title.show&&p.showInfo?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"chartTitle",ref:C,class:"vue-ui-sparkline-title",style:e.normalizeStyle(`display:flex;align-items:center;width:100%;color:${t.value.style.title.color};background:${t.value.style.backgroundColor};justify-content:${t.value.style.title.textAlign==="left"?"flex-start":t.value.style.title.textAlign==="right"?"flex-end":"center"};height:${t.value.style.title.fontSize*2}px;font-size:${t.value.style.title.fontSize}px;font-weight:${t.value.style.title.bold?"bold":"normal"};`)},[e.createElementVNode("span",{style:e.normalizeStyle(`padding:${t.value.style.title.textAlign==="left"?"0 0 0 12px":t.value.style.title.textAlign==="right"?"0 12px 0 0":"0"}`)},e.toDisplayString(c.value?c.value.period:t.value.style.title.text),5)],4)):e.createCommentVNode("",!0),k.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(r.XMLNS),viewBox:`0 0 ${n.value.width} ${n.value.height}`,style:e.normalizeStyle(`background:${t.value.style.backgroundColor};overflow:visible`)},[e.createVNode(G._sfc_main),l.$slots["chart-background"]?(e.openBlock(),e.createElementBlock("foreignObject",{key:0,x:0,y:0,width:n.value.width<=0?10:n.value.width,height:n.value.height<=0?10:n.value.height,style:{pointerEvents:"none"}},[e.renderSlot(l.$slots,"chart-background",{},void 0,!0)],8,X)):e.createCommentVNode("",!0),e.createElementVNode("defs",null,[e.createElementVNode("linearGradient",{x1:"0%",y1:"0%",x2:"100%",y2:"0%",id:`sparkline_gradient_${v.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":e.unref(r.setOpacity)(e.unref(r.shiftHue)(t.value.style.area.color,.05),t.value.style.area.opacity)},null,8,Y),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(r.setOpacity)(t.value.style.area.color,t.value.style.area.opacity)},null,8,J)],8,Z),e.createElementVNode("linearGradient",{x2:"0%",y2:"100%",id:`sparkline_bar_gradient_pos_${v.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":t.value.style.bar.color},null,8,Q),e.createElementVNode("stop",{offset:"100%","stop-color":e.unref(r.shiftHue)(t.value.style.bar.color,.05)},null,8,ee)],8,K),e.createElementVNode("linearGradient",{x2:"0%",y2:"100%",id:`sparkline_bar_gradient_neg_${v.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":e.unref(r.shiftHue)(t.value.style.bar.color,.05)},null,8,le),e.createElementVNode("stop",{offset:"100%","stop-color":t.value.style.bar.color},null,8,ae)],8,te)]),t.value.style.area.show&&!g.value&&d.value[0]?(e.openBlock(),e.createElementBlock("g",oe,[t.value.style.line.smooth?(e.openBlock(),e.createElementBlock("path",{key:0,d:`M ${d.value[0].x},${s.value.bottom} ${e.unref(r.createSmoothPath)(d.value)} L ${d.value.at(-1).x},${s.value.bottom} Z`,fill:t.value.style.area.useGradient?`url(#sparkline_gradient_${v.value})`:e.unref(r.setOpacity)(t.value.style.area.color,t.value.style.area.opacity)},null,8,ne)):(e.openBlock(),e.createElementBlock("path",{key:1,d:`M${T.value}Z`,fill:t.value.style.area.useGradient?`url(#sparkline_gradient_${v.value})`:e.unref(r.setOpacity)(t.value.style.area.color,t.value.style.area.opacity)},null,8,re))])):e.createCommentVNode("",!0),t.value.style.line.smooth&&!g.value?(e.openBlock(),e.createElementBlock("path",{key:2,d:`M ${e.unref(r.createSmoothPath)(d.value)}`,stroke:t.value.style.line.color,fill:"none","stroke-width":t.value.style.line.strokeWidth,"stroke-linecap":"round"},null,8,ue)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(a,i)=>(e.openBlock(),e.createElementBlock("g",null,[i<d.value.length-1&&!t.value.style.line.smooth&&!g.value?(e.openBlock(),e.createElementBlock("line",{key:0,x1:a.x,x2:d.value[i+1].x,y1:a.y,y2:d.value[i+1].y,stroke:a.color,"stroke-width":t.value.style.line.strokeWidth,"stroke-linecap":"round","stroke-linejoin":"round","shape-rendering":"geometricPrecision"},null,8,se)):e.createCommentVNode("",!0),g.value?(e.openBlock(),e.createElementBlock("rect",{key:1,x:a.x-a.width/2,y:a.absoluteValue>0?a.y:_.value,width:a.width,height:Math.abs(a.y-_.value),fill:a.absoluteValue>0?`url(#sparkline_bar_gradient_pos_${v.value})`:`url(#sparkline_bar_gradient_neg_${v.value})`,rx:t.value.style.bar.borderRadius},null,8,ie)):e.createCommentVNode("",!0),t.value.style.verticalIndicator.show&&(c.value&&a.id===c.value.id||p.selectedIndex===i)?(e.openBlock(),e.createElementBlock("line",{key:2,x1:a.x,x2:a.x,y1:s.value.top-6,y2:s.value.bottom,stroke:t.value.style.verticalIndicator.color||a.color,"stroke-width":t.value.style.verticalIndicator.strokeWidth,"stroke-linecap":"round","stroke-dasharray":t.value.style.verticalIndicator.strokeDasharray||0},null,8,de)):e.createCommentVNode("",!0)]))),256)),N.value<0?(e.openBlock(),e.createElementBlock("line",{key:3,x1:s.value.start,x2:s.value.start+s.value.width-16,y1:_.value,y2:_.value,stroke:t.value.style.zeroLine.color,"stroke-dasharray":t.value.style.zeroLine.strokeWidth*2,"stroke-width":t.value.style.zeroLine.strokeWidth,"stroke-linecap":"round"},null,8,ce)):e.createCommentVNode("",!0),t.value.style.plot.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:4},e.renderList(d.value,(a,i)=>(e.openBlock(),e.createElementBlock("g",null,[c.value&&a.id===c.value.id||p.selectedIndex===i?(e.openBlock(),e.createElementBlock("circle",{key:0,cx:a.x,cy:a.y,r:t.value.style.plot.radius,fill:a.color,stroke:t.value.style.plot.stroke,"stroke-width":t.value.style.plot.strokeWidth},null,8,ve)):e.createCommentVNode("",!0)]))),256)):e.createCommentVNode("",!0),p.showInfo&&t.value.style.dataLabel.show?(e.openBlock(),e.createElementBlock("text",{key:5,x:t.value.style.dataLabel.position==="left"?12+t.value.style.dataLabel.offsetX:s.value.width+12+t.value.style.dataLabel.offsetX,y:n.value.height/2+t.value.style.dataLabel.fontSize/2.5+t.value.style.dataLabel.offsetY,"font-size":t.value.style.dataLabel.fontSize,"font-weight":t.value.style.dataLabel.bold?"bold":"normal",fill:t.value.style.dataLabel.color},e.toDisplayString(c.value?e.unref(r.applyDataLabel)(t.value.style.dataLabel.formatter,c.value.absoluteValue,e.unref(r.dataLabel)({p:t.value.style.dataLabel.prefix,v:c.value.absoluteValue,s:t.value.style.dataLabel.suffix,r:t.value.style.dataLabel.roundingValue}),{datapoint:c.value}):e.unref(r.applyDataLabel)(t.value.style.dataLabel.formatter,M.value,e.unref(r.dataLabel)({p:t.value.style.dataLabel.prefix,v:M.value,s:t.value.style.dataLabel.suffix,r:t.value.style.dataLabel.roundingValue}))),9,he)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(a,i)=>(e.openBlock(),e.createElementBlock("rect",{x:a.x-(s.value.width/(h.value+1)>n.value.padding?n.value.padding:s.value.width/(h.value+1))/2,y:s.value.top-6,height:s.value.height+6,width:s.value.width/(h.value+1)>n.value.padding?n.value.padding:s.value.width/(h.value+1),fill:"transparent",onMouseenter:I=>W(a,i),onMouseleave:j,onClick:()=>F(a,i)},null,40,ye))),256)),e.renderSlot(l.$slots,"svg",{svg:n.value},void 0,!0)],12,U)):e.createCommentVNode("",!0),l.$slots.source?(e.openBlock(),e.createElementBlock("div",{key:2,ref_key:"source",ref:L,dir:"auto"},[e.renderSlot(l.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0),k.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(q.default,{key:3,config:{type:"sparkline",style:{backgroundColor:t.value.style.backgroundColor,sparkline:{color:"#CCCCCC"}}}},null,8,["config"]))],12,H))}},pe=R._export_sfc(fe,[["__scopeId","data-v-792e1bb5"]]);exports.default=pe;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useSlots as ne, onMounted as Y, computed as m, ref as d, watch as G, openBlock as s, createElementBlock as r, normalizeStyle as v, createElementVNode as p, toDisplayString as w, createCommentVNode as y, unref as C, createVNode as q, Fragment as x, renderList as $, normalizeClass as F, createBlock as ue, withCtx as H, renderSlot as U, normalizeProps as X, guardReactiveProps as J } from "vue";
|
|
2
|
-
import { u as ie, c as K, t as ce, a as de, p as i, d as N, b as ve, o as pe, e as Q, g as ge, f as V, X as fe, s as he, w as ye, i as Z, x as me } from "./index-
|
|
3
|
-
import { u as ee } from "./useNestedProp-
|
|
4
|
-
import ke from "./vue-ui-skeleton-
|
|
5
|
-
import { _ as be } from "./PackageVersion-
|
|
6
|
-
import { _ as _e } from "./Tooltip-
|
|
2
|
+
import { u as ie, c as K, t as ce, a as de, p as i, d as N, b as ve, o as pe, e as Q, g as ge, f as V, X as fe, s as he, w as ye, i as Z, x as me } from "./index-B-k71vpj.js";
|
|
3
|
+
import { u as ee } from "./useNestedProp-BeXDUo1v.js";
|
|
4
|
+
import ke from "./vue-ui-skeleton-DSXzxNMC.js";
|
|
5
|
+
import { _ as be } from "./PackageVersion-1NslmM8M.js";
|
|
6
|
+
import { _ as _e } from "./Tooltip-C72f83eg.js";
|
|
7
7
|
import { _ as we } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
8
8
|
const Ce = ["xmlns", "viewBox"], xe = ["id"], $e = ["stop-color"], Se = ["stop-color"], ze = ["stop-color"], Pe = {
|
|
9
9
|
id: "stackPill",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-CgZGelSi.cjs"),V=require("./useNestedProp-BxCE3J3Z.cjs"),q=require("./vue-ui-skeleton-m4l9jfqA.cjs"),O=require("./PackageVersion-B_1OHk5A.cjs"),U=require("./Tooltip-AHTiRuWB.cjs"),M=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),j=["xmlns","viewBox"],H=["id"],I=["stop-color"],R=["stop-color"],W=["stop-color"],Y={id:"stackPill",clipPathUnits:"objectBoundingBox"},G=["fill"],X={key:0,"clip-path":"url(#stackPill)"},J=["x","width","height","fill"],K=["x","width","height","fill","stroke"],Q=["onClick","x","width","height","onMouseenter"],Z=["width","height","rx"],ee=["onClick"],te={style:{display:"flex","flex-direction":"row","align-items":"center",gap:"4px","justify-content":"center"}},le=["height","width"],oe=["fill"],ae={key:4,ref:"source",dir:"auto"},re={__name:"vue-ui-sparkstackbar",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint"],setup(P,{emit:D}){const u=P,{vue_ui_sparkstackbar:L}=a.useConfig(),F=e.useSlots();e.onMounted(()=>{F["chart-background"]&&console.warn("VueUiSparkStackbar does not support the #chart-background slot.")});const x=e.computed(()=>!!u.dataset&&u.dataset.length),B=e.ref(null),S=e.ref(a.createUid()),b=e.ref(!1),_=e.ref(""),t=e.computed({get:()=>$(),set:l=>l});function $(){const l=V.useNestedProp({userConfig:u.config,defaultConfig:L});return l.theme?{...V.useNestedProp({userConfig:a.themes.vue_ui_sparkstackbar[l.theme]||u.config,defaultConfig:l}),customPalette:a.themePalettes[l.theme]||a.palette}:l}e.watch(()=>u.config,l=>{t.value=$(),E()},{deep:!0}),e.watch(()=>u.dataset,l=>{v.value=u.dataset.map((n,o)=>({...n,color:n.color?a.convertColorToHex(n.color):f.value[o]||a.palette[o]||a.palette[o%a.palette.length]}))},{deep:!0});const f=e.computed(()=>a.convertCustomPalette(t.value.customPalette)),v=e.ref(u.dataset.map((l,n)=>({...l,value:t.value.style.animation.show?0:l.value||0,color:l.color?a.convertColorToHex(l.color):f.value[n]||a.palette[n]||a.palette[n%a.palette.length]}))),g=e.ref(!0);e.onMounted(()=>{if(E(),t.value.style.animation.show){let p=function(){r+=o/l,r<o?(v.value=v.value.map((s,i)=>({...s,value:s.value+=n[i],color:s.color?a.convertColorToHex(s.color):f.value[i]||a.palette[i]||a.palette[i%a.palette.length]})),requestAnimationFrame(p)):(g.value=!1,v.value=u.dataset.map((s,i)=>({...s,value:s.value||0,color:s.color?a.convertColorToHex(s.color):f.value[i]||a.palette[i]||a.palette[i%a.palette.length],id:a.createUid()})))};const l=t.value.style.animation.animationFrames,n=u.dataset.map((s,i)=>s.value/l),o=u.dataset.map(s=>s.value||0).reduce((s,i)=>s+i,0);let r=0;g.value=!0,p()}});function E(){a.objectIsEmpty(u.dataset)?a.error({componentName:"VueUiSparkStackbar",type:"dataset"}):u.dataset.forEach((l,n)=>{a.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["name","value"]}).forEach(o=>{a.error({componentName:"VueUiSparkStackbar",type:"datasetSerieAttribute",property:o,index:n})})})}const c=e.ref({width:500,height:16}),d=e.ref([]),N=e.computed(()=>u.dataset.map(l=>l.value||0).filter((l,n)=>!d.value.includes(n)).reduce((l,n)=>l+n,0)),y=e.computed(()=>v.value.map((l,n)=>{const o=l.value||0,r=o/N.value,p=isNaN(r)?0:r,s=p*c.value.width;return{...l,value:o,proportion:p,width:s,proportionLabel:a.dataLabel({v:p*100,s:"%",r:t.value.style.legend.percentage.rounding})}})),C=e.computed(()=>y.value.filter((l,n)=>!d.value.includes(n)));function T(l){d.value.includes(l)?d.value=d.value.filter(n=>n!==l):d.value.length<v.value.length-1&&d.value.push(l)}const h=e.computed(()=>{let l=0;const n=[];for(let o=0;o<C.value.length;o+=1)n.push({...C.value[o],start:l}),l+=C.value[o].width;return n});function z(l,n){D("selectDatapoint",{datapoint:l,index:n})}const w=e.ref(null),k=e.ref(!1),m=e.ref(null);function A({datapoint:l,seriesIndex:n}){if(!t.value.style.tooltip.show)return;w.value={datapoint:l,seriesIndex:n,config:t.value,series:y.value},b.value=!0,m.value=n;const o=t.value.style.tooltip.customFormat;if(a.isFunction(o))try{const r=o({seriesIndex:n,datapoint:l,series:y.value,config:t.value});typeof r=="string"&&(_.value=r,k.value=!0)}catch{console.warn("Custom format cannot be applied."),k.value=!1}if(!k.value){let r="";r+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${t.value.style.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${l.name}</div>`,r+=`<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12" height="14" width="14"><circle cx="6" cy="6" r="6" stroke="none" fill="${l.color}"/></svg>`,r+=`<b>${l.proportionLabel}</b>`,r+=`<span>(${a.applyDataLabel(t.value.style.legend.value.formatter,l.value,a.dataLabel({p:t.value.style.legend.value.prefix,v:l.value,s:t.value.style.legend.value.suffix,r:t.value.style.legend.value.rounding}),{datapoint:l,seriesIndex:n})})</span>`,_.value=`<div>${r}</div>`}}return(l,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"sparkstackbarChart",ref:B,style:e.normalizeStyle(`width:100%; background:${t.value.style.backgroundColor}`)},[t.value.style.title.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`width:calc(100% - 12px);background:transparent;margin:0 auto;margin:${t.value.style.title.margin};padding: 0 6px;text-align:${t.value.style.title.textAlign}`)},[e.createElementVNode("div",{style:e.normalizeStyle(`font-size:${t.value.style.title.fontSize}px;color:${t.value.style.title.color};font-weight:${t.value.style.title.bold?"bold":"normal"}`)},e.toDisplayString(t.value.style.title.text),5),t.value.style.title.subtitle.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`font-size:${t.value.style.title.subtitle.fontSize}px;color:${t.value.style.title.subtitle.color};font-weight:${t.value.style.title.subtitle.bold?"bold":"normal"}`)},e.toDisplayString(t.value.style.title.subtitle.text),5)):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),x.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(a.XMLNS),width:"100%",viewBox:`0 0 ${c.value.width} ${c.value.height}`},[e.createVNode(O._sfc_main),e.createElementVNode("defs",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("linearGradient",{key:`stack_gradient_${r}`,gradientTransform:"rotate(90)",id:`stack_gradient_${r}_${S.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":o.color},null,8,I),e.createElementVNode("stop",{offset:"50%","stop-color":e.unref(a.setOpacity)(e.unref(a.shiftHue)(o.color,.05),100-t.value.style.bar.gradient.intensity)},null,8,R),e.createElementVNode("stop",{offset:"100%","stop-color":o.color},null,8,W)],8,H))),128)),e.createElementVNode("clipPath",Y,[e.createElementVNode("rect",{x:"0.005",y:"-2",width:"0.99",height:"5",rx:"3",ry:"3",fill:t.value.style.backgroundColor},null,8,G)])]),N.value>0?(e.openBlock(),e.createElementBlock("g",X,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("rect",{key:`stack_underlayer_${r}`,x:o.start,y:0,width:o.width,height:c.value.height,fill:t.value.style.bar.gradient.underlayerColor,class:e.normalizeClass({animated:!g.value}),style:e.normalizeStyle({opacity:m.value!==null&&t.value.style.tooltip.show?m.value===r?1:.5:1})},null,14,J))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("rect",{key:`stack_${r}`,x:o.start,y:0,width:o.width,height:c.value.height,fill:t.value.style.bar.gradient.show?`url(#stack_gradient_${r}_${S.value})`:o.color,stroke:t.value.style.backgroundColor,"stroke-linecap":"round",class:e.normalizeClass({animated:!g.value}),style:e.normalizeStyle({opacity:m.value!==null&&t.value.style.tooltip.show?m.value===r?1:.5:1})},null,14,K))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("rect",{key:`stack_trap_${r}`,onClick:()=>z(o,r),x:o.start,y:0,width:o.width,height:c.value.height,fill:"transparent",stroke:"none",class:e.normalizeClass({animated:!g.value}),onMouseenter:()=>A({datapoint:o,seriesIndex:r}),onMouseleave:n[0]||(n[0]=p=>{b.value=!1,m.value=null})},null,42,Q))),128))])):(e.openBlock(),e.createElementBlock("rect",{key:1,x:2,y:1,width:c.value.width-4,height:c.value.height-2,stroke:"#CCCCCC","stroke-width":"2",fill:"transparent",rx:(c.value.height-4)/2},null,8,Z))],8,j)):e.createCommentVNode("",!0),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(q.default,{key:2,config:{type:"sparkStackbar",style:{backgroundColor:t.value.style.backgroundColor,sparkStackbar:{color:"#CCCCCC"}}}},null,8,["config"])),t.value.style.legend.show?(e.openBlock(),e.createElementBlock("div",{key:3,style:e.normalizeStyle(`background:transparent;margin:0 auto;margin:${t.value.style.legend.margin};justify-content:${t.value.style.legend.textAlign==="left"?"flex-start":t.value.style.legend.textAlign==="right"?"flex-end":"center"}`),class:"vue-ui-sparkstackbar-legend"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(o,r)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(`font-size:${t.value.style.legend.fontSize}px;`),class:e.normalizeClass({"vue-ui-sparkstackbar-legend-item":!0,"vue-ui-sparkstackbar-legend-item-unselected":d.value.includes(r)}),onClick:p=>{T(r),z(o,r)}},[e.createElementVNode("div",te,[(e.openBlock(),e.createElementBlock("svg",{height:`${t.value.style.legend.fontSize}px`,width:`${t.value.style.legend.fontSize}px`,viewBox:"0 0 10 10"},[e.createElementVNode("circle",{cx:5,cy:5,r:5,fill:o.color},null,8,oe)],8,le)),e.createElementVNode("span",{style:e.normalizeStyle(`color:${t.value.style.legend.name.color}; font-weight:${t.value.style.legend.name.bold?"bold":"normal"}`)},e.toDisplayString(o.name),5),t.value.style.legend.percentage.show?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(`font-weight:${t.value.style.legend.percentage.bold?"bold":"normal"};color:${t.value.style.legend.percentage.color}`)},e.toDisplayString(d.value.includes(r)?" - ":o.proportionLabel),5)):e.createCommentVNode("",!0),t.value.style.legend.value.show?(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle(`font-weight:${t.value.style.legend.value.bold?"bold":"normal"};color:${t.value.style.legend.value.color}`)}," ("+e.toDisplayString(e.unref(a.applyDataLabel)(t.value.style.legend.value.formatter,o.value,e.unref(a.dataLabel)({p:t.value.style.legend.value.prefix,v:o.value,s:t.value.style.legend.value.suffix,r:t.value.style.legend.value.rounding}),{datapoint:o,seriesIndex:r}))+") ",5)):e.createCommentVNode("",!0)])],14,ee))),256))],4)):e.createCommentVNode("",!0),e.createVNode(U._sfc_main,{show:b.value&&t.value.style.tooltip.show,parent:B.value,backgroundColor:t.value.style.tooltip.backgroundColor,color:t.value.style.tooltip.color,fontSize:t.value.style.tooltip.fontSize,borderRadius:t.value.style.tooltip.borderRadius,borderColor:t.value.style.tooltip.borderColor,borderWidth:t.value.style.tooltip.borderWidth,backgroundOpacity:t.value.style.tooltip.backgroundOpacity,position:t.value.style.tooltip.position,content:_.value,isCustom:k.value,offsetY:-124+t.value.style.tooltip.offsetY,blockShiftY:!0},{"tooltip-before":e.withCtx(()=>[e.renderSlot(l.$slots,"tooltip-before",e.normalizeProps(e.guardReactiveProps({...w.value})),void 0,!0)]),"tooltip-after":e.withCtx(()=>[e.renderSlot(l.$slots,"tooltip-after",e.normalizeProps(e.guardReactiveProps({...w.value})),void 0,!0)]),_:3},8,["show","parent","backgroundColor","color","fontSize","borderRadius","borderColor","borderWidth","backgroundOpacity","position","content","isCustom","offsetY"]),l.$slots.source?(e.openBlock(),e.createElementBlock("div",ae,[e.renderSlot(l.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0)],4))}},ne=M._export_sfc(re,[["__scopeId","data-v-72244c73"]]);exports.default=ne;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./index-CC7tVh7F.cjs"),V=require("./useNestedProp-CxwPeWts.cjs"),q=require("./vue-ui-skeleton-BgEjqaz9.cjs"),O=require("./PackageVersion-D3dK8oA3.cjs"),U=require("./Tooltip-C5qSWrXO.cjs"),M=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),j=["xmlns","viewBox"],H=["id"],I=["stop-color"],R=["stop-color"],W=["stop-color"],Y={id:"stackPill",clipPathUnits:"objectBoundingBox"},G=["fill"],X={key:0,"clip-path":"url(#stackPill)"},J=["x","width","height","fill"],K=["x","width","height","fill","stroke"],Q=["onClick","x","width","height","onMouseenter"],Z=["width","height","rx"],ee=["onClick"],te={style:{display:"flex","flex-direction":"row","align-items":"center",gap:"4px","justify-content":"center"}},le=["height","width"],oe=["fill"],ae={key:4,ref:"source",dir:"auto"},re={__name:"vue-ui-sparkstackbar",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint"],setup(P,{emit:D}){const u=P,{vue_ui_sparkstackbar:L}=a.useConfig(),F=e.useSlots();e.onMounted(()=>{F["chart-background"]&&console.warn("VueUiSparkStackbar does not support the #chart-background slot.")});const x=e.computed(()=>!!u.dataset&&u.dataset.length),B=e.ref(null),S=e.ref(a.createUid()),b=e.ref(!1),_=e.ref(""),t=e.computed({get:()=>$(),set:l=>l});function $(){const l=V.useNestedProp({userConfig:u.config,defaultConfig:L});return l.theme?{...V.useNestedProp({userConfig:a.themes.vue_ui_sparkstackbar[l.theme]||u.config,defaultConfig:l}),customPalette:a.themePalettes[l.theme]||a.palette}:l}e.watch(()=>u.config,l=>{t.value=$(),E()},{deep:!0}),e.watch(()=>u.dataset,l=>{v.value=u.dataset.map((n,o)=>({...n,color:n.color?a.convertColorToHex(n.color):f.value[o]||a.palette[o]||a.palette[o%a.palette.length]}))},{deep:!0});const f=e.computed(()=>a.convertCustomPalette(t.value.customPalette)),v=e.ref(u.dataset.map((l,n)=>({...l,value:t.value.style.animation.show?0:l.value||0,color:l.color?a.convertColorToHex(l.color):f.value[n]||a.palette[n]||a.palette[n%a.palette.length]}))),g=e.ref(!0);e.onMounted(()=>{if(E(),t.value.style.animation.show){let p=function(){r+=o/l,r<o?(v.value=v.value.map((s,i)=>({...s,value:s.value+=n[i],color:s.color?a.convertColorToHex(s.color):f.value[i]||a.palette[i]||a.palette[i%a.palette.length]})),requestAnimationFrame(p)):(g.value=!1,v.value=u.dataset.map((s,i)=>({...s,value:s.value||0,color:s.color?a.convertColorToHex(s.color):f.value[i]||a.palette[i]||a.palette[i%a.palette.length],id:a.createUid()})))};const l=t.value.style.animation.animationFrames,n=u.dataset.map((s,i)=>s.value/l),o=u.dataset.map(s=>s.value||0).reduce((s,i)=>s+i,0);let r=0;g.value=!0,p()}});function E(){a.objectIsEmpty(u.dataset)?a.error({componentName:"VueUiSparkStackbar",type:"dataset"}):u.dataset.forEach((l,n)=>{a.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["name","value"]}).forEach(o=>{a.error({componentName:"VueUiSparkStackbar",type:"datasetSerieAttribute",property:o,index:n})})})}const c=e.ref({width:500,height:16}),d=e.ref([]),N=e.computed(()=>u.dataset.map(l=>l.value||0).filter((l,n)=>!d.value.includes(n)).reduce((l,n)=>l+n,0)),y=e.computed(()=>v.value.map((l,n)=>{const o=l.value||0,r=o/N.value,p=isNaN(r)?0:r,s=p*c.value.width;return{...l,value:o,proportion:p,width:s,proportionLabel:a.dataLabel({v:p*100,s:"%",r:t.value.style.legend.percentage.rounding})}})),C=e.computed(()=>y.value.filter((l,n)=>!d.value.includes(n)));function T(l){d.value.includes(l)?d.value=d.value.filter(n=>n!==l):d.value.length<v.value.length-1&&d.value.push(l)}const h=e.computed(()=>{let l=0;const n=[];for(let o=0;o<C.value.length;o+=1)n.push({...C.value[o],start:l}),l+=C.value[o].width;return n});function z(l,n){D("selectDatapoint",{datapoint:l,index:n})}const w=e.ref(null),k=e.ref(!1),m=e.ref(null);function A({datapoint:l,seriesIndex:n}){if(!t.value.style.tooltip.show)return;w.value={datapoint:l,seriesIndex:n,config:t.value,series:y.value},b.value=!0,m.value=n;const o=t.value.style.tooltip.customFormat;if(a.isFunction(o))try{const r=o({seriesIndex:n,datapoint:l,series:y.value,config:t.value});typeof r=="string"&&(_.value=r,k.value=!0)}catch{console.warn("Custom format cannot be applied."),k.value=!1}if(!k.value){let r="";r+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${t.value.style.tooltip.borderColor};padding-bottom:6px;margin-bottom:3px;">${l.name}</div>`,r+=`<div style="display:flex;flex-direction:row;gap:6px;align-items:center;"><svg viewBox="0 0 12 12" height="14" width="14"><circle cx="6" cy="6" r="6" stroke="none" fill="${l.color}"/></svg>`,r+=`<b>${l.proportionLabel}</b>`,r+=`<span>(${a.applyDataLabel(t.value.style.legend.value.formatter,l.value,a.dataLabel({p:t.value.style.legend.value.prefix,v:l.value,s:t.value.style.legend.value.suffix,r:t.value.style.legend.value.rounding}),{datapoint:l,seriesIndex:n})})</span>`,_.value=`<div>${r}</div>`}}return(l,n)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"sparkstackbarChart",ref:B,style:e.normalizeStyle(`width:100%; background:${t.value.style.backgroundColor}`)},[t.value.style.title.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`width:calc(100% - 12px);background:transparent;margin:0 auto;margin:${t.value.style.title.margin};padding: 0 6px;text-align:${t.value.style.title.textAlign}`)},[e.createElementVNode("div",{style:e.normalizeStyle(`font-size:${t.value.style.title.fontSize}px;color:${t.value.style.title.color};font-weight:${t.value.style.title.bold?"bold":"normal"}`)},e.toDisplayString(t.value.style.title.text),5),t.value.style.title.subtitle.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(`font-size:${t.value.style.title.subtitle.fontSize}px;color:${t.value.style.title.subtitle.color};font-weight:${t.value.style.title.subtitle.bold?"bold":"normal"}`)},e.toDisplayString(t.value.style.title.subtitle.text),5)):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),x.value?(e.openBlock(),e.createElementBlock("svg",{key:1,xmlns:e.unref(a.XMLNS),width:"100%",viewBox:`0 0 ${c.value.width} ${c.value.height}`},[e.createVNode(O._sfc_main),e.createElementVNode("defs",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("linearGradient",{key:`stack_gradient_${r}`,gradientTransform:"rotate(90)",id:`stack_gradient_${r}_${S.value}`},[e.createElementVNode("stop",{offset:"0%","stop-color":o.color},null,8,I),e.createElementVNode("stop",{offset:"50%","stop-color":e.unref(a.setOpacity)(e.unref(a.shiftHue)(o.color,.05),100-t.value.style.bar.gradient.intensity)},null,8,R),e.createElementVNode("stop",{offset:"100%","stop-color":o.color},null,8,W)],8,H))),128)),e.createElementVNode("clipPath",Y,[e.createElementVNode("rect",{x:"0.005",y:"-2",width:"0.99",height:"5",rx:"3",ry:"3",fill:t.value.style.backgroundColor},null,8,G)])]),N.value>0?(e.openBlock(),e.createElementBlock("g",X,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("rect",{key:`stack_underlayer_${r}`,x:o.start,y:0,width:o.width,height:c.value.height,fill:t.value.style.bar.gradient.underlayerColor,class:e.normalizeClass({animated:!g.value}),style:e.normalizeStyle({opacity:m.value!==null&&t.value.style.tooltip.show?m.value===r?1:.5:1})},null,14,J))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("rect",{key:`stack_${r}`,x:o.start,y:0,width:o.width,height:c.value.height,fill:t.value.style.bar.gradient.show?`url(#stack_gradient_${r}_${S.value})`:o.color,stroke:t.value.style.backgroundColor,"stroke-linecap":"round",class:e.normalizeClass({animated:!g.value}),style:e.normalizeStyle({opacity:m.value!==null&&t.value.style.tooltip.show?m.value===r?1:.5:1})},null,14,K))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(o,r)=>(e.openBlock(),e.createElementBlock("rect",{key:`stack_trap_${r}`,onClick:()=>z(o,r),x:o.start,y:0,width:o.width,height:c.value.height,fill:"transparent",stroke:"none",class:e.normalizeClass({animated:!g.value}),onMouseenter:()=>A({datapoint:o,seriesIndex:r}),onMouseleave:n[0]||(n[0]=p=>{b.value=!1,m.value=null})},null,42,Q))),128))])):(e.openBlock(),e.createElementBlock("rect",{key:1,x:2,y:1,width:c.value.width-4,height:c.value.height-2,stroke:"#CCCCCC","stroke-width":"2",fill:"transparent",rx:(c.value.height-4)/2},null,8,Z))],8,j)):e.createCommentVNode("",!0),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(q.default,{key:2,config:{type:"sparkStackbar",style:{backgroundColor:t.value.style.backgroundColor,sparkStackbar:{color:"#CCCCCC"}}}},null,8,["config"])),t.value.style.legend.show?(e.openBlock(),e.createElementBlock("div",{key:3,style:e.normalizeStyle(`background:transparent;margin:0 auto;margin:${t.value.style.legend.margin};justify-content:${t.value.style.legend.textAlign==="left"?"flex-start":t.value.style.legend.textAlign==="right"?"flex-end":"center"}`),class:"vue-ui-sparkstackbar-legend"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(o,r)=>(e.openBlock(),e.createElementBlock("div",{style:e.normalizeStyle(`font-size:${t.value.style.legend.fontSize}px;`),class:e.normalizeClass({"vue-ui-sparkstackbar-legend-item":!0,"vue-ui-sparkstackbar-legend-item-unselected":d.value.includes(r)}),onClick:p=>{T(r),z(o,r)}},[e.createElementVNode("div",te,[(e.openBlock(),e.createElementBlock("svg",{height:`${t.value.style.legend.fontSize}px`,width:`${t.value.style.legend.fontSize}px`,viewBox:"0 0 10 10"},[e.createElementVNode("circle",{cx:5,cy:5,r:5,fill:o.color},null,8,oe)],8,le)),e.createElementVNode("span",{style:e.normalizeStyle(`color:${t.value.style.legend.name.color}; font-weight:${t.value.style.legend.name.bold?"bold":"normal"}`)},e.toDisplayString(o.name),5),t.value.style.legend.percentage.show?(e.openBlock(),e.createElementBlock("span",{key:0,style:e.normalizeStyle(`font-weight:${t.value.style.legend.percentage.bold?"bold":"normal"};color:${t.value.style.legend.percentage.color}`)},e.toDisplayString(d.value.includes(r)?" - ":o.proportionLabel),5)):e.createCommentVNode("",!0),t.value.style.legend.value.show?(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle(`font-weight:${t.value.style.legend.value.bold?"bold":"normal"};color:${t.value.style.legend.value.color}`)}," ("+e.toDisplayString(e.unref(a.applyDataLabel)(t.value.style.legend.value.formatter,o.value,e.unref(a.dataLabel)({p:t.value.style.legend.value.prefix,v:o.value,s:t.value.style.legend.value.suffix,r:t.value.style.legend.value.rounding}),{datapoint:o,seriesIndex:r}))+") ",5)):e.createCommentVNode("",!0)])],14,ee))),256))],4)):e.createCommentVNode("",!0),e.createVNode(U._sfc_main,{show:b.value&&t.value.style.tooltip.show,parent:B.value,backgroundColor:t.value.style.tooltip.backgroundColor,color:t.value.style.tooltip.color,fontSize:t.value.style.tooltip.fontSize,borderRadius:t.value.style.tooltip.borderRadius,borderColor:t.value.style.tooltip.borderColor,borderWidth:t.value.style.tooltip.borderWidth,backgroundOpacity:t.value.style.tooltip.backgroundOpacity,position:t.value.style.tooltip.position,content:_.value,isCustom:k.value,offsetY:-124+t.value.style.tooltip.offsetY,blockShiftY:!0},{"tooltip-before":e.withCtx(()=>[e.renderSlot(l.$slots,"tooltip-before",e.normalizeProps(e.guardReactiveProps({...w.value})),void 0,!0)]),"tooltip-after":e.withCtx(()=>[e.renderSlot(l.$slots,"tooltip-after",e.normalizeProps(e.guardReactiveProps({...w.value})),void 0,!0)]),_:3},8,["show","parent","backgroundColor","color","fontSize","borderRadius","borderColor","borderWidth","backgroundOpacity","position","content","isCustom","offsetY"]),l.$slots.source?(e.openBlock(),e.createElementBlock("div",ae,[e.renderSlot(l.$slots,"source",{},void 0,!0)],512)):e.createCommentVNode("",!0)],4))}},ne=M._export_sfc(re,[["__scopeId","data-v-72244c73"]]);exports.default=ne;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("./index-CgZGelSi.cjs"),Me=require("./useNestedProp-BxCE3J3Z.cjs"),Te=require("./useResponsive-BJ7DTGpm.cjs"),Ve=require("./usePrinter-sTw1FdN_.cjs"),tt=require("./Slicer-CkI4c7ft.cjs"),at=require("./Tooltip-AHTiRuWB.cjs"),lt=require("./Title-DjAOcuWO.cjs"),ot=require("./Legend-CMyzYtIb.cjs"),rt=require("./vue-ui-accordion-BZH6cz4t.cjs"),st=require("./DataTable-Dtq94CxH.cjs"),nt=require("./vue-ui-skeleton-m4l9jfqA.cjs"),it=require("./PackageVersion-B_1OHk5A.cjs"),ut=require("./PenAndPaper-DhXsAnuf.cjs"),ct=require("./useUserOptionState-BgepsfED.cjs"),dt=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),vt=["id"],ht=["xmlns","viewBox"],mt=["x","y","width","height"],gt={key:1},yt=["id"],bt=["stop-color"],pt=["stop-color"],ft=["stop-color"],kt=["x1","x2","y1","y2","stroke"],xt=["x1","x2","y1","y2","stroke"],wt=["x1","x2","y1","y2","stroke"],Bt=["x1","x2","y1","y2","stroke"],Ct=["x","y","height","rx","width","fill","stroke","stroke-width"],St=["x","y","width","rx","height","fill","stroke","stroke-width"],zt=["x1","x2","y1","y2","stroke","stroke-width"],Lt=["x1","x2","y1","y2","stroke","stroke-width"],Nt=["x","y","font-size","fill","font-weight"],Et=["transform","font-size","fill","font-weight"],_t=["x","y","font-size","fill","font-weight"],$t={key:0},Mt=["x","y","font-size","font-weight","fill"],Tt=["x","y","font-size","fill","font-weight"],Vt={key:0},Pt=["x","y","font-size","font-weight","fill"],Ft=["x1","x2","y1","y2","stroke"],It=["x","y","font-size","font-weight","fill"],Ot=["x1","x2","y1","y2","stroke"],Rt=["font-size","font-weight","fill","text-anchor","transform"],Dt={key:0},At={key:1},qt=["text-anchor","font-size","font-weight","fill","transform","onClick"],Ht={key:0},Ut={key:1},Wt=["font-size","font-weight","fill","x","y","onClick"],Yt=["x","y","width","height","onClick","onMouseenter","fill"],Xt=["x","y","width","height","onClick","onMouseenter","fill"],Gt={key:4,class:"vue-data-ui-watermark"},Jt=["onClick"],Zt=["innerHTML"],Kt={__name:"vue-ui-stackbar",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint","selectLegend","selectTimeLabel"],setup(X,{expose:Pe,emit:G}){const v=X,{vue_ui_stackbar:Fe}=c.useConfig(),$=e.computed({get(){return!!v.dataset&&v.dataset.length},set(l){return l}}),M=e.ref(null),J=e.ref(c.createUid()),R=e.ref(!1),ee=e.ref(null),Z=e.ref(""),p=e.ref([]),te=e.ref(0),ae=e.ref(null),le=e.ref(null),oe=e.ref(null),re=e.ref(null),se=e.ref(0),D=e.ref(!1),V=e.ref(null),P=e.ref(!1),Ie=e.ref(0),Oe=e.ref(0),Re=e.ref(0),T=e.ref(null);e.onMounted(()=>{Q()});const t=e.computed({get:()=>ue(),set:l=>l}),{userOptionsVisible:K,setUserOptionsVisibility:ne,keepUserOptionState:ie}=ct.useUserOptionState({config:t.value});function ue(){const l=Me.useNestedProp({userConfig:v.config,defaultConfig:Fe});let o={};return l.theme?o={...Me.useNestedProp({userConfig:c.themes.vue_ui_stackbar[l.theme]||v.config,defaultConfig:l}),customPalette:c.themePalettes[l.theme]||c.palette}:o=l,v.config&&c.hasDeepProperty(v.config,"style.chart.grid.scale.scaleMin")?o.style.chart.grid.scale.scaleMin=v.config.style.chart.grid.scale.scaleMin:o.style.chart.grid.scale.scaleMin=null,v.config&&c.hasDeepProperty(v.config,"style.chart.grid.scale.scaleMax")?o.style.chart.grid.scale.scaleMax=v.config.style.chart.grid.scale.scaleMax:o.style.chart.grid.scale.scaleMax=null,v.config&&c.hasDeepProperty(v.config,"style.chart.zoom.startIndex")?o.style.chart.zoom.startIndex=v.config.style.chart.zoom.startIndex:o.style.chart.zoom.startIndex=null,v.config&&c.hasDeepProperty(v.config,"style.chart.zoom.endIndex")?o.style.chart.zoom.endIndex=v.config.style.chart.zoom.endIndex:o.style.chart.zoom.endIndex=null,o}e.watch(()=>v.config,l=>{t.value=ue(),K.value=!t.value.showOnChartHover,Q(),Ie.value+=1,Oe.value+=1,Re.value+=1},{deep:!0}),e.watch(()=>v.dataset,l=>{ye()},{deep:!0});const b=e.ref({dataLabels:{show:t.value.style.chart.bars.dataLabels.show},showTable:t.value.table.show,showTooltip:t.value.style.chart.tooltip.show}),{isPrinting:ce,isImaging:de,generatePdf:ve,generateImage:he}=Ve.usePrinter({elementId:`stackbar_${J.value}`,fileName:t.value.style.chart.title.text||"vue-ui-stackbar"}),A=e.ref({width:t.value.style.chart.width,height:t.value.style.chart.height,paddingRatio:{top:t.value.style.chart.padding.top/t.value.style.chart.height,right:t.value.style.chart.padding.right/t.value.style.chart.width,bottom:t.value.style.chart.padding.bottom/t.value.style.chart.height,left:t.value.style.chart.padding.left/t.value.style.chart.width}}),De=e.computed(()=>c.convertCustomPalette(t.value.customPalette)),me=e.ref(null),ge=e.ref(null);e.onMounted(()=>{Q()});function Q(){if(c.objectIsEmpty(v.dataset)?c.error({componentName:"VueUiStackbar",type:"dataset"}):v.dataset.forEach((l,o)=>{c.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["name","series"]}).forEach(a=>{$.value=!1,c.error({componentName:"VueUiStackbar",type:"datasetSerieAttribute",property:a,index:o})})}),setTimeout(()=>{P.value=!0},10),t.value.responsive){const l=Te.throttle(()=>{P.value=!1;const{width:o,height:a}=Te.useResponsive({chart:M.value,title:t.value.style.chart.title.text?ae.value:null,legend:t.value.style.chart.legend.show?le.value:null,slicer:t.value.style.chart.zoom.show&&S.value>1?oe.value:null,source:re.value});A.value.width=o,A.value.height=a,clearTimeout(ge.value),ge.value=setTimeout(()=>{P.value=!0},10)});me.value=new ResizeObserver(l),me.value.observe(M.value.parentNode)}be()}const s=e.computed(()=>{const{height:l,width:o}=A.value,{right:a}=A.value.paddingRatio,r=t.value.style.chart.padding.top,n=o-o*a,i=l-t.value.style.chart.padding.bottom,y=t.value.style.chart.padding.left,L=o-y-o*a,N=l-r-t.value.style.chart.padding.bottom;return{chartHeight:l,chartWidth:o,top:r,right:n,bottom:i,left:y,width:L,height:N<0?0:N}}),C=e.computed(()=>v.dataset.map((l,o)=>{const a=c.convertColorToHex(l.color)||De.value[o]||c.palette[o]||c.palette[o%c.palette.length];return{...l,series:JSON.parse(JSON.stringify(l.series)).map(r=>t.value.style.chart.bars.distributed?Math.abs(r):r),signedSeries:l.series.map(r=>r>=0?1:-1),absoluteIndex:o,id:c.createUid(),color:a}})),S=e.computed(()=>Math.max(...C.value.filter(l=>!p.value.includes(l.id)).map(l=>l.series.length))),u=e.ref({start:0,end:Math.max(...v.dataset.map(l=>l.series.length))});function ye(){be()}async function be(){(t.value.style.chart.zoom.startIndex!==null||t.value.style.chart.zoom.endIndex!==null)&&T.value?(t.value.style.chart.zoom.startIndex!==null&&(await e.nextTick(),await e.nextTick(),T.value&&T.value.setStartValue(t.value.style.chart.zoom.startIndex)),t.value.style.chart.zoom.endIndex!==null&&(await e.nextTick(),await e.nextTick(),T.value&&T.value.setEndValue(Ae(t.value.style.chart.zoom.endIndex+1)))):(u.value={start:0,end:Math.max(...v.dataset.map(l=>l.series.length))},se.value+=1)}function Ae(l){const o=Math.max(...v.dataset.map(a=>a.series.length));return l>o?o:l<0||t.value.style.chart.zoom.startIndex!==null&&l<t.value.style.chart.zoom.startIndex?t.value.style.chart.zoom.startIndex!==null?t.value.style.chart.zoom.startIndex+1:1:l}const d=e.computed(()=>{let l;return t.value.orientation==="vertical"?l=s.value.width/(u.value.end-u.value.start):l=s.value.height/(u.value.end-u.value.start),l<=0?0:l}),F=e.computed(()=>c.sumSeries(C.value.filter(l=>!p.value.includes(l.id))).slice(u.value.start,u.value.end)),qe=e.computed(()=>c.sumSeries(C.value.filter(l=>!p.value.includes(l.id)).map(l=>({...l,series:l.series.map((o,a)=>l.signedSeries[a]===-1&&o>=0?-o:o)}))).slice(u.value.start,u.value.end)),q=e.computed(()=>{const l=C.value.filter(o=>!p.value.includes(o.id));return{positive:c.sumSeries(l.map(o=>({...o,series:o.series.slice(u.value.start,u.value.end).map(a=>a>=0?a:0)}))),negative:c.sumSeries(l.map(o=>({...o,series:o.series.slice(u.value.start,u.value.end).map(a=>a<0?a:0)})))}}),w=e.computed(()=>{const l=t.value.style.chart.grid.scale.scaleMax!==null&&!t.value.style.chart.bars.distributed?t.value.style.chart.grid.scale.scaleMax:Math.max(...q.value.positive),o=Math.min(...q.value.negative),a=t.value.style.chart.grid.scale.scaleMin!==null&&!t.value.style.chart.bars.distributed?t.value.style.chart.grid.scale.scaleMin:[-1/0,1/0,NaN,void 0,null].includes(o)?0:o,r=!t.value.style.chart.bars.distributed&&(t.value.style.chart.grid.scale.scaleMax!==null||t.value.style.chart.grid.scale.scaleMin!==null)?c.calculateNiceScaleWithExactExtremes(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks):c.calculateNiceScale(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks);return r.ticks.map(n=>({zero:s.value.bottom-s.value.height*(Math.abs(r.min)/(r.max+Math.abs(r.min))),y:s.value.bottom-s.value.height*((n+Math.abs(r.min))/(r.max+Math.abs(r.min))),x:s.value.left-8,horizontal_zero:s.value.left+s.value.width*(Math.abs(r.min)/(r.max+Math.abs(r.min))),horizontal_x:s.value.left+s.value.width*((n+Math.abs(r.min))/(r.max+Math.abs(r.min))),horizontal_y:s.value.bottom-8,value:n}))}),z=e.computed(()=>{const l=[];for(let o=0;o<S.value;o+=1)l.push({text:t.value.style.chart.grid.x.timeLabels.values[o]||String(o),absoluteIndex:o});return l.slice(u.value.start,u.value.end)}),g=e.computed(()=>{if(!$.value)return[];let l=Array(S.value).fill(0),o=Array(S.value).fill(0),a=Array(S.value).fill(0),r=Array(S.value).fill(0);const n=Math.max(...q.value.positive)||0,i=Math.min(...q.value.negative),y=[-1/0,1/0,NaN,void 0,null].includes(i)?0:i,L=!t.value.style.chart.bars.distributed&&(t.value.style.chart.grid.scale.scaleMax!==null||t.value.style.chart.grid.scale.scaleMin!==null)?c.calculateNiceScaleWithExactExtremes(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:y>0?0:y,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:n<0?0:n,t.value.style.chart.grid.scale.ticks):c.calculateNiceScale(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:y>0?0:y,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:n<0?0:n,t.value.style.chart.grid.scale.ticks),{min:N,max:I}=L,E=I+(N>=0?0:Math.abs(N))||1,f=s.value.height,Y=s.value.width,_e=w.value[0]?w.value[0].zero:s.value.bottom,$e=w.value[0]?w.value[0].horizontal_zero:s.value.left;return C.value.filter(O=>!p.value.includes(O.id)).map(O=>{const B=O.series.slice(u.value.start,u.value.end),Xe=O.signedSeries.slice(u.value.start,u.value.end),Ge=B.map((h,m)=>s.value.left+d.value*m+d.value*t.value.style.chart.bars.gapRatio/4),Je=B.map((h,m)=>s.value.top+d.value*m+d.value*t.value.style.chart.bars.gapRatio/4),Ze=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;let _,x;return h>0?(x=f*k,_=_e-x-l[m],l[m]+=x):(x=f*k,_=_e+a[m],a[m]+=Math.abs(x)),_}),Ke=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;let _,x;return h>0?(x=Y*k,_=$e+o[m],o[m]+=x):(x=Y*k,_=$e-Math.abs(x)-r[m],r[m]+=Math.abs(x)),_}),Qe=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;return h>0?f*k:f*Math.abs(k)}),je=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;return h>0?Y*k:Y*Math.abs(k)}),et=B.map(h=>Math.abs(h)).reduce((h,m)=>h+m,0);return{...O,proportions:B.map((h,m)=>t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/et),series:B,signedSeries:Xe,x:Ge,y:Ze,height:Qe,horizontal_width:je,horizontal_y:Je,horizontal_x:Ke}})}),pe=e.computed(()=>qe.value.map((l,o)=>({value:l,sign:l>=0?1:-1})));function H(l,o,a,r,n){const i=n===-1&&l>=0?-l:l;return c.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,i,c.dataLabel({p:t.value.style.chart.bars.dataLabels.prefix,v:i,s:t.value.style.chart.bars.dataLabels.suffix,r:t.value.style.chart.bars.dataLabels.rounding}),{datapoint:o,seriesIndex:a,datapointIndex:r})}function fe(l,o,a,r){return c.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,l,c.dataLabel({v:isNaN(l)?0:l,s:"%",r:t.value.style.chart.bars.dataLabels.rounding}),{datapoint:o,seriesIndex:a,datapointIndex:r})}function ke(l){const o=JSON.parse(JSON.stringify(g.value)).map(a=>({name:a.name,value:a.series[l]===0?0:a.series[l]||null,proportion:a.proportions[l]||null,color:a.color,id:a.id}));G("selectDatapoint",{datapoint:o,period:z.value[l]})}function xe(l){V.value=l,R.value=!0;const o=t.value.style.chart.tooltip.customFormat,a=JSON.parse(JSON.stringify(g.value)).map(n=>({name:n.name,value:n.series[l]===0?0:(n.signedSeries[l]===-1&&n.series[l]>=0?-n.series[l]:n.series[l])||null,proportion:n.proportions[l]||null,color:n.color,id:n.id})),r=a.map(n=>Math.abs(n.value)).reduce((n,i)=>n+i,0);if(c.isFunction(o)&&c.functionReturnsString(()=>o({seriesIndex:l,datapoint:a,series:g.value,config:t.value})))Z.value=o({seriesIndex:l,datapoint:a,series:g.value,config:t.value});else{const{showValue:n,showPercentage:i,borderColor:y,roundingValue:L,roundingPercentage:N}=t.value.style.chart.tooltip;let I="";z.value[l]&&z.value[l].text&&t.value.style.chart.tooltip.showTimeLabel&&(I+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${y};padding-bottom:6px;margin-bottom:3px;">${z.value[l].text}</div>`);const E=[n&&i?"(":"",n&&i?")":""];a.reverse().forEach(f=>{I+=`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("./index-CC7tVh7F.cjs"),Me=require("./useNestedProp-CxwPeWts.cjs"),Te=require("./useResponsive-BJ7DTGpm.cjs"),Ve=require("./usePrinter-CMvfTteH.cjs"),tt=require("./Slicer-BggxvZRw.cjs"),at=require("./Tooltip-C5qSWrXO.cjs"),lt=require("./Title-BhL7TMa_.cjs"),ot=require("./Legend-CAgxjrra.cjs"),rt=require("./vue-ui-accordion-IZgkGqto.cjs"),st=require("./DataTable-BLSMgcEN.cjs"),nt=require("./vue-ui-skeleton-BgEjqaz9.cjs"),it=require("./PackageVersion-D3dK8oA3.cjs"),ut=require("./PenAndPaper-CYFIR9j7.cjs"),ct=require("./useUserOptionState-BgepsfED.cjs"),dt=require("./_plugin-vue_export-helper-BHFhmbuH.cjs"),vt=["id"],ht=["xmlns","viewBox"],mt=["x","y","width","height"],gt={key:1},yt=["id"],bt=["stop-color"],pt=["stop-color"],ft=["stop-color"],kt=["x1","x2","y1","y2","stroke"],xt=["x1","x2","y1","y2","stroke"],wt=["x1","x2","y1","y2","stroke"],Bt=["x1","x2","y1","y2","stroke"],Ct=["x","y","height","rx","width","fill","stroke","stroke-width"],St=["x","y","width","rx","height","fill","stroke","stroke-width"],zt=["x1","x2","y1","y2","stroke","stroke-width"],Lt=["x1","x2","y1","y2","stroke","stroke-width"],Nt=["x","y","font-size","fill","font-weight"],Et=["transform","font-size","fill","font-weight"],_t=["x","y","font-size","fill","font-weight"],$t={key:0},Mt=["x","y","font-size","font-weight","fill"],Tt=["x","y","font-size","fill","font-weight"],Vt={key:0},Pt=["x","y","font-size","font-weight","fill"],Ft=["x1","x2","y1","y2","stroke"],It=["x","y","font-size","font-weight","fill"],Ot=["x1","x2","y1","y2","stroke"],Rt=["font-size","font-weight","fill","text-anchor","transform"],Dt={key:0},At={key:1},qt=["text-anchor","font-size","font-weight","fill","transform","onClick"],Ht={key:0},Ut={key:1},Wt=["font-size","font-weight","fill","x","y","onClick"],Yt=["x","y","width","height","onClick","onMouseenter","fill"],Xt=["x","y","width","height","onClick","onMouseenter","fill"],Gt={key:4,class:"vue-data-ui-watermark"},Jt=["onClick"],Zt=["innerHTML"],Kt={__name:"vue-ui-stackbar",props:{config:{type:Object,default(){return{}}},dataset:{type:Array,default(){return[]}}},emits:["selectDatapoint","selectLegend","selectTimeLabel"],setup(X,{expose:Pe,emit:G}){const v=X,{vue_ui_stackbar:Fe}=c.useConfig(),$=e.computed({get(){return!!v.dataset&&v.dataset.length},set(l){return l}}),M=e.ref(null),J=e.ref(c.createUid()),R=e.ref(!1),ee=e.ref(null),Z=e.ref(""),p=e.ref([]),te=e.ref(0),ae=e.ref(null),le=e.ref(null),oe=e.ref(null),re=e.ref(null),se=e.ref(0),D=e.ref(!1),V=e.ref(null),P=e.ref(!1),Ie=e.ref(0),Oe=e.ref(0),Re=e.ref(0),T=e.ref(null);e.onMounted(()=>{Q()});const t=e.computed({get:()=>ue(),set:l=>l}),{userOptionsVisible:K,setUserOptionsVisibility:ne,keepUserOptionState:ie}=ct.useUserOptionState({config:t.value});function ue(){const l=Me.useNestedProp({userConfig:v.config,defaultConfig:Fe});let o={};return l.theme?o={...Me.useNestedProp({userConfig:c.themes.vue_ui_stackbar[l.theme]||v.config,defaultConfig:l}),customPalette:c.themePalettes[l.theme]||c.palette}:o=l,v.config&&c.hasDeepProperty(v.config,"style.chart.grid.scale.scaleMin")?o.style.chart.grid.scale.scaleMin=v.config.style.chart.grid.scale.scaleMin:o.style.chart.grid.scale.scaleMin=null,v.config&&c.hasDeepProperty(v.config,"style.chart.grid.scale.scaleMax")?o.style.chart.grid.scale.scaleMax=v.config.style.chart.grid.scale.scaleMax:o.style.chart.grid.scale.scaleMax=null,v.config&&c.hasDeepProperty(v.config,"style.chart.zoom.startIndex")?o.style.chart.zoom.startIndex=v.config.style.chart.zoom.startIndex:o.style.chart.zoom.startIndex=null,v.config&&c.hasDeepProperty(v.config,"style.chart.zoom.endIndex")?o.style.chart.zoom.endIndex=v.config.style.chart.zoom.endIndex:o.style.chart.zoom.endIndex=null,o}e.watch(()=>v.config,l=>{t.value=ue(),K.value=!t.value.showOnChartHover,Q(),Ie.value+=1,Oe.value+=1,Re.value+=1},{deep:!0}),e.watch(()=>v.dataset,l=>{ye()},{deep:!0});const b=e.ref({dataLabels:{show:t.value.style.chart.bars.dataLabels.show},showTable:t.value.table.show,showTooltip:t.value.style.chart.tooltip.show}),{isPrinting:ce,isImaging:de,generatePdf:ve,generateImage:he}=Ve.usePrinter({elementId:`stackbar_${J.value}`,fileName:t.value.style.chart.title.text||"vue-ui-stackbar"}),A=e.ref({width:t.value.style.chart.width,height:t.value.style.chart.height,paddingRatio:{top:t.value.style.chart.padding.top/t.value.style.chart.height,right:t.value.style.chart.padding.right/t.value.style.chart.width,bottom:t.value.style.chart.padding.bottom/t.value.style.chart.height,left:t.value.style.chart.padding.left/t.value.style.chart.width}}),De=e.computed(()=>c.convertCustomPalette(t.value.customPalette)),me=e.ref(null),ge=e.ref(null);e.onMounted(()=>{Q()});function Q(){if(c.objectIsEmpty(v.dataset)?c.error({componentName:"VueUiStackbar",type:"dataset"}):v.dataset.forEach((l,o)=>{c.getMissingDatasetAttributes({datasetObject:l,requiredAttributes:["name","series"]}).forEach(a=>{$.value=!1,c.error({componentName:"VueUiStackbar",type:"datasetSerieAttribute",property:a,index:o})})}),setTimeout(()=>{P.value=!0},10),t.value.responsive){const l=Te.throttle(()=>{P.value=!1;const{width:o,height:a}=Te.useResponsive({chart:M.value,title:t.value.style.chart.title.text?ae.value:null,legend:t.value.style.chart.legend.show?le.value:null,slicer:t.value.style.chart.zoom.show&&S.value>1?oe.value:null,source:re.value});A.value.width=o,A.value.height=a,clearTimeout(ge.value),ge.value=setTimeout(()=>{P.value=!0},10)});me.value=new ResizeObserver(l),me.value.observe(M.value.parentNode)}be()}const s=e.computed(()=>{const{height:l,width:o}=A.value,{right:a}=A.value.paddingRatio,r=t.value.style.chart.padding.top,n=o-o*a,i=l-t.value.style.chart.padding.bottom,y=t.value.style.chart.padding.left,L=o-y-o*a,N=l-r-t.value.style.chart.padding.bottom;return{chartHeight:l,chartWidth:o,top:r,right:n,bottom:i,left:y,width:L,height:N<0?0:N}}),C=e.computed(()=>v.dataset.map((l,o)=>{const a=c.convertColorToHex(l.color)||De.value[o]||c.palette[o]||c.palette[o%c.palette.length];return{...l,series:JSON.parse(JSON.stringify(l.series)).map(r=>t.value.style.chart.bars.distributed?Math.abs(r):r),signedSeries:l.series.map(r=>r>=0?1:-1),absoluteIndex:o,id:c.createUid(),color:a}})),S=e.computed(()=>Math.max(...C.value.filter(l=>!p.value.includes(l.id)).map(l=>l.series.length))),u=e.ref({start:0,end:Math.max(...v.dataset.map(l=>l.series.length))});function ye(){be()}async function be(){(t.value.style.chart.zoom.startIndex!==null||t.value.style.chart.zoom.endIndex!==null)&&T.value?(t.value.style.chart.zoom.startIndex!==null&&(await e.nextTick(),await e.nextTick(),T.value&&T.value.setStartValue(t.value.style.chart.zoom.startIndex)),t.value.style.chart.zoom.endIndex!==null&&(await e.nextTick(),await e.nextTick(),T.value&&T.value.setEndValue(Ae(t.value.style.chart.zoom.endIndex+1)))):(u.value={start:0,end:Math.max(...v.dataset.map(l=>l.series.length))},se.value+=1)}function Ae(l){const o=Math.max(...v.dataset.map(a=>a.series.length));return l>o?o:l<0||t.value.style.chart.zoom.startIndex!==null&&l<t.value.style.chart.zoom.startIndex?t.value.style.chart.zoom.startIndex!==null?t.value.style.chart.zoom.startIndex+1:1:l}const d=e.computed(()=>{let l;return t.value.orientation==="vertical"?l=s.value.width/(u.value.end-u.value.start):l=s.value.height/(u.value.end-u.value.start),l<=0?0:l}),F=e.computed(()=>c.sumSeries(C.value.filter(l=>!p.value.includes(l.id))).slice(u.value.start,u.value.end)),qe=e.computed(()=>c.sumSeries(C.value.filter(l=>!p.value.includes(l.id)).map(l=>({...l,series:l.series.map((o,a)=>l.signedSeries[a]===-1&&o>=0?-o:o)}))).slice(u.value.start,u.value.end)),q=e.computed(()=>{const l=C.value.filter(o=>!p.value.includes(o.id));return{positive:c.sumSeries(l.map(o=>({...o,series:o.series.slice(u.value.start,u.value.end).map(a=>a>=0?a:0)}))),negative:c.sumSeries(l.map(o=>({...o,series:o.series.slice(u.value.start,u.value.end).map(a=>a<0?a:0)})))}}),w=e.computed(()=>{const l=t.value.style.chart.grid.scale.scaleMax!==null&&!t.value.style.chart.bars.distributed?t.value.style.chart.grid.scale.scaleMax:Math.max(...q.value.positive),o=Math.min(...q.value.negative),a=t.value.style.chart.grid.scale.scaleMin!==null&&!t.value.style.chart.bars.distributed?t.value.style.chart.grid.scale.scaleMin:[-1/0,1/0,NaN,void 0,null].includes(o)?0:o,r=!t.value.style.chart.bars.distributed&&(t.value.style.chart.grid.scale.scaleMax!==null||t.value.style.chart.grid.scale.scaleMin!==null)?c.calculateNiceScaleWithExactExtremes(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks):c.calculateNiceScale(a>0?0:a,l<0?0:l,t.value.style.chart.grid.scale.ticks);return r.ticks.map(n=>({zero:s.value.bottom-s.value.height*(Math.abs(r.min)/(r.max+Math.abs(r.min))),y:s.value.bottom-s.value.height*((n+Math.abs(r.min))/(r.max+Math.abs(r.min))),x:s.value.left-8,horizontal_zero:s.value.left+s.value.width*(Math.abs(r.min)/(r.max+Math.abs(r.min))),horizontal_x:s.value.left+s.value.width*((n+Math.abs(r.min))/(r.max+Math.abs(r.min))),horizontal_y:s.value.bottom-8,value:n}))}),z=e.computed(()=>{const l=[];for(let o=0;o<S.value;o+=1)l.push({text:t.value.style.chart.grid.x.timeLabels.values[o]||String(o),absoluteIndex:o});return l.slice(u.value.start,u.value.end)}),g=e.computed(()=>{if(!$.value)return[];let l=Array(S.value).fill(0),o=Array(S.value).fill(0),a=Array(S.value).fill(0),r=Array(S.value).fill(0);const n=Math.max(...q.value.positive)||0,i=Math.min(...q.value.negative),y=[-1/0,1/0,NaN,void 0,null].includes(i)?0:i,L=!t.value.style.chart.bars.distributed&&(t.value.style.chart.grid.scale.scaleMax!==null||t.value.style.chart.grid.scale.scaleMin!==null)?c.calculateNiceScaleWithExactExtremes(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:y>0?0:y,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:n<0?0:n,t.value.style.chart.grid.scale.ticks):c.calculateNiceScale(t.value.style.chart.grid.scale.scaleMin!==null?t.value.style.chart.grid.scale.scaleMin:y>0?0:y,t.value.style.chart.grid.scale.scaleMax!==null?t.value.style.chart.grid.scale.scaleMax:n<0?0:n,t.value.style.chart.grid.scale.ticks),{min:N,max:I}=L,E=I+(N>=0?0:Math.abs(N))||1,f=s.value.height,Y=s.value.width,_e=w.value[0]?w.value[0].zero:s.value.bottom,$e=w.value[0]?w.value[0].horizontal_zero:s.value.left;return C.value.filter(O=>!p.value.includes(O.id)).map(O=>{const B=O.series.slice(u.value.start,u.value.end),Xe=O.signedSeries.slice(u.value.start,u.value.end),Ge=B.map((h,m)=>s.value.left+d.value*m+d.value*t.value.style.chart.bars.gapRatio/4),Je=B.map((h,m)=>s.value.top+d.value*m+d.value*t.value.style.chart.bars.gapRatio/4),Ze=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;let _,x;return h>0?(x=f*k,_=_e-x-l[m],l[m]+=x):(x=f*k,_=_e+a[m],a[m]+=Math.abs(x)),_}),Ke=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;let _,x;return h>0?(x=Y*k,_=$e+o[m],o[m]+=x):(x=Y*k,_=$e-Math.abs(x)-r[m],r[m]+=Math.abs(x)),_}),Qe=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;return h>0?f*k:f*Math.abs(k)}),je=B.map((h,m)=>{const k=t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/E;return h>0?Y*k:Y*Math.abs(k)}),et=B.map(h=>Math.abs(h)).reduce((h,m)=>h+m,0);return{...O,proportions:B.map((h,m)=>t.value.style.chart.bars.distributed?(h||0)/F.value[m]:(h||0)/et),series:B,signedSeries:Xe,x:Ge,y:Ze,height:Qe,horizontal_width:je,horizontal_y:Je,horizontal_x:Ke}})}),pe=e.computed(()=>qe.value.map((l,o)=>({value:l,sign:l>=0?1:-1})));function H(l,o,a,r,n){const i=n===-1&&l>=0?-l:l;return c.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,i,c.dataLabel({p:t.value.style.chart.bars.dataLabels.prefix,v:i,s:t.value.style.chart.bars.dataLabels.suffix,r:t.value.style.chart.bars.dataLabels.rounding}),{datapoint:o,seriesIndex:a,datapointIndex:r})}function fe(l,o,a,r){return c.applyDataLabel(t.value.style.chart.bars.dataLabels.formatter,l,c.dataLabel({v:isNaN(l)?0:l,s:"%",r:t.value.style.chart.bars.dataLabels.rounding}),{datapoint:o,seriesIndex:a,datapointIndex:r})}function ke(l){const o=JSON.parse(JSON.stringify(g.value)).map(a=>({name:a.name,value:a.series[l]===0?0:a.series[l]||null,proportion:a.proportions[l]||null,color:a.color,id:a.id}));G("selectDatapoint",{datapoint:o,period:z.value[l]})}function xe(l){V.value=l,R.value=!0;const o=t.value.style.chart.tooltip.customFormat,a=JSON.parse(JSON.stringify(g.value)).map(n=>({name:n.name,value:n.series[l]===0?0:(n.signedSeries[l]===-1&&n.series[l]>=0?-n.series[l]:n.series[l])||null,proportion:n.proportions[l]||null,color:n.color,id:n.id})),r=a.map(n=>Math.abs(n.value)).reduce((n,i)=>n+i,0);if(c.isFunction(o)&&c.functionReturnsString(()=>o({seriesIndex:l,datapoint:a,series:g.value,config:t.value})))Z.value=o({seriesIndex:l,datapoint:a,series:g.value,config:t.value});else{const{showValue:n,showPercentage:i,borderColor:y,roundingValue:L,roundingPercentage:N}=t.value.style.chart.tooltip;let I="";z.value[l]&&z.value[l].text&&t.value.style.chart.tooltip.showTimeLabel&&(I+=`<div style="width:100%;text-align:center;border-bottom:1px solid ${y};padding-bottom:6px;margin-bottom:3px;">${z.value[l].text}</div>`);const E=[n&&i?"(":"",n&&i?")":""];a.reverse().forEach(f=>{I+=`
|
|
2
2
|
<div style="display:flex;flex-direction:row;align-items:center;gap:4px">
|
|
3
3
|
<svg viewBox="0 0 12 12" height="14" width="14"><rect rx="1" x="0" y="0" height="12" width="12" stroke="none" fill="${t.value.style.chart.bars.gradient.show?`url(#gradient_${f.id})`:f.color}"/></svg>
|
|
4
4
|
${f.name}${n||i?":":""} ${n?c.dataLabel({p:t.value.style.chart.bars.dataLabels.prefix,v:f.value,s:t.value.style.chart.bars.dataLabels.suffix,r:L}):""} ${E[0]}${i?c.dataLabel({v:isNaN(f.value/r)?0:Math.abs(f.value)/r*100,s:"%",r:N}):""}${E[1]}
|