vue-chrts 0.1.1-test.3 → 0.1.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.
- package/dist/components/AreaStackedChart/AreaStackedChart.js +24 -24
- package/dist/components/BarChart/BarChart.js +49 -47
- package/dist/components/BarChart/BarChart.vue.d.ts +1 -1
- package/dist/components/LineChart/LineChart.js +30 -29
- package/dist/components/Tooltip.vue.d.ts +1 -1
- package/package.json +2 -2
|
@@ -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
|
|
3
|
-
import { VisXYContainer as
|
|
4
|
-
import
|
|
5
|
-
import { LegendPosition as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as v, computed as c, createApp as V, createElementBlock as f, openBlock as s, normalizeClass as b, createVNode as l, createCommentVNode as P, unref as i, withCtx as x, createBlock as L } from "vue";
|
|
2
|
+
import { Orientation as o, StackedBar as A, GroupedBar as O } from "@unovis/ts";
|
|
3
|
+
import { VisXYContainer as C, VisTooltip as G, VisGroupedBar as N, VisStackedBar as j, VisAxis as h, VisBulletLegend as w } from "@unovis/vue";
|
|
4
|
+
import E from "../Tooltip.js";
|
|
5
|
+
import { LegendPosition as z } from "../../types.js";
|
|
6
|
+
const S = /* @__PURE__ */ v({
|
|
7
7
|
__name: "BarChart",
|
|
8
8
|
props: {
|
|
9
9
|
data: {},
|
|
@@ -14,16 +14,16 @@ 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: {},
|
|
23
23
|
barPadding: {},
|
|
24
24
|
radius: {},
|
|
25
25
|
hideLegend: { type: Boolean },
|
|
26
|
-
orientation: { default:
|
|
26
|
+
orientation: { default: o.Vertical },
|
|
27
27
|
legendPosition: {},
|
|
28
28
|
xDomainLine: { type: Boolean },
|
|
29
29
|
yDomainLine: { type: Boolean },
|
|
@@ -32,60 +32,62 @@ 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
|
|
40
|
-
() =>
|
|
41
|
-
),
|
|
39
|
+
const m = c(() => a.yAxis.map((e) => (t) => t[e])), p = (e, t) => Object.values(a.categories)[t].color, g = c(
|
|
40
|
+
() => a.legendPosition === z.Top
|
|
41
|
+
), y = c(() => (e, t) => {
|
|
42
42
|
if (typeof window > "u" || typeof document > "u")
|
|
43
43
|
return "";
|
|
44
|
+
const u = Object.keys(a.categories), B = Object.keys(e).find((r) => !u.includes(r));
|
|
44
45
|
try {
|
|
45
|
-
const
|
|
46
|
+
const r = V(E, {
|
|
46
47
|
data: e,
|
|
47
|
-
categories:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
categories: a.categories,
|
|
49
|
+
xValue: e[B]
|
|
50
|
+
}), k = document.createElement("div");
|
|
51
|
+
r.mount(k);
|
|
52
|
+
const T = k.innerHTML;
|
|
53
|
+
return r.unmount(), T;
|
|
52
54
|
} catch {
|
|
53
55
|
return "";
|
|
54
56
|
}
|
|
55
57
|
});
|
|
56
|
-
return (e,
|
|
57
|
-
class:
|
|
58
|
+
return (e, t) => (s(), f("div", {
|
|
59
|
+
class: b(["flex flex-col space-y-4", { "flex-col-reverse": g.value }])
|
|
58
60
|
}, [
|
|
59
|
-
|
|
60
|
-
default:
|
|
61
|
-
|
|
61
|
+
l(i(C), { height: e.height }, {
|
|
62
|
+
default: x(() => [
|
|
63
|
+
l(i(G), {
|
|
62
64
|
triggers: {
|
|
63
|
-
[i(
|
|
64
|
-
[i(
|
|
65
|
+
[i(O).selectors.bar]: y.value,
|
|
66
|
+
[i(A).selectors.bar]: y.value
|
|
65
67
|
}
|
|
66
68
|
}, null, 8, ["triggers"]),
|
|
67
|
-
e.stacked ? (
|
|
69
|
+
e.stacked ? (s(), L(i(j), {
|
|
68
70
|
key: 1,
|
|
69
|
-
data: e.data,
|
|
70
|
-
x: (
|
|
71
|
-
y:
|
|
72
|
-
color:
|
|
71
|
+
data: e.orientation === i(o).Horizontal ? [...e.data].reverse() : e.data,
|
|
72
|
+
x: (u, d) => d,
|
|
73
|
+
y: m.value,
|
|
74
|
+
color: p,
|
|
73
75
|
"rounded-corners": e.radius ?? 0,
|
|
74
76
|
"group-padding": e.groupPadding ?? 0,
|
|
75
77
|
"bar-padding": e.barPadding ?? 0.2,
|
|
76
|
-
orientation: e.orientation ?? i(
|
|
77
|
-
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (
|
|
78
|
+
orientation: e.orientation ?? i(o).Vertical
|
|
79
|
+
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (s(), L(i(N), {
|
|
78
80
|
key: 0,
|
|
79
|
-
data: e.data,
|
|
80
|
-
x: (
|
|
81
|
-
y:
|
|
82
|
-
color:
|
|
81
|
+
data: e.orientation === i(o).Horizontal ? [...e.data].reverse() : e.data,
|
|
82
|
+
x: (u, d) => d,
|
|
83
|
+
y: m.value,
|
|
84
|
+
color: p,
|
|
83
85
|
"rounded-corners": e.radius ?? 0,
|
|
84
86
|
"group-padding": e.groupPadding ?? 0,
|
|
85
87
|
"bar-padding": e.barPadding ?? 0.2,
|
|
86
|
-
orientation: e.orientation ?? i(
|
|
88
|
+
orientation: e.orientation ?? i(o).Vertical
|
|
87
89
|
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
|
|
88
|
-
|
|
90
|
+
l(i(h), {
|
|
89
91
|
type: "x",
|
|
90
92
|
"tick-format": e.xFormatter,
|
|
91
93
|
label: e.xLabel,
|
|
@@ -96,10 +98,10 @@ const M = /* @__PURE__ */ h({
|
|
|
96
98
|
"tick-values": e.xExplicitTicks,
|
|
97
99
|
"min-max-ticks-only": e.minMaxTicksOnly
|
|
98
100
|
}, null, 8, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"]),
|
|
99
|
-
|
|
101
|
+
l(i(h), {
|
|
100
102
|
type: "y",
|
|
101
103
|
label: e.yLabel,
|
|
102
|
-
"grid-line": e.orientation !== i(
|
|
104
|
+
"grid-line": e.orientation !== i(o).Horizontal && e.yGridLine,
|
|
103
105
|
"domain-line": !!e.yDomainLine,
|
|
104
106
|
"tick-format": () => "",
|
|
105
107
|
"num-ticks": e.yNumTicks,
|
|
@@ -108,11 +110,11 @@ const M = /* @__PURE__ */ h({
|
|
|
108
110
|
]),
|
|
109
111
|
_: 1
|
|
110
112
|
}, 8, ["height"]),
|
|
111
|
-
e.hideLegend ?
|
|
113
|
+
e.hideLegend ? P("", !0) : (s(), f("div", {
|
|
112
114
|
key: 0,
|
|
113
|
-
class:
|
|
115
|
+
class: b(["flex items center justify-end", { "pb-4": g.value }])
|
|
114
116
|
}, [
|
|
115
|
-
|
|
117
|
+
l(i(w), {
|
|
116
118
|
items: Object.values(e.categories)
|
|
117
119
|
}, null, 8, ["items"])
|
|
118
120
|
], 2))
|
|
@@ -120,5 +122,5 @@ const M = /* @__PURE__ */ h({
|
|
|
120
122
|
}
|
|
121
123
|
});
|
|
122
124
|
export {
|
|
123
|
-
|
|
125
|
+
S as default
|
|
124
126
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BarChartProps } from './types';
|
|
2
|
-
declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
2
|
+
declare const _default: <T extends {}>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & BarChartProps<T> & Partial<{}>> & import('vue').PublicProps;
|
|
4
4
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
5
5
|
attrs: any;
|
|
@@ -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))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BulletLegendItemInterface } from '
|
|
1
|
+
import { BulletLegendItemInterface } from '../types';
|
|
2
2
|
declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
|
|
4
4
|
data: T;
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-chrts",
|
|
3
|
-
"version": "0.1.1
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
8
8
|
"main": "./dist/index.umd.cjs",
|
|
9
9
|
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"import": "./dist/index.js",
|
|
@@ -24,7 +25,6 @@
|
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@tailwindcss/vite": "^4.0.15",
|
|
26
27
|
"@tanstack/vue-table": "^8.21.2",
|
|
27
|
-
"@types/culori": "^2.1.1",
|
|
28
28
|
"@types/node": "^22.13.11",
|
|
29
29
|
"@unovis/ts": "^1.5.1",
|
|
30
30
|
"@unovis/vue": "^1.5.1",
|