vue-chrts 0.2.5 → 1.0.0-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.
Files changed (29) hide show
  1. package/dist/components/AreaChart/AreaChart.js +103 -73
  2. package/dist/components/AreaChart/types.d.ts +26 -9
  3. package/dist/components/BarChart/BarChart.js +91 -85
  4. package/dist/components/BarChart/stackedGroupedUtils.d.ts +2 -3
  5. package/dist/components/BarChart/types.d.ts +13 -1
  6. package/dist/components/BubbleChart/BubbleChart.js +78 -61
  7. package/dist/components/BubbleChart/BubbleChart.vue.d.ts +1 -1
  8. package/dist/components/BubbleChart/types.d.ts +15 -17
  9. package/dist/components/DonutChart/DonutChart.js +87 -69
  10. package/dist/components/DonutChart/types.d.ts +16 -8
  11. package/dist/components/GanttChart/GanttChart.js +140 -0
  12. package/dist/components/GanttChart/GanttChart.vue.d.ts +33 -0
  13. package/dist/components/GanttChart/GanttChart2.js +4 -0
  14. package/dist/components/GanttChart/types.d.ts +112 -0
  15. package/dist/components/LineChart/LineChart.js +27 -129
  16. package/dist/components/LineChart/LineChart.vue.d.ts +9 -8
  17. package/dist/components/LineChart/types.d.ts +2 -140
  18. package/dist/components/Tooltip.js +9 -9
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js +13 -13
  21. package/dist/types.d.ts +24 -14
  22. package/dist/types.js +4 -4
  23. package/dist/utils.d.ts +1 -0
  24. package/dist/utils.js +27 -26
  25. package/package.json +1 -1
  26. package/dist/components/AreaStackedChart/AreaStackedChart.js +0 -77
  27. package/dist/components/AreaStackedChart/AreaStackedChart.vue.d.ts +0 -14
  28. package/dist/components/AreaStackedChart/AreaStackedChart2.js +0 -4
  29. package/dist/components/AreaStackedChart/types.d.ts +0 -86
@@ -1,13 +1,13 @@
1
- import { defineComponent as U, useSlots as j, useTemplateRef as w, ref as R, computed as p, createElementBlock as u, openBlock as a, normalizeClass as S, normalizeStyle as T, createVNode as m, createCommentVNode as d, createElementVNode as X, unref as t, withCtx as x, createBlock as c, Fragment as L, renderList as z, mergeProps as C, renderSlot as D } from "vue";
2
- import { Position as A, CurveType as b } from "@unovis/ts";
3
- import { createMarkers as I, getFirstPropertyValue as Y } from "../../utils.js";
1
+ import { defineComponent as N, useSlots as W, useTemplateRef as E, ref as M, computed as u, createElementBlock as y, openBlock as s, normalizeClass as w, normalizeStyle as k, createVNode as m, createCommentVNode as d, createElementVNode as X, unref as n, withCtx as z, createBlock as c, Fragment as h, renderList as R, mergeProps as f, renderSlot as T } from "vue";
2
+ import { Position as C, CurveType as L } from "@unovis/ts";
3
+ import { createMarkers as Y, getFirstPropertyValue as U } from "../../utils.js";
4
4
  import H from "../Tooltip.js";
5
- import { VisXYContainer as K, VisTooltip as q, VisArea as J, VisLine as Q, VisAxis as B, VisCrosshair as Z, VisBulletLegend as _ } from "@unovis/vue";
6
- import { LegendPosition as ee } from "../../types.js";
7
- const ie = {
5
+ import { VisXYContainer as q, VisTooltip as J, VisArea as K, VisLine as Q, VisAxis as A, VisCrosshair as Z, VisBulletLegend as I } from "@unovis/vue";
6
+ import { LegendPosition as _ } from "../../types.js";
7
+ const ee = {
8
8
  ref: "slotWrapper",
9
9
  style: { display: "none" }
10
- }, y = 24, V = 4, te = 0.5, F = "#3b82f6", de = /* @__PURE__ */ U({
10
+ }, ie = 0.5, $ = "#3b82f6", se = /* @__PURE__ */ N({
11
11
  __name: "AreaChart",
12
12
  props: {
13
13
  data: {},
@@ -20,15 +20,21 @@ const ie = {
20
20
  xFormatter: {},
21
21
  yFormatter: {},
22
22
  curveType: {},
23
+ hideArea: { type: Boolean, default: !1 },
24
+ gradientStops: { default: () => [
25
+ { offset: "0%", stopOpacity: 1 },
26
+ { offset: "75%", stopOpacity: 0 }
27
+ ] },
23
28
  lineWidth: { default: 2 },
24
29
  lineDashArray: {},
25
- xNumTicks: { default: (r) => r.data.length > y ? y / V : r.data.length - 1 },
30
+ xNumTicks: {},
26
31
  xExplicitTicks: {},
27
32
  minMaxTicksOnly: { type: Boolean },
28
- yNumTicks: { default: (r) => r.data.length > y ? y / V : r.data.length - 1 },
29
- hideLegend: { type: Boolean },
33
+ yNumTicks: {},
34
+ hideLegend: { type: Boolean, default: !1 },
30
35
  hideTooltip: { type: Boolean },
31
- legendPosition: {},
36
+ legendPosition: { default: _.BottomCenter },
37
+ legendStyle: { default: void 0 },
32
38
  xDomainLine: { type: Boolean },
33
39
  yDomainLine: { type: Boolean },
34
40
  xTickLine: { type: Boolean },
@@ -40,82 +46,102 @@ const ie = {
40
46
  crosshairConfig: { default: () => ({
41
47
  color: "#666"
42
48
  }) },
49
+ xAxisConfig: {},
50
+ yAxisConfig: {},
43
51
  yDomain: {},
44
52
  xDomain: {}
45
53
  },
46
54
  emits: ["click"],
47
- setup(r, { emit: $ }) {
48
- const G = $, n = r, O = j(), h = w("slotWrapper"), s = R(), f = p(
49
- () => Object.values(n.categories).map((e) => e.color)
50
- ), N = p(() => n.markerConfig ? I(n.markerConfig) : ""), g = p(() => n.legendPosition === ee.Top), E = p(() => {
51
- const e = (i, o) => `
55
+ setup(D, { emit: b }) {
56
+ const B = b, t = D, O = W(), v = E("slotWrapper"), p = M(), g = u(() => {
57
+ const e = Object.values(t.categories).map(
58
+ (a, i) => `var(--vis-color${i})`
59
+ );
60
+ return Object.values(t.categories).map(
61
+ (a, i) => a.color ?? e[i]
62
+ );
63
+ }), V = u(() => t.markerConfig ? Y(t.markerConfig) : ""), x = u(() => t.legendPosition.startsWith("top")), F = u(() => t.legendPosition.includes("left") ? "flex-start" : t.legendPosition.includes("right") ? "flex-end" : "center"), G = u(() => {
64
+ const e = (i, o) => {
65
+ var r;
66
+ return `
52
67
  <linearGradient id="gradient${i}-${o}" gradientTransform="rotate(90)">
53
- <stop offset="0%" stop-color="${o}" stop-opacity="1" />
68
+ ${((r = t.gradientStops) == null ? void 0 : r.map(
69
+ (l) => `<stop offset="${l.offset}" stop-color="${o}" stop-opacity="${l.stopOpacity}" />`
70
+ ).join("")) ?? ""}
54
71
  <stop offset="100%" stop-color="${o}" stop-opacity="0" />
55
72
  </linearGradient>
56
- `, l = (i, o) => `
73
+ `;
74
+ }, a = (i, o) => {
75
+ var r;
76
+ return `
57
77
  <linearGradient id="gradient${i}-${o}" gradientTransform="rotate(90)">
58
- <stop offset="0%" style="stop-color:var(--vis-color0);stop-opacity:1" />
59
- <stop offset="100%" style="stop-color:var(--vis-color0);stop-opacity:0" />
78
+
79
+ ${((r = t.gradientStops) == null ? void 0 : r.map(
80
+ (l) => `
81
+ <stop offset="${l.offset}" style="stop-color:var(${o});stop-opacity:${l.stopOpacity}" />
82
+ `
83
+ ).join("")) ?? ""}
60
84
  </linearGradient>
61
85
  `;
62
- return f.value.map(
63
- (i, o) => i != null && i.includes("#") ? e(o, i) : l(o, i ?? F)
86
+ };
87
+ return g.value.map(
88
+ (i, o) => i != null && i.includes("#") ? e(o, i) : a(o, i ?? $)
64
89
  ).join("");
65
90
  });
66
91
  function P(e) {
67
- var l;
92
+ var a;
68
93
  return {
69
94
  y: (i) => Number(i[e]),
70
- color: ((l = n.categories[e]) == null ? void 0 : l.color) ?? F
95
+ color: ((a = t.categories[e]) == null ? void 0 : a.color) ?? $
71
96
  };
72
97
  }
73
- function W(e) {
74
- return typeof window > "u" ? "" : h.value ? h.value.innerHTML : "";
98
+ function S(e) {
99
+ return typeof window > "u" ? "" : v.value ? v.value.innerHTML : "";
75
100
  }
76
- function M(e) {
77
- return s.value = e, W();
101
+ function j(e) {
102
+ return p.value = e, S();
78
103
  }
79
- return (e, l) => (a(), u("div", {
80
- style: T({
104
+ return (e, a) => (s(), y("div", {
105
+ style: k({
81
106
  display: "flex",
82
- flexDirection: g.value ? "column-reverse" : "column"
107
+ flexDirection: x.value ? "column-reverse" : "column",
108
+ gap: "var(--vis-legend-spacing)"
83
109
  }),
84
- class: S({ markers: !!n.markerConfig }),
85
- onClick: l[0] || (l[0] = (i) => G("click", i, s.value))
110
+ class: w({ markers: !!t.markerConfig }),
111
+ onClick: a[0] || (a[0] = (i) => B("click", i, p.value))
86
112
  }, [
87
- m(t(K), {
113
+ m(n(q), {
88
114
  data: e.data,
89
115
  height: e.height,
90
116
  padding: e.padding,
91
- "svg-defs": E.value + N.value,
117
+ "svg-defs": G.value + V.value,
92
118
  "y-domain": e.yDomain,
93
119
  "x-domain": e.xDomain
94
120
  }, {
95
- default: x(() => [
96
- e.hideTooltip ? d("", !0) : (a(), c(t(q), {
121
+ default: z(() => [
122
+ e.hideTooltip ? d("", !0) : (s(), c(n(J), {
97
123
  key: 0,
98
- "horizontal-placement": t(A).Right,
99
- "vertical-placement": t(A).Top
124
+ "horizontal-placement": n(C).Right,
125
+ "vertical-placement": n(C).Top
100
126
  }, null, 8, ["horizontal-placement", "vertical-placement"])),
101
- (a(!0), u(L, null, z(Object.keys(n.categories), (i, o) => (a(), u(L, { key: i }, [
102
- m(t(J), C({
103
- x: (k, v) => v
127
+ (s(!0), y(h, null, R(Object.keys(t.categories), (i, o) => (s(), y(h, { key: i }, [
128
+ m(n(K), f({
129
+ x: (r, l) => l
104
130
  }, { ref_for: !0 }, P(i), {
105
- color: `url(#gradient${o}-${f.value[o]})`,
106
- opacity: te,
107
- "curve-type": e.curveType ?? t(b).MonotoneX
108
- }), null, 16, ["x", "color", "curve-type"]),
109
- m(t(Q), {
110
- x: (k, v) => v,
111
- y: (k) => k[i],
112
- color: f.value[o],
113
- "curve-type": e.curveType ?? t(b).MonotoneX,
131
+ color: `url(#gradient${o}-${g.value[o]})`,
132
+ opacity: e.hideArea ? 0 : ie,
133
+ "curve-type": e.curveType ?? n(L).MonotoneX
134
+ }), null, 16, ["x", "color", "opacity", "curve-type"]),
135
+ m(n(Q), {
136
+ x: (r, l) => l,
137
+ y: (r) => r[i],
138
+ color: g.value[o],
139
+ "curve-type": e.curveType ?? n(L).MonotoneX,
114
140
  "line-width": e.lineWidth,
115
141
  lineDashArray: e.lineDashArray ? e.lineDashArray[o] : void 0
116
142
  }, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"])
117
143
  ], 64))), 128)),
118
- e.hideXAxis ? d("", !0) : (a(), c(t(B), {
144
+ e.hideXAxis ? d("", !0) : (s(), c(n(A), f({
119
145
  key: 1,
120
146
  type: "x",
121
147
  label: e.xLabel,
@@ -127,8 +153,8 @@ const ie = {
127
153
  "domain-line": e.xDomainLine,
128
154
  "tick-line": e.xTickLine,
129
155
  "min-max-ticks-only": e.minMaxTicksOnly
130
- }, null, 8, ["label", "num-ticks", "tick-format", "tick-values", "grid-line", "domain-line", "tick-line", "min-max-ticks-only"])),
131
- e.hideYAxis ? d("", !0) : (a(), c(t(B), {
156
+ }, e.xAxisConfig), null, 16, ["label", "num-ticks", "tick-format", "tick-values", "grid-line", "domain-line", "tick-line", "min-max-ticks-only"])),
157
+ e.hideYAxis ? d("", !0) : (s(), c(n(A), f({
132
158
  key: 2,
133
159
  type: "y",
134
160
  label: e.yLabel,
@@ -137,35 +163,39 @@ const ie = {
137
163
  "grid-line": e.yGridLine,
138
164
  "domain-line": e.yDomainLine,
139
165
  "tick-line": e.yTickLine
140
- }, null, 8, ["label", "num-ticks", "tick-format", "grid-line", "domain-line", "tick-line"])),
141
- e.hideTooltip ? d("", !0) : (a(), c(t(Z), C({ key: 3 }, e.crosshairConfig, { template: M }), null, 16))
166
+ }, e.yAxisConfig), null, 16, ["label", "num-ticks", "tick-format", "grid-line", "domain-line", "tick-line"])),
167
+ e.hideTooltip ? d("", !0) : (s(), c(n(Z), f({ key: 3 }, e.crosshairConfig, { template: j }), null, 16))
142
168
  ]),
143
169
  _: 1
144
170
  }, 8, ["data", "height", "padding", "svg-defs", "y-domain", "x-domain"]),
145
- e.hideLegend ? d("", !0) : (a(), u("div", {
171
+ t.hideLegend ? d("", !0) : (s(), y("div", {
146
172
  key: 0,
147
- style: T({
173
+ style: k({
148
174
  display: "flex",
149
- alignItems: "center",
150
- justifyContent: "flex-end",
151
- paddingBottom: g.value ? "1rem" : void 0,
152
- paddingTop: g.value ? void 0 : "1rem"
175
+ justifyContent: F.value
153
176
  })
154
177
  }, [
155
- m(t(_), {
156
- items: Object.values(e.categories)
157
- }, null, 8, ["items"])
178
+ m(n(I), {
179
+ style: k([
180
+ t.legendStyle,
181
+ "display: flex; gap: var(--vis-legend-spacing);"
182
+ ]),
183
+ items: Object.values(t.categories).map((i) => ({
184
+ ...i,
185
+ color: Array.isArray(i.color) ? i.color[0] : i.color
186
+ }))
187
+ }, null, 8, ["style", "items"])
158
188
  ], 4)),
159
- X("div", ie, [
160
- t(O).tooltip ? D(e.$slots, "tooltip", {
189
+ X("div", ee, [
190
+ n(O).tooltip ? T(e.$slots, "tooltip", {
161
191
  key: 0,
162
- values: s.value
163
- }) : s.value ? D(e.$slots, "fallback", { key: 1 }, () => [
192
+ values: p.value
193
+ }) : p.value ? T(e.$slots, "fallback", { key: 1 }, () => [
164
194
  m(H, {
165
- data: s.value,
195
+ data: p.value,
166
196
  categories: e.categories,
167
- toolTipTitle: t(Y)(s.value) ?? "",
168
- yFormatter: n.yFormatter
197
+ toolTipTitle: n(U)(p.value) ?? "",
198
+ yFormatter: t.yFormatter
169
199
  }, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
170
200
  ]) : d("", !0)
171
201
  ], 512)
@@ -173,5 +203,5 @@ const ie = {
173
203
  }
174
204
  });
175
205
  export {
176
- de as default
206
+ se as default
177
207
  };
@@ -1,4 +1,4 @@
1
- import { axisFormatter, CrosshairConfig, LegendPosition, MarkerConfig } from '../../types';
1
+ import { axisFormatter, CrosshairConfig, LegendPosition, MarkerConfig, AxisConfig } from '../../types';
2
2
  import { BulletLegendItemInterface, CurveType } from '@unovis/ts';
3
3
  export interface AreaChartProps<T> {
4
4
  /**
@@ -39,17 +39,11 @@ export interface AreaChartProps<T> {
39
39
  */
40
40
  markerConfig?: Record<string, MarkerConfig>;
41
41
  /**
42
- * @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the x-axis.
43
- * @param {number} i - The index of the tick in the `ticks` array.
44
- * @param {(number[]|Date[])} ticks - An array of all tick values for the x-axis.
45
- * @returns {string} The formatted string representation of the tick.
42
+ * A function that formats the x-axis tick labels.
46
43
  */
47
44
  xFormatter?: axisFormatter;
48
45
  /**
49
- * @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the y-axis.
50
- * @param {number} i - The index of the tick in the `ticks` array.
51
- * @param {(number[]|Date[])} ticks - An array of all tick values for the y-axis.
52
- * @returns {string} The formatted string representation of the tick.
46
+ * A function that formats the y-axis tick labels.
53
47
  */
54
48
  yFormatter?: axisFormatter;
55
49
  /**
@@ -57,6 +51,17 @@ export interface AreaChartProps<T> {
57
51
  * See `CurveType` for available options.
58
52
  */
59
53
  curveType?: CurveType;
54
+ /**
55
+ * If `true`, hides the area fill, displaying only the line.
56
+ */
57
+ hideArea?: boolean;
58
+ /**
59
+ * Edit the gradient stops for the area fill.
60
+ */
61
+ gradientStops?: Array<{
62
+ offset: string;
63
+ stopOpacity: number;
64
+ }>;
60
65
  /**
61
66
  * The width of the line in pixels. Default is 2px.
62
67
  */
@@ -94,6 +99,10 @@ export interface AreaChartProps<T> {
94
99
  * See `LegendPosition` for available options.
95
100
  */
96
101
  legendPosition?: LegendPosition;
102
+ /**
103
+ * Optional style object for the legend container. Allows custom CSS styling.
104
+ */
105
+ legendStyle?: string | Record<string, string>;
97
106
  /**
98
107
  * If `true`, displays a domain line (axis line) along the x-axis.
99
108
  */
@@ -130,6 +139,14 @@ export interface AreaChartProps<T> {
130
139
  * Crosshair configuration object for customizing the appearance of the crosshair line.
131
140
  */
132
141
  crosshairConfig?: CrosshairConfig;
142
+ /**
143
+ * Axis configuration object for customizing the appearance of the axes.
144
+ */
145
+ xAxisConfig?: AxisConfig;
146
+ /**
147
+ * Axis configuration object for customizing the appearance of the axes.
148
+ */
149
+ yAxisConfig?: AxisConfig;
133
150
  /**
134
151
  * The domain for the y-axis, specified as a tuple of two values.
135
152
  */
@@ -1,14 +1,14 @@
1
- import { defineComponent as R, useSlots as W, useTemplateRef as X, ref as Y, computed as b, createElementBlock as v, openBlock as t, normalizeStyle as P, createVNode as k, createCommentVNode as m, createElementVNode as j, unref as o, withCtx as H, createBlock as u, Fragment as $, renderList as q, renderSlot as C } from "vue";
2
- import { Orientation as p, StackedBar as I, GroupedBar as U } from "@unovis/ts";
3
- import { getFirstPropertyValue as J } from "../../utils.js";
4
- import { useStackedGrouped as K } from "./stackedGroupedUtils.js";
5
- import { VisXYContainer as Q, VisXYLabels as Z, VisTooltip as _, VisStackedBar as F, VisGroupedBar as ee, VisAxis as V, VisBulletLegend as ae } from "@unovis/vue";
1
+ import { defineComponent as W, useSlots as X, useTemplateRef as H, ref as Y, computed as f, createElementBlock as v, openBlock as l, normalizeStyle as L, createVNode as k, createCommentVNode as y, createElementVNode as j, unref as i, withCtx as $, createBlock as u, Fragment as q, renderList as I, mergeProps as P, renderSlot as C } from "vue";
2
+ import { Orientation as p, StackedBar as U, GroupedBar as J } from "@unovis/ts";
3
+ import { getFirstPropertyValue as K } from "../../utils.js";
4
+ import { useStackedGrouped as Q } from "./stackedGroupedUtils.js";
5
+ import { VisXYContainer as Z, VisXYLabels as _, VisTooltip as ee, VisStackedBar as F, VisGroupedBar as ae, VisAxis as V, VisBulletLegend as ie } from "@unovis/vue";
6
6
  import oe from "../Tooltip.js";
7
- import { LegendPosition as ie } from "../../types.js";
8
- const re = {
7
+ import { LegendPosition as re } from "../../types.js";
8
+ const ne = {
9
9
  ref: "slotWrapper",
10
10
  style: { display: "none" }
11
- }, ce = /* @__PURE__ */ R({
11
+ }, ge = /* @__PURE__ */ W({
12
12
  __name: "BarChart",
13
13
  props: {
14
14
  data: {},
@@ -33,10 +33,11 @@ const re = {
33
33
  groupPadding: { default: 0 },
34
34
  barPadding: { default: 0.2 },
35
35
  radius: {},
36
- hideLegend: { type: Boolean },
36
+ hideLegend: { type: Boolean, default: !1 },
37
37
  hideTooltip: { type: Boolean, default: !1 },
38
38
  orientation: { default: p.Vertical },
39
- legendPosition: {},
39
+ legendPosition: { default: re.BottomCenter },
40
+ legendStyle: { default: void 0 },
40
41
  xDomainLine: { type: Boolean },
41
42
  yDomainLine: { type: Boolean },
42
43
  xTickLine: { type: Boolean },
@@ -46,118 +47,121 @@ const re = {
46
47
  hideXAxis: { type: Boolean },
47
48
  hideYAxis: { type: Boolean },
48
49
  stackedGroupedSpacing: { default: 0.1 },
50
+ xAxisConfig: {},
51
+ yAxisConfig: {},
49
52
  stackAndGrouped: { type: Boolean },
50
53
  valueLabel: {},
51
54
  xAxis: {}
52
55
  },
53
56
  emits: ["click"],
54
57
  setup(G, { emit: S }) {
55
- const O = S, a = G, w = W(), L = X("slotWrapper"), s = Y();
58
+ const O = S, a = G, D = X(), x = H("slotWrapper"), s = Y();
56
59
  if (a.valueLabel && !a.xAxis)
57
60
  throw new Error(
58
61
  "BarChart: 'xAxis' prop is required when 'valueLabel' is enabled. Please provide an 'xAxis' to display value labels."
59
62
  );
60
63
  if (!a.yAxis || a.yAxis.length === 0)
61
64
  throw new Error("yAxis is required");
62
- const h = b(() => a.yAxis.map((e) => (r) => r[e])), x = (e, r) => {
63
- var i;
64
- return (i = Object.values(a.categories)[r]) == null ? void 0 : i.color;
65
- }, c = b(
66
- () => K({
65
+ const h = f(() => a.yAxis.map((e) => (t) => t[e])), A = (e, t) => {
66
+ var r;
67
+ return (r = Object.values(a.categories)[t]) == null ? void 0 : r.color;
68
+ }, c = f(
69
+ () => Q({
67
70
  data: a.data,
68
71
  categories: a.categories,
69
72
  stackAndGrouped: a.stackAndGrouped,
70
73
  xAxis: a.xAxis,
71
74
  spacing: a.stackedGroupedSpacing
72
75
  }).value
73
- ), A = b(
74
- () => a.legendPosition === ie.Top
75
- );
76
+ ), E = f(() => a.legendPosition.startsWith("top")), N = f(() => a.legendPosition.includes("left") ? "flex-start" : a.legendPosition.includes("right") ? "flex-end" : "center");
76
77
  function B(e) {
77
- return s.value = e, D();
78
+ s.value = e;
78
79
  }
79
- function D(e) {
80
- return typeof window > "u" ? "" : L.value ? L.value.innerHTML : "";
81
- }
82
- const T = a.yAxis.map((e) => (r) => r[e]), E = T.length, N = a.data.flatMap(
83
- (e, r) => T.map((i, d) => ({
84
- x: r,
85
- y: Number(i(e) ?? 0),
80
+ const T = a.yAxis.map((e) => (t) => t[e]), M = T.length, w = a.data.flatMap(
81
+ (e, t) => T.map((r, d) => ({
82
+ x: t,
83
+ y: Number(r(e) ?? 0),
86
84
  itemIndex: d
87
85
  }))
88
86
  ), z = (e) => {
89
87
  if (a.stacked || a.stackAndGrouped) return e.x;
90
- const r = E;
91
- if (r <= 1) return e.x;
92
- const d = 1 - (a.groupPadding ?? 0), g = d / r, y = -d / 2, n = g * e.itemIndex + g / 2, f = 1 - (a.barPadding ?? 0), M = (y + n) * f;
93
- return e.x + M;
88
+ const t = M;
89
+ if (t <= 1) return e.x;
90
+ const d = 1 - (a.groupPadding ?? 0), g = d / t, m = -d / 2, o = g * e.itemIndex + g / 2, b = 1 - (a.barPadding ?? 0), R = (m + o) * b;
91
+ return e.x + R;
94
92
  };
95
- return (e, r) => (t(), v("div", {
96
- style: P({
93
+ return (e, t) => (l(), v("div", {
94
+ style: L({
97
95
  display: "flex",
98
- flexDirection: A.value ? "column-reverse" : "column",
99
- gap: "1rem"
96
+ flexDirection: E.value ? "column-reverse" : "column",
97
+ gap: "var(--vis-legend-spacing)"
100
98
  }),
101
- onClick: r[0] || (r[0] = (i) => O("click", i, s.value))
99
+ onClick: t[0] || (t[0] = (r) => O("click", r, s.value))
102
100
  }, [
103
- k(o(Q), {
101
+ k(i(Z), {
104
102
  padding: e.padding,
105
103
  height: e.height
106
104
  }, {
107
- default: H(() => {
108
- var i, d, g, y;
105
+ default: $(() => {
106
+ var r, d, g, m;
109
107
  return [
110
- e.valueLabel ? (t(), u(o(Z), {
108
+ e.valueLabel ? (l(), u(i(_), {
111
109
  key: 0,
112
- data: o(N),
110
+ data: i(w),
113
111
  x: z,
114
- y: (n) => {
115
- var l;
116
- return n.y + (((l = a.valueLabel) == null ? void 0 : l.labelSpacing) ?? 0);
112
+ y: (o) => {
113
+ var n;
114
+ return o.y + (((n = a.valueLabel) == null ? void 0 : n.labelSpacing) ?? 0);
117
115
  },
118
- label: (i = a.valueLabel) == null ? void 0 : i.label,
116
+ label: (r = a.valueLabel) == null ? void 0 : r.label,
119
117
  backgroundColor: ((d = a.valueLabel) == null ? void 0 : d.backgroundColor) ?? "transparent",
120
118
  color: ((g = a.valueLabel) == null ? void 0 : g.color) ?? "red",
121
- labelFontSize: (y = a.valueLabel) == null ? void 0 : y.labelFontSize
122
- }, null, 8, ["data", "y", "label", "backgroundColor", "color", "labelFontSize"])) : m("", !0),
123
- k(o(_), {
119
+ labelFontSize: (m = a.valueLabel) == null ? void 0 : m.labelFontSize
120
+ }, null, 8, ["data", "y", "label", "backgroundColor", "color", "labelFontSize"])) : y("", !0),
121
+ k(i(ee), {
124
122
  triggers: {
125
- [o(U).selectors.bar]: B,
126
- [o(I).selectors.bar]: B
123
+ [i(J).selectors.bar]: (o) => {
124
+ var n;
125
+ return B(o), o ? (n = x.value) == null ? void 0 : n.innerHTML : "";
126
+ },
127
+ [i(U).selectors.bar]: (o) => {
128
+ var n;
129
+ return B(o), o ? (n = x.value) == null ? void 0 : n.innerHTML : "";
130
+ }
127
131
  }
128
132
  }, null, 8, ["triggers"]),
129
- e.stackAndGrouped ? (t(!0), v($, { key: 1 }, q(c.value.states, (n) => (t(), u(o(F), {
130
- key: n,
133
+ e.stackAndGrouped ? (l(!0), v(q, { key: 1 }, I(c.value.states, (o) => (l(), u(i(F), {
134
+ key: o,
131
135
  data: c.value.chartData,
132
- x: (l, f) => f + c.value.positions[n],
133
- y: c.value.bars[n],
134
- color: c.value.colorFunctions[n],
136
+ x: (n, b) => b + c.value.positions[o],
137
+ y: c.value.bars[o],
138
+ color: c.value.colorFunctions[o],
135
139
  "rounded-corners": e.radius ?? 0,
136
140
  "group-padding": e.groupPadding ?? 0,
137
141
  "bar-padding": e.barPadding,
138
- orientation: e.orientation ?? o(p).Vertical
139
- }, null, 8, ["data", "x", "y", "color", "rounded-corners", "group-padding", "bar-padding", "orientation"]))), 128)) : e.stacked ? (t(), u(o(F), {
142
+ orientation: e.orientation ?? i(p).Vertical
143
+ }, null, 8, ["data", "x", "y", "color", "rounded-corners", "group-padding", "bar-padding", "orientation"]))), 128)) : e.stacked ? (l(), u(i(F), {
140
144
  key: 3,
141
145
  data: e.data,
142
- x: (n, l) => l,
146
+ x: (o, n) => n,
143
147
  y: h.value,
144
- color: x,
148
+ color: A,
145
149
  "rounded-corners": e.radius ?? 0,
146
150
  "group-padding": e.groupPadding ?? 0,
147
151
  "bar-padding": e.barPadding ?? 0.2,
148
- orientation: e.orientation ?? o(p).Vertical
149
- }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (t(), u(o(ee), {
152
+ orientation: e.orientation ?? i(p).Vertical
153
+ }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (l(), u(i(ae), {
150
154
  key: 2,
151
155
  data: e.data,
152
- x: (n, l) => l,
156
+ x: (o, n) => n,
153
157
  y: h.value,
154
- color: x,
158
+ color: A,
155
159
  "rounded-corners": e.radius ?? 0,
156
160
  "group-padding": e.groupPadding ?? 0,
157
161
  "bar-padding": e.barPadding ?? 0.2,
158
- orientation: e.orientation ?? o(p).Vertical
162
+ orientation: e.orientation ?? i(p).Vertical
159
163
  }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
160
- e.hideXAxis ? m("", !0) : (t(), u(o(V), {
164
+ e.hideXAxis ? y("", !0) : (l(), u(i(V), P({
161
165
  key: 4,
162
166
  type: "x",
163
167
  "tick-format": e.xFormatter,
@@ -168,53 +172,55 @@ const re = {
168
172
  "num-ticks": e.xNumTicks,
169
173
  "tick-values": e.xExplicitTicks,
170
174
  minMaxTicksOnly: e.minMaxTicksOnly
171
- }, null, 8, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "minMaxTicksOnly"])),
172
- e.hideYAxis ? m("", !0) : (t(), u(o(V), {
175
+ }, e.xAxisConfig), null, 16, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "minMaxTicksOnly"])),
176
+ e.hideYAxis ? y("", !0) : (l(), u(i(V), P({
173
177
  key: 5,
174
178
  type: "y",
175
179
  label: e.yLabel,
176
- "grid-line": e.orientation !== o(p).Horizontal && e.yGridLine,
180
+ "grid-line": e.orientation !== i(p).Horizontal && e.yGridLine,
177
181
  "domain-line": !!e.yDomainLine,
178
182
  "tick-format": e.yFormatter,
179
183
  "num-ticks": e.yNumTicks,
180
184
  "tick-line": e.yTickLine
181
- }, null, 8, ["label", "grid-line", "domain-line", "tick-format", "num-ticks", "tick-line"]))
185
+ }, e.yAxisConfig), null, 16, ["label", "grid-line", "domain-line", "tick-format", "num-ticks", "tick-line"]))
182
186
  ];
183
187
  }),
184
188
  _: 1
185
189
  }, 8, ["padding", "height"]),
186
- e.hideLegend ? m("", !0) : (t(), v("div", {
190
+ a.hideLegend ? y("", !0) : (l(), v("div", {
187
191
  key: 0,
188
- style: P({
192
+ style: L({
189
193
  display: "flex",
190
- alignItems: "center",
191
- justifyContent: "flex-end",
192
- paddingBottom: A.value ? "1rem" : void 0
194
+ justifyContent: N.value
193
195
  })
194
196
  }, [
195
- k(o(ae), {
196
- items: Object.values(a.categories).map((i) => ({
197
- ...i,
198
- color: Array.isArray(i.color) ? i.color[0] : i.color
197
+ k(i(ie), {
198
+ style: L([
199
+ a.legendStyle,
200
+ "display: flex; gap: var(--vis-legend-spacing);"
201
+ ]),
202
+ items: Object.values(a.categories).map((r) => ({
203
+ ...r,
204
+ color: Array.isArray(r.color) ? r.color[0] : r.color
199
205
  }))
200
- }, null, 8, ["items"])
206
+ }, null, 8, ["style", "items"])
201
207
  ], 4)),
202
- j("div", re, [
203
- o(w).tooltip ? C(e.$slots, "tooltip", {
208
+ j("div", ne, [
209
+ i(D).tooltip ? C(e.$slots, "tooltip", {
204
210
  key: 0,
205
211
  values: s.value
206
212
  }) : s.value ? C(e.$slots, "fallback", { key: 1 }, () => [
207
213
  k(oe, {
208
214
  data: s.value,
209
215
  categories: a.categories,
210
- toolTipTitle: o(J)(s.value) ?? "",
211
- yFormatter: a.orientation === o(p).Horizontal ? a.xFormatter : a.yFormatter
216
+ toolTipTitle: i(K)(s.value) ?? "",
217
+ yFormatter: a.orientation === i(p).Horizontal ? a.xFormatter : a.yFormatter
212
218
  }, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
213
- ]) : m("", !0)
219
+ ]) : y("", !0)
214
220
  ], 512)
215
221
  ], 4));
216
222
  }
217
223
  });
218
224
  export {
219
- ce as default
225
+ ge as default
220
226
  };
@@ -1,9 +1,8 @@
1
1
  import { ComputedRef } from 'vue';
2
+ import { BulletLegendItemInterface } from '../../types';
2
3
  export interface StackedGroupedConfig<T> {
3
4
  data: T[];
4
- categories: Record<string, {
5
- color?: string | Array<string>;
6
- }>;
5
+ categories: Record<string, BulletLegendItemInterface>;
7
6
  stackAndGrouped: boolean;
8
7
  xAxis?: keyof T;
9
8
  spacing?: number;