vue-chrts 0.2.3 → 0.2.5-test.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,19 +1,13 @@
1
- import { defineComponent as z, useSlots as P, useTemplateRef as N, ref as O, computed as R, createElementBlock as c, openBlock as a, Fragment as j, createCommentVNode as r, createVNode as s, createElementVNode as w, unref as t, withCtx as D, createBlock as u, renderSlot as g } from "vue";
2
- import { Scatter as K, Position as M } from "@unovis/ts";
3
- import { VisBulletLegend as k, VisXYContainer as S, VisTooltip as E, VisScatter as G, VisAxis as x } from "@unovis/vue";
4
- import { LegendPosition as d } from "../../types.js";
5
- import { getFirstPropertyValue as $ } from "../../utils.js";
6
- import W from "../Tooltip.js";
7
- const X = {
8
- key: 0,
9
- class: "flex items-center justify-end pb-4"
10
- }, Y = {
11
- key: 1,
12
- class: "flex items-center justify-end pt-4"
13
- }, q = {
1
+ import { defineComponent as N, useSlots as O, useTemplateRef as S, ref as _, computed as m, createElementBlock as f, openBlock as l, normalizeStyle as c, createVNode as s, createCommentVNode as r, createElementVNode as D, unref as t, withCtx as R, createBlock as d, renderSlot as g } from "vue";
2
+ import { Scatter as w, Position as K } from "@unovis/ts";
3
+ import { VisXYContainer as M, VisTooltip as E, VisScatter as G, VisAxis as k, VisBulletLegend as W } from "@unovis/vue";
4
+ import { LegendPosition as $ } from "../../types.js";
5
+ import { getFirstPropertyValue as j } from "../../utils.js";
6
+ import X from "../Tooltip.js";
7
+ const Y = {
14
8
  ref: "slotWrapper",
15
9
  class: "hidden"
16
- }, ee = /* @__PURE__ */ z({
10
+ }, Z = /* @__PURE__ */ N({
17
11
  __name: "BubbleChart",
18
12
  props: {
19
13
  xAccessor: {},
@@ -34,7 +28,8 @@ const X = {
34
28
  categoryKey: {},
35
29
  xFormatter: {},
36
30
  yFormatter: {},
37
- legendPosition: { default: d.Bottom },
31
+ legendPosition: { default: $.BottomCenter },
32
+ legendStyle: { default: void 0 },
38
33
  sizeOptions: {},
39
34
  xDomainLine: { type: Boolean, default: !0 },
40
35
  yDomainLine: { type: Boolean, default: !0 },
@@ -52,51 +47,58 @@ const X = {
52
47
  }) }
53
48
  },
54
49
  emits: ["click"],
55
- setup(L, { emit: h }) {
56
- const e = L, T = P(), m = N("slotWrapper"), o = O(), y = R(() => e.categories && typeof e.categories == "object" && !Array.isArray(e.categories) ? Object.values(e.categories) : Array.isArray(e.categories) ? e.categories : []), b = e.xAccessor, B = e.yAccessor, v = e.sizeAccessor || ((i) => typeof i.comments == "number" ? i.comments : 1), A = (i) => {
57
- var p, f;
50
+ setup(x, { emit: L }) {
51
+ const e = x, T = O(), u = S("slotWrapper"), a = _(), h = e.xAccessor, v = e.yAccessor, b = e.sizeAccessor || ((i) => typeof i.comments == "number" ? i.comments : 1), B = (i) => {
52
+ var y, p;
58
53
  if (!e.categories || !e.categoryKey)
59
- return console.warn("BubbleChart: categories and categoryKey are required for color mapping"), "#cccccc";
54
+ return console.warn(
55
+ "BubbleChart: categories and categoryKey are required for color mapping"
56
+ ), "#cccccc";
60
57
  const n = String(i[e.categoryKey]);
61
- let l = (p = e.categories[n]) == null ? void 0 : p.color;
62
- return Object.keys(e.categories).length === 1 && (l = (f = e.categories[e.categoryKey]) == null ? void 0 : f.color), l || (console.warn(`BubbleChart: No color defined for category "${n}"`), "#cccccc");
63
- }, F = h;
64
- function V(i) {
65
- return o.value = i, C();
66
- }
58
+ let o = (y = e.categories[n]) == null ? void 0 : y.color;
59
+ return Object.keys(e.categories).length === 1 && (o = (p = e.categories[e.categoryKey]) == null ? void 0 : p.color), o || (console.warn(
60
+ `BubbleChart: No color defined for category "${n}"`
61
+ ), "#cccccc");
62
+ }, A = L;
67
63
  function C(i) {
68
- return typeof window > "u" ? "" : m.value ? m.value.innerHTML : "";
64
+ return a.value = i, V();
65
+ }
66
+ function V(i) {
67
+ return typeof window > "u" ? "" : u.value ? u.value.innerHTML : "";
69
68
  }
70
- const _ = {
71
- [K.selectors.point]: V
72
- };
73
- return (i, n) => (a(), c(j, null, [
74
- !e.hideLegend && e.legendPosition === t(d).Top ? (a(), c("div", X, [
75
- s(t(k), { items: y.value }, null, 8, ["items"])
76
- ])) : r("", !0),
77
- s(t(S), {
69
+ const F = {
70
+ [w.selectors.point]: C
71
+ }, z = m(() => e.legendPosition.startsWith("top")), P = m(() => e.legendPosition.includes("left") ? "flex-start" : e.legendPosition.includes("right") ? "flex-end" : "center");
72
+ return (i, n) => (l(), f("div", {
73
+ style: c({
74
+ display: "flex",
75
+ flexDirection: z.value ? "column-reverse" : "column",
76
+ gap: "var(--vis-legend-spacing)"
77
+ })
78
+ }, [
79
+ s(t(M), {
78
80
  data: e.data,
79
81
  height: e.height || 600,
80
82
  padding: e.padding,
81
83
  scaleByDomain: !0,
82
- onClick: n[0] || (n[0] = (l) => F("click", l, o.value))
84
+ onClick: n[0] || (n[0] = (o) => A("click", o, a.value))
83
85
  }, {
84
- default: D(() => [
85
- e.hideTooltip ? r("", !0) : (a(), u(t(E), {
86
+ default: R(() => [
87
+ e.hideTooltip ? r("", !0) : (l(), d(t(E), {
86
88
  key: 0,
87
- triggers: _
89
+ triggers: F
88
90
  })),
89
91
  s(t(G), {
90
- x: t(b),
91
- y: t(B),
92
- color: A,
93
- size: t(v),
94
- labelPosition: e.labelPosition || t(M).Bottom,
92
+ x: t(h),
93
+ y: t(v),
94
+ color: B,
95
+ size: t(b),
96
+ labelPosition: e.labelPosition || t(K).Bottom,
95
97
  sizeRange: e.sizeRange || [1, 20],
96
98
  opacity: e.opacity,
97
99
  cursor: "pointer"
98
100
  }, null, 8, ["x", "y", "size", "labelPosition", "sizeRange", "opacity"]),
99
- e.hideXAxis ? r("", !0) : (a(), u(t(x), {
101
+ e.hideXAxis ? r("", !0) : (l(), d(t(k), {
100
102
  key: 1,
101
103
  type: "x",
102
104
  label: e.xLabel,
@@ -108,7 +110,7 @@ const X = {
108
110
  tickValues: e.xExplicitTicks,
109
111
  minMaxTicksOnly: e.minMaxTicksOnly
110
112
  }, null, 8, ["label", "tickFormat", "gridLine", "domainLine", "tickLine", "numTicks", "tickValues", "minMaxTicksOnly"])),
111
- e.hideYAxis ? r("", !0) : (a(), u(t(x), {
113
+ e.hideYAxis ? r("", !0) : (l(), d(t(k), {
112
114
  key: 2,
113
115
  type: "y",
114
116
  label: e.yLabel,
@@ -121,25 +123,41 @@ const X = {
121
123
  ]),
122
124
  _: 1
123
125
  }, 8, ["data", "height", "padding"]),
124
- !e.hideLegend && e.legendPosition === t(d).Bottom ? (a(), c("div", Y, [
125
- s(t(k), { items: y.value }, null, 8, ["items"])
126
- ])) : r("", !0),
127
- w("div", q, [
126
+ e.hideLegend ? r("", !0) : (l(), f("div", {
127
+ key: 0,
128
+ style: c({
129
+ display: "flex",
130
+ justifyContent: P.value
131
+ })
132
+ }, [
133
+ s(t(W), {
134
+ class: "bulletLegendOverrides",
135
+ style: c([
136
+ e.legendStyle,
137
+ "display: flex; gap: var(--vis-legend-spacing);"
138
+ ]),
139
+ items: Object.values(e.categories).map((o) => ({
140
+ ...o,
141
+ color: Array.isArray(o.color) ? o.color[0] : o.color
142
+ }))
143
+ }, null, 8, ["style", "items"])
144
+ ], 4)),
145
+ D("div", Y, [
128
146
  t(T).tooltip ? g(i.$slots, "tooltip", {
129
147
  key: 0,
130
- values: o.value
131
- }) : o.value ? g(i.$slots, "fallback", { key: 1 }, () => [
132
- s(W, {
133
- data: o.value,
148
+ values: a.value
149
+ }) : a.value ? g(i.$slots, "fallback", { key: 1 }, () => [
150
+ s(X, {
151
+ data: a.value,
134
152
  categories: e.categories || {},
135
- toolTipTitle: t($)(o.value) ?? "",
153
+ toolTipTitle: t(j)(a.value) ?? "",
136
154
  yFormatter: e.yFormatter
137
155
  }, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
138
156
  ]) : r("", !0)
139
157
  ], 512)
140
- ], 64));
158
+ ], 4));
141
159
  }
142
160
  });
143
161
  export {
144
- ee as default
162
+ Z as default
145
163
  };
@@ -107,6 +107,10 @@ export interface BubbleChartProps<T> {
107
107
  * See `LegendPosition` for available options.
108
108
  */
109
109
  legendPosition?: LegendPosition;
110
+ /**
111
+ * Optional inline CSS styles for the legend container.
112
+ */
113
+ legendStyle?: Record<string, string>;
110
114
  /** Options for controlling bubble sizes. */
111
115
  sizeOptions?: SizeOptions;
112
116
  /**
@@ -1,11 +1,11 @@
1
- import { defineComponent as V, useSlots as b, useTemplateRef as w, ref as T, createElementBlock as u, openBlock as p, Fragment as D, createElementVNode as n, createCommentVNode as m, createVNode as o, renderSlot as i, unref as l, withCtx as S, normalizeStyle as W, toDisplayString as B } from "vue";
2
- import { Donut as L } from "@unovis/ts";
3
- import { DonutType as R } from "./types.js";
4
- import { VisSingleContainer as H, VisTooltip as N, VisDonut as $, VisBulletLegend as j } from "@unovis/vue";
5
- const z = {
1
+ import { defineComponent as V, useSlots as b, useTemplateRef as x, ref as w, createElementBlock as c, openBlock as m, Fragment as T, createElementVNode as a, createCommentVNode as g, createVNode as r, renderSlot as s, unref as n, withCtx as D, normalizeStyle as S, toDisplayString as W } from "vue";
2
+ import { Donut as B } from "@unovis/ts";
3
+ import { DonutType as L } from "./types.js";
4
+ import { VisSingleContainer as R, VisTooltip as H, VisDonut as N, VisBulletLegend as $ } from "@unovis/vue";
5
+ const j = {
6
6
  ref: "slotWrapper",
7
7
  style: { display: "none" }
8
- }, A = { style: { display: "flex", "align-items": "center", padding: "10px 15px" } }, E = {
8
+ }, z = { style: { display: "flex", "align-items": "center", padding: "10px 15px" } }, A = {
9
9
  key: 0,
10
10
  style: {
11
11
  display: "flex",
@@ -13,7 +13,7 @@ const z = {
13
13
  justifyContent: "center",
14
14
  marginTop: "1rem"
15
15
  }
16
- }, M = /* @__PURE__ */ V({
16
+ }, U = /* @__PURE__ */ V({
17
17
  __name: "DonutChart",
18
18
  props: {
19
19
  type: {},
@@ -26,74 +26,74 @@ const z = {
26
26
  padAngle: {}
27
27
  },
28
28
  emits: ["click"],
29
- setup(c, { emit: g }) {
30
- const f = g, r = c, h = b(), s = w("slotWrapper"), t = T(), y = (e) => e, v = r.type === R.Half;
29
+ setup(t, { emit: p }) {
30
+ const f = p, i = t, h = b(), d = x("slotWrapper"), l = w(), y = (e) => e, v = i.type === L.Half;
31
31
  function C(e) {
32
- return t.value = e, k();
32
+ return l.value = e, k();
33
33
  }
34
34
  function k(e) {
35
- return typeof window > "u" ? "" : s.value ? s.value.innerHTML : "";
35
+ return typeof window > "u" ? "" : d.value ? d.value.innerHTML : "";
36
36
  }
37
- return (e, d) => (p(), u(D, null, [
38
- n("div", {
37
+ return (e, u) => (m(), c(T, null, [
38
+ a("div", {
39
39
  style: {
40
40
  display: "flex",
41
41
  alignItems: "center",
42
42
  justifyContent: "center"
43
43
  },
44
- onClick: d[0] || (d[0] = (a) => f("click", a, t.value))
44
+ onClick: u[0] || (u[0] = (o) => f("click", o, l.value))
45
45
  }, [
46
- o(l(H), {
47
- data: e.data,
48
- height: e.height,
46
+ r(n(R), {
47
+ data: t.data,
48
+ height: t.height,
49
49
  margin: {}
50
50
  }, {
51
- default: S(() => [
52
- o(l(N), {
51
+ default: D(() => [
52
+ r(n(H), {
53
53
  "horizontal-shift": 20,
54
54
  "vertical-shift": 20,
55
55
  triggers: {
56
- [l(L).selectors.segment]: C
56
+ [n(B).selectors.segment]: C
57
57
  }
58
58
  }, null, 8, ["triggers"]),
59
- o(l($), {
59
+ r(n(N), {
60
60
  value: y,
61
- "corner-radius": e.radius,
62
- "arc-width": e.arcWidth ?? 20,
63
- color: r.labels.map((a) => a.color),
61
+ "corner-radius": t.radius,
62
+ "arc-width": t.arcWidth ?? 20,
63
+ color: i.labels.map((o) => o.color),
64
64
  "angle-range": v ? [-1.5707963267948966, 1.5707963267948966] : [],
65
- "pad-angle": r.padAngle || 0
65
+ "pad-angle": i.padAngle || 0
66
66
  }, null, 8, ["corner-radius", "arc-width", "color", "angle-range", "pad-angle"])
67
67
  ]),
68
68
  _: 1
69
69
  }, 8, ["data", "height"]),
70
- i(e.$slots, "default"),
71
- n("div", z, [
72
- l(h).tooltip ? i(e.$slots, "tooltip", {
70
+ s(e.$slots, "default"),
71
+ a("div", j, [
72
+ n(h).tooltip ? s(e.$slots, "tooltip", {
73
73
  key: 0,
74
- values: t.value
75
- }) : t.value ? i(e.$slots, "fallback", { key: 1 }, () => [
76
- n("div", A, [
77
- n("div", {
78
- style: W({
74
+ values: l.value
75
+ }) : l.value ? s(e.$slots, "fallback", { key: 1 }, () => [
76
+ a("div", z, [
77
+ a("div", {
78
+ style: S({
79
79
  width: "0.5rem",
80
80
  height: "0.5rem",
81
81
  borderRadius: "9999px",
82
82
  marginRight: "0.5rem",
83
- backgroundColor: r.labels[t.value.index].color
83
+ backgroundColor: i.labels[l.value.index].color
84
84
  })
85
85
  }, null, 4),
86
- n("div", null, B(t.value.data), 1)
86
+ a("div", null, W(l.value.data), 1)
87
87
  ])
88
- ]) : m("", !0)
88
+ ]) : g("", !0)
89
89
  ], 512)
90
90
  ]),
91
- e.hideLegend ? m("", !0) : (p(), u("div", E, [
92
- o(l(j), { items: e.labels }, null, 8, ["items"])
91
+ t.hideLegend ? g("", !0) : (m(), c("div", A, [
92
+ r(n($), { items: t.labels }, null, 8, ["items"])
93
93
  ]))
94
94
  ], 64));
95
95
  }
96
96
  });
97
97
  export {
98
- M as default
98
+ U as default
99
99
  };
@@ -1,13 +1,13 @@
1
- import { defineComponent as P, computed as f, useSlots as O, useTemplateRef as j, ref as w, createElementBlock as p, openBlock as n, normalizeClass as x, normalizeStyle as k, createVNode as s, createCommentVNode as a, createElementVNode as M, unref as i, withCtx as W, createBlock as m, Fragment as z, renderList as E, mergeProps as G, renderSlot as h } from "vue";
1
+ import { defineComponent as N, computed as u, useSlots as O, useTemplateRef as W, ref as j, createElementBlock as y, openBlock as a, normalizeClass as w, normalizeStyle as g, createVNode as c, createCommentVNode as r, createElementVNode as M, unref as i, withCtx as S, createBlock as d, Fragment as z, renderList as E, mergeProps as G, renderSlot as h } from "vue";
2
2
  import { Position as v, CurveType as X } from "@unovis/ts";
3
3
  import { createMarkers as $, getFirstPropertyValue as R } from "../../utils.js";
4
- import S from "../Tooltip.js";
5
- import { VisXYContainer as Y, VisTooltip as H, VisLine as I, VisAxis as T, VisCrosshair as U, VisBulletLegend as q } from "@unovis/vue";
6
- import { LegendPosition as J } from "../../types.js";
7
- const Q = {
4
+ import Y from "../Tooltip.js";
5
+ import { VisXYContainer as H, VisTooltip as U, VisLine as q, VisAxis as x, VisCrosshair as I, VisBulletLegend as J } from "@unovis/vue";
6
+ import { LegendPosition as Q } from "../../types.js";
7
+ const Z = {
8
8
  ref: "slotWrapper",
9
9
  style: { display: "none" }
10
- }, oe = /* @__PURE__ */ P({
10
+ }, le = /* @__PURE__ */ N({
11
11
  __name: "LineChart",
12
12
  props: {
13
13
  data: {},
@@ -27,13 +27,14 @@ const Q = {
27
27
  curveType: {},
28
28
  lineWidth: { default: 2 },
29
29
  lineDashArray: {},
30
- xNumTicks: { default: (o) => o.data.length > 24 ? 24 / 4 : o.data.length - 1 },
30
+ xNumTicks: { default: (e) => e.data.length > 24 ? 24 / 4 : e.data.length - 1 },
31
31
  xExplicitTicks: {},
32
32
  minMaxTicksOnly: { type: Boolean },
33
- yNumTicks: { default: (o) => o.data.length > 24 ? 24 / 4 : o.data.length - 1 },
33
+ yNumTicks: { default: (e) => e.data.length > 24 ? 24 / 4 : e.data.length - 1 },
34
34
  hideTooltip: { type: Boolean },
35
- hideLegend: { type: Boolean },
36
- legendPosition: {},
35
+ hideLegend: { type: Boolean, default: !1 },
36
+ legendPosition: { default: Q.BottomCenter },
37
+ legendStyle: { default: void 0 },
37
38
  xGridLine: { type: Boolean },
38
39
  xDomainLine: { type: Boolean },
39
40
  yGridLine: { type: Boolean },
@@ -44,52 +45,54 @@ const Q = {
44
45
  hideYAxis: { type: Boolean },
45
46
  crosshairConfig: { default: () => ({
46
47
  color: "#666"
47
- }) }
48
+ }) },
49
+ yDomain: {},
50
+ xDomain: {}
48
51
  },
49
52
  emits: ["click"],
50
- setup(o, { emit: L }) {
51
- const C = L, t = o, B = f(() => t.markerConfig ? $(t.markerConfig) : ""), b = O(), c = j("slotWrapper"), l = w();
52
- function D(e) {
53
- return typeof window > "u" ? "" : c.value ? c.value.innerHTML : "";
53
+ setup(e, { emit: T }) {
54
+ const L = T, t = e, D = u(() => t.markerConfig ? $(t.markerConfig) : ""), C = O(), f = W("slotWrapper"), o = j();
55
+ function p(n) {
56
+ return typeof window > "u" ? "" : f.value ? f.value.innerHTML : "";
54
57
  }
55
- function V(e) {
56
- return l.value = e, D();
58
+ function B(n) {
59
+ return o.value = n, p();
57
60
  }
58
- const y = f(
59
- () => t.legendPosition === J.Top
60
- ), A = Object.values(t.categories).map(
61
- (e, r) => `var(--vis-color${r})`
62
- ), F = (e) => Object.values(t.categories)[e].color ?? A[e];
63
- return (e, r) => (n(), p("div", {
64
- style: k({
61
+ const b = u(() => t.legendPosition.startsWith("top")), A = u(() => t.legendPosition.includes("left") ? "flex-start" : t.legendPosition.includes("right") ? "flex-end" : "center"), V = Object.values(t.categories).map(
62
+ (n, s) => `var(--vis-color${s})`
63
+ ), F = (n) => Object.values(t.categories)[n].color ?? V[n];
64
+ return (n, s) => (a(), y("div", {
65
+ style: g({
65
66
  display: "flex",
66
- flexDirection: y.value ? "column-reverse" : "column",
67
- gap: "1rem"
67
+ flexDirection: b.value ? "column-reverse" : "column",
68
+ gap: "var(--vis-legend-spacing)"
68
69
  }),
69
- class: x({ markers: !!t.markerConfig }),
70
- onClick: r[0] || (r[0] = (d) => C("click", d, l.value))
70
+ class: w({ markers: !!t.markerConfig }),
71
+ onClick: s[0] || (s[0] = (l) => L("click", l, o.value))
71
72
  }, [
72
- s(i(Y), {
73
+ c(i(H), {
73
74
  data: e.data,
74
75
  padding: e.padding,
75
76
  height: e.height,
76
- svgDefs: B.value
77
+ svgDefs: D.value,
78
+ yDomain: e.yDomain,
79
+ xDomain: e.xDomain
77
80
  }, {
78
- default: W(() => [
79
- s(i(H), {
81
+ default: S(() => [
82
+ c(i(U), {
80
83
  "horizontal-placement": i(v).Right,
81
84
  "vertical-placement": i(v).Top
82
85
  }, null, 8, ["horizontal-placement", "vertical-placement"]),
83
- (n(!0), p(z, null, E(Object.keys(t.categories), (d, u) => (n(), m(i(I), {
84
- key: u,
85
- x: (g, N) => N,
86
- y: (g) => g[d],
87
- color: F(u),
86
+ (a(!0), y(z, null, E(Object.keys(t.categories), (l, m) => (a(), d(i(q), {
87
+ key: m,
88
+ x: (k, P) => P,
89
+ y: (k) => k[l],
90
+ color: F(m),
88
91
  "curve-type": e.curveType ?? i(X).MonotoneX,
89
92
  "line-width": e.lineWidth,
90
- lineDashArray: e.lineDashArray ? e.lineDashArray[u] : void 0
93
+ lineDashArray: e.lineDashArray ? e.lineDashArray[m] : void 0
91
94
  }, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"]))), 128)),
92
- e.hideXAxis ? a("", !0) : (n(), m(i(T), {
95
+ e.hideXAxis ? r("", !0) : (a(), d(i(x), {
93
96
  key: 0,
94
97
  type: "x",
95
98
  "tick-format": e.xFormatter,
@@ -102,7 +105,7 @@ const Q = {
102
105
  "tick-values": e.xExplicitTicks,
103
106
  "min-max-ticks-only": e.minMaxTicksOnly
104
107
  }, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"])),
105
- e.hideYAxis ? a("", !0) : (n(), m(i(T), {
108
+ e.hideYAxis ? r("", !0) : (a(), d(i(x), {
106
109
  key: 1,
107
110
  type: "y",
108
111
  "tick-format": e.yFormatter,
@@ -112,39 +115,44 @@ const Q = {
112
115
  "grid-line": e.yGridLine,
113
116
  "tick-line": e.yTickLine
114
117
  }, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"])),
115
- e.hideTooltip ? a("", !0) : (n(), m(i(U), G({ key: 2 }, e.crosshairConfig, { template: V }), null, 16))
118
+ e.hideTooltip ? r("", !0) : (a(), d(i(I), G({ key: 2 }, e.crosshairConfig, { template: B }), null, 16))
116
119
  ]),
117
120
  _: 1
118
- }, 8, ["data", "padding", "height", "svgDefs"]),
119
- e.hideLegend ? a("", !0) : (n(), p("div", {
121
+ }, 8, ["data", "padding", "height", "svgDefs", "yDomain", "xDomain"]),
122
+ t.hideLegend ? r("", !0) : (a(), y("div", {
120
123
  key: 0,
121
- style: k({
124
+ style: g({
122
125
  display: "flex",
123
- alignItems: "center",
124
- justifyContent: "flex-end",
125
- paddingBottom: y.value ? "1rem" : void 0
126
+ justifyContent: A.value
126
127
  })
127
128
  }, [
128
- s(i(q), {
129
- items: Object.values(e.categories)
130
- }, null, 8, ["items"])
129
+ c(i(J), {
130
+ style: g([
131
+ t.legendStyle,
132
+ "display: flex; gap: var(--vis-legend-spacing);"
133
+ ]),
134
+ items: Object.values(t.categories).map((l) => ({
135
+ ...l,
136
+ color: Array.isArray(l.color) ? l.color[0] : l.color
137
+ }))
138
+ }, null, 8, ["style", "items"])
131
139
  ], 4)),
132
- M("div", Q, [
133
- i(b).tooltip ? h(e.$slots, "tooltip", {
140
+ M("div", Z, [
141
+ i(C).tooltip ? h(n.$slots, "tooltip", {
134
142
  key: 0,
135
- values: l.value
136
- }) : l.value ? h(e.$slots, "fallback", { key: 1 }, () => [
137
- s(S, {
138
- data: l.value,
143
+ values: o.value
144
+ }) : o.value ? h(n.$slots, "fallback", { key: 1 }, () => [
145
+ c(Y, {
146
+ data: o.value,
139
147
  categories: e.categories,
140
- toolTipTitle: i(R)(l.value) ?? "",
148
+ toolTipTitle: i(R)(o.value) ?? "",
141
149
  yFormatter: t.yFormatter
142
150
  }, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
143
- ]) : a("", !0)
151
+ ]) : r("", !0)
144
152
  ], 512)
145
153
  ], 6));
146
154
  }
147
155
  });
148
156
  export {
149
- oe as default
157
+ le as default
150
158
  };
@@ -71,7 +71,7 @@ export interface LineChartProps<T> {
71
71
  /**
72
72
  * Force specific ticks on the x-axis.
73
73
  */
74
- xExplicitTicks?: number;
74
+ xExplicitTicks?: (number | string | Date)[];
75
75
  /**
76
76
  * Force only first and last ticks on the x-axis.
77
77
  */
@@ -93,6 +93,10 @@ export interface LineChartProps<T> {
93
93
  * See `LegendPosition` for available options.
94
94
  */
95
95
  legendPosition?: LegendPosition;
96
+ /**
97
+ * Optional style object for the legend container. Allows custom CSS styling.
98
+ */
99
+ legendStyle?: string | Record<string, string>;
96
100
  /**
97
101
  * If `true`, displays grid lines along the x-axis.
98
102
  */
@@ -129,4 +133,12 @@ export interface LineChartProps<T> {
129
133
  * Crosshair configuration object for customizing the appearance of the crosshair line.
130
134
  */
131
135
  crosshairConfig?: CrosshairConfig;
136
+ /**
137
+ * The domain for the y-axis, specified as a tuple of two values.
138
+ */
139
+ yDomain?: [number | undefined, number | undefined];
140
+ /**
141
+ * The domain for the x-axis, specified as a tuple of two values.
142
+ */
143
+ xDomain?: [number | undefined, number | undefined];
132
144
  }
@@ -1,11 +1,11 @@
1
- import { defineComponent as v, computed as y, createElementBlock as r, openBlock as i, createElementVNode as e, toDisplayString as l, Fragment as h, renderList as b, normalizeStyle as n } from "vue";
2
- const f = { style: { padding: "10px 15px" } }, x = { style: {
1
+ import { defineComponent as v, computed as y, createElementBlock as i, openBlock as l, createElementVNode as o, toDisplayString as n, Fragment as b, renderList as f, normalizeStyle as a } from "vue";
2
+ const h = { style: { padding: "10px 15px" } }, B = { style: {
3
3
  color: "var(--tooltip-value-color)",
4
4
  textTransform: "capitalize",
5
- borderBottom: "1px solid rgba(255, 255, 255, 0.05)",
5
+ borderBottom: "borderBottom: 1px solid var(--tooltip-border-color)",
6
6
  marginBottom: "0.25rem",
7
7
  paddingBottom: "0.25rem"
8
- } }, B = /* @__PURE__ */ v({
8
+ } }, F = /* @__PURE__ */ v({
9
9
  __name: "Tooltip",
10
10
  props: {
11
11
  data: {},
@@ -13,30 +13,30 @@ const f = { style: { padding: "10px 15px" } }, x = { style: {
13
13
  toolTipTitle: {},
14
14
  yFormatter: { type: Function }
15
15
  },
16
- setup(c) {
17
- const a = c, d = ["_index", "_stacked", "_ending"], m = y(() => Object.entries(a.data ?? []).filter(
18
- ([t, g]) => !d.includes(t) && Object.keys(a.categories).includes(t)
16
+ setup(t) {
17
+ const c = t, g = ["_index", "_stacked", "_ending"], p = y(() => Object.entries(c.data ?? []).filter(
18
+ ([r, u]) => !g.includes(r) && Object.keys(c.categories).includes(r)
19
19
  ));
20
- return (t, g) => (i(), r("div", f, [
21
- e("div", x, l(t.toolTipTitle), 1),
22
- (i(!0), r(h, null, b(m.value, ([o, s], u) => {
23
- var p;
24
- return i(), r("div", {
25
- key: o,
20
+ return (r, u) => (l(), i("div", h, [
21
+ o("div", B, n(t.toolTipTitle), 1),
22
+ (l(!0), i(b, null, f(p.value, ([e, s], x) => {
23
+ var d, m;
24
+ return l(), i("div", {
25
+ key: e,
26
26
  style: { display: "flex", "align-items": "center", "margin-bottom": "4px" }
27
27
  }, [
28
- e("span", {
29
- style: n([{ width: "8px", height: "8px", "border-radius": "4px", "margin-right": "8px" }, {
30
- backgroundColor: (p = t.categories[o]) != null && p.color ? t.categories[o].color : `var(--vis-color${u})`
28
+ o("span", {
29
+ style: a([{ width: "8px", height: "8px", "border-radius": "4px", "margin-right": "8px" }, {
30
+ backgroundColor: typeof ((d = t.categories[e]) == null ? void 0 : d.color) == "string" && ((m = t.categories[e]) != null && m.color) ? t.categories[e].color : `var(--vis-color${x})`
31
31
  }])
32
32
  }, null, 4),
33
- e("div", null, [
34
- e("span", {
35
- style: n([{ "font-weight": "600", "margin-right": "8px" }, { color: "var(--tooltip-label-color)" }])
36
- }, l(t.categories[o].name) + ":", 1),
37
- e("span", {
38
- style: n([{ "font-weight": "400" }, { color: "var(--tooltip-value-color)" }])
39
- }, l(t.yFormatter ? t.yFormatter(s) : s), 1)
33
+ o("div", null, [
34
+ o("span", {
35
+ style: a([{ "font-weight": "600", "margin-right": "8px" }, { color: "var(--tooltip-label-color)" }])
36
+ }, n(t.categories[e].name) + ":", 1),
37
+ o("span", {
38
+ style: a([{ "font-weight": "400" }, { color: "var(--tooltip-value-color)" }])
39
+ }, n(t.yFormatter ? t.yFormatter(s) : s), 1)
40
40
  ])
41
41
  ]);
42
42
  }), 128))
@@ -44,5 +44,5 @@ const f = { style: { padding: "10px 15px" } }, x = { style: {
44
44
  }
45
45
  });
46
46
  export {
47
- B as default
47
+ F as default
48
48
  };