vue-chrts 0.2.4 → 0.2.5-test.2

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.
@@ -101,6 +101,10 @@ type BarChartPropsBase<T> = {
101
101
  * See `LegendPosition` for available options.
102
102
  */
103
103
  legendPosition?: LegendPosition;
104
+ /**
105
+ * Optional style object for the legend container. Allows custom CSS styling.
106
+ */
107
+ legendStyle?: string | Record<string, string>;
104
108
  /**
105
109
  * If `true`, displays a domain line (axis line) along the x-axis.
106
110
  */
@@ -133,23 +137,35 @@ type BarChartPropsBase<T> = {
133
137
  * If `true`, hide the y-axis.
134
138
  */
135
139
  hideYAxis?: boolean;
140
+ /**
141
+ * Specific spacing between stacked and grouped bars in pixels.
142
+ * Only applicable if `stackAndGrouped` is `true`.
143
+ */
136
144
  stackedGroupedSpacing?: number;
137
145
  };
138
- type BarChartPropsStackAndGrouped<T> = BarChartPropsBase<T> & {
139
- stackAndGrouped: true;
146
+ export type BarChartProps<T> = BarChartPropsBase<T> & {
140
147
  /**
141
- * The key in the data object type 'T' to be used for the x-axis values.
142
- * Required when stackAndGrouped is true.
148
+ * Whether the bars should be stacked and grouped.
149
+ * If true, `valueLabel` is optional and `xAxis` is required.
143
150
  */
144
- xAxis: keyof T;
145
- };
146
- type BarChartPropsNormal<T> = BarChartPropsBase<T> & {
147
- stackAndGrouped?: false;
151
+ stackAndGrouped?: boolean;
152
+ /**
153
+ * Configuration for the value label display.
154
+ * Required if `stackAndGrouped` is false and `xAxis` is present.
155
+ * Optional otherwise.
156
+ */
157
+ valueLabel?: ValueLabel;
148
158
  /**
149
- * The key in the data object type 'T' to be used for the x-axis values.
150
- * Optional when stackAndGrouped is not true.
159
+ * The data key for the X-axis.
160
+ * Required if `stackAndGrouped` is true, or if `stackAndGrouped` is false AND `valueLabel` is present.
151
161
  */
152
162
  xAxis?: keyof T;
153
163
  };
154
- export type BarChartProps<T> = BarChartPropsStackAndGrouped<T> | BarChartPropsNormal<T>;
164
+ export type ValueLabel = {
165
+ label: (d: any, index: number) => string | number;
166
+ labelSpacing?: number;
167
+ backgroundColor?: string;
168
+ color?: string;
169
+ labelFontSize?: number;
170
+ };
155
171
  export {};
@@ -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,19 +1,12 @@
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";
1
+ import { defineComponent as w, useSlots as D, useTemplateRef as L, ref as T, computed as g, createElementBlock as p, openBlock as f, normalizeStyle as o, createVNode as r, createCommentVNode as m, renderSlot as d, createElementVNode as a, unref as i, withCtx as B, toDisplayString as P } from "vue";
2
+ import { Donut as W } from "@unovis/ts";
3
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 = {
4
+ import { VisSingleContainer as A, VisTooltip as H, VisDonut as N, VisBulletLegend as $ } from "@unovis/vue";
5
+ import { LegendPosition as z } from "../../types.js";
6
+ const E = {
6
7
  ref: "slotWrapper",
7
8
  style: { display: "none" }
8
- }, A = { style: { display: "flex", "align-items": "center", padding: "10px 15px" } }, E = {
9
- key: 0,
10
- style: {
11
- display: "flex",
12
- alignItems: "center",
13
- justifyContent: "center",
14
- marginTop: "1rem"
15
- }
16
- }, M = /* @__PURE__ */ V({
9
+ }, j = { style: { display: "flex", "align-items": "center", padding: "10px 15px" } }, I = /* @__PURE__ */ w({
17
10
  __name: "DonutChart",
18
11
  props: {
19
12
  type: {},
@@ -22,78 +15,91 @@ const z = {
22
15
  height: {},
23
16
  radius: {},
24
17
  hideLegend: { type: Boolean },
18
+ legendPosition: { default: z.BottomCenter },
19
+ legendStyle: {},
25
20
  labels: {},
26
21
  padAngle: {}
27
22
  },
28
23
  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;
31
- function C(e) {
32
- return t.value = e, k();
24
+ setup(l, { emit: h }) {
25
+ const v = h, e = l, y = D(), u = L("slotWrapper"), n = T(), x = (t) => t, C = e.type === R.Half;
26
+ function k(t) {
27
+ return n.value = t, V();
33
28
  }
34
- function k(e) {
35
- return typeof window > "u" ? "" : s.value ? s.value.innerHTML : "";
29
+ function V(t) {
30
+ return typeof window > "u" ? "" : u.value ? u.value.innerHTML : "";
36
31
  }
37
- return (e, d) => (p(), u(D, null, [
38
- n("div", {
39
- style: {
32
+ const b = g(() => e.legendPosition.includes("top")), S = g(() => e.legendPosition.includes("left") ? "flex-start" : e.legendPosition.includes("right") ? "flex-end" : "center");
33
+ return (t, c) => (f(), p("div", {
34
+ style: o({
35
+ display: "flex",
36
+ flexDirection: b.value ? "column-reverse" : "column",
37
+ gap: "var(--vis-legend-spacing)"
38
+ }),
39
+ onClick: c[0] || (c[0] = (s) => v("click", s, n.value))
40
+ }, [
41
+ r(i(A), {
42
+ data: l.data,
43
+ height: l.height,
44
+ margin: {}
45
+ }, {
46
+ default: B(() => [
47
+ r(i(H), {
48
+ "horizontal-shift": 20,
49
+ "vertical-shift": 20,
50
+ triggers: {
51
+ [i(W).selectors.segment]: k
52
+ }
53
+ }, null, 8, ["triggers"]),
54
+ r(i(N), {
55
+ value: x,
56
+ "corner-radius": l.radius,
57
+ "arc-width": l.arcWidth ?? 20,
58
+ color: e.labels.map((s) => s.color),
59
+ "angle-range": C ? [-1.5707963267948966, 1.5707963267948966] : [],
60
+ "pad-angle": e.padAngle || 0
61
+ }, null, 8, ["corner-radius", "arc-width", "color", "angle-range", "pad-angle"])
62
+ ]),
63
+ _: 1
64
+ }, 8, ["data", "height"]),
65
+ e.hideLegend ? m("", !0) : (f(), p("div", {
66
+ key: 0,
67
+ style: o({
40
68
  display: "flex",
41
- alignItems: "center",
42
- justifyContent: "center"
43
- },
44
- onClick: d[0] || (d[0] = (a) => f("click", a, t.value))
69
+ justifyContent: S.value
70
+ })
45
71
  }, [
46
- o(l(H), {
47
- data: e.data,
48
- height: e.height,
49
- margin: {}
50
- }, {
51
- default: S(() => [
52
- o(l(N), {
53
- "horizontal-shift": 20,
54
- "vertical-shift": 20,
55
- triggers: {
56
- [l(L).selectors.segment]: C
57
- }
58
- }, null, 8, ["triggers"]),
59
- o(l($), {
60
- value: y,
61
- "corner-radius": e.radius,
62
- "arc-width": e.arcWidth ?? 20,
63
- color: r.labels.map((a) => a.color),
64
- "angle-range": v ? [-1.5707963267948966, 1.5707963267948966] : [],
65
- "pad-angle": r.padAngle || 0
66
- }, null, 8, ["corner-radius", "arc-width", "color", "angle-range", "pad-angle"])
72
+ r(i($), {
73
+ style: o([
74
+ e.legendStyle,
75
+ "display: flex; gap: var(--vis-legend-spacing);"
67
76
  ]),
68
- _: 1
69
- }, 8, ["data", "height"]),
70
- i(e.$slots, "default"),
71
- n("div", z, [
72
- l(h).tooltip ? i(e.$slots, "tooltip", {
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({
79
- width: "0.5rem",
80
- height: "0.5rem",
81
- borderRadius: "9999px",
82
- marginRight: "0.5rem",
83
- backgroundColor: r.labels[t.value.index].color
84
- })
85
- }, null, 4),
86
- n("div", null, B(t.value.data), 1)
87
- ])
88
- ]) : m("", !0)
89
- ], 512)
90
- ]),
91
- e.hideLegend ? m("", !0) : (p(), u("div", E, [
92
- o(l(j), { items: e.labels }, null, 8, ["items"])
93
- ]))
94
- ], 64));
77
+ items: l.labels
78
+ }, null, 8, ["style", "items"])
79
+ ], 4)),
80
+ d(t.$slots, "default"),
81
+ a("div", E, [
82
+ i(y).tooltip ? d(t.$slots, "tooltip", {
83
+ key: 0,
84
+ values: n.value
85
+ }) : n.value ? d(t.$slots, "fallback", { key: 1 }, () => [
86
+ a("div", j, [
87
+ a("div", {
88
+ style: o({
89
+ width: "0.5rem",
90
+ height: "0.5rem",
91
+ borderRadius: "9999px",
92
+ marginRight: "0.5rem",
93
+ backgroundColor: e.labels[n.value.index].color
94
+ })
95
+ }, null, 4),
96
+ a("div", null, P(n.value.data), 1)
97
+ ])
98
+ ]) : m("", !0)
99
+ ], 512)
100
+ ], 4));
95
101
  }
96
102
  });
97
103
  export {
98
- M as default
104
+ I as default
99
105
  };
@@ -1,3 +1,4 @@
1
+ import { LegendPosition } from '../../types';
1
2
  export type DonutChartProps = {
2
3
  /**
3
4
  * The type of donut chart to render.
@@ -25,6 +26,15 @@ export type DonutChartProps = {
25
26
  * If `true`, hides the chart legend.
26
27
  */
27
28
  hideLegend?: boolean;
29
+ /**
30
+ * Optional position for the legend, if applicable.
31
+ * See `LegendPosition` for available options.
32
+ */
33
+ legendPosition?: LegendPosition;
34
+ /**
35
+ * Optional style object for the legend container. Allows custom CSS styling.
36
+ */
37
+ legendStyle?: string | Record<string, string>;
28
38
  /**
29
39
  * An array of label objects defining the name and color for each segment.
30
40
  */
@@ -1,154 +1,53 @@
1
- import { defineComponent as N, computed as f, useSlots as P, useTemplateRef as O, ref as j, createElementBlock as p, openBlock as n, normalizeClass as w, normalizeStyle as k, createVNode as s, createCommentVNode as l, 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";
2
- import { Position as v, CurveType as X } from "@unovis/ts";
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 = {
8
- ref: "slotWrapper",
9
- style: { display: "none" }
10
- }, te = /* @__PURE__ */ N({
1
+ import { defineComponent as a, createBlock as r, openBlock as p, mergeProps as s, createSlots as l, renderList as y, withCtx as c, renderSlot as m, normalizeProps as d, guardReactiveProps as h } from "vue";
2
+ import B from "../AreaChart/AreaChart.js";
3
+ const g = /* @__PURE__ */ a({
4
+ inheritAttrs: !1,
11
5
  __name: "LineChart",
12
6
  props: {
13
7
  data: {},
14
8
  height: {},
15
9
  xLabel: {},
16
10
  yLabel: {},
17
- padding: { default: () => ({
18
- top: 5,
19
- right: 5,
20
- bottom: 5,
21
- left: 5
22
- }) },
11
+ padding: {},
23
12
  categories: {},
24
13
  markerConfig: {},
25
- xFormatter: {},
26
- yFormatter: {},
14
+ xFormatter: { type: Function },
15
+ yFormatter: { type: Function },
27
16
  curveType: {},
28
- lineWidth: { default: 2 },
17
+ lineWidth: {},
29
18
  lineDashArray: {},
30
- xNumTicks: { default: (t) => t.data.length > 24 ? 24 / 4 : t.data.length - 1 },
19
+ xNumTicks: {},
31
20
  xExplicitTicks: {},
32
21
  minMaxTicksOnly: { type: Boolean },
33
- yNumTicks: { default: (t) => t.data.length > 24 ? 24 / 4 : t.data.length - 1 },
34
- hideTooltip: { type: Boolean },
22
+ yNumTicks: {},
35
23
  hideLegend: { type: Boolean },
24
+ hideTooltip: { type: Boolean },
36
25
  legendPosition: {},
37
- xGridLine: { type: Boolean },
26
+ legendStyle: {},
38
27
  xDomainLine: { type: Boolean },
39
- yGridLine: { type: Boolean },
40
28
  yDomainLine: { type: Boolean },
41
29
  xTickLine: { type: Boolean },
42
30
  yTickLine: { type: Boolean },
31
+ xGridLine: { type: Boolean },
32
+ yGridLine: { type: Boolean },
43
33
  hideXAxis: { type: Boolean },
44
34
  hideYAxis: { type: Boolean },
45
- crosshairConfig: { default: () => ({
46
- color: "#666"
47
- }) },
35
+ crosshairConfig: {},
48
36
  yDomain: {},
49
37
  xDomain: {}
50
38
  },
51
- emits: ["click"],
52
- setup(t, { emit: L }) {
53
- const D = L, o = t, C = f(() => o.markerConfig ? $(o.markerConfig) : ""), B = P(), y = O("slotWrapper"), a = j();
54
- function b(e) {
55
- return typeof window > "u" ? "" : y.value ? y.value.innerHTML : "";
56
- }
57
- function V(e) {
58
- return a.value = e, b();
59
- }
60
- const c = f(
61
- () => o.legendPosition === J.Top
62
- ), A = Object.values(o.categories).map(
63
- (e, r) => `var(--vis-color${r})`
64
- ), F = (e) => Object.values(o.categories)[e].color ?? A[e];
65
- return (e, r) => (n(), p("div", {
66
- style: k({
67
- display: "flex",
68
- flexDirection: c.value ? "column-reverse" : "column",
69
- gap: "1rem"
70
- }),
71
- class: w({ markers: !!o.markerConfig }),
72
- onClick: r[0] || (r[0] = (d) => D("click", d, a.value))
73
- }, [
74
- s(i(Y), {
75
- data: e.data,
76
- padding: e.padding,
77
- height: e.height,
78
- svgDefs: C.value,
79
- yDomain: e.yDomain,
80
- xDomain: e.xDomain
81
- }, {
82
- default: W(() => [
83
- s(i(H), {
84
- "horizontal-placement": i(v).Right,
85
- "vertical-placement": i(v).Top
86
- }, null, 8, ["horizontal-placement", "vertical-placement"]),
87
- (n(!0), p(z, null, E(Object.keys(o.categories), (d, u) => (n(), m(i(I), {
88
- key: u,
89
- x: (g, x) => x,
90
- y: (g) => g[d],
91
- color: F(u),
92
- "curve-type": e.curveType ?? i(X).MonotoneX,
93
- "line-width": e.lineWidth,
94
- lineDashArray: e.lineDashArray ? e.lineDashArray[u] : void 0
95
- }, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"]))), 128)),
96
- e.hideXAxis ? l("", !0) : (n(), m(i(T), {
97
- key: 0,
98
- type: "x",
99
- "tick-format": e.xFormatter,
100
- label: e.xLabel,
101
- "label-margin": 8,
102
- "domain-line": e.xDomainLine,
103
- "grid-line": e.xGridLine,
104
- "tick-line": e.xTickLine,
105
- "num-ticks": e.xNumTicks,
106
- "tick-values": e.xExplicitTicks,
107
- "min-max-ticks-only": e.minMaxTicksOnly
108
- }, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"])),
109
- e.hideYAxis ? l("", !0) : (n(), m(i(T), {
110
- key: 1,
111
- type: "y",
112
- "tick-format": e.yFormatter,
113
- label: e.yLabel,
114
- "num-ticks": e.yNumTicks,
115
- "domain-line": e.yDomainLine,
116
- "grid-line": e.yGridLine,
117
- "tick-line": e.yTickLine
118
- }, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"])),
119
- e.hideTooltip ? l("", !0) : (n(), m(i(U), G({ key: 2 }, e.crosshairConfig, { template: V }), null, 16))
120
- ]),
121
- _: 1
122
- }, 8, ["data", "padding", "height", "svgDefs", "yDomain", "xDomain"]),
123
- e.hideLegend ? l("", !0) : (n(), p("div", {
124
- key: 0,
125
- style: k({
126
- display: "flex",
127
- alignItems: "center",
128
- justifyContent: "flex-end",
129
- paddingBottom: c.value ? "1rem" : void 0
130
- })
131
- }, [
132
- s(i(q), {
133
- items: Object.values(e.categories)
134
- }, null, 8, ["items"])
135
- ], 4)),
136
- M("div", Q, [
137
- i(B).tooltip ? h(e.$slots, "tooltip", {
138
- key: 0,
139
- values: a.value
140
- }) : a.value ? h(e.$slots, "fallback", { key: 1 }, () => [
141
- s(S, {
142
- data: a.value,
143
- categories: e.categories,
144
- toolTipTitle: i(R)(a.value) ?? "",
145
- yFormatter: o.yFormatter
146
- }, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
147
- ]) : l("", !0)
148
- ], 512)
149
- ], 6));
39
+ setup(n) {
40
+ const i = n;
41
+ return (e, u) => (p(), r(B, s({ ...e.$attrs, ...i }, { "hide-area": !0 }), l({ _: 2 }, [
42
+ y(e.$slots, (x, o) => ({
43
+ name: o,
44
+ fn: c((t) => [
45
+ m(e.$slots, o, d(h(t)))
46
+ ])
47
+ }))
48
+ ]), 1040));
150
49
  }
151
50
  });
152
51
  export {
153
- te as default
52
+ g as default
154
53
  };