vue-chrts 0.1.11 → 0.1.12-test.0

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