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
|
|
2
|
-
import { VisXYContainer as
|
|
3
|
-
import { CurveType as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
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
|
|
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
|
|
18
|
+
const o = y(N, {
|
|
19
19
|
data: e,
|
|
20
|
-
categories:
|
|
21
|
-
}),
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
return
|
|
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,
|
|
30
|
-
|
|
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:
|
|
35
|
-
|
|
34
|
+
default: _(() => [
|
|
35
|
+
r(t(T), {
|
|
36
36
|
x: m,
|
|
37
37
|
y: u,
|
|
38
|
-
color: Object.values(
|
|
39
|
-
"curve-type": t(
|
|
38
|
+
color: Object.values(n.categories).map((o) => o.color),
|
|
39
|
+
"curve-type": t(B).Linear
|
|
40
40
|
}, null, 8, ["color", "curve-type"]),
|
|
41
|
-
|
|
41
|
+
r(t(c), {
|
|
42
42
|
type: "x",
|
|
43
43
|
label: "Time",
|
|
44
44
|
"num-ticks": 12
|
|
45
45
|
}),
|
|
46
|
-
|
|
46
|
+
r(t(c), {
|
|
47
47
|
type: "y",
|
|
48
48
|
label: "Number of visitors",
|
|
49
49
|
"num-ticks": 3
|
|
50
50
|
}),
|
|
51
|
-
e.hideTooltip ?
|
|
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
|
-
|
|
60
|
-
|
|
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
|
-
|
|
68
|
+
H as default
|
|
69
69
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Orientation as s, StackedBar as
|
|
3
|
-
import { VisXYContainer as
|
|
4
|
-
import
|
|
5
|
-
import { LegendPosition as
|
|
6
|
-
const
|
|
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: (
|
|
17
|
+
yNumTicks: { default: (n) => n.data.length > 24 ? 24 / 4 : n.data.length - 1 },
|
|
18
18
|
minMaxTicksOnly: { type: Boolean },
|
|
19
|
-
xNumTicks: { default: (
|
|
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(
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
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(() =>
|
|
40
|
-
() =>
|
|
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
|
|
45
|
+
const r = B(w, {
|
|
46
46
|
data: e,
|
|
47
|
-
categories:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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,
|
|
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
|
-
|
|
60
|
-
default:
|
|
61
|
-
|
|
60
|
+
l(i(P), { height: e.height }, {
|
|
61
|
+
default: v(() => [
|
|
62
|
+
l(i(A), {
|
|
62
63
|
triggers: {
|
|
63
|
-
[i(
|
|
64
|
-
[i(
|
|
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(
|
|
68
|
+
e.stacked ? (d(), f(i(G), {
|
|
68
69
|
key: 1,
|
|
69
70
|
data: e.data,
|
|
70
|
-
x: (
|
|
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(
|
|
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: (
|
|
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
|
-
|
|
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
|
-
|
|
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 ?
|
|
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
|
-
|
|
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
|
-
|
|
124
|
+
z as default
|
|
124
125
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as v, computed as
|
|
2
|
-
import { Position as g, CurveType as
|
|
3
|
-
import { VisXYContainer as
|
|
4
|
-
import
|
|
5
|
-
import { LegendPosition as
|
|
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
|
|
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
|
|
36
|
+
const o = b(j, {
|
|
37
37
|
data: e,
|
|
38
|
-
categories:
|
|
39
|
-
|
|
40
|
-
a.
|
|
41
|
-
|
|
42
|
-
|
|
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 =
|
|
47
|
-
() =>
|
|
47
|
+
}), s = d(
|
|
48
|
+
() => n.legendPosition === D.Top
|
|
48
49
|
);
|
|
49
|
-
return (e,
|
|
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
|
-
|
|
53
|
+
r(i(F), {
|
|
53
54
|
data: e.data,
|
|
54
55
|
height: e.height
|
|
55
56
|
}, {
|
|
56
|
-
default:
|
|
57
|
-
|
|
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
|
-
(
|
|
62
|
-
key:
|
|
63
|
-
x: (
|
|
64
|
-
y: (
|
|
65
|
-
color: h(
|
|
66
|
-
"curve-type": e.curveType ?? i(
|
|
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
|
-
|
|
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
|
-
|
|
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) : (
|
|
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) : (
|
|
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
|
-
|
|
102
|
+
r(i(P), {
|
|
102
103
|
items: Object.values(e.categories)
|
|
103
104
|
}, null, 8, ["items"])
|
|
104
105
|
], 2))
|