vue-chrts 0.1.1-test.3 → 0.1.1-test.4

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,8 +1,8 @@
1
- import { defineComponent as d, computed as f, createApp as h, createElementBlock as y, openBlock as a, createVNode as o, createElementVNode as g, unref as t, withCtx as v, createBlock as _, createCommentVNode as V } from "vue";
2
- import { VisXYContainer as k, VisArea as C, VisAxis as c, VisCrosshair as T, VisBulletLegend as b } from "@unovis/vue";
3
- import { CurveType as x } from "@unovis/ts";
4
- import B from "../Tooltip.js";
5
- const N = { class: "flex flex-col space-y-4" }, A = { class: "flex items center justify-end" }, O = /* @__PURE__ */ d({
1
+ import { defineComponent as f, computed as h, createApp as y, createElementBlock as g, openBlock as a, createVNode as r, createElementVNode as v, unref as t, withCtx as _, createBlock as V, createCommentVNode as k } from "vue";
2
+ import { VisXYContainer as C, VisArea as T, VisAxis as c, VisCrosshair as b, VisBulletLegend as x } from "@unovis/vue";
3
+ import { CurveType as B } from "@unovis/ts";
4
+ import N from "../Tooltip.js";
5
+ const A = { class: "flex flex-col space-y-4" }, j = { class: "flex items center justify-end" }, H = /* @__PURE__ */ f({
6
6
  __name: "AreaStackedChart",
7
7
  props: {
8
8
  data: {},
@@ -11,44 +11,44 @@ const N = { class: "flex flex-col space-y-4" }, A = { class: "flex items center
11
11
  hideTooltip: { type: Boolean }
12
12
  },
13
13
  setup(s) {
14
- const i = s, l = f(() => (e) => {
14
+ const n = s, l = h(() => (e, p) => {
15
15
  if (typeof window > "u" || typeof document > "u")
16
16
  return "";
17
17
  try {
18
- const r = h(B, {
18
+ const o = y(N, {
19
19
  data: e,
20
- categories: i.categories
21
- }), n = document.createElement("div");
22
- r.mount(n);
23
- const p = n.innerHTML;
24
- return r.unmount(), p;
20
+ categories: n.categories
21
+ }), i = document.createElement("div");
22
+ o.mount(i);
23
+ const d = i.innerHTML;
24
+ return o.unmount(), d;
25
25
  } catch {
26
26
  return "";
27
27
  }
28
28
  }), m = (e) => Number.parseInt(e.time), u = [(e) => e.firstTime, (e) => e.returning];
29
- return (e, r) => (a(), y("div", N, [
30
- o(t(k), {
29
+ return (e, p) => (a(), g("div", A, [
30
+ r(t(C), {
31
31
  data: e.data,
32
32
  height: e.height
33
33
  }, {
34
- default: v(() => [
35
- o(t(C), {
34
+ default: _(() => [
35
+ r(t(T), {
36
36
  x: m,
37
37
  y: u,
38
- color: Object.values(i.categories).map((n) => n.color),
39
- "curve-type": t(x).Linear
38
+ color: Object.values(n.categories).map((o) => o.color),
39
+ "curve-type": t(B).Linear
40
40
  }, null, 8, ["color", "curve-type"]),
41
- o(t(c), {
41
+ r(t(c), {
42
42
  type: "x",
43
43
  label: "Time",
44
44
  "num-ticks": 12
45
45
  }),
46
- o(t(c), {
46
+ r(t(c), {
47
47
  type: "y",
48
48
  label: "Number of visitors",
49
49
  "num-ticks": 3
50
50
  }),
51
- e.hideTooltip ? V("", !0) : (a(), _(t(T), {
51
+ e.hideTooltip ? k("", !0) : (a(), V(t(b), {
52
52
  key: 0,
53
53
  color: "#666",
54
54
  template: l.value
@@ -56,8 +56,8 @@ const N = { class: "flex flex-col space-y-4" }, A = { class: "flex items center
56
56
  ]),
57
57
  _: 1
58
58
  }, 8, ["data", "height"]),
59
- g("div", A, [
60
- o(t(b), {
59
+ v("div", j, [
60
+ r(t(x), {
61
61
  items: Object.values(e.categories)
62
62
  }, null, 8, ["items"])
63
63
  ])
@@ -65,5 +65,5 @@ const N = { class: "flex flex-col space-y-4" }, A = { class: "flex items center
65
65
  }
66
66
  });
67
67
  export {
68
- O as default
68
+ H as default
69
69
  };
@@ -1,9 +1,9 @@
1
- import { defineComponent as h, computed as u, createApp as b, createElementBlock as y, openBlock as d, normalizeClass as k, createVNode as r, createCommentVNode as B, unref as i, withCtx as T, createBlock as f } from "vue";
2
- import { Orientation as s, StackedBar as v, GroupedBar as x } from "@unovis/ts";
3
- import { VisXYContainer as V, VisTooltip as P, VisGroupedBar as A, VisStackedBar as C, VisAxis as L, VisBulletLegend as G } from "@unovis/vue";
4
- import N from "../Tooltip.js";
5
- import { LegendPosition as w } from "../../types.js";
6
- const M = /* @__PURE__ */ h({
1
+ import { defineComponent as b, computed as u, createApp as B, createElementBlock as y, openBlock as d, normalizeClass as k, createVNode as l, createCommentVNode as T, unref as i, withCtx as v, createBlock as f } from "vue";
2
+ import { Orientation as s, StackedBar as x, GroupedBar as V } from "@unovis/ts";
3
+ import { VisXYContainer as P, VisTooltip as A, VisGroupedBar as C, VisStackedBar as G, VisAxis as h, VisBulletLegend as N } from "@unovis/vue";
4
+ import w from "../Tooltip.js";
5
+ import { LegendPosition as E } from "../../types.js";
6
+ const z = /* @__PURE__ */ b({
7
7
  __name: "BarChart",
8
8
  props: {
9
9
  data: {},
@@ -14,9 +14,9 @@ const M = /* @__PURE__ */ h({
14
14
  categories: {},
15
15
  xFormatter: {},
16
16
  yFormatter: {},
17
- yNumTicks: { default: (a) => a.data.length > 24 ? 24 / 4 : a.data.length - 1 },
17
+ yNumTicks: { default: (n) => n.data.length > 24 ? 24 / 4 : n.data.length - 1 },
18
18
  minMaxTicksOnly: { type: Boolean },
19
- xNumTicks: { default: (a) => a.data.length > 24 ? 24 / 4 : a.data.length - 1 },
19
+ xNumTicks: { default: (n) => n.data.length > 24 ? 24 / 4 : n.data.length - 1 },
20
20
  xExplicitTicks: {},
21
21
  yAxis: {},
22
22
  groupPadding: {},
@@ -32,52 +32,53 @@ const M = /* @__PURE__ */ h({
32
32
  xGridLine: { type: Boolean },
33
33
  yGridLine: { type: Boolean, default: !0 }
34
34
  },
35
- setup(a) {
36
- const o = a;
37
- if (!o.yAxis || o.yAxis.length === 0)
35
+ setup(n) {
36
+ const a = n;
37
+ if (!a.yAxis || a.yAxis.length === 0)
38
38
  throw new Error("yAxis is required");
39
- const c = u(() => o.yAxis.map((e) => (n) => n[e])), m = (e, n) => Object.values(o.categories)[n].color, p = u(
40
- () => o.legendPosition === w.Top
41
- ), g = u(() => (e) => {
39
+ const c = u(() => a.yAxis.map((e) => (o) => o[e])), m = (e, o) => Object.values(a.categories)[o].color, p = u(
40
+ () => a.legendPosition === E.Top
41
+ ), g = u(() => (e, o) => {
42
42
  if (typeof window > "u" || typeof document > "u")
43
43
  return "";
44
44
  try {
45
- const n = b(N, {
45
+ const r = B(w, {
46
46
  data: e,
47
- categories: o.categories
48
- }), l = document.createElement("div");
49
- n.mount(l);
50
- const t = l.innerHTML;
51
- return n.unmount(), t;
47
+ categories: a.categories,
48
+ xValue: a.xFormatter(Math.floor(o))
49
+ }), t = document.createElement("div");
50
+ r.mount(t);
51
+ const L = t.innerHTML;
52
+ return r.unmount(), L;
52
53
  } catch {
53
54
  return "";
54
55
  }
55
56
  });
56
- return (e, n) => (d(), y("div", {
57
+ return (e, o) => (d(), y("div", {
57
58
  class: k(["flex flex-col space-y-4", { "flex-col-reverse": p.value }])
58
59
  }, [
59
- r(i(V), { height: e.height }, {
60
- default: T(() => [
61
- r(i(P), {
60
+ l(i(P), { height: e.height }, {
61
+ default: v(() => [
62
+ l(i(A), {
62
63
  triggers: {
63
- [i(x).selectors.bar]: g.value,
64
- [i(v).selectors.bar]: g.value
64
+ [i(V).selectors.bar]: g.value,
65
+ [i(x).selectors.bar]: g.value
65
66
  }
66
67
  }, null, 8, ["triggers"]),
67
- e.stacked ? (d(), f(i(C), {
68
+ e.stacked ? (d(), f(i(G), {
68
69
  key: 1,
69
70
  data: e.data,
70
- x: (l, t) => t,
71
+ x: (r, t) => t,
71
72
  y: c.value,
72
73
  color: m,
73
74
  "rounded-corners": e.radius ?? 0,
74
75
  "group-padding": e.groupPadding ?? 0,
75
76
  "bar-padding": e.barPadding ?? 0.2,
76
77
  orientation: e.orientation ?? i(s).Vertical
77
- }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (d(), f(i(A), {
78
+ }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (d(), f(i(C), {
78
79
  key: 0,
79
80
  data: e.data,
80
- x: (l, t) => t,
81
+ x: (r, t) => t,
81
82
  y: c.value,
82
83
  color: m,
83
84
  "rounded-corners": e.radius ?? 0,
@@ -85,7 +86,7 @@ const M = /* @__PURE__ */ h({
85
86
  "bar-padding": e.barPadding ?? 0.2,
86
87
  orientation: e.orientation ?? i(s).Vertical
87
88
  }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
88
- r(i(L), {
89
+ l(i(h), {
89
90
  type: "x",
90
91
  "tick-format": e.xFormatter,
91
92
  label: e.xLabel,
@@ -96,7 +97,7 @@ const M = /* @__PURE__ */ h({
96
97
  "tick-values": e.xExplicitTicks,
97
98
  "min-max-ticks-only": e.minMaxTicksOnly
98
99
  }, null, 8, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"]),
99
- r(i(L), {
100
+ l(i(h), {
100
101
  type: "y",
101
102
  label: e.yLabel,
102
103
  "grid-line": e.orientation !== i(s).Horizontal && e.yGridLine,
@@ -108,11 +109,11 @@ const M = /* @__PURE__ */ h({
108
109
  ]),
109
110
  _: 1
110
111
  }, 8, ["height"]),
111
- e.hideLegend ? B("", !0) : (d(), y("div", {
112
+ e.hideLegend ? T("", !0) : (d(), y("div", {
112
113
  key: 0,
113
114
  class: k(["flex items center justify-end", { "pb-4": p.value }])
114
115
  }, [
115
- r(i(G), {
116
+ l(i(N), {
116
117
  items: Object.values(e.categories)
117
118
  }, null, 8, ["items"])
118
119
  ], 2))
@@ -120,5 +121,5 @@ const M = /* @__PURE__ */ h({
120
121
  }
121
122
  });
122
123
  export {
123
- M as default
124
+ z as default
124
125
  };
@@ -1,8 +1,8 @@
1
- import { defineComponent as v, computed as u, createApp as b, createElementBlock as m, openBlock as n, normalizeClass as p, createVNode as o, createCommentVNode as y, unref as i, withCtx as B, createBlock as k, Fragment as x, renderList as C } from "vue";
2
- import { Position as g, CurveType as V } from "@unovis/ts";
3
- import { VisXYContainer as N, VisTooltip as F, VisLine as O, VisAxis as f, VisCrosshair as P, VisBulletLegend as j } from "@unovis/vue";
4
- import D from "../Tooltip.js";
5
- import { LegendPosition as E } from "../../types.js";
1
+ import { defineComponent as v, computed as d, createApp as b, createElementBlock as m, openBlock as l, normalizeClass as p, createVNode as r, createCommentVNode as y, unref as i, withCtx as x, createBlock as k, Fragment as B, renderList as V } from "vue";
2
+ import { Position as g, CurveType as C } from "@unovis/ts";
3
+ import { VisXYContainer as F, VisTooltip as N, VisLine as M, VisAxis as f, VisCrosshair as O, VisBulletLegend as P } from "@unovis/vue";
4
+ import j from "../Tooltip.js";
5
+ import { LegendPosition as D } from "../../types.js";
6
6
  const X = /* @__PURE__ */ v({
7
7
  __name: "LineChart",
8
8
  props: {
@@ -29,43 +29,44 @@ const X = /* @__PURE__ */ v({
29
29
  yTickLine: { type: Boolean }
30
30
  },
31
31
  setup(t) {
32
- const l = t, h = (e) => Object.values(l.categories)[e].color, L = u(() => (e) => {
32
+ const n = t, h = (e) => Object.values(n.categories)[e].color, L = d(() => (e, u) => {
33
33
  if (typeof window > "u" || typeof document > "u")
34
34
  return "";
35
35
  try {
36
- const a = b(D, {
36
+ const o = b(j, {
37
37
  data: e,
38
- categories: l.categories
39
- }), r = document.createElement("div");
40
- a.mount(r);
41
- const c = r.innerHTML;
42
- return a.unmount(), c;
38
+ categories: n.categories,
39
+ xValue: n.xFormatter(Math.floor(u))
40
+ }), a = document.createElement("div");
41
+ o.mount(a);
42
+ const c = a.innerHTML;
43
+ return o.unmount(), c;
43
44
  } catch {
44
45
  return "";
45
46
  }
46
- }), s = u(
47
- () => l.legendPosition === E.Top
47
+ }), s = d(
48
+ () => n.legendPosition === D.Top
48
49
  );
49
- return (e, a) => (n(), m("div", {
50
+ return (e, u) => (l(), m("div", {
50
51
  class: p(["flex flex-col space-y-4", { "flex-col-reverse": s.value }])
51
52
  }, [
52
- o(i(N), {
53
+ r(i(F), {
53
54
  data: e.data,
54
55
  height: e.height
55
56
  }, {
56
- default: B(() => [
57
- o(i(F), {
57
+ default: x(() => [
58
+ r(i(N), {
58
59
  "horizontal-placement": i(g).Right,
59
60
  "vertical-placement": i(g).Top
60
61
  }, null, 8, ["horizontal-placement", "vertical-placement"]),
61
- (n(!0), m(x, null, C(Object.keys(l.categories), (r, c) => (n(), k(i(O), {
62
- key: c,
63
- x: (d, T) => T,
64
- y: (d) => d[r],
65
- color: h(c),
66
- "curve-type": e.curveType ?? i(V).MonotoneX
62
+ (l(!0), m(B, null, V(Object.keys(n.categories), (o, a) => (l(), k(i(M), {
63
+ key: a,
64
+ x: (c, T) => T,
65
+ y: (c) => c[o],
66
+ color: h(a),
67
+ "curve-type": e.curveType ?? i(C).MonotoneX
67
68
  }, null, 8, ["x", "y", "color", "curve-type"]))), 128)),
68
- o(i(f), {
69
+ r(i(f), {
69
70
  type: "x",
70
71
  "tick-format": e.xFormatter,
71
72
  label: e.xLabel,
@@ -77,7 +78,7 @@ const X = /* @__PURE__ */ v({
77
78
  "tick-values": e.xExplicitTicks,
78
79
  "min-max-ticks-only": e.minMaxTicksOnly
79
80
  }, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"]),
80
- o(i(f), {
81
+ r(i(f), {
81
82
  type: "y",
82
83
  "tick-format": e.yFormatter,
83
84
  label: e.yLabel,
@@ -86,7 +87,7 @@ const X = /* @__PURE__ */ v({
86
87
  "grid-line": e.yGridLine,
87
88
  "tick-line": e.yTickLine
88
89
  }, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"]),
89
- e.hideTooltip ? y("", !0) : (n(), k(i(P), {
90
+ e.hideTooltip ? y("", !0) : (l(), k(i(O), {
90
91
  key: 0,
91
92
  color: "#666",
92
93
  template: L.value
@@ -94,11 +95,11 @@ const X = /* @__PURE__ */ v({
94
95
  ]),
95
96
  _: 1
96
97
  }, 8, ["data", "height"]),
97
- e.hideLegend ? y("", !0) : (n(), m("div", {
98
+ e.hideLegend ? y("", !0) : (l(), m("div", {
98
99
  key: 0,
99
100
  class: p(["flex items center justify-end", { "pb-4": s.value }])
100
101
  }, [
101
- o(i(j), {
102
+ r(i(P), {
102
103
  items: Object.values(e.categories)
103
104
  }, null, 8, ["items"])
104
105
  ], 2))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-chrts",
3
- "version": "0.1.1-test.3",
3
+ "version": "0.1.1-test.4",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"