@wick-charts/vue 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -3
- package/dist/BarSeries.vue.js +26 -20
- package/dist/CandlestickSeries.vue.js +30 -24
- package/dist/ChartContainer.vue.js +88 -65
- package/dist/HeatmapSeries.vue.js +40 -0
- package/dist/HeatmapSeries.vue2.js +4 -0
- package/dist/LineSeries.vue.js +26 -20
- package/dist/PieSeries.vue.js +24 -18
- package/dist/core/dist/animation/animator.js +21 -21
- package/dist/core/dist/animation/config.js +114 -87
- package/dist/core/dist/animation/easing.js +3 -1
- package/dist/core/dist/animation/intro-wave.js +68 -0
- package/dist/core/dist/axis/dom-labels.js +13 -14
- package/dist/core/dist/chart/badge-animator.js +56 -0
- package/dist/core/dist/chart/edge-indicators.js +28 -13
- package/dist/core/dist/chart/last-value.js +18 -17
- package/dist/core/dist/chart/y-target.js +13 -12
- package/dist/core/dist/chart.js +908 -626
- package/dist/core/dist/components/annotation-chip.js +28 -0
- package/dist/core/dist/components/edge-indicator.js +58 -26
- package/dist/core/dist/components/loading-indicator.js +46 -0
- package/dist/core/dist/components/marker.js +49 -31
- package/dist/core/dist/components/reference-line.js +27 -36
- package/dist/core/dist/components/time-region.js +30 -28
- package/dist/core/dist/data/store.js +38 -19
- package/dist/core/dist/data/sync.js +60 -38
- package/dist/core/dist/heatmap-tooltip.js +16 -0
- package/dist/core/dist/interactions/handler.js +67 -43
- package/dist/core/dist/perf/perf-hud.js +2 -2
- package/dist/core/dist/scales/x-scale.js +85 -37
- package/dist/core/dist/scales/y-scale.js +38 -27
- package/dist/core/dist/series/bar-intro.js +18 -0
- package/dist/core/dist/series/bar.js +337 -205
- package/dist/core/dist/series/base-multi-layer.js +224 -96
- package/dist/core/dist/series/candlestick-intro.js +57 -0
- package/dist/core/dist/series/candlestick.js +454 -276
- package/dist/core/dist/series/heatmap.js +387 -0
- package/dist/core/dist/series/line-intro.js +85 -0
- package/dist/core/dist/series/line.js +590 -282
- package/dist/core/dist/series/painters/builtins.js +2 -2
- package/dist/core/dist/series/pie.js +396 -259
- package/dist/core/dist/series/register-builtins.js +8 -7
- package/dist/core/dist/series/types.js +6 -0
- package/dist/core/dist/series/wave-intro.js +26 -0
- package/dist/core/dist/theme/create.js +69 -63
- package/dist/core/dist/theme/themes/mint-breeze.js +2 -2
- package/dist/core/dist/theme/themes/sand-dune.js +2 -2
- package/dist/core/dist/utils/color.js +109 -34
- package/dist/core/dist/utils/deep-equal.js +18 -0
- package/dist/core/dist/utils/time.js +25 -19
- package/dist/index.d.ts +1411 -122
- package/dist/index.js +177 -130
- package/dist/ui/Crosshair.vue.js +20 -21
- package/dist/ui/HeatmapTooltip.vue.js +96 -0
- package/dist/ui/HeatmapTooltip.vue2.js +4 -0
- package/dist/ui/InfoBar.vue.js +46 -47
- package/dist/ui/Legend.vue.js +80 -79
- package/dist/ui/PieLegend.vue.js +5 -5
- package/dist/ui/PieTooltip.vue.js +77 -67
- package/dist/ui/Tooltip.vue.js +60 -60
- package/dist/ui/YAxis.vue.js +2 -2
- package/dist/ui/YLabel.vue.js +94 -61
- package/package.json +2 -2
- package/src/BarSeries.vue +23 -7
- package/src/CandlestickSeries.vue +23 -7
- package/src/ChartContainer.vue +134 -12
- package/src/HeatmapSeries.vue +69 -0
- package/src/LineSeries.vue +23 -7
- package/src/PieSeries.vue +22 -6
- package/src/index.ts +84 -3
- package/src/ui/Crosshair.vue +1 -2
- package/src/ui/HeatmapTooltip.vue +144 -0
- package/src/ui/InfoBar.vue +1 -2
- package/src/ui/Legend.vue +13 -0
- package/src/ui/Marker.vue +1 -1
- package/src/ui/PieTooltip.vue +10 -0
- package/src/ui/ReferenceLine.vue +2 -2
- package/src/ui/TimeRegion.vue +2 -2
- package/src/ui/Tooltip.vue +2 -2
- package/src/ui/YLabel.vue +123 -8
package/dist/ui/InfoBar.vue.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as V, computed as n, inject as B, ref as N, onMounted as T, onUnmounted as W, useSlots as A, unref as e, openBlock as l, createBlock as O, Teleport as D, createElementVNode as i, normalizeStyle as s, renderSlot as M, createElementBlock as u, Fragment as p, toDisplayString as m, renderList as _, createCommentVNode as F } from "vue";
|
|
2
2
|
import { buildHoverSnapshots as P, buildLastSnapshots as R } from "../core/dist/snapshots.js";
|
|
3
3
|
import { resolveCandlestickBodyColor as $ } from "../core/dist/theme/resolve.js";
|
|
4
4
|
import { formatCompact as j, formatPriceAdaptive as U } from "../core/dist/utils/format.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const Y = {
|
|
5
|
+
import { useCrosshairPosition as X } from "../composables.js";
|
|
6
|
+
import { useChartInstance as q, ThemeKey as G, InfoBarAnchorKey as J } from "../context.js";
|
|
7
|
+
const Q = {
|
|
9
8
|
key: 0,
|
|
10
9
|
style: { display: "inline-flex", alignItems: "center", gap: "4px" }
|
|
11
|
-
},
|
|
10
|
+
}, Y = {
|
|
12
11
|
key: 1,
|
|
13
12
|
style: { display: "inline-flex", alignItems: "center", gap: "3px" }
|
|
14
|
-
},
|
|
13
|
+
}, le = /* @__PURE__ */ V({
|
|
15
14
|
__name: "InfoBar",
|
|
16
15
|
props: {
|
|
17
16
|
sort: {},
|
|
@@ -20,36 +19,36 @@ const Y = {
|
|
|
20
19
|
setup(L) {
|
|
21
20
|
const C = L, b = n(() => C.sort ?? "none"), y = n(
|
|
22
21
|
() => C.format ?? ((o, w) => w === "volume" ? j(o) : U(o))
|
|
23
|
-
),
|
|
22
|
+
), r = q(), h = X(r), a = B(G), g = B(J);
|
|
24
23
|
if (!a)
|
|
25
24
|
throw new Error("<InfoBar> must be used within <ChartContainer>: missing ThemeKey.");
|
|
26
25
|
if (!g)
|
|
27
26
|
throw new Error("<InfoBar> must be used within <ChartContainer>: missing InfoBarAnchorKey.");
|
|
28
|
-
const v =
|
|
27
|
+
const v = N(0), S = () => {
|
|
29
28
|
v.value++;
|
|
30
29
|
};
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
T(() => {
|
|
31
|
+
r.on("overlayChange", S), r.getSeriesIds().length > 0 && v.value++;
|
|
33
32
|
}), W(() => {
|
|
34
|
-
|
|
33
|
+
r.off("overlayChange", S);
|
|
35
34
|
});
|
|
36
35
|
const x = n(() => {
|
|
37
36
|
v.value;
|
|
38
37
|
const o = h.value;
|
|
39
|
-
return o === null ? null : P(
|
|
40
|
-
}), E = n(() => (v.value, R(
|
|
38
|
+
return o === null ? null : P(r, { time: o.time, sort: b.value, cacheKey: "infobar-hover" });
|
|
39
|
+
}), E = n(() => (v.value, R(r, { sort: b.value, cacheKey: "infobar-last" }))), c = n(() => x.value !== null && x.value.length > 0), f = n(
|
|
41
40
|
() => c.value ? x.value : E.value
|
|
42
|
-
), K = n(() =>
|
|
41
|
+
), K = n(() => r.getDataInterval()), k = n(() => f.value.length === 0 ? 0 : c.value && h.value ? h.value.time : Math.max(...f.value.map((o) => o.data.time))), z = A(), I = n(() => typeof z.default == "function");
|
|
43
42
|
function H(o) {
|
|
44
43
|
return "open" in o;
|
|
45
44
|
}
|
|
46
|
-
return (o, w) => e(g) && e(a) &&
|
|
45
|
+
return (o, w) => e(g) && e(a) && f.value.length > 0 ? (l(), O(D, {
|
|
47
46
|
key: 0,
|
|
48
47
|
to: e(g)
|
|
49
48
|
}, [
|
|
50
|
-
|
|
49
|
+
i("div", {
|
|
51
50
|
"data-tooltip-legend": "",
|
|
52
|
-
style:
|
|
51
|
+
style: s(
|
|
53
52
|
I.value ? {
|
|
54
53
|
display: "flex",
|
|
55
54
|
alignItems: "center",
|
|
@@ -78,49 +77,49 @@ const Y = {
|
|
|
78
77
|
}, [
|
|
79
78
|
I.value ? M(o.$slots, "default", {
|
|
80
79
|
key: 0,
|
|
81
|
-
snapshots:
|
|
82
|
-
time:
|
|
80
|
+
snapshots: f.value,
|
|
81
|
+
time: k.value,
|
|
83
82
|
isHover: c.value
|
|
84
|
-
}) : (l(),
|
|
85
|
-
|
|
86
|
-
style:
|
|
87
|
-
},
|
|
88
|
-
(l(!0),
|
|
83
|
+
}) : (l(), u(p, { key: 1 }, [
|
|
84
|
+
i("span", {
|
|
85
|
+
style: s({ color: e(a).axis.textColor, marginRight: "2px" })
|
|
86
|
+
}, m(e(r).timeScale.formatX(k.value, K.value)), 5),
|
|
87
|
+
(l(!0), u(p, null, _(f.value, (t) => (l(), u(p, {
|
|
89
88
|
key: t.id
|
|
90
89
|
}, [
|
|
91
|
-
H(t.data) ? (l(),
|
|
92
|
-
(l(!0),
|
|
90
|
+
H(t.data) ? (l(), u("span", Q, [
|
|
91
|
+
(l(!0), u(p, null, _([
|
|
93
92
|
{ label: "O", field: "open", val: t.data.open },
|
|
94
93
|
{ label: "H", field: "high", val: t.data.high },
|
|
95
94
|
{ label: "L", field: "low", val: t.data.low },
|
|
96
95
|
{ label: "C", field: "close", val: t.data.close }
|
|
97
|
-
], (d) => (l(),
|
|
96
|
+
], (d) => (l(), u(p, {
|
|
98
97
|
key: d.label
|
|
99
98
|
}, [
|
|
100
|
-
|
|
101
|
-
style:
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
style:
|
|
99
|
+
i("span", {
|
|
100
|
+
style: s({ color: e(a).axis.textColor, opacity: 0.5, marginLeft: "5px" })
|
|
101
|
+
}, m(d.label), 5),
|
|
102
|
+
i("span", {
|
|
103
|
+
style: s({
|
|
105
104
|
color: e($)(
|
|
106
105
|
t.data.close >= t.data.open ? e(a).candlestick.up.body : e(a).candlestick.down.body
|
|
107
106
|
),
|
|
108
107
|
fontWeight: 500,
|
|
109
108
|
marginLeft: "2px"
|
|
110
109
|
})
|
|
111
|
-
},
|
|
110
|
+
}, m(y.value(d.val, d.field)), 5)
|
|
112
111
|
], 64))), 128)),
|
|
113
|
-
t.data.volume != null ? (l(),
|
|
114
|
-
|
|
115
|
-
style:
|
|
112
|
+
t.data.volume != null ? (l(), u(p, { key: 0 }, [
|
|
113
|
+
i("span", {
|
|
114
|
+
style: s({ color: e(a).axis.textColor, opacity: 0.5, marginLeft: "5px" })
|
|
116
115
|
}, "V", 4),
|
|
117
|
-
|
|
118
|
-
style:
|
|
119
|
-
},
|
|
116
|
+
i("span", {
|
|
117
|
+
style: s({ color: e(a).axis.textColor, fontWeight: 500, marginLeft: "2px" })
|
|
118
|
+
}, m(y.value(t.data.volume, "volume")), 5)
|
|
120
119
|
], 64)) : F("", !0)
|
|
121
|
-
])) : (l(),
|
|
122
|
-
|
|
123
|
-
style:
|
|
120
|
+
])) : (l(), u("span", Y, [
|
|
121
|
+
i("span", {
|
|
122
|
+
style: s({
|
|
124
123
|
width: "6px",
|
|
125
124
|
height: "6px",
|
|
126
125
|
borderRadius: "50%",
|
|
@@ -128,9 +127,9 @@ const Y = {
|
|
|
128
127
|
flexShrink: 0
|
|
129
128
|
})
|
|
130
129
|
}, null, 4),
|
|
131
|
-
|
|
132
|
-
style:
|
|
133
|
-
},
|
|
130
|
+
i("span", {
|
|
131
|
+
style: s({ color: t.color, fontWeight: 500 })
|
|
132
|
+
}, m(y.value(t.data.value, "value")), 5)
|
|
134
133
|
]))
|
|
135
134
|
], 64))), 128))
|
|
136
135
|
], 64))
|
|
@@ -139,5 +138,5 @@ const Y = {
|
|
|
139
138
|
}
|
|
140
139
|
});
|
|
141
140
|
export {
|
|
142
|
-
|
|
141
|
+
le as default
|
|
143
142
|
};
|
package/dist/ui/Legend.vue.js
CHANGED
|
@@ -1,105 +1,106 @@
|
|
|
1
|
-
import { defineComponent as W, inject as C, computed as k, ref as E, onMounted as H, onUnmounted as N, useSlots as M, unref as
|
|
1
|
+
import { defineComponent as W, inject as C, computed as k, ref as E, onMounted as H, onUnmounted as N, useSlots as M, unref as d, openBlock as c, createBlock as U, Teleport as q, createElementBlock as u, normalizeStyle as h, renderSlot as G, Fragment as F, renderList as T, createElementVNode as S, toDisplayString as A, createCommentVNode as $ } from "vue";
|
|
2
2
|
import { useChartInstance as J, ThemeKey as O, LegendAnchorKey as P, LegendRightAnchorKey as Q } from "../context.js";
|
|
3
3
|
const X = ["data-legend"], Y = ["data-legend"], Z = { style: { "white-space": "nowrap" } }, _ = ["data-legend"], ee = ["onClick"], te = { style: { "white-space": "nowrap" } }, le = /* @__PURE__ */ W({
|
|
4
4
|
__name: "Legend",
|
|
5
5
|
props: {
|
|
6
6
|
items: {},
|
|
7
7
|
position: { default: "bottom" },
|
|
8
|
-
mode: { default: "toggle" }
|
|
8
|
+
mode: { default: "toggle" },
|
|
9
|
+
onToggle: {}
|
|
9
10
|
},
|
|
10
11
|
setup(t) {
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
12
|
+
const f = t, i = J(), r = C(O), I = C(P), w = C(Q);
|
|
13
|
+
if (!r)
|
|
13
14
|
throw new Error("<Legend> must be used within <ChartContainer>: missing ThemeKey.");
|
|
14
15
|
if (!I || !w)
|
|
15
16
|
throw new Error("<Legend> must be used within <ChartContainer>: missing legend anchors.");
|
|
16
|
-
const L = k(() =>
|
|
17
|
+
const L = k(() => f.position === "right" ? w.value : I.value), p = E(null), v = E(0), V = () => {
|
|
17
18
|
v.value++;
|
|
18
19
|
}, D = () => {
|
|
19
|
-
|
|
20
|
+
p.value = null;
|
|
20
21
|
};
|
|
21
22
|
H(() => {
|
|
22
23
|
i.on("overlayChange", V), i.on("seriesChange", D), i.getSeriesIds().length > 0 && v.value++;
|
|
23
24
|
}), N(() => {
|
|
24
25
|
i.off("overlayChange", V), i.off("seriesChange", D);
|
|
25
26
|
});
|
|
26
|
-
function z(
|
|
27
|
-
const { id:
|
|
28
|
-
return { id:
|
|
29
|
-
|
|
27
|
+
function z(o) {
|
|
28
|
+
const { id: s, seriesId: e, layerIndex: l, label: n, color: x, isDisabled: y } = o;
|
|
29
|
+
return { id: s, seriesId: e, layerIndex: l, label: n, color: x, isDisabled: y, toggle: () => {
|
|
30
|
+
l !== void 0 ? i.setLayerVisible(e, l, !i.isLayerVisible(e, l)) : i.setSeriesVisible(e, !i.isSeriesVisible(e)), f.onToggle?.({ id: s, action: "toggle" });
|
|
30
31
|
}, isolate: () => {
|
|
31
|
-
if (
|
|
32
|
+
if (p.value === s) {
|
|
32
33
|
i.batch(() => {
|
|
33
|
-
for (const
|
|
34
|
-
i.setSeriesVisible(
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
for (let
|
|
34
|
+
for (const a of i.getSeriesIds()) {
|
|
35
|
+
i.setSeriesVisible(a, !0);
|
|
36
|
+
const m = i.getSeriesLayers(a);
|
|
37
|
+
if (m)
|
|
38
|
+
for (let g = 0; g < m.length; g++) i.setLayerVisible(a, g, !0);
|
|
38
39
|
}
|
|
39
|
-
}),
|
|
40
|
+
}), p.value = null, f.onToggle?.({ id: s, action: "unisolate" });
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
43
|
i.batch(() => {
|
|
43
|
-
for (const
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
i.setSeriesVisible(
|
|
47
|
-
for (let
|
|
48
|
-
i.setLayerVisible(
|
|
44
|
+
for (const a of i.getSeriesIds()) {
|
|
45
|
+
const m = i.getSeriesLayers(a);
|
|
46
|
+
if (m) {
|
|
47
|
+
i.setSeriesVisible(a, a === e);
|
|
48
|
+
for (let g = 0; g < m.length; g++)
|
|
49
|
+
i.setLayerVisible(a, g, a === e && g === l);
|
|
49
50
|
} else
|
|
50
|
-
i.setSeriesVisible(
|
|
51
|
+
i.setSeriesVisible(a, a === s);
|
|
51
52
|
}
|
|
52
|
-
}),
|
|
53
|
+
}), p.value = s, f.onToggle?.({ id: s, action: "isolate" });
|
|
53
54
|
} };
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
-
const
|
|
57
|
-
for (const e of
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
for (let
|
|
61
|
-
const
|
|
62
|
-
|
|
56
|
+
function j(o) {
|
|
57
|
+
const s = [];
|
|
58
|
+
for (const e of o.getSeriesIds()) {
|
|
59
|
+
const l = o.getSeriesLayers(e);
|
|
60
|
+
if (l)
|
|
61
|
+
for (let n = 0; n < l.length; n++) {
|
|
62
|
+
const x = `${e}_layer${n}`, y = o.isSeriesVisible(e) && o.isLayerVisible(e, n);
|
|
63
|
+
s.push(
|
|
63
64
|
z({
|
|
64
|
-
id:
|
|
65
|
+
id: x,
|
|
65
66
|
seriesId: e,
|
|
66
|
-
layerIndex:
|
|
67
|
-
label:
|
|
68
|
-
color:
|
|
69
|
-
isDisabled: !
|
|
67
|
+
layerIndex: n,
|
|
68
|
+
label: o.getLayerLabel(e, n) ?? `Series ${n + 1}`,
|
|
69
|
+
color: l[n].color,
|
|
70
|
+
isDisabled: !y
|
|
70
71
|
})
|
|
71
72
|
);
|
|
72
73
|
}
|
|
73
74
|
else {
|
|
74
|
-
const
|
|
75
|
-
if (!
|
|
76
|
-
const
|
|
77
|
-
|
|
75
|
+
const n = o.getSeriesColor(e);
|
|
76
|
+
if (!n) continue;
|
|
77
|
+
const x = o.getSeriesLabel(e), y = o.isSeriesVisible(e);
|
|
78
|
+
s.push(
|
|
78
79
|
z({
|
|
79
80
|
id: e,
|
|
80
81
|
seriesId: e,
|
|
81
82
|
layerIndex: void 0,
|
|
82
|
-
label:
|
|
83
|
-
color:
|
|
84
|
-
isDisabled: !
|
|
83
|
+
label: x ?? "Series",
|
|
84
|
+
color: n,
|
|
85
|
+
isDisabled: !y
|
|
85
86
|
})
|
|
86
87
|
);
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
|
-
return
|
|
90
|
+
return s;
|
|
90
91
|
}
|
|
91
|
-
const
|
|
92
|
-
function
|
|
93
|
-
|
|
92
|
+
const b = k(() => (v.value, p.value, j(i))), K = M(), B = k(() => typeof K.default == "function");
|
|
93
|
+
function R(o) {
|
|
94
|
+
f.mode === "isolate" || f.mode === "solo" ? o.isolate() : o.toggle();
|
|
94
95
|
}
|
|
95
|
-
return (
|
|
96
|
+
return (o, s) => L.value && d(r) ? (c(), U(q, {
|
|
96
97
|
key: 0,
|
|
97
98
|
to: L.value
|
|
98
99
|
}, [
|
|
99
|
-
|
|
100
|
+
B.value && b.value.length > 0 ? (c(), u("div", {
|
|
100
101
|
key: 0,
|
|
101
102
|
"data-legend": t.position,
|
|
102
|
-
style:
|
|
103
|
+
style: h({
|
|
103
104
|
display: "flex",
|
|
104
105
|
flexDirection: t.position === "right" ? "column" : "row",
|
|
105
106
|
flexWrap: "wrap",
|
|
@@ -107,18 +108,18 @@ const X = ["data-legend"], Y = ["data-legend"], Z = { style: { "white-space": "n
|
|
|
107
108
|
padding: t.position === "right" ? "8px 6px" : "6px 8px",
|
|
108
109
|
alignItems: t.position === "right" ? "flex-start" : "center",
|
|
109
110
|
justifyContent: t.position === "right" ? "flex-start" : "center",
|
|
110
|
-
fontFamily:
|
|
111
|
-
fontSize:
|
|
112
|
-
color:
|
|
111
|
+
fontFamily: d(r).typography.fontFamily,
|
|
112
|
+
fontSize: d(r).axis.fontSize + "px",
|
|
113
|
+
color: d(r).axis.textColor,
|
|
113
114
|
pointerEvents: "auto",
|
|
114
115
|
flexShrink: 0
|
|
115
116
|
})
|
|
116
117
|
}, [
|
|
117
|
-
G(
|
|
118
|
-
], 12, X)) : t.items && t.items.length > 0 ? (
|
|
118
|
+
G(o.$slots, "default", { items: b.value })
|
|
119
|
+
], 12, X)) : t.items && t.items.length > 0 ? (c(), u("div", {
|
|
119
120
|
key: 1,
|
|
120
121
|
"data-legend": t.position,
|
|
121
|
-
style:
|
|
122
|
+
style: h({
|
|
122
123
|
display: "flex",
|
|
123
124
|
flexDirection: t.position === "right" ? "column" : "row",
|
|
124
125
|
flexWrap: "wrap",
|
|
@@ -126,15 +127,15 @@ const X = ["data-legend"], Y = ["data-legend"], Z = { style: { "white-space": "n
|
|
|
126
127
|
padding: t.position === "right" ? "8px 6px" : "6px 8px",
|
|
127
128
|
alignItems: t.position === "right" ? "flex-start" : "center",
|
|
128
129
|
justifyContent: t.position === "right" ? "flex-start" : "center",
|
|
129
|
-
fontFamily:
|
|
130
|
-
fontSize:
|
|
131
|
-
color:
|
|
130
|
+
fontFamily: d(r).typography.fontFamily,
|
|
131
|
+
fontSize: d(r).axis.fontSize + "px",
|
|
132
|
+
color: d(r).axis.textColor,
|
|
132
133
|
pointerEvents: "auto",
|
|
133
134
|
flexShrink: 0
|
|
134
135
|
})
|
|
135
136
|
}, [
|
|
136
|
-
(
|
|
137
|
-
key:
|
|
137
|
+
(c(!0), u(F, null, T(t.items, (e, l) => (c(), u("div", {
|
|
138
|
+
key: l,
|
|
138
139
|
style: {
|
|
139
140
|
display: "flex",
|
|
140
141
|
alignItems: "center",
|
|
@@ -142,8 +143,8 @@ const X = ["data-legend"], Y = ["data-legend"], Z = { style: { "white-space": "n
|
|
|
142
143
|
userSelect: "none"
|
|
143
144
|
}
|
|
144
145
|
}, [
|
|
145
|
-
|
|
146
|
-
style:
|
|
146
|
+
S("span", {
|
|
147
|
+
style: h({
|
|
147
148
|
width: "8px",
|
|
148
149
|
height: "8px",
|
|
149
150
|
borderRadius: "2px",
|
|
@@ -151,12 +152,12 @@ const X = ["data-legend"], Y = ["data-legend"], Z = { style: { "white-space": "n
|
|
|
151
152
|
flexShrink: 0
|
|
152
153
|
})
|
|
153
154
|
}, null, 4),
|
|
154
|
-
|
|
155
|
+
S("span", Z, A(e.label), 1)
|
|
155
156
|
]))), 128))
|
|
156
|
-
], 12, Y)) :
|
|
157
|
+
], 12, Y)) : b.value.length > 0 ? (c(), u("div", {
|
|
157
158
|
key: 2,
|
|
158
159
|
"data-legend": t.position,
|
|
159
|
-
style:
|
|
160
|
+
style: h({
|
|
160
161
|
display: "flex",
|
|
161
162
|
flexDirection: t.position === "right" ? "column" : "row",
|
|
162
163
|
flexWrap: "wrap",
|
|
@@ -164,18 +165,18 @@ const X = ["data-legend"], Y = ["data-legend"], Z = { style: { "white-space": "n
|
|
|
164
165
|
padding: t.position === "right" ? "8px 6px" : "6px 8px",
|
|
165
166
|
alignItems: t.position === "right" ? "flex-start" : "center",
|
|
166
167
|
justifyContent: t.position === "right" ? "flex-start" : "center",
|
|
167
|
-
fontFamily:
|
|
168
|
-
fontSize:
|
|
169
|
-
color:
|
|
168
|
+
fontFamily: d(r).typography.fontFamily,
|
|
169
|
+
fontSize: d(r).axis.fontSize + "px",
|
|
170
|
+
color: d(r).axis.textColor,
|
|
170
171
|
pointerEvents: "auto",
|
|
171
172
|
flexShrink: 0
|
|
172
173
|
})
|
|
173
174
|
}, [
|
|
174
|
-
(
|
|
175
|
+
(c(!0), u(F, null, T(b.value, (e) => (c(), u("button", {
|
|
175
176
|
key: e.id,
|
|
176
177
|
type: "button",
|
|
177
|
-
onClick: (
|
|
178
|
-
style:
|
|
178
|
+
onClick: (l) => R(e),
|
|
179
|
+
style: h({
|
|
179
180
|
display: "flex",
|
|
180
181
|
alignItems: "center",
|
|
181
182
|
gap: "4px",
|
|
@@ -192,8 +193,8 @@ const X = ["data-legend"], Y = ["data-legend"], Z = { style: { "white-space": "n
|
|
|
192
193
|
textAlign: "left"
|
|
193
194
|
})
|
|
194
195
|
}, [
|
|
195
|
-
|
|
196
|
-
style:
|
|
196
|
+
S("span", {
|
|
197
|
+
style: h({
|
|
197
198
|
width: "8px",
|
|
198
199
|
height: "8px",
|
|
199
200
|
borderRadius: "2px",
|
|
@@ -201,10 +202,10 @@ const X = ["data-legend"], Y = ["data-legend"], Z = { style: { "white-space": "n
|
|
|
201
202
|
flexShrink: 0
|
|
202
203
|
})
|
|
203
204
|
}, null, 4),
|
|
204
|
-
|
|
205
|
+
S("span", te, A(e.label), 1)
|
|
205
206
|
], 12, ee))), 128))
|
|
206
|
-
], 12, _)) :
|
|
207
|
-
], 8, ["to"])) :
|
|
207
|
+
], 12, _)) : $("", !0)
|
|
208
|
+
], 8, ["to"])) : $("", !0);
|
|
208
209
|
}
|
|
209
210
|
});
|
|
210
211
|
export {
|
package/dist/ui/PieLegend.vue.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as V, inject as C, computed as r, useSlots as w, ref as E, onMounted as L, onUnmounted as B, renderSlot as R, openBlock as n, createBlock as T, Teleport as D, createElementVNode as d, normalizeStyle as l, createElementBlock as a, Fragment as I, renderList as F, toDisplayString as u, createCommentVNode as v } from "vue";
|
|
2
2
|
import { formatCompact as P } from "../core/dist/utils/format.js";
|
|
3
|
-
import { LegendAnchorKey as K, LegendRightAnchorKey as M, useChartInstance as
|
|
4
|
-
const
|
|
3
|
+
import { LegendAnchorKey as K, LegendRightAnchorKey as M, useChartInstance as j, useTheme as O } from "../context.js";
|
|
4
|
+
const U = ["data-chart-pie-legend-position"], $ = { style: { flex: 1, opacity: 0.8 } }, q = { style: { flex: 1, opacity: 0.8 } }, Q = /* @__PURE__ */ V({
|
|
5
5
|
__name: "PieLegend",
|
|
6
6
|
props: {
|
|
7
7
|
seriesId: {},
|
|
@@ -13,7 +13,7 @@ const O = ["data-chart-pie-legend-position"], U = { style: { flex: 1, opacity: 0
|
|
|
13
13
|
const s = m, x = C(K), b = C(M);
|
|
14
14
|
if (!x || !b)
|
|
15
15
|
throw new Error("<PieLegend> must be used within <ChartContainer>: missing legend anchors.");
|
|
16
|
-
const S = r(() => s.position === "right" ? b.value : s.position === "bottom" ? x.value : null), e = r(() => s.mode ?? "both"), h = r(() => s.format ?? P), p =
|
|
16
|
+
const S = r(() => s.position === "right" ? b.value : s.position === "bottom" ? x.value : null), e = r(() => s.mode ?? "both"), h = r(() => s.format ?? P), p = j(), _ = O(), A = w(), W = r(() => typeof A.default == "function"), c = E(0), k = () => {
|
|
17
17
|
c.value++;
|
|
18
18
|
};
|
|
19
19
|
L(() => {
|
|
@@ -57,7 +57,7 @@ const O = ["data-chart-pie-legend-position"], U = { style: { flex: 1, opacity: 0
|
|
|
57
57
|
d("span", {
|
|
58
58
|
style: l({ width: "10px", height: "10px", borderRadius: "50%", background: t.color, flexShrink: 0 })
|
|
59
59
|
}, null, 4),
|
|
60
|
-
d("span",
|
|
60
|
+
d("span", $, u(t.label), 1),
|
|
61
61
|
e.value === "value" || e.value === "both" ? (n(), a("span", {
|
|
62
62
|
key: 0,
|
|
63
63
|
style: l({
|
|
@@ -79,7 +79,7 @@ const O = ["data-chart-pie-legend-position"], U = { style: { flex: 1, opacity: 0
|
|
|
79
79
|
})
|
|
80
80
|
}, u(t.percent.toFixed(1)) + "% ", 5)) : v("", !0)
|
|
81
81
|
]))), 128))
|
|
82
|
-
], 12,
|
|
82
|
+
], 12, U)
|
|
83
83
|
], 8, ["to"])) : i.value.length > 0 ? (n(), a("div", {
|
|
84
84
|
key: 2,
|
|
85
85
|
"data-chart-pie-legend": "",
|