vue-chrts 0.1.11-beta.1 → 0.1.12-beta.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.
@@ -102,8 +102,9 @@ const m = 24, B = 4, z = 0.5, C = "#3b82f6", Z = /* @__PURE__ */ O({
102
102
  }, null, 8, ["horizontal-placement", "vertical-placement"])),
103
103
  (o(!0), c(h, null, G(Object.keys(a.categories), (r, l) => (o(), c(h, { key: l }, [
104
104
  p(i(I), N({
105
- x: (y, f) => f
106
- }, { ref_for: !0 }, F(r), {
105
+ x: (y, f) => f,
106
+ ref_for: !0
107
+ }, F(r), {
107
108
  color: `url(#gradient${l}-${i(u)[l]})`,
108
109
  opacity: z,
109
110
  "curve-type": e.curveType ?? i(L).MonotoneX
@@ -1,9 +1,9 @@
1
- import { defineComponent as x, computed as c, createApp as A, createElementBlock as b, openBlock as t, normalizeClass as L, createVNode as p, createCommentVNode as m, unref as i, withCtx as V, createBlock as l } from "vue";
2
- import { Orientation as s, StackedBar as P, GroupedBar as O } from "@unovis/ts";
3
- import { VisXYContainer as C, VisTooltip as F, VisGroupedBar as G, VisStackedBar as N, VisAxis as T, VisBulletLegend as j } from "@unovis/vue";
1
+ import { defineComponent as v, computed as c, createApp as V, createElementBlock as f, openBlock as l, normalizeClass as b, createVNode as r, createCommentVNode as x, unref as i, withCtx as P, createBlock as h } from "vue";
2
+ import { Orientation as s, StackedBar as A, GroupedBar as O } from "@unovis/ts";
3
+ import { VisXYContainer as C, VisTooltip as F, VisGroupedBar as G, VisStackedBar as N, VisAxis as L, VisBulletLegend as j } from "@unovis/vue";
4
4
  import w from "../Tooltip.js";
5
5
  import { LegendPosition as E } from "../../types.js";
6
- const H = /* @__PURE__ */ x({
6
+ const S = /* @__PURE__ */ v({
7
7
  __name: "BarChart",
8
8
  props: {
9
9
  data: {},
@@ -36,71 +36,68 @@ const H = /* @__PURE__ */ x({
36
36
  xTickLine: { type: Boolean },
37
37
  yTickLine: { type: Boolean },
38
38
  xGridLine: { type: Boolean },
39
- yGridLine: { type: Boolean, default: !0 },
40
- hideXAxis: { type: Boolean },
41
- hideYAxis: { type: Boolean }
39
+ yGridLine: { type: Boolean, default: !0 }
42
40
  },
43
41
  setup(a) {
44
42
  const n = a;
45
43
  if (!n.yAxis || n.yAxis.length === 0)
46
44
  throw new Error("yAxis is required");
47
- const y = c(() => n.yAxis.map((e) => (o) => o[e])), g = (e, o) => Object.values(n.categories)[o].color, k = c(
45
+ const m = c(() => n.yAxis.map((e) => (t) => t[e])), p = (e, t) => Object.values(n.categories)[t].color, g = c(
48
46
  () => n.legendPosition === E.Top
49
- ), f = c(() => (e, o) => {
47
+ ), y = c(() => (e, t) => {
50
48
  if (typeof window > "u" || typeof document > "u")
51
49
  return "";
52
- const u = Object.keys(n.categories), B = Object.keys(e).find((r) => !u.includes(r));
50
+ const u = Object.keys(n.categories), T = Object.keys(e).find((o) => !u.includes(o));
53
51
  try {
54
- const r = A(w, {
52
+ const o = V(w, {
55
53
  data: e,
56
54
  categories: n.categories,
57
- toolTipTitle: e[B],
55
+ toolTipTitle: e[T],
58
56
  yFormatter: n.yFormatter
59
- }), h = document.createElement("div");
60
- r.mount(h);
61
- const v = h.innerHTML;
62
- return r.unmount(), v;
57
+ }), k = document.createElement("div");
58
+ o.mount(k);
59
+ const B = k.innerHTML;
60
+ return o.unmount(), B;
63
61
  } catch {
64
62
  return "";
65
63
  }
66
64
  });
67
- return (e, o) => (t(), b("div", {
68
- class: L(["flex flex-col space-y-4", { "flex-col-reverse": k.value }])
65
+ return (e, t) => (l(), f("div", {
66
+ class: b(["flex flex-col space-y-4", { "flex-col-reverse": g.value }])
69
67
  }, [
70
- p(i(C), {
68
+ r(i(C), {
71
69
  padding: e.padding,
72
70
  height: e.height
73
71
  }, {
74
- default: V(() => [
75
- p(i(F), {
72
+ default: P(() => [
73
+ r(i(F), {
76
74
  triggers: {
77
- [i(O).selectors.bar]: f.value,
78
- [i(P).selectors.bar]: f.value
75
+ [i(O).selectors.bar]: y.value,
76
+ [i(A).selectors.bar]: y.value
79
77
  }
80
78
  }, null, 8, ["triggers"]),
81
- e.stacked ? (t(), l(i(N), {
79
+ e.stacked ? (l(), h(i(N), {
82
80
  key: 1,
83
81
  data: e.data,
84
82
  x: (u, d) => d,
85
- y: y.value,
86
- color: g,
83
+ y: m.value,
84
+ color: p,
87
85
  "rounded-corners": e.radius ?? 0,
88
86
  "group-padding": e.groupPadding ?? 0,
89
87
  "bar-padding": e.barPadding ?? 0.2,
90
88
  orientation: e.orientation ?? i(s).Vertical
91
- }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (t(), l(i(G), {
89
+ }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (l(), h(i(G), {
92
90
  key: 0,
93
91
  data: e.data,
94
92
  x: (u, d) => d,
95
- y: y.value,
96
- color: g,
93
+ y: m.value,
94
+ color: p,
97
95
  "rounded-corners": e.radius ?? 0,
98
96
  "group-padding": e.groupPadding ?? 0,
99
97
  "bar-padding": e.barPadding ?? 0.2,
100
98
  orientation: e.orientation ?? i(s).Vertical
101
99
  }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
102
- e.hideXAxis ? m("", !0) : (t(), l(i(T), {
103
- key: 2,
100
+ r(i(L), {
104
101
  type: "x",
105
102
  "tick-format": e.xFormatter,
106
103
  label: e.xLabel,
@@ -109,10 +106,9 @@ const H = /* @__PURE__ */ x({
109
106
  "tick-line": e.xTickLine,
110
107
  "num-ticks": e.xNumTicks,
111
108
  "tick-values": e.xExplicitTicks,
112
- minMaxTicksOnly: e.minMaxTicksOnly
113
- }, null, 8, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "minMaxTicksOnly"])),
114
- e.hideYAxis ? m("", !0) : (t(), l(i(T), {
115
- key: 3,
109
+ "min-max-ticks-only": e.minMaxTicksOnly
110
+ }, null, 8, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"]),
111
+ r(i(L), {
116
112
  type: "y",
117
113
  label: e.yLabel,
118
114
  "grid-line": e.orientation !== i(s).Horizontal && e.yGridLine,
@@ -120,15 +116,15 @@ const H = /* @__PURE__ */ x({
120
116
  "tick-format": e.yFormatter,
121
117
  "num-ticks": e.yNumTicks,
122
118
  "tick-line": e.yTickLine
123
- }, null, 8, ["label", "grid-line", "domain-line", "tick-format", "num-ticks", "tick-line"]))
119
+ }, null, 8, ["label", "grid-line", "domain-line", "tick-format", "num-ticks", "tick-line"])
124
120
  ]),
125
121
  _: 1
126
122
  }, 8, ["padding", "height"]),
127
- e.hideLegend ? m("", !0) : (t(), b("div", {
123
+ e.hideLegend ? x("", !0) : (l(), f("div", {
128
124
  key: 0,
129
- class: L(["flex items center justify-end", { "pb-4": k.value }])
125
+ class: b(["flex items center justify-end", { "pb-4": g.value }])
130
126
  }, [
131
- p(i(j), {
127
+ r(i(j), {
132
128
  items: Object.values(e.categories)
133
129
  }, null, 8, ["items"])
134
130
  ], 2))
@@ -136,5 +132,5 @@ const H = /* @__PURE__ */ x({
136
132
  }
137
133
  });
138
134
  export {
139
- H as default
135
+ S as default
140
136
  };
@@ -121,12 +121,4 @@ export interface BarChartProps<T> {
121
121
  * If `true`, displays grid lines along the y-axis.
122
122
  */
123
123
  yGridLine?: boolean;
124
- /**
125
- * If `true`, hide the x-axis.
126
- */
127
- hideXAxis?: boolean;
128
- /**
129
- * If `true`, hide the y-axis.
130
- */
131
- hideYAxis?: boolean;
132
124
  }
@@ -1,10 +1,10 @@
1
- import { defineComponent as b, computed as y, createApp as B, createElementBlock as d, openBlock as n, normalizeClass as g, createVNode as p, createCommentVNode as s, unref as i, withCtx as x, createBlock as m, Fragment as C, renderList as V } from "vue";
1
+ import { defineComponent as b, computed as p, createApp as B, createElementBlock as s, openBlock as l, normalizeClass as u, createVNode as r, createCommentVNode as y, unref as i, withCtx as x, createBlock as g, Fragment as C, renderList as V } from "vue";
2
2
  import { Position as k, CurveType as F } from "@unovis/ts";
3
- import { VisXYContainer as O, VisTooltip as A, VisLine as M, VisAxis as f, VisCrosshair as N, VisBulletLegend as P } from "@unovis/vue";
4
- import j from "../Tooltip.js";
5
- import { LegendPosition as D } from "../../types.js";
6
- import { getFirstPropertyValue as E } from "../../utils.js";
7
- const H = /* @__PURE__ */ b({
3
+ import { VisXYContainer as N, VisTooltip as O, VisLine as P, VisAxis as f, VisCrosshair as j, VisBulletLegend as D } from "@unovis/vue";
4
+ import E from "../Tooltip.js";
5
+ import { LegendPosition as G } from "../../types.js";
6
+ import { getFirstPropertyValue as M } from "../../utils.js";
7
+ const R = /* @__PURE__ */ b({
8
8
  __name: "LineChart",
9
9
  props: {
10
10
  data: {},
@@ -33,52 +33,49 @@ const H = /* @__PURE__ */ b({
33
33
  yGridLine: { type: Boolean },
34
34
  yDomainLine: { type: Boolean },
35
35
  xTickLine: { type: Boolean },
36
- yTickLine: { type: Boolean },
37
- hideXAxis: { type: Boolean },
38
- hideYAxis: { type: Boolean }
36
+ yTickLine: { type: Boolean }
39
37
  },
40
38
  setup(t) {
41
- const o = t, h = Object.values(o.categories).map((e, c) => `var(--vis-color${c})`), T = (e) => Object.values(o.categories)[e].color ?? h[e], L = y(() => (e, c) => {
39
+ const n = t, h = Object.values(n.categories).map((e, c) => `var(--vis-color${c})`), L = (e) => Object.values(n.categories)[e].color ?? h[e], T = p(() => (e, c) => {
42
40
  if (typeof window > "u" || typeof document > "u")
43
41
  return "";
44
42
  try {
45
- const a = B(j, {
43
+ const o = B(E, {
46
44
  data: e,
47
- categories: o.categories,
48
- toolTipTitle: E(e),
49
- yFormatter: o.yFormatter
50
- }), l = document.createElement("div");
51
- a.mount(l);
52
- const r = l.innerHTML;
53
- return a.unmount(), r;
45
+ categories: n.categories,
46
+ toolTipTitle: M(e),
47
+ yFormatter: n.yFormatter
48
+ }), a = document.createElement("div");
49
+ o.mount(a);
50
+ const m = a.innerHTML;
51
+ return o.unmount(), m;
54
52
  } catch {
55
53
  return "";
56
54
  }
57
- }), u = y(
58
- () => o.legendPosition === D.Top
55
+ }), d = p(
56
+ () => n.legendPosition === G.Top
59
57
  );
60
- return (e, c) => (n(), d("div", {
61
- class: g(["flex flex-col space-y-4", { "flex-col-reverse": u.value }])
58
+ return (e, c) => (l(), s("div", {
59
+ class: u(["flex flex-col space-y-4", { "flex-col-reverse": d.value }])
62
60
  }, [
63
- p(i(O), {
61
+ r(i(N), {
64
62
  data: e.data,
65
63
  padding: e.padding,
66
64
  height: e.height
67
65
  }, {
68
66
  default: x(() => [
69
- p(i(A), {
67
+ r(i(O), {
70
68
  "horizontal-placement": i(k).Right,
71
69
  "vertical-placement": i(k).Top
72
70
  }, null, 8, ["horizontal-placement", "vertical-placement"]),
73
- (n(!0), d(C, null, V(Object.keys(o.categories), (a, l) => (n(), m(i(M), {
74
- key: l,
75
- x: (r, v) => v,
76
- y: (r) => r[a],
77
- color: T(l),
71
+ (l(!0), s(C, null, V(Object.keys(n.categories), (o, a) => (l(), g(i(P), {
72
+ key: a,
73
+ x: (m, v) => v,
74
+ y: (m) => m[o],
75
+ color: L(a),
78
76
  "curve-type": e.curveType ?? i(F).MonotoneX
79
77
  }, null, 8, ["x", "y", "color", "curve-type"]))), 128)),
80
- e.hideXAxis ? s("", !0) : (n(), m(i(f), {
81
- key: 0,
78
+ r(i(f), {
82
79
  type: "x",
83
80
  "tick-format": e.xFormatter,
84
81
  label: e.xLabel,
@@ -88,10 +85,9 @@ const H = /* @__PURE__ */ b({
88
85
  "tick-line": e.xTickLine,
89
86
  "num-ticks": e.xNumTicks,
90
87
  "tick-values": e.xExplicitTicks,
91
- minMaxTicksOnly: e.minMaxTicksOnly
92
- }, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "minMaxTicksOnly"])),
93
- e.hideYAxis ? s("", !0) : (n(), m(i(f), {
94
- key: 1,
88
+ "min-max-ticks-only": e.minMaxTicksOnly
89
+ }, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"]),
90
+ r(i(f), {
95
91
  type: "y",
96
92
  "tick-format": e.yFormatter,
97
93
  label: e.yLabel,
@@ -99,20 +95,20 @@ const H = /* @__PURE__ */ b({
99
95
  "domain-line": e.yDomainLine,
100
96
  "grid-line": e.yGridLine,
101
97
  "tick-line": e.yTickLine
102
- }, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"])),
103
- e.hideTooltip ? s("", !0) : (n(), m(i(N), {
104
- key: 2,
98
+ }, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"]),
99
+ e.hideTooltip ? y("", !0) : (l(), g(i(j), {
100
+ key: 0,
105
101
  color: "#666",
106
- template: L.value
102
+ template: T.value
107
103
  }, null, 8, ["template"]))
108
104
  ]),
109
105
  _: 1
110
106
  }, 8, ["data", "padding", "height"]),
111
- e.hideLegend ? s("", !0) : (n(), d("div", {
107
+ e.hideLegend ? y("", !0) : (l(), s("div", {
112
108
  key: 0,
113
- class: g(["flex items center justify-end", { "pb-4": u.value }])
109
+ class: u(["flex items center justify-end", { "pb-4": d.value }])
114
110
  }, [
115
- p(i(P), {
111
+ r(i(D), {
116
112
  items: Object.values(e.categories)
117
113
  }, null, 8, ["items"])
118
114
  ], 2))
@@ -120,5 +116,5 @@ const H = /* @__PURE__ */ b({
120
116
  }
121
117
  });
122
118
  export {
123
- H as default
119
+ R as default
124
120
  };
@@ -105,12 +105,4 @@ export interface LineChartProps<T> {
105
105
  * If `true`, displays tick lines on the y-axis.
106
106
  */
107
107
  yTickLine?: boolean;
108
- /**
109
- * If `true`, hide the x-axis.
110
- */
111
- hideXAxis?: boolean;
112
- /**
113
- * If `true`, hide the y-axis.
114
- */
115
- hideYAxis?: boolean;
116
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "0.1.11-beta.1",
3
+ "version": "0.1.12-beta.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"