@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.
Files changed (80) hide show
  1. package/README.md +18 -3
  2. package/dist/BarSeries.vue.js +26 -20
  3. package/dist/CandlestickSeries.vue.js +30 -24
  4. package/dist/ChartContainer.vue.js +88 -65
  5. package/dist/HeatmapSeries.vue.js +40 -0
  6. package/dist/HeatmapSeries.vue2.js +4 -0
  7. package/dist/LineSeries.vue.js +26 -20
  8. package/dist/PieSeries.vue.js +24 -18
  9. package/dist/core/dist/animation/animator.js +21 -21
  10. package/dist/core/dist/animation/config.js +114 -87
  11. package/dist/core/dist/animation/easing.js +3 -1
  12. package/dist/core/dist/animation/intro-wave.js +68 -0
  13. package/dist/core/dist/axis/dom-labels.js +13 -14
  14. package/dist/core/dist/chart/badge-animator.js +56 -0
  15. package/dist/core/dist/chart/edge-indicators.js +28 -13
  16. package/dist/core/dist/chart/last-value.js +18 -17
  17. package/dist/core/dist/chart/y-target.js +13 -12
  18. package/dist/core/dist/chart.js +908 -626
  19. package/dist/core/dist/components/annotation-chip.js +28 -0
  20. package/dist/core/dist/components/edge-indicator.js +58 -26
  21. package/dist/core/dist/components/loading-indicator.js +46 -0
  22. package/dist/core/dist/components/marker.js +49 -31
  23. package/dist/core/dist/components/reference-line.js +27 -36
  24. package/dist/core/dist/components/time-region.js +30 -28
  25. package/dist/core/dist/data/store.js +38 -19
  26. package/dist/core/dist/data/sync.js +60 -38
  27. package/dist/core/dist/heatmap-tooltip.js +16 -0
  28. package/dist/core/dist/interactions/handler.js +67 -43
  29. package/dist/core/dist/perf/perf-hud.js +2 -2
  30. package/dist/core/dist/scales/x-scale.js +85 -37
  31. package/dist/core/dist/scales/y-scale.js +38 -27
  32. package/dist/core/dist/series/bar-intro.js +18 -0
  33. package/dist/core/dist/series/bar.js +337 -205
  34. package/dist/core/dist/series/base-multi-layer.js +224 -96
  35. package/dist/core/dist/series/candlestick-intro.js +57 -0
  36. package/dist/core/dist/series/candlestick.js +454 -276
  37. package/dist/core/dist/series/heatmap.js +387 -0
  38. package/dist/core/dist/series/line-intro.js +85 -0
  39. package/dist/core/dist/series/line.js +590 -282
  40. package/dist/core/dist/series/painters/builtins.js +2 -2
  41. package/dist/core/dist/series/pie.js +396 -259
  42. package/dist/core/dist/series/register-builtins.js +8 -7
  43. package/dist/core/dist/series/types.js +6 -0
  44. package/dist/core/dist/series/wave-intro.js +26 -0
  45. package/dist/core/dist/theme/create.js +69 -63
  46. package/dist/core/dist/theme/themes/mint-breeze.js +2 -2
  47. package/dist/core/dist/theme/themes/sand-dune.js +2 -2
  48. package/dist/core/dist/utils/color.js +109 -34
  49. package/dist/core/dist/utils/deep-equal.js +18 -0
  50. package/dist/core/dist/utils/time.js +25 -19
  51. package/dist/index.d.ts +1411 -122
  52. package/dist/index.js +177 -130
  53. package/dist/ui/Crosshair.vue.js +20 -21
  54. package/dist/ui/HeatmapTooltip.vue.js +96 -0
  55. package/dist/ui/HeatmapTooltip.vue2.js +4 -0
  56. package/dist/ui/InfoBar.vue.js +46 -47
  57. package/dist/ui/Legend.vue.js +80 -79
  58. package/dist/ui/PieLegend.vue.js +5 -5
  59. package/dist/ui/PieTooltip.vue.js +77 -67
  60. package/dist/ui/Tooltip.vue.js +60 -60
  61. package/dist/ui/YAxis.vue.js +2 -2
  62. package/dist/ui/YLabel.vue.js +94 -61
  63. package/package.json +2 -2
  64. package/src/BarSeries.vue +23 -7
  65. package/src/CandlestickSeries.vue +23 -7
  66. package/src/ChartContainer.vue +134 -12
  67. package/src/HeatmapSeries.vue +69 -0
  68. package/src/LineSeries.vue +23 -7
  69. package/src/PieSeries.vue +22 -6
  70. package/src/index.ts +84 -3
  71. package/src/ui/Crosshair.vue +1 -2
  72. package/src/ui/HeatmapTooltip.vue +144 -0
  73. package/src/ui/InfoBar.vue +1 -2
  74. package/src/ui/Legend.vue +13 -0
  75. package/src/ui/Marker.vue +1 -1
  76. package/src/ui/PieTooltip.vue +10 -0
  77. package/src/ui/ReferenceLine.vue +2 -2
  78. package/src/ui/TimeRegion.vue +2 -2
  79. package/src/ui/Tooltip.vue +2 -2
  80. package/src/ui/YLabel.vue +123 -8
@@ -1,17 +1,16 @@
1
- import { defineComponent as T, computed as n, inject as B, ref as V, onMounted as N, onUnmounted as W, useSlots as A, unref as e, openBlock as l, createBlock as O, Teleport as D, createElementVNode as r, normalizeStyle as i, renderSlot as M, createElementBlock as s, Fragment as p, toDisplayString as f, renderList as _, createCommentVNode as F } from "vue";
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 { formatTime as q } from "../core/dist/utils/time.js";
6
- import { useCrosshairPosition as G } from "../composables.js";
7
- import { useChartInstance as J, ThemeKey as Q, InfoBarAnchorKey as X } from "../context.js";
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
- }, Z = {
10
+ }, Y = {
12
11
  key: 1,
13
12
  style: { display: "inline-flex", alignItems: "center", gap: "3px" }
14
- }, ie = /* @__PURE__ */ T({
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
- ), u = J(), h = G(u), a = B(Q), g = B(X);
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 = V(0), k = () => {
27
+ const v = N(0), S = () => {
29
28
  v.value++;
30
29
  };
31
- N(() => {
32
- u.on("overlayChange", k), u.getSeriesIds().length > 0 && v.value++;
30
+ T(() => {
31
+ r.on("overlayChange", S), r.getSeriesIds().length > 0 && v.value++;
33
32
  }), W(() => {
34
- u.off("overlayChange", k);
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(u, { time: o.time, sort: b.value, cacheKey: "infobar-hover" });
40
- }), E = n(() => (v.value, R(u, { sort: b.value, cacheKey: "infobar-last" }))), c = n(() => x.value !== null && x.value.length > 0), m = n(
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(() => u.getDataInterval()), S = n(() => m.value.length === 0 ? 0 : c.value && h.value ? h.value.time : Math.max(...m.value.map((o) => o.data.time))), z = A(), I = n(() => typeof z.default == "function");
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) && m.value.length > 0 ? (l(), O(D, {
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
- r("div", {
49
+ i("div", {
51
50
  "data-tooltip-legend": "",
52
- style: i(
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: m.value,
82
- time: S.value,
80
+ snapshots: f.value,
81
+ time: k.value,
83
82
  isHover: c.value
84
- }) : (l(), s(p, { key: 1 }, [
85
- r("span", {
86
- style: i({ color: e(a).axis.textColor, marginRight: "2px" })
87
- }, f(e(q)(S.value, K.value)), 5),
88
- (l(!0), s(p, null, _(m.value, (t) => (l(), s(p, {
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(), s("span", Y, [
92
- (l(!0), s(p, null, _([
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(), s(p, {
96
+ ], (d) => (l(), u(p, {
98
97
  key: d.label
99
98
  }, [
100
- r("span", {
101
- style: i({ color: e(a).axis.textColor, opacity: 0.5, marginLeft: "5px" })
102
- }, f(d.label), 5),
103
- r("span", {
104
- style: i({
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
- }, f(y.value(d.val, d.field)), 5)
110
+ }, m(y.value(d.val, d.field)), 5)
112
111
  ], 64))), 128)),
113
- t.data.volume != null ? (l(), s(p, { key: 0 }, [
114
- r("span", {
115
- style: i({ color: e(a).axis.textColor, opacity: 0.5, marginLeft: "5px" })
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
- r("span", {
118
- style: i({ color: e(a).axis.textColor, fontWeight: 500, marginLeft: "2px" })
119
- }, f(y.value(t.data.volume, "volume")), 5)
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(), s("span", Z, [
122
- r("span", {
123
- style: i({
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
- r("span", {
132
- style: i({ color: t.color, fontWeight: 500 })
133
- }, f(y.value(t.data.value, "value")), 5)
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
- ie as default
141
+ le as default
143
142
  };
@@ -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 a, openBlock as g, createBlock as U, Teleport as q, createElementBlock as u, normalizeStyle as f, renderSlot as G, Fragment as F, renderList as A, createElementVNode as b, toDisplayString as $, createCommentVNode as j } from "vue";
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 S = t, i = J(), l = C(O), I = C(P), w = C(Q);
12
- if (!l)
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(() => S.position === "right" ? w.value : I.value), h = E(null), v = E(0), V = () => {
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
- h.value = null;
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(n) {
27
- const { id: d, seriesId: e, layerIndex: s, label: o, color: p, isDisabled: x } = n;
28
- return { id: d, seriesId: e, layerIndex: s, label: o, color: p, isDisabled: x, toggle: () => {
29
- s !== void 0 ? i.setLayerVisible(e, s, !i.isLayerVisible(e, s)) : i.setSeriesVisible(e, !i.isSeriesVisible(e));
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 (h.value === d) {
32
+ if (p.value === s) {
32
33
  i.batch(() => {
33
- for (const r of i.getSeriesIds()) {
34
- i.setSeriesVisible(r, !0);
35
- const y = i.getSeriesLayers(r);
36
- if (y)
37
- for (let c = 0; c < y.length; c++) i.setLayerVisible(r, c, !0);
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
- }), h.value = null;
40
+ }), p.value = null, f.onToggle?.({ id: s, action: "unisolate" });
40
41
  return;
41
42
  }
42
43
  i.batch(() => {
43
- for (const r of i.getSeriesIds()) {
44
- const y = i.getSeriesLayers(r);
45
- if (y) {
46
- i.setSeriesVisible(r, r === e);
47
- for (let c = 0; c < y.length; c++)
48
- i.setLayerVisible(r, c, r === e && c === s);
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(r, r === d);
51
+ i.setSeriesVisible(a, a === s);
51
52
  }
52
- }), h.value = d;
53
+ }), p.value = s, f.onToggle?.({ id: s, action: "isolate" });
53
54
  } };
54
55
  }
55
- function K(n) {
56
- const d = [];
57
- for (const e of n.getSeriesIds()) {
58
- const s = n.getSeriesLayers(e);
59
- if (s)
60
- for (let o = 0; o < s.length; o++) {
61
- const p = `${e}_layer${o}`, x = n.isSeriesVisible(e) && n.isLayerVisible(e, o);
62
- d.push(
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: p,
65
+ id: x,
65
66
  seriesId: e,
66
- layerIndex: o,
67
- label: n.getLayerLabel(e, o) ?? `Series ${o + 1}`,
68
- color: s[o].color,
69
- isDisabled: !x
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 o = n.getSeriesColor(e);
75
- if (!o) continue;
76
- const p = n.getSeriesLabel(e), x = n.isSeriesVisible(e);
77
- d.push(
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: p ?? "Series",
83
- color: o,
84
- isDisabled: !x
83
+ label: x ?? "Series",
84
+ color: n,
85
+ isDisabled: !y
85
86
  })
86
87
  );
87
88
  }
88
89
  }
89
- return d;
90
+ return s;
90
91
  }
91
- const m = k(() => (v.value, h.value, K(i))), B = M(), R = k(() => typeof B.default == "function");
92
- function T(n) {
93
- S.mode === "isolate" || S.mode === "solo" ? n.isolate() : n.toggle();
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 (n, d) => L.value && a(l) ? (g(), U(q, {
96
+ return (o, s) => L.value && d(r) ? (c(), U(q, {
96
97
  key: 0,
97
98
  to: L.value
98
99
  }, [
99
- R.value && m.value.length > 0 ? (g(), u("div", {
100
+ B.value && b.value.length > 0 ? (c(), u("div", {
100
101
  key: 0,
101
102
  "data-legend": t.position,
102
- style: f({
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: a(l).typography.fontFamily,
111
- fontSize: a(l).axis.fontSize + "px",
112
- color: a(l).axis.textColor,
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(n.$slots, "default", { items: m.value })
118
- ], 12, X)) : t.items && t.items.length > 0 ? (g(), u("div", {
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: f({
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: a(l).typography.fontFamily,
130
- fontSize: a(l).axis.fontSize + "px",
131
- color: a(l).axis.textColor,
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
- (g(!0), u(F, null, A(t.items, (e, s) => (g(), u("div", {
137
- key: s,
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
- b("span", {
146
- style: f({
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
- b("span", Z, $(e.label), 1)
155
+ S("span", Z, A(e.label), 1)
155
156
  ]))), 128))
156
- ], 12, Y)) : m.value.length > 0 ? (g(), u("div", {
157
+ ], 12, Y)) : b.value.length > 0 ? (c(), u("div", {
157
158
  key: 2,
158
159
  "data-legend": t.position,
159
- style: f({
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: a(l).typography.fontFamily,
168
- fontSize: a(l).axis.fontSize + "px",
169
- color: a(l).axis.textColor,
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
- (g(!0), u(F, null, A(m.value, (e) => (g(), u("button", {
175
+ (c(!0), u(F, null, T(b.value, (e) => (c(), u("button", {
175
176
  key: e.id,
176
177
  type: "button",
177
- onClick: (s) => T(e),
178
- style: f({
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
- b("span", {
196
- style: f({
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
- b("span", te, $(e.label), 1)
205
+ S("span", te, A(e.label), 1)
205
206
  ], 12, ee))), 128))
206
- ], 12, _)) : j("", !0)
207
- ], 8, ["to"])) : j("", !0);
207
+ ], 12, _)) : $("", !0)
208
+ ], 8, ["to"])) : $("", !0);
208
209
  }
209
210
  });
210
211
  export {
@@ -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 $, useTheme as j } from "../context.js";
4
- const O = ["data-chart-pie-legend-position"], U = { style: { flex: 1, opacity: 0.8 } }, q = { style: { flex: 1, opacity: 0.8 } }, Q = /* @__PURE__ */ V({
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 = $(), _ = j(), A = w(), W = r(() => typeof A.default == "function"), c = E(0), k = () => {
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", U, u(t.label), 1),
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, O)
82
+ ], 12, U)
83
83
  ], 8, ["to"])) : i.value.length > 0 ? (n(), a("div", {
84
84
  key: 2,
85
85
  "data-chart-pie-legend": "",