vue-chrts 2.0.0-beta.3 → 2.0.0-beta.5

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,13 +1,13 @@
1
- import { defineComponent as W, useSlots as E, useTemplateRef as M, ref as w, computed as m, createElementBlock as f, openBlock as c, normalizeStyle as x, createVNode as y, createCommentVNode as d, createElementVNode as X, unref as o, withCtx as R, createBlock as g, Fragment as T, renderList as Y, mergeProps as k, renderSlot as L } from "vue";
2
- import { Position as C, CurveType as A } from "@unovis/ts";
3
- import { createMarkers as z } from "../../utils.js";
4
- import U from "../Tooltip.js";
5
- import { VisXYContainer as H, VisTooltip as q, VisArea as J, VisLine as K, VisAxis as D, VisCrosshair as Q, VisBulletLegend as Z } from "@unovis/vue";
6
- import { LegendPosition as I } from "../../types.js";
7
- const _ = ["id"], ee = {
1
+ import { defineComponent as z, useSlots as R, useTemplateRef as U, ref as H, computed as d, createElementBlock as f, openBlock as c, normalizeClass as K, normalizeStyle as p, createVNode as u, createCommentVNode as y, createElementVNode as q, unref as r, withCtx as J, createBlock as k, Fragment as T, renderList as Q, mergeProps as v, renderSlot as b } from "vue";
2
+ import { Position as $, CurveType as h } from "@unovis/ts";
3
+ import { createMarkers as Z } from "../../utils.js";
4
+ import I from "../Tooltip.js";
5
+ import { VisXYContainer as _, VisTooltip as ee, VisArea as B, VisLine as D, VisAxis as O, VisCrosshair as te, VisBulletLegend as ie } from "@unovis/vue";
6
+ import { LegendPosition as ae } from "../../types.js";
7
+ const ne = ["id"], oe = {
8
8
  ref: "slotWrapper",
9
9
  style: { display: "none" }
10
- }, te = 0.5, $ = "#3b82f6", se = /* @__PURE__ */ W({
10
+ }, F = 0.5, A = "#3b82f6", ye = /* @__PURE__ */ z({
11
11
  __name: "AreaChart",
12
12
  props: {
13
13
  data: {},
@@ -34,7 +34,7 @@ const _ = ["id"], ee = {
34
34
  yNumTicks: {},
35
35
  hideLegend: { type: Boolean, default: !1 },
36
36
  hideTooltip: { type: Boolean },
37
- legendPosition: { default: I.BottomCenter },
37
+ legendPosition: { default: ae.BottomCenter },
38
38
  legendStyle: { default: void 0 },
39
39
  xDomainLine: { type: Boolean },
40
40
  yDomainLine: { type: Boolean },
@@ -50,37 +50,38 @@ const _ = ["id"], ee = {
50
50
  xAxisConfig: {},
51
51
  yAxisConfig: {},
52
52
  yDomain: {},
53
- xDomain: {}
53
+ xDomain: {},
54
+ stacked: { type: Boolean }
54
55
  },
55
56
  emits: ["click"],
56
- setup(e, { emit: b }) {
57
- const B = b, n = e, O = E(), p = M("slotWrapper"), u = w(), v = m(() => {
58
- const a = Object.values(n.categories).map(
59
- (l, i) => `var(--vis-color${i})`
57
+ setup(e, { emit: V }) {
58
+ const j = V, n = e, G = R(), C = U("slotWrapper"), m = H(), g = d(() => {
59
+ const i = Object.values(n.categories).map(
60
+ (l, a) => `var(--vis-color${a})`
60
61
  );
61
62
  return Object.values(n.categories).map(
62
- (l, i) => l.color ?? a[i]
63
+ (l, a) => l.color ?? i[a]
63
64
  );
64
- }), F = m(() => {
65
- var a;
66
- return (a = n.markerConfig) != null && a.config ? z(n.markerConfig) : "";
67
- }), V = m(() => n.legendPosition.startsWith("top")), G = m(() => n.legendPosition.includes("left") ? "flex-start" : n.legendPosition.includes("right") ? "flex-end" : "center"), S = m(() => {
68
- const a = (i, t) => {
69
- var r;
65
+ }), N = d(() => {
66
+ var i;
67
+ return (i = n.markerConfig) != null && i.config ? Z(n.markerConfig) : "";
68
+ }), S = d(() => n.legendPosition.startsWith("top")), W = d(() => n.legendPosition.includes("left") ? "flex-start" : n.legendPosition.includes("right") ? "flex-end" : "center"), M = d(() => {
69
+ const i = (a, t) => {
70
+ var o;
70
71
  return `
71
- <linearGradient id="gradient${i}-${t}" gradientTransform="rotate(90)">
72
- ${((r = n.gradientStops) == null ? void 0 : r.map(
72
+ <linearGradient id="gradient${a}-${t}" gradientTransform="rotate(90)">
73
+ ${((o = n.gradientStops) == null ? void 0 : o.map(
73
74
  (s) => `<stop offset="${s.offset}" stop-color="${t}" stop-opacity="${s.stopOpacity}" />`
74
75
  ).join("")) ?? ""}
75
76
  <stop offset="100%" stop-color="${t}" stop-opacity="0" />
76
77
  </linearGradient>
77
78
  `;
78
- }, l = (i, t) => {
79
- var r;
79
+ }, l = (a, t) => {
80
+ var o;
80
81
  return `
81
- <linearGradient id="gradient${i}-${t}" gradientTransform="rotate(90)">
82
+ <linearGradient id="gradient${a}-${t}" gradientTransform="rotate(90)">
82
83
 
83
- ${((r = n.gradientStops) == null ? void 0 : r.map(
84
+ ${((o = n.gradientStops) == null ? void 0 : o.map(
84
85
  (s) => `
85
86
  <stop offset="${s.offset}" style="stop-color:var(${t});stop-opacity:${s.stopOpacity}" />
86
87
  `
@@ -88,67 +89,94 @@ const _ = ["id"], ee = {
88
89
  </linearGradient>
89
90
  `;
90
91
  };
91
- return v.value.map(
92
- (i, t) => i != null && i.includes("#") ? a(t, i) : l(t, i ?? $)
92
+ return g.value.map(
93
+ (a, t) => a != null && a.includes("#") ? i(t, a) : l(t, a ?? A)
93
94
  ).join("");
94
95
  });
95
- function j(a) {
96
+ function P(i) {
96
97
  var l;
97
98
  return {
98
- y: (i) => Number(i[a]),
99
- color: ((l = n.categories[a]) == null ? void 0 : l.color) ?? $
99
+ y: (a) => Number(a[i]),
100
+ color: ((l = n.categories[i]) == null ? void 0 : l.color) ?? A
100
101
  };
101
102
  }
102
- function N(a) {
103
- return typeof window > "u" ? "" : p.value ? p.value.innerHTML : "";
103
+ const w = d(() => Object.keys(n.categories).map(
104
+ (i) => (l) => Number(l[i])
105
+ )), X = d(() => {
106
+ const i = Object.keys(n.categories);
107
+ return i.map((l, a) => (t) => {
108
+ let o = 0;
109
+ for (let s = 0; s <= a; s++)
110
+ o += Number(t[i[s]]) || 0;
111
+ return o;
112
+ });
113
+ }), L = d(() => (i, l) => g.value[l] ?? A);
114
+ function E(i) {
115
+ return typeof window > "u" ? "" : C.value ? C.value.innerHTML : "";
104
116
  }
105
- function P(a) {
106
- return u.value = a, N();
117
+ function Y(i) {
118
+ return m.value = i, E();
107
119
  }
108
- return (a, l) => {
109
- var i;
120
+ return (i, l) => {
121
+ var a;
110
122
  return c(), f("div", {
111
- style: x({
123
+ style: p({
112
124
  display: "flex",
113
- flexDirection: V.value ? "column-reverse" : "column",
125
+ flexDirection: S.value ? "column-reverse" : "column",
114
126
  gap: "var(--vis-legend-spacing)"
115
127
  }),
116
- id: (i = e.markerConfig) == null ? void 0 : i.id,
117
- onClick: l[0] || (l[0] = (t) => B("click", t, u.value))
128
+ class: K({ "stacked-area-chart": e.stacked }),
129
+ id: (a = e.markerConfig) == null ? void 0 : a.id,
130
+ onClick: l[0] || (l[0] = (t) => j("click", t, m.value))
118
131
  }, [
119
- y(o(H), {
132
+ u(r(_), {
120
133
  data: e.data,
121
134
  height: e.height,
122
135
  padding: e.padding,
123
- "svg-defs": S.value + F.value,
136
+ "svg-defs": M.value + N.value,
124
137
  "y-domain": e.yDomain,
125
138
  "x-domain": e.xDomain
126
139
  }, {
127
- default: R(() => [
128
- e.hideTooltip ? d("", !0) : (c(), g(o(q), {
140
+ default: J(() => [
141
+ e.hideTooltip ? y("", !0) : (c(), k(r(ee), {
129
142
  key: 0,
130
- "horizontal-placement": o(C).Right,
131
- "vertical-placement": o(C).Top
143
+ "horizontal-placement": r($).Right,
144
+ "vertical-placement": r($).Top
132
145
  }, null, 8, ["horizontal-placement", "vertical-placement"])),
133
- (c(!0), f(T, null, Y(Object.keys(n.categories), (t, r) => (c(), f(T, { key: t }, [
134
- y(o(J), k({
135
- x: (s, h) => h
136
- }, { ref_for: !0 }, j(t), {
137
- color: `url(#gradient${r}-${v.value[r]})`,
138
- opacity: e.hideArea ? 0 : te,
139
- "curve-type": e.curveType ?? o(A).MonotoneX
146
+ e.stacked ? (c(), f(T, { key: 1 }, [
147
+ u(r(B), {
148
+ x: (t, o) => o,
149
+ y: w.value,
150
+ color: L.value,
151
+ opacity: e.hideArea ? 0 : F,
152
+ "curve-type": e.curveType ?? r(h).MonotoneX
153
+ }, null, 8, ["x", "y", "color", "opacity", "curve-type"]),
154
+ u(r(D), {
155
+ x: (t, o) => o,
156
+ y: X.value,
157
+ color: L.value,
158
+ "curve-type": e.curveType ?? r(h).MonotoneX,
159
+ "line-width": e.lineWidth
160
+ }, null, 8, ["x", "y", "color", "curve-type", "line-width"])
161
+ ], 64)) : (c(!0), f(T, { key: 2 }, Q(Object.keys(n.categories), (t, o) => (c(), f(T, { key: t }, [
162
+ u(r(B), v({
163
+ x: (s, x) => x
164
+ }, { ref_for: !0 }, P(t), {
165
+ color: `url(#gradient${o}-${g.value[o]})`,
166
+ opacity: e.hideArea ? 0 : F,
167
+ "curve-type": e.curveType ?? r(h).MonotoneX
140
168
  }), null, 16, ["x", "color", "opacity", "curve-type"]),
141
- y(o(K), {
142
- x: (s, h) => h,
169
+ u(r(D), {
170
+ x: (s, x) => x,
143
171
  y: (s) => s[t],
144
- color: v.value[r],
145
- "curve-type": e.curveType ?? o(A).MonotoneX,
172
+ color: g.value[o],
173
+ "curve-type": e.curveType ?? r(h).MonotoneX,
146
174
  "line-width": e.lineWidth,
147
- lineDashArray: e.lineDashArray ? e.lineDashArray[r] : void 0
175
+ lineDashArray: e.lineDashArray ? e.lineDashArray[o] : void 0
148
176
  }, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"])
149
177
  ], 64))), 128)),
150
- e.hideXAxis ? d("", !0) : (c(), g(o(D), k({
151
- key: 1,
178
+ e.hideXAxis ? y("", !0) : (c(), k(r(O), v({
179
+ key: 3,
152
180
  type: "x",
153
181
  label: e.xLabel,
154
182
  "label-margin": 8,
@@ -160,8 +188,8 @@ const _ = ["id"], ee = {
160
188
  "tick-line": e.xTickLine,
161
189
  "min-max-ticks-only": e.minMaxTicksOnly
162
190
  }, e.xAxisConfig), null, 16, ["label", "num-ticks", "tick-format", "tick-values", "grid-line", "domain-line", "tick-line", "min-max-ticks-only"])),
163
- e.hideYAxis ? d("", !0) : (c(), g(o(D), k({
164
- key: 2,
191
+ e.hideYAxis ? y("", !0) : (c(), k(r(O), v({
192
+ key: 4,
165
193
  type: "y",
166
194
  label: e.yLabel,
167
195
  "num-ticks": e.yNumTicks,
@@ -170,19 +198,19 @@ const _ = ["id"], ee = {
170
198
  "domain-line": e.yDomainLine,
171
199
  "tick-line": e.yTickLine
172
200
  }, e.yAxisConfig), null, 16, ["label", "num-ticks", "tick-format", "grid-line", "domain-line", "tick-line"])),
173
- e.hideTooltip ? d("", !0) : (c(), g(o(Q), k({ key: 3 }, e.crosshairConfig, { template: P }), null, 16))
201
+ e.hideTooltip ? y("", !0) : (c(), k(r(te), v({ key: 5 }, e.crosshairConfig, { template: Y }), null, 16))
174
202
  ]),
175
203
  _: 1
176
204
  }, 8, ["data", "height", "padding", "svg-defs", "y-domain", "x-domain"]),
177
- n.hideLegend ? d("", !0) : (c(), f("div", {
205
+ n.hideLegend ? y("", !0) : (c(), f("div", {
178
206
  key: 0,
179
- style: x({
207
+ style: p({
180
208
  display: "flex",
181
- justifyContent: G.value
209
+ justifyContent: W.value
182
210
  })
183
211
  }, [
184
- y(o(Z), {
185
- style: x([
212
+ u(r(ie), {
213
+ style: p([
186
214
  n.legendStyle,
187
215
  "display: flex; gap: var(--vis-legend-spacing);"
188
216
  ]),
@@ -192,23 +220,23 @@ const _ = ["id"], ee = {
192
220
  }))
193
221
  }, null, 8, ["style", "items"])
194
222
  ], 4)),
195
- X("div", ee, [
196
- o(O).tooltip ? L(a.$slots, "tooltip", {
223
+ q("div", oe, [
224
+ r(G).tooltip ? b(i.$slots, "tooltip", {
197
225
  key: 0,
198
- values: u.value
199
- }) : u.value ? L(a.$slots, "fallback", { key: 1 }, () => [
200
- y(U, {
201
- data: u.value,
226
+ values: m.value
227
+ }) : m.value ? b(i.$slots, "fallback", { key: 1 }, () => [
228
+ u(I, {
229
+ data: m.value,
202
230
  categories: e.categories,
203
231
  "title-formatter": n.tooltipTitleFormatter,
204
232
  yFormatter: n.yFormatter
205
233
  }, null, 8, ["data", "categories", "title-formatter", "yFormatter"])
206
- ]) : d("", !0)
234
+ ]) : y("", !0)
207
235
  ], 512)
208
- ], 12, _);
236
+ ], 14, ne);
209
237
  };
210
238
  }
211
239
  });
212
240
  export {
213
- se as default
241
+ ye as default
214
242
  };
@@ -165,4 +165,9 @@ export interface AreaChartProps<T> {
165
165
  * The domain for the x-axis, specified as a tuple of two values.
166
166
  */
167
167
  xDomain?: [number | undefined, number | undefined];
168
+ /**
169
+ * If `true`, creates a stacked area chart where areas are stacked on top of each other.
170
+ * When false (default), areas are overlaid on top of each other.
171
+ */
172
+ stacked?: boolean;
168
173
  }
@@ -1,4 +1,4 @@
1
- import { defineComponent as W, useSlots as X, useTemplateRef as H, ref as Y, computed as k, createElementBlock as p, openBlock as d, normalizeStyle as L, createVNode as b, createCommentVNode as x, createElementVNode as j, unref as a, withCtx as q, createBlock as c, Fragment as $, renderList as I, mergeProps as C, renderSlot as F } from "vue";
1
+ import { defineComponent as W, useSlots as X, useTemplateRef as H, ref as Y, computed as k, createElementBlock as p, openBlock as d, normalizeStyle as L, createVNode as b, createCommentVNode as x, createElementVNode as j, unref as a, withCtx as $, createBlock as c, Fragment as q, renderList as I, mergeProps as C, renderSlot as F } from "vue";
2
2
  import { Orientation as u, StackedBar as U, GroupedBar as J } from "@unovis/ts";
3
3
  import { useStackedGrouped as K } from "./stackedGroupedUtils.js";
4
4
  import { VisXYContainer as Q, VisXYLabels as Z, VisTooltip as _, VisStackedBar as G, VisGroupedBar as ee, VisAxis as V, VisBulletLegend as te } from "@unovis/vue";
@@ -102,7 +102,7 @@ const ne = {
102
102
  padding: e.padding,
103
103
  height: e.height
104
104
  }, {
105
- default: q(() => {
105
+ default: $(() => {
106
106
  var o, s, m, f;
107
107
  return [
108
108
  e.valueLabel ? (d(), c(a(Z), {
@@ -130,7 +130,7 @@ const ne = {
130
130
  }
131
131
  }
132
132
  }, null, 8, ["triggers"]),
133
- e.stackAndGrouped ? (d(!0), p($, { key: 1 }, I(y.value.states, (n) => (d(), c(a(G), {
133
+ e.stackAndGrouped ? (d(!0), p(q, { key: 1 }, I(y.value.states, (n) => (d(), c(a(G), {
134
134
  key: n,
135
135
  data: y.value.chartData,
136
136
  x: (r, v) => v + y.value.positions[n],
@@ -1,9 +1,9 @@
1
- import { defineComponent as O, useSlots as S, useTemplateRef as D, ref as R, computed as p, createElementBlock as g, openBlock as l, normalizeStyle as d, createVNode as s, createCommentVNode as r, createElementVNode as w, unref as t, withCtx as K, createBlock as u, mergeProps as x, renderSlot as k } from "vue";
1
+ import { defineComponent as O, useSlots as S, useTemplateRef as D, ref as R, computed as g, createElementBlock as p, openBlock as l, normalizeStyle as d, createVNode as s, createCommentVNode as r, createElementVNode as w, unref as t, withCtx as K, createBlock as u, mergeProps as x, renderSlot as k } from "vue";
2
2
  import { Scatter as M, Position as E } from "@unovis/ts";
3
- import { VisXYContainer as G, VisTooltip as W, VisScatter as j, VisAxis as L, VisBulletLegend as X } from "@unovis/vue";
4
- import { LegendPosition as Y } from "../../types.js";
5
- import $ from "../Tooltip.js";
6
- const q = {
3
+ import { VisXYContainer as G, VisTooltip as W, VisScatter as $, VisAxis as L, VisBulletLegend as j } from "@unovis/vue";
4
+ import { LegendPosition as X } from "../../types.js";
5
+ import Y from "../Tooltip.js";
6
+ const _ = {
7
7
  ref: "slotWrapper",
8
8
  class: "hidden"
9
9
  }, Q = /* @__PURE__ */ O({
@@ -28,7 +28,7 @@ const q = {
28
28
  xFormatter: {},
29
29
  yFormatter: {},
30
30
  tooltipTitleFormatter: {},
31
- legendPosition: { default: Y.BottomCenter },
31
+ legendPosition: { default: X.BottomCenter },
32
32
  legendStyle: { default: void 0 },
33
33
  sizeOptions: {},
34
34
  xDomainLine: { type: Boolean, default: !0 },
@@ -70,8 +70,8 @@ const q = {
70
70
  }
71
71
  const z = {
72
72
  [M.selectors.point]: F
73
- }, P = p(() => e.legendPosition.startsWith("top")), N = p(() => e.legendPosition.includes("left") ? "flex-start" : e.legendPosition.includes("right") ? "flex-end" : "center");
74
- return (i, a) => (l(), g("div", {
73
+ }, P = g(() => e.legendPosition.startsWith("top")), N = g(() => e.legendPosition.includes("left") ? "flex-start" : e.legendPosition.includes("right") ? "flex-end" : "center");
74
+ return (i, a) => (l(), p("div", {
75
75
  style: d({
76
76
  display: "flex",
77
77
  flexDirection: P.value ? "column-reverse" : "column",
@@ -90,7 +90,7 @@ const q = {
90
90
  key: 0,
91
91
  triggers: z
92
92
  })),
93
- s(t(j), {
93
+ s(t($), {
94
94
  x: t(v),
95
95
  y: t(b),
96
96
  color: A,
@@ -125,14 +125,14 @@ const q = {
125
125
  ]),
126
126
  _: 1
127
127
  }, 8, ["data", "height", "padding"]),
128
- e.hideLegend ? r("", !0) : (l(), g("div", {
128
+ e.hideLegend ? r("", !0) : (l(), p("div", {
129
129
  key: 0,
130
130
  style: d({
131
131
  display: "flex",
132
132
  justifyContent: N.value
133
133
  })
134
134
  }, [
135
- s(t(X), {
135
+ s(t(j), {
136
136
  class: "bulletLegendOverrides",
137
137
  style: d([
138
138
  e.legendStyle,
@@ -144,12 +144,12 @@ const q = {
144
144
  }))
145
145
  }, null, 8, ["style", "items"])
146
146
  ], 4)),
147
- w("div", q, [
147
+ w("div", _, [
148
148
  t(T).tooltip ? k(i.$slots, "tooltip", {
149
149
  key: 0,
150
150
  values: n.value
151
151
  }) : n.value ? k(i.$slots, "fallback", { key: 1 }, () => [
152
- s($, {
152
+ s(Y, {
153
153
  data: n.value,
154
154
  categories: e.categories || {},
155
155
  "title-formatter": e.tooltipTitleFormatter,
@@ -1,8 +1,8 @@
1
- import { defineComponent as B, useSlots as D, useTemplateRef as P, ref as W, computed as s, createElementBlock as f, openBlock as m, normalizeStyle as d, createVNode as a, createCommentVNode as v, createElementVNode as y, unref as r, withCtx as b, renderSlot as u } from "vue";
1
+ import { defineComponent as B, useSlots as D, useTemplateRef as P, ref as W, computed as s, createElementBlock as p, openBlock as m, normalizeStyle as d, createVNode as a, createCommentVNode as v, createElementVNode as y, unref as r, withCtx as b, renderSlot as u } from "vue";
2
2
  import { Donut as N } from "@unovis/ts";
3
- import { DonutType as j } from "./types.js";
4
- import z from "../Tooltip.js";
5
- import { VisSingleContainer as H, VisTooltip as $, VisDonut as E, VisBulletLegend as F } from "@unovis/vue";
3
+ import { DonutType as $ } from "./types.js";
4
+ import j from "../Tooltip.js";
5
+ import { VisSingleContainer as z, VisTooltip as H, VisDonut as E, VisBulletLegend as F } from "@unovis/vue";
6
6
  import { LegendPosition as O } from "../../types.js";
7
7
  const R = { style: {
8
8
  position: "absolute",
@@ -12,7 +12,7 @@ const R = { style: {
12
12
  } }, M = {
13
13
  ref: "slotWrapper",
14
14
  style: { display: "none" }
15
- }, Q = /* @__PURE__ */ B({
15
+ }, K = /* @__PURE__ */ B({
16
16
  __name: "DonutChart",
17
17
  props: {
18
18
  type: {},
@@ -29,7 +29,7 @@ const R = { style: {
29
29
  },
30
30
  emits: ["click"],
31
31
  setup(l, { emit: h }) {
32
- const C = h, t = l, k = D(), c = P("slotWrapper"), i = W(), T = (e) => e, V = t.type === j.Half;
32
+ const C = h, t = l, k = D(), c = P("slotWrapper"), i = W(), T = (e) => e, V = t.type === $.Half;
33
33
  function x(e) {
34
34
  const o = Object.values(t.categories)[e.index].name;
35
35
  return i.value = {
@@ -40,12 +40,12 @@ const R = { style: {
40
40
  function A() {
41
41
  return typeof window > "u" ? "" : c.value ? c.value.innerHTML : "";
42
42
  }
43
- const L = s(() => t.legendPosition.includes("top")), S = s(() => t.legendPosition.includes("left") ? "flex-start" : t.legendPosition.includes("right") ? "flex-end" : "center"), g = (e, o = "#ccc") => e ? Array.isArray(e) ? e[0] || o : e : o, p = s(() => Object.values(t.categories)), w = (e, o) => {
44
- const n = p.value[o];
43
+ const L = s(() => t.legendPosition.includes("top")), S = s(() => t.legendPosition.includes("left") ? "flex-start" : t.legendPosition.includes("right") ? "flex-end" : "center"), g = (e, o = "#ccc") => e ? Array.isArray(e) ? e[0] || o : e : o, f = s(() => Object.values(t.categories)), w = (e, o) => {
44
+ const n = f.value[o];
45
45
  if (n)
46
46
  return g(n.color);
47
47
  };
48
- return (e, o) => (m(), f("div", {
48
+ return (e, o) => (m(), p("div", {
49
49
  style: d({
50
50
  display: "flex",
51
51
  flexDirection: L.value ? "column-reverse" : "column",
@@ -53,13 +53,13 @@ const R = { style: {
53
53
  }),
54
54
  onClick: o[0] || (o[0] = (n) => C("click", n, i.value))
55
55
  }, [
56
- a(r(H), {
56
+ a(r(z), {
57
57
  data: l.data,
58
58
  height: l.height,
59
59
  margin: {}
60
60
  }, {
61
61
  default: b(() => [
62
- a(r($), {
62
+ a(r(H), {
63
63
  "horizontal-shift": 20,
64
64
  "vertical-shift": 20,
65
65
  triggers: {
@@ -80,7 +80,7 @@ const R = { style: {
80
80
  ]),
81
81
  _: 3
82
82
  }, 8, ["data", "height"]),
83
- t.hideLegend ? v("", !0) : (m(), f("div", {
83
+ t.hideLegend ? v("", !0) : (m(), p("div", {
84
84
  key: 0,
85
85
  style: d({
86
86
  display: "flex",
@@ -92,7 +92,7 @@ const R = { style: {
92
92
  t.legendStyle,
93
93
  "display: flex; gap: var(--vis-legend-spacing);"
94
94
  ]),
95
- items: p.value.map((n) => ({
95
+ items: f.value.map((n) => ({
96
96
  ...n,
97
97
  color: g(n.color)
98
98
  }))
@@ -103,7 +103,7 @@ const R = { style: {
103
103
  key: 0,
104
104
  values: i.value
105
105
  }) : i.value ? u(e.$slots, "fallback", { key: 1 }, () => [
106
- a(z, {
106
+ a(j, {
107
107
  data: i.value,
108
108
  categories: t.categories,
109
109
  "title-formatter": t.tooltipTitleFormatter
@@ -114,5 +114,5 @@ const R = { style: {
114
114
  }
115
115
  });
116
116
  export {
117
- Q as default
117
+ K as default
118
118
  };
@@ -2,8 +2,8 @@ import { defineComponent as B, useSlots as V, useTemplateRef as w, ref as A, com
2
2
  import { Timeline as x } from "@unovis/ts";
3
3
  import { dateFormatter as S } from "../../utils.js";
4
4
  import N from "../Tooltip.js";
5
- import { VisXYContainer as j, VisTimeline as O, VisTooltip as D, VisAxis as G, VisBulletLegend as M } from "@unovis/vue";
6
- import { LegendPosition as $ } from "../../types.js";
5
+ import { VisXYContainer as j, VisTimeline as O, VisTooltip as $, VisAxis as D, VisBulletLegend as G } from "@unovis/vue";
6
+ import { LegendPosition as M } from "../../types.js";
7
7
  const I = /* @__PURE__ */ B({
8
8
  __name: "GanttChart",
9
9
  props: {
@@ -23,7 +23,7 @@ const I = /* @__PURE__ */ B({
23
23
  crosshairConfig: {},
24
24
  lineWidth: { default: 12 },
25
25
  rowHeight: { default: 24 },
26
- legendPosition: { default: $.TopRight },
26
+ legendPosition: { default: M.TopRight },
27
27
  legendStyle: {},
28
28
  hideLegend: { type: Boolean },
29
29
  xTickLine: { type: Boolean },
@@ -80,7 +80,7 @@ const I = /* @__PURE__ */ B({
80
80
  showLabels: e.showLabels,
81
81
  onClick: L
82
82
  }, null, 8, ["x", "length", "lineWidth", "rowHeight", "type", "color", "labelWidth", "showLabels"]),
83
- n(o(D), {
83
+ n(o($), {
84
84
  triggers: {
85
85
  [o(x).selectors.label]: (t) => {
86
86
  var m;
@@ -88,7 +88,7 @@ const I = /* @__PURE__ */ B({
88
88
  }
89
89
  }
90
90
  }, null, 8, ["triggers"]),
91
- n(o(G), P({
91
+ n(o(D), P({
92
92
  type: "x",
93
93
  tickFormat: i.xTickFormat || o(S),
94
94
  numTicks: i.xNumTicks,
@@ -106,7 +106,7 @@ const I = /* @__PURE__ */ B({
106
106
  justifyContent: b.value
107
107
  })
108
108
  }, [
109
- n(o(M), {
109
+ n(o(G), {
110
110
  style: d([
111
111
  e.legendStyle,
112
112
  "display: flex; gap: var(--vis-legend-spacing);"
@@ -36,15 +36,16 @@ const g = /* @__PURE__ */ n({
36
36
  xAxisConfig: {},
37
37
  yAxisConfig: {},
38
38
  yDomain: {},
39
- xDomain: {}
39
+ xDomain: {},
40
+ stacked: { type: Boolean }
40
41
  },
41
42
  setup(o) {
42
- const i = o;
43
- return a(), (e, h) => (l(), r(x, p(i, { "hide-area": !0 }), s({ _: 2 }, [
43
+ const t = o;
44
+ return a(), (e, B) => (l(), r(x, p(t, { "hide-area": !0 }), s({ _: 2 }, [
44
45
  e.$slots.tooltip ? {
45
46
  name: "tooltip",
46
- fn: y((t) => [
47
- c(e.$slots, "tooltip", m(d(t)))
47
+ fn: y((i) => [
48
+ c(e.$slots, "tooltip", m(d(i)))
48
49
  ]),
49
50
  key: "0"
50
51
  } : void 0
@@ -1,7 +1,74 @@
1
- import o from "./Tooltip2.js";
2
- /* empty css */
3
- import t from "../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-2385aa2d"]]);
1
+ import { defineComponent as F, computed as m, createElementBlock as n, openBlock as s, createElementVNode as r, toDisplayString as c, Fragment as p, renderList as z, normalizeStyle as w } from "vue";
2
+ import { getFirstPropertyValue as B } from "../utils.js";
3
+ const C = /* @__PURE__ */ F({
4
+ __name: "Tooltip",
5
+ props: {
6
+ data: {},
7
+ categories: {},
8
+ titleFormatter: { type: Function },
9
+ yFormatter: { type: Function }
10
+ },
11
+ setup(l) {
12
+ const t = l, v = m(
13
+ () => t.titleFormatter ? t.titleFormatter(t.data) : B(t.data)
14
+ ), d = ["_index", "_stacked", "_ending"], g = m(() => Object.entries(t.data ?? []).filter(
15
+ ([e, a]) => !d.includes(e) && Object.keys(t.categories).includes(e)
16
+ )), u = {
17
+ display: "flex",
18
+ flexDirection: "column"
19
+ }, f = {
20
+ color: "var(--vis-tooltip-title-color, #000)",
21
+ textTransform: "var(--vis-tooltip-title-text-transform, capitalize)",
22
+ borderBottom: "var(--vis-tooltip-title-border-bottom, 1px solid #e5e7eb)",
23
+ padding: "var(--vis-tooltip-title-padding, 0.75rem 0.75rem 0.5rem 0.75rem)",
24
+ margin: "var(--vis-tooltip-title-margin, 0 0 0.25rem 0)",
25
+ fontSize: "var(--vis-tooltip-title-font-size, 0.875rem)",
26
+ lineHeight: "var(--vis-tooltip-title-line-height, 100%)",
27
+ fontWeight: "var(--vis-tooltip-title-font-weight, 600)"
28
+ }, y = {
29
+ display: "grid",
30
+ gridTemplateColumns: "auto 1fr auto",
31
+ alignItems: "center",
32
+ gap: "var(--vis-tooltip-content-gap, 0.25rem 0.5rem)",
33
+ padding: "var(--vis-tooltip-content-padding, 0 0.75rem 0.5rem 0.75rem)"
34
+ }, h = {
35
+ fontWeight: "var(--vis-tooltip-label-font-weight, 400)",
36
+ fontSize: "var(--vis-tooltip-label-font-size, 0.875rem)",
37
+ color: "var(--vis-tooltip-label-color, inherit)",
38
+ margin: "var(--vis-tooltip-label-margin, 0 1rem 0 0)",
39
+ whiteSpace: "nowrap"
40
+ }, b = {
41
+ fontSize: "var(--vis-tooltip-value-font-size, 0.875rem)",
42
+ fontWeight: "var(--vis-tooltip-value-font-weight, 600)",
43
+ color: "var(--vis-tooltip-value-color, inherit)",
44
+ textAlign: "right",
45
+ fontVariantNumeric: "tabular-nums"
46
+ }, x = (e, a) => {
47
+ var o, i;
48
+ return {
49
+ width: "8px",
50
+ height: "8px",
51
+ aspectRatio: "1",
52
+ borderRadius: "var(--vis-tooltip-dot-border-radius, 4px)",
53
+ margin: "var(--vis-tooltip-dot-margin, 0)",
54
+ flexShrink: "0",
55
+ backgroundColor: typeof ((o = t.categories[e]) == null ? void 0 : o.color) == "string" && ((i = t.categories[e]) != null && i.color) ? t.categories[e].color : `var(--vis-color${a})`
56
+ };
57
+ };
58
+ return (e, a) => (s(), n("div", { style: u }, [
59
+ r("div", { style: f }, c(v.value), 1),
60
+ r("div", { style: y }, [
61
+ (s(!0), n(p, null, z(g.value, ([o, i], S) => (s(), n(p, { key: o }, [
62
+ r("span", {
63
+ style: w(x(o, S))
64
+ }, null, 4),
65
+ r("span", { style: h }, c(l.categories[o].name), 1),
66
+ r("span", { style: b }, c(l.yFormatter ? l.yFormatter(i) : i), 1)
67
+ ], 64))), 128))
68
+ ])
69
+ ]));
70
+ }
71
+ });
5
72
  export {
6
- m as default
73
+ C as default
7
74
  };
@@ -1,42 +1,4 @@
1
- import { defineComponent as y, computed as m, createElementBlock as r, openBlock as a, createElementVNode as i, toDisplayString as l, Fragment as _, renderList as f, normalizeStyle as h } from "vue";
2
- import { getFirstPropertyValue as b } from "../utils.js";
3
- const x = { class: "vis-tooltip" }, B = { class: "vis-tooltip-title" }, E = { class: "vis-tooltip-content" }, j = { class: "vis-tooltip-label" }, k = { class: "vis-tooltip-value" }, O = /* @__PURE__ */ y({
4
- __name: "Tooltip",
5
- props: {
6
- data: {},
7
- categories: {},
8
- titleFormatter: { type: Function },
9
- yFormatter: { type: Function }
10
- },
11
- setup(t) {
12
- const e = t, u = m(
13
- () => e.titleFormatter ? e.titleFormatter(e.data) : b(e.data)
14
- ), v = ["_index", "_stacked", "_ending"], p = m(() => Object.entries(e.data ?? []).filter(
15
- ([s, g]) => !v.includes(s) && Object.keys(e.categories).includes(s)
16
- ));
17
- return (s, g) => (a(), r("div", x, [
18
- i("div", B, l(u.value), 1),
19
- i("div", E, [
20
- (a(!0), r(_, null, f(p.value, ([o, n], F) => {
21
- var c, d;
22
- return a(), r("div", {
23
- key: o,
24
- class: "vis-tooltip-entry"
25
- }, [
26
- i("span", {
27
- class: "vis-tooltip-dot",
28
- style: h({
29
- backgroundColor: typeof ((c = t.categories[o]) == null ? void 0 : c.color) == "string" && ((d = t.categories[o]) != null && d.color) ? t.categories[o].color : `var(--vis-color${F})`
30
- })
31
- }, null, 4),
32
- i("span", j, l(t.categories[o].name), 1),
33
- i("span", k, l(t.yFormatter ? t.yFormatter(n) : n), 1)
34
- ]);
35
- }), 128))
36
- ])
37
- ]));
38
- }
39
- });
1
+ import f from "./Tooltip.js";
40
2
  export {
41
- O as default
3
+ f as default
42
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "2.0.0-beta.3",
3
+ "version": "2.0.0-beta.5",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,9 +0,0 @@
1
- const s = (t, e) => {
2
- const o = t.__vccOpts || t;
3
- for (const [r, c] of e)
4
- o[r] = c;
5
- return o;
6
- };
7
- export {
8
- s as default
9
- };
package/dist/index.js.css DELETED
@@ -1 +0,0 @@
1
- .vis-tooltip[data-v-2385aa2d]{display:flex;flex-direction:column}.vis-tooltip-title[data-v-2385aa2d]{color:var(--vis-tooltip-title-color, #000);text-transform:var(--vis-tooltip-title-text-transform, capitalize);border-bottom:var(--vis-tooltip-title-border-bottom, 1px solid #e5e7eb);padding:var(--vis-tooltip-title-padding, .75rem .75rem .5rem .75rem);margin:var(--vis-tooltip-title-margin, 0 0 .25rem 0);font-size:var(--vis-tooltip-title-font-size, .875rem);line-height:var(--vis-tooltip-title-line-height, 100%);font-weight:var(--vis-tooltip-title-font-weight, 600)}.vis-tooltip-content[data-v-2385aa2d]{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:var(--vis-tooltip-content-gap, .25rem .5rem);padding:var(--vis-tooltip-content-padding, 0 .75rem)}.vis-tooltip-entry[data-v-2385aa2d]{display:contents}.vis-tooltip-dot[data-v-2385aa2d]{width:8px;height:8px;aspect-ratio:1;border-radius:var(--vis-tooltip-dot-border-radius, 4px);margin:var(--vis-tooltip-dot-margin, 0);flex-shrink:0}.vis-tooltip-label[data-v-2385aa2d]{font-weight:var(--vis-tooltip-label-font-weight, 400);font-size:var(--vis-tooltip-label-font-size, .875rem);color:var(--vis-tooltip-label-color, inherit);margin:var(--vis-tooltip-label-margin, 0 1rem 0 0);white-space:nowrap}.vis-tooltip-value[data-v-2385aa2d]{font-size:var(--vis-tooltip-value-font-size, .875rem);font-weight:var(--vis-tooltip-value-font-weight, 600);color:var(--vis-tooltip-value-color, inherit);text-align:right;font-variant-numeric:tabular-nums}