vue-chrts 0.2.5-test.1 → 0.2.5-test.2
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/AreaChart/AreaChart.js +98 -73
- package/dist/components/AreaChart/types.d.ts +11 -0
- package/dist/components/DonutChart/DonutChart.js +82 -76
- package/dist/components/DonutChart/types.d.ts +10 -0
- package/dist/components/LineChart/LineChart.js +27 -132
- package/dist/components/LineChart/LineChart.vue.d.ts +3 -10
- package/dist/components/LineChart/types.d.ts +2 -144
- package/dist/index.d.ts +1 -2
- package/dist/index.js +14 -16
- package/package.json +1 -1
- package/dist/components/AreaStackedChart/AreaStackedChart.js +0 -77
- package/dist/components/AreaStackedChart/AreaStackedChart.vue.d.ts +0 -14
- package/dist/components/AreaStackedChart/AreaStackedChart2.js +0 -4
- package/dist/components/AreaStackedChart/types.d.ts +0 -86
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Position as
|
|
3
|
-
import { createMarkers as
|
|
4
|
-
import
|
|
5
|
-
import { VisXYContainer as q, VisTooltip as J, VisArea as
|
|
6
|
-
import { LegendPosition as
|
|
7
|
-
const
|
|
1
|
+
import { defineComponent as N, useSlots as W, useTemplateRef as E, ref as M, computed as m, createElementBlock as f, openBlock as c, normalizeClass as w, normalizeStyle as v, createVNode as y, createCommentVNode as u, createElementVNode as X, unref as n, withCtx as z, createBlock as g, Fragment as h, renderList as R, mergeProps as x, renderSlot as T } from "vue";
|
|
2
|
+
import { Position as L, CurveType as C } from "@unovis/ts";
|
|
3
|
+
import { createMarkers as Y, getFirstPropertyValue as U } from "../../utils.js";
|
|
4
|
+
import H from "../Tooltip.js";
|
|
5
|
+
import { VisXYContainer as q, VisTooltip as J, VisArea as K, VisLine as Q, VisAxis as A, VisCrosshair as Z, VisBulletLegend as I } from "@unovis/vue";
|
|
6
|
+
import { LegendPosition as _ } from "../../types.js";
|
|
7
|
+
const ee = {
|
|
8
8
|
ref: "slotWrapper",
|
|
9
9
|
style: { display: "none" }
|
|
10
|
-
},
|
|
10
|
+
}, te = 0.5, $ = "#3b82f6", se = /* @__PURE__ */ N({
|
|
11
11
|
__name: "AreaChart",
|
|
12
12
|
props: {
|
|
13
13
|
data: {},
|
|
@@ -20,15 +20,20 @@ const ie = {
|
|
|
20
20
|
xFormatter: {},
|
|
21
21
|
yFormatter: {},
|
|
22
22
|
curveType: {},
|
|
23
|
+
hideArea: { type: Boolean, default: !1 },
|
|
24
|
+
gradientStops: { default: () => [
|
|
25
|
+
{ offset: "0%", stopOpacity: 1 },
|
|
26
|
+
{ offset: "75%", stopOpacity: 0 }
|
|
27
|
+
] },
|
|
23
28
|
lineWidth: { default: 2 },
|
|
24
29
|
lineDashArray: {},
|
|
25
|
-
xNumTicks: {
|
|
30
|
+
xNumTicks: {},
|
|
26
31
|
xExplicitTicks: {},
|
|
27
32
|
minMaxTicksOnly: { type: Boolean },
|
|
28
|
-
yNumTicks: {
|
|
33
|
+
yNumTicks: {},
|
|
29
34
|
hideLegend: { type: Boolean, default: !1 },
|
|
30
35
|
hideTooltip: { type: Boolean },
|
|
31
|
-
legendPosition: { default:
|
|
36
|
+
legendPosition: { default: _.BottomCenter },
|
|
32
37
|
legendStyle: { default: void 0 },
|
|
33
38
|
xDomainLine: { type: Boolean },
|
|
34
39
|
yDomainLine: { type: Boolean },
|
|
@@ -45,79 +50,96 @@ const ie = {
|
|
|
45
50
|
xDomain: {}
|
|
46
51
|
},
|
|
47
52
|
emits: ["click"],
|
|
48
|
-
setup(e, { emit:
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
setup(e, { emit: D }) {
|
|
54
|
+
const b = D, i = e, B = W(), p = E("slotWrapper"), d = M(), k = m(() => {
|
|
55
|
+
const o = Object.values(i.categories).map(
|
|
56
|
+
(l, t) => `var(--vis-color${t})`
|
|
57
|
+
);
|
|
58
|
+
return Object.values(i.categories).map(
|
|
59
|
+
(l, t) => l.color ?? o[t]
|
|
60
|
+
);
|
|
61
|
+
}), O = m(() => i.markerConfig ? Y(i.markerConfig) : ""), V = m(() => i.legendPosition.startsWith("top")), F = m(() => i.legendPosition.includes("left") ? "flex-start" : i.legendPosition.includes("right") ? "flex-end" : "center"), G = m(() => {
|
|
62
|
+
const o = (t, a) => {
|
|
63
|
+
var r;
|
|
64
|
+
return `
|
|
53
65
|
<linearGradient id="gradient${t}-${a}" gradientTransform="rotate(90)">
|
|
54
|
-
|
|
66
|
+
${((r = i.gradientStops) == null ? void 0 : r.map(
|
|
67
|
+
(s) => `<stop offset="${s.offset}" stop-color="${a}" stop-opacity="${s.stopOpacity}" />`
|
|
68
|
+
).join("")) ?? ""}
|
|
55
69
|
<stop offset="100%" stop-color="${a}" stop-opacity="0" />
|
|
56
70
|
</linearGradient>
|
|
57
|
-
|
|
71
|
+
`;
|
|
72
|
+
}, l = (t, a) => {
|
|
73
|
+
var r;
|
|
74
|
+
return `
|
|
58
75
|
<linearGradient id="gradient${t}-${a}" gradientTransform="rotate(90)">
|
|
59
|
-
|
|
60
|
-
|
|
76
|
+
|
|
77
|
+
${((r = i.gradientStops) == null ? void 0 : r.map(
|
|
78
|
+
(s) => `
|
|
79
|
+
<stop offset="${s.offset}" style="stop-color:var(${a});stop-opacity:${s.stopOpacity}" />
|
|
80
|
+
`
|
|
81
|
+
).join("")) ?? ""}
|
|
61
82
|
</linearGradient>
|
|
62
83
|
`;
|
|
63
|
-
|
|
64
|
-
|
|
84
|
+
};
|
|
85
|
+
return k.value.map(
|
|
86
|
+
(t, a) => t != null && t.includes("#") ? o(a, t) : l(a, t ?? $)
|
|
65
87
|
).join("");
|
|
66
88
|
});
|
|
67
|
-
function
|
|
68
|
-
var
|
|
89
|
+
function P(o) {
|
|
90
|
+
var l;
|
|
69
91
|
return {
|
|
70
|
-
y: (t) => Number(t[
|
|
71
|
-
color: ((
|
|
92
|
+
y: (t) => Number(t[o]),
|
|
93
|
+
color: ((l = i.categories[o]) == null ? void 0 : l.color) ?? $
|
|
72
94
|
};
|
|
73
95
|
}
|
|
74
|
-
function
|
|
75
|
-
return typeof window > "u" ? "" :
|
|
96
|
+
function S(o) {
|
|
97
|
+
return typeof window > "u" ? "" : p.value ? p.value.innerHTML : "";
|
|
76
98
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
99
|
+
function j(o) {
|
|
100
|
+
return d.value = o, S();
|
|
79
101
|
}
|
|
80
|
-
return (
|
|
81
|
-
style:
|
|
102
|
+
return (o, l) => (c(), f("div", {
|
|
103
|
+
style: v({
|
|
82
104
|
display: "flex",
|
|
83
|
-
flexDirection:
|
|
105
|
+
flexDirection: V.value ? "column-reverse" : "column",
|
|
84
106
|
gap: "var(--vis-legend-spacing)"
|
|
85
107
|
}),
|
|
86
|
-
class:
|
|
87
|
-
onClick:
|
|
108
|
+
class: w({ markers: !!i.markerConfig }),
|
|
109
|
+
onClick: l[0] || (l[0] = (t) => b("click", t, d.value))
|
|
88
110
|
}, [
|
|
89
|
-
|
|
111
|
+
y(n(q), {
|
|
90
112
|
data: e.data,
|
|
91
113
|
height: e.height,
|
|
92
114
|
padding: e.padding,
|
|
93
|
-
"svg-defs":
|
|
115
|
+
"svg-defs": G.value + O.value,
|
|
94
116
|
"y-domain": e.yDomain,
|
|
95
117
|
"x-domain": e.xDomain
|
|
96
118
|
}, {
|
|
97
119
|
default: z(() => [
|
|
98
|
-
e.hideTooltip ?
|
|
120
|
+
e.hideTooltip ? u("", !0) : (c(), g(n(J), {
|
|
99
121
|
key: 0,
|
|
100
|
-
"horizontal-placement":
|
|
101
|
-
"vertical-placement":
|
|
122
|
+
"horizontal-placement": n(L).Right,
|
|
123
|
+
"vertical-placement": n(L).Top
|
|
102
124
|
}, null, 8, ["horizontal-placement", "vertical-placement"])),
|
|
103
|
-
(
|
|
104
|
-
|
|
105
|
-
x: (
|
|
106
|
-
}, { ref_for: !0 },
|
|
107
|
-
color: `url(#gradient${a}-${
|
|
108
|
-
opacity:
|
|
109
|
-
"curve-type": e.curveType ??
|
|
110
|
-
}), null, 16, ["x", "color", "curve-type"]),
|
|
111
|
-
|
|
112
|
-
x: (
|
|
113
|
-
y: (
|
|
114
|
-
color:
|
|
115
|
-
"curve-type": e.curveType ??
|
|
125
|
+
(c(!0), f(h, null, R(Object.keys(i.categories), (t, a) => (c(), f(h, { key: t }, [
|
|
126
|
+
y(n(K), x({
|
|
127
|
+
x: (r, s) => s
|
|
128
|
+
}, { ref_for: !0 }, P(t), {
|
|
129
|
+
color: `url(#gradient${a}-${k.value[a]})`,
|
|
130
|
+
opacity: e.hideArea ? 0 : te,
|
|
131
|
+
"curve-type": e.curveType ?? n(C).MonotoneX
|
|
132
|
+
}), null, 16, ["x", "color", "opacity", "curve-type"]),
|
|
133
|
+
y(n(Q), {
|
|
134
|
+
x: (r, s) => s,
|
|
135
|
+
y: (r) => r[t],
|
|
136
|
+
color: k.value[a],
|
|
137
|
+
"curve-type": e.curveType ?? n(C).MonotoneX,
|
|
116
138
|
"line-width": e.lineWidth,
|
|
117
139
|
lineDashArray: e.lineDashArray ? e.lineDashArray[a] : void 0
|
|
118
140
|
}, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"])
|
|
119
141
|
], 64))), 128)),
|
|
120
|
-
e.hideXAxis ?
|
|
142
|
+
e.hideXAxis ? u("", !0) : (c(), g(n(A), {
|
|
121
143
|
key: 1,
|
|
122
144
|
type: "x",
|
|
123
145
|
label: e.xLabel,
|
|
@@ -130,7 +152,7 @@ const ie = {
|
|
|
130
152
|
"tick-line": e.xTickLine,
|
|
131
153
|
"min-max-ticks-only": e.minMaxTicksOnly
|
|
132
154
|
}, null, 8, ["label", "num-ticks", "tick-format", "tick-values", "grid-line", "domain-line", "tick-line", "min-max-ticks-only"])),
|
|
133
|
-
e.hideYAxis ?
|
|
155
|
+
e.hideYAxis ? u("", !0) : (c(), g(n(A), {
|
|
134
156
|
key: 2,
|
|
135
157
|
type: "y",
|
|
136
158
|
label: e.yLabel,
|
|
@@ -140,41 +162,44 @@ const ie = {
|
|
|
140
162
|
"domain-line": e.yDomainLine,
|
|
141
163
|
"tick-line": e.yTickLine
|
|
142
164
|
}, null, 8, ["label", "num-ticks", "tick-format", "grid-line", "domain-line", "tick-line"])),
|
|
143
|
-
e.hideTooltip ?
|
|
165
|
+
e.hideTooltip ? u("", !0) : (c(), g(n(Z), x({ key: 3 }, e.crosshairConfig, { template: j }), null, 16))
|
|
144
166
|
]),
|
|
145
167
|
_: 1
|
|
146
168
|
}, 8, ["data", "height", "padding", "svg-defs", "y-domain", "x-domain"]),
|
|
147
|
-
|
|
169
|
+
i.hideLegend ? u("", !0) : (c(), f("div", {
|
|
148
170
|
key: 0,
|
|
149
|
-
style:
|
|
171
|
+
style: v({
|
|
150
172
|
display: "flex",
|
|
151
|
-
justifyContent:
|
|
173
|
+
justifyContent: F.value
|
|
152
174
|
})
|
|
153
175
|
}, [
|
|
154
|
-
|
|
155
|
-
style:
|
|
156
|
-
|
|
176
|
+
y(n(I), {
|
|
177
|
+
style: v([
|
|
178
|
+
i.legendStyle,
|
|
157
179
|
"display: flex; gap: var(--vis-legend-spacing);"
|
|
158
180
|
]),
|
|
159
|
-
items: Object.values(
|
|
181
|
+
items: Object.values(i.categories).map((t) => ({
|
|
182
|
+
...t,
|
|
183
|
+
color: Array.isArray(t.color) ? t.color[0] : t.color
|
|
184
|
+
}))
|
|
160
185
|
}, null, 8, ["style", "items"])
|
|
161
186
|
], 4)),
|
|
162
|
-
X("div",
|
|
163
|
-
|
|
187
|
+
X("div", ee, [
|
|
188
|
+
n(B).tooltip ? T(o.$slots, "tooltip", {
|
|
164
189
|
key: 0,
|
|
165
|
-
values:
|
|
166
|
-
}) :
|
|
167
|
-
|
|
168
|
-
data:
|
|
190
|
+
values: d.value
|
|
191
|
+
}) : d.value ? T(o.$slots, "fallback", { key: 1 }, () => [
|
|
192
|
+
y(H, {
|
|
193
|
+
data: d.value,
|
|
169
194
|
categories: e.categories,
|
|
170
|
-
toolTipTitle:
|
|
171
|
-
yFormatter:
|
|
195
|
+
toolTipTitle: n(U)(d.value) ?? "",
|
|
196
|
+
yFormatter: i.yFormatter
|
|
172
197
|
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
173
|
-
]) :
|
|
198
|
+
]) : u("", !0)
|
|
174
199
|
], 512)
|
|
175
200
|
], 6));
|
|
176
201
|
}
|
|
177
202
|
});
|
|
178
203
|
export {
|
|
179
|
-
|
|
204
|
+
se as default
|
|
180
205
|
};
|
|
@@ -57,6 +57,17 @@ export interface AreaChartProps<T> {
|
|
|
57
57
|
* See `CurveType` for available options.
|
|
58
58
|
*/
|
|
59
59
|
curveType?: CurveType;
|
|
60
|
+
/**
|
|
61
|
+
* If `true`, hides the area fill, displaying only the line.
|
|
62
|
+
*/
|
|
63
|
+
hideArea?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Edit the gradient stops for the area fill.
|
|
66
|
+
*/
|
|
67
|
+
gradientStops?: Array<{
|
|
68
|
+
offset: string;
|
|
69
|
+
stopOpacity: number;
|
|
70
|
+
}>;
|
|
60
71
|
/**
|
|
61
72
|
* The width of the line in pixels. Default is 2px.
|
|
62
73
|
*/
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Donut as
|
|
3
|
-
import { DonutType as
|
|
4
|
-
import { VisSingleContainer as
|
|
5
|
-
|
|
1
|
+
import { defineComponent as w, useSlots as D, useTemplateRef as L, ref as T, computed as g, createElementBlock as p, openBlock as f, normalizeStyle as o, createVNode as r, createCommentVNode as m, renderSlot as d, createElementVNode as a, unref as i, withCtx as B, toDisplayString as P } from "vue";
|
|
2
|
+
import { Donut as W } from "@unovis/ts";
|
|
3
|
+
import { DonutType as R } from "./types.js";
|
|
4
|
+
import { VisSingleContainer as A, VisTooltip as H, VisDonut as N, VisBulletLegend as $ } from "@unovis/vue";
|
|
5
|
+
import { LegendPosition as z } from "../../types.js";
|
|
6
|
+
const E = {
|
|
6
7
|
ref: "slotWrapper",
|
|
7
8
|
style: { display: "none" }
|
|
8
|
-
},
|
|
9
|
-
key: 0,
|
|
10
|
-
style: {
|
|
11
|
-
display: "flex",
|
|
12
|
-
alignItems: "center",
|
|
13
|
-
justifyContent: "center",
|
|
14
|
-
marginTop: "1rem"
|
|
15
|
-
}
|
|
16
|
-
}, U = /* @__PURE__ */ V({
|
|
9
|
+
}, j = { style: { display: "flex", "align-items": "center", padding: "10px 15px" } }, I = /* @__PURE__ */ w({
|
|
17
10
|
__name: "DonutChart",
|
|
18
11
|
props: {
|
|
19
12
|
type: {},
|
|
@@ -22,78 +15,91 @@ const j = {
|
|
|
22
15
|
height: {},
|
|
23
16
|
radius: {},
|
|
24
17
|
hideLegend: { type: Boolean },
|
|
18
|
+
legendPosition: { default: z.BottomCenter },
|
|
19
|
+
legendStyle: {},
|
|
25
20
|
labels: {},
|
|
26
21
|
padAngle: {}
|
|
27
22
|
},
|
|
28
23
|
emits: ["click"],
|
|
29
|
-
setup(
|
|
30
|
-
const
|
|
31
|
-
function
|
|
32
|
-
return
|
|
24
|
+
setup(l, { emit: h }) {
|
|
25
|
+
const v = h, e = l, y = D(), u = L("slotWrapper"), n = T(), x = (t) => t, C = e.type === R.Half;
|
|
26
|
+
function k(t) {
|
|
27
|
+
return n.value = t, V();
|
|
33
28
|
}
|
|
34
|
-
function
|
|
35
|
-
return typeof window > "u" ? "" :
|
|
29
|
+
function V(t) {
|
|
30
|
+
return typeof window > "u" ? "" : u.value ? u.value.innerHTML : "";
|
|
36
31
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
const b = g(() => e.legendPosition.includes("top")), S = g(() => e.legendPosition.includes("left") ? "flex-start" : e.legendPosition.includes("right") ? "flex-end" : "center");
|
|
33
|
+
return (t, c) => (f(), p("div", {
|
|
34
|
+
style: o({
|
|
35
|
+
display: "flex",
|
|
36
|
+
flexDirection: b.value ? "column-reverse" : "column",
|
|
37
|
+
gap: "var(--vis-legend-spacing)"
|
|
38
|
+
}),
|
|
39
|
+
onClick: c[0] || (c[0] = (s) => v("click", s, n.value))
|
|
40
|
+
}, [
|
|
41
|
+
r(i(A), {
|
|
42
|
+
data: l.data,
|
|
43
|
+
height: l.height,
|
|
44
|
+
margin: {}
|
|
45
|
+
}, {
|
|
46
|
+
default: B(() => [
|
|
47
|
+
r(i(H), {
|
|
48
|
+
"horizontal-shift": 20,
|
|
49
|
+
"vertical-shift": 20,
|
|
50
|
+
triggers: {
|
|
51
|
+
[i(W).selectors.segment]: k
|
|
52
|
+
}
|
|
53
|
+
}, null, 8, ["triggers"]),
|
|
54
|
+
r(i(N), {
|
|
55
|
+
value: x,
|
|
56
|
+
"corner-radius": l.radius,
|
|
57
|
+
"arc-width": l.arcWidth ?? 20,
|
|
58
|
+
color: e.labels.map((s) => s.color),
|
|
59
|
+
"angle-range": C ? [-1.5707963267948966, 1.5707963267948966] : [],
|
|
60
|
+
"pad-angle": e.padAngle || 0
|
|
61
|
+
}, null, 8, ["corner-radius", "arc-width", "color", "angle-range", "pad-angle"])
|
|
62
|
+
]),
|
|
63
|
+
_: 1
|
|
64
|
+
}, 8, ["data", "height"]),
|
|
65
|
+
e.hideLegend ? m("", !0) : (f(), p("div", {
|
|
66
|
+
key: 0,
|
|
67
|
+
style: o({
|
|
40
68
|
display: "flex",
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
onClick: u[0] || (u[0] = (o) => f("click", o, l.value))
|
|
69
|
+
justifyContent: S.value
|
|
70
|
+
})
|
|
45
71
|
}, [
|
|
46
|
-
r(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}, {
|
|
51
|
-
default: D(() => [
|
|
52
|
-
r(n(H), {
|
|
53
|
-
"horizontal-shift": 20,
|
|
54
|
-
"vertical-shift": 20,
|
|
55
|
-
triggers: {
|
|
56
|
-
[n(B).selectors.segment]: C
|
|
57
|
-
}
|
|
58
|
-
}, null, 8, ["triggers"]),
|
|
59
|
-
r(n(N), {
|
|
60
|
-
value: y,
|
|
61
|
-
"corner-radius": t.radius,
|
|
62
|
-
"arc-width": t.arcWidth ?? 20,
|
|
63
|
-
color: i.labels.map((o) => o.color),
|
|
64
|
-
"angle-range": v ? [-1.5707963267948966, 1.5707963267948966] : [],
|
|
65
|
-
"pad-angle": i.padAngle || 0
|
|
66
|
-
}, null, 8, ["corner-radius", "arc-width", "color", "angle-range", "pad-angle"])
|
|
72
|
+
r(i($), {
|
|
73
|
+
style: o([
|
|
74
|
+
e.legendStyle,
|
|
75
|
+
"display: flex; gap: var(--vis-legend-spacing);"
|
|
67
76
|
]),
|
|
68
|
-
|
|
69
|
-
}, 8, ["
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
])
|
|
89
|
-
],
|
|
90
|
-
])
|
|
91
|
-
|
|
92
|
-
r(n($), { items: t.labels }, null, 8, ["items"])
|
|
93
|
-
]))
|
|
94
|
-
], 64));
|
|
77
|
+
items: l.labels
|
|
78
|
+
}, null, 8, ["style", "items"])
|
|
79
|
+
], 4)),
|
|
80
|
+
d(t.$slots, "default"),
|
|
81
|
+
a("div", E, [
|
|
82
|
+
i(y).tooltip ? d(t.$slots, "tooltip", {
|
|
83
|
+
key: 0,
|
|
84
|
+
values: n.value
|
|
85
|
+
}) : n.value ? d(t.$slots, "fallback", { key: 1 }, () => [
|
|
86
|
+
a("div", j, [
|
|
87
|
+
a("div", {
|
|
88
|
+
style: o({
|
|
89
|
+
width: "0.5rem",
|
|
90
|
+
height: "0.5rem",
|
|
91
|
+
borderRadius: "9999px",
|
|
92
|
+
marginRight: "0.5rem",
|
|
93
|
+
backgroundColor: e.labels[n.value.index].color
|
|
94
|
+
})
|
|
95
|
+
}, null, 4),
|
|
96
|
+
a("div", null, P(n.value.data), 1)
|
|
97
|
+
])
|
|
98
|
+
]) : m("", !0)
|
|
99
|
+
], 512)
|
|
100
|
+
], 4));
|
|
95
101
|
}
|
|
96
102
|
});
|
|
97
103
|
export {
|
|
98
|
-
|
|
104
|
+
I as default
|
|
99
105
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LegendPosition } from '../../types';
|
|
1
2
|
export type DonutChartProps = {
|
|
2
3
|
/**
|
|
3
4
|
* The type of donut chart to render.
|
|
@@ -25,6 +26,15 @@ export type DonutChartProps = {
|
|
|
25
26
|
* If `true`, hides the chart legend.
|
|
26
27
|
*/
|
|
27
28
|
hideLegend?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Optional position for the legend, if applicable.
|
|
31
|
+
* See `LegendPosition` for available options.
|
|
32
|
+
*/
|
|
33
|
+
legendPosition?: LegendPosition;
|
|
34
|
+
/**
|
|
35
|
+
* Optional style object for the legend container. Allows custom CSS styling.
|
|
36
|
+
*/
|
|
37
|
+
legendStyle?: string | Record<string, string>;
|
|
28
38
|
/**
|
|
29
39
|
* An array of label objects defining the name and color for each segment.
|
|
30
40
|
*/
|
|
@@ -1,158 +1,53 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { VisXYContainer as H, VisTooltip as U, VisLine as q, VisAxis as x, VisCrosshair as I, VisBulletLegend as J } from "@unovis/vue";
|
|
6
|
-
import { LegendPosition as Q } from "../../types.js";
|
|
7
|
-
const Z = {
|
|
8
|
-
ref: "slotWrapper",
|
|
9
|
-
style: { display: "none" }
|
|
10
|
-
}, le = /* @__PURE__ */ N({
|
|
1
|
+
import { defineComponent as a, createBlock as r, openBlock as p, mergeProps as s, createSlots as l, renderList as y, withCtx as c, renderSlot as m, normalizeProps as d, guardReactiveProps as h } from "vue";
|
|
2
|
+
import B from "../AreaChart/AreaChart.js";
|
|
3
|
+
const g = /* @__PURE__ */ a({
|
|
4
|
+
inheritAttrs: !1,
|
|
11
5
|
__name: "LineChart",
|
|
12
6
|
props: {
|
|
13
7
|
data: {},
|
|
14
8
|
height: {},
|
|
15
9
|
xLabel: {},
|
|
16
10
|
yLabel: {},
|
|
17
|
-
padding: {
|
|
18
|
-
top: 5,
|
|
19
|
-
right: 5,
|
|
20
|
-
bottom: 5,
|
|
21
|
-
left: 5
|
|
22
|
-
}) },
|
|
11
|
+
padding: {},
|
|
23
12
|
categories: {},
|
|
24
13
|
markerConfig: {},
|
|
25
|
-
xFormatter: {},
|
|
26
|
-
yFormatter: {},
|
|
14
|
+
xFormatter: { type: Function },
|
|
15
|
+
yFormatter: { type: Function },
|
|
27
16
|
curveType: {},
|
|
28
|
-
lineWidth: {
|
|
17
|
+
lineWidth: {},
|
|
29
18
|
lineDashArray: {},
|
|
30
|
-
xNumTicks: {
|
|
19
|
+
xNumTicks: {},
|
|
31
20
|
xExplicitTicks: {},
|
|
32
21
|
minMaxTicksOnly: { type: Boolean },
|
|
33
|
-
yNumTicks: {
|
|
22
|
+
yNumTicks: {},
|
|
23
|
+
hideLegend: { type: Boolean },
|
|
34
24
|
hideTooltip: { type: Boolean },
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
legendStyle: { default: void 0 },
|
|
38
|
-
xGridLine: { type: Boolean },
|
|
25
|
+
legendPosition: {},
|
|
26
|
+
legendStyle: {},
|
|
39
27
|
xDomainLine: { type: Boolean },
|
|
40
|
-
yGridLine: { type: Boolean },
|
|
41
28
|
yDomainLine: { type: Boolean },
|
|
42
29
|
xTickLine: { type: Boolean },
|
|
43
30
|
yTickLine: { type: Boolean },
|
|
31
|
+
xGridLine: { type: Boolean },
|
|
32
|
+
yGridLine: { type: Boolean },
|
|
44
33
|
hideXAxis: { type: Boolean },
|
|
45
34
|
hideYAxis: { type: Boolean },
|
|
46
|
-
crosshairConfig: {
|
|
47
|
-
color: "#666"
|
|
48
|
-
}) },
|
|
35
|
+
crosshairConfig: {},
|
|
49
36
|
yDomain: {},
|
|
50
37
|
xDomain: {}
|
|
51
38
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
(n, s) => `var(--vis-color${s})`
|
|
63
|
-
), F = (n) => Object.values(t.categories)[n].color ?? V[n];
|
|
64
|
-
return (n, s) => (a(), y("div", {
|
|
65
|
-
style: g({
|
|
66
|
-
display: "flex",
|
|
67
|
-
flexDirection: b.value ? "column-reverse" : "column",
|
|
68
|
-
gap: "var(--vis-legend-spacing)"
|
|
69
|
-
}),
|
|
70
|
-
class: w({ markers: !!t.markerConfig }),
|
|
71
|
-
onClick: s[0] || (s[0] = (l) => L("click", l, o.value))
|
|
72
|
-
}, [
|
|
73
|
-
c(i(H), {
|
|
74
|
-
data: e.data,
|
|
75
|
-
padding: e.padding,
|
|
76
|
-
height: e.height,
|
|
77
|
-
svgDefs: D.value,
|
|
78
|
-
yDomain: e.yDomain,
|
|
79
|
-
xDomain: e.xDomain
|
|
80
|
-
}, {
|
|
81
|
-
default: S(() => [
|
|
82
|
-
c(i(U), {
|
|
83
|
-
"horizontal-placement": i(v).Right,
|
|
84
|
-
"vertical-placement": i(v).Top
|
|
85
|
-
}, null, 8, ["horizontal-placement", "vertical-placement"]),
|
|
86
|
-
(a(!0), y(z, null, E(Object.keys(t.categories), (l, m) => (a(), d(i(q), {
|
|
87
|
-
key: m,
|
|
88
|
-
x: (k, P) => P,
|
|
89
|
-
y: (k) => k[l],
|
|
90
|
-
color: F(m),
|
|
91
|
-
"curve-type": e.curveType ?? i(X).MonotoneX,
|
|
92
|
-
"line-width": e.lineWidth,
|
|
93
|
-
lineDashArray: e.lineDashArray ? e.lineDashArray[m] : void 0
|
|
94
|
-
}, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"]))), 128)),
|
|
95
|
-
e.hideXAxis ? r("", !0) : (a(), d(i(x), {
|
|
96
|
-
key: 0,
|
|
97
|
-
type: "x",
|
|
98
|
-
"tick-format": e.xFormatter,
|
|
99
|
-
label: e.xLabel,
|
|
100
|
-
"label-margin": 8,
|
|
101
|
-
"domain-line": e.xDomainLine,
|
|
102
|
-
"grid-line": e.xGridLine,
|
|
103
|
-
"tick-line": e.xTickLine,
|
|
104
|
-
"num-ticks": e.xNumTicks,
|
|
105
|
-
"tick-values": e.xExplicitTicks,
|
|
106
|
-
"min-max-ticks-only": e.minMaxTicksOnly
|
|
107
|
-
}, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"])),
|
|
108
|
-
e.hideYAxis ? r("", !0) : (a(), d(i(x), {
|
|
109
|
-
key: 1,
|
|
110
|
-
type: "y",
|
|
111
|
-
"tick-format": e.yFormatter,
|
|
112
|
-
label: e.yLabel,
|
|
113
|
-
"num-ticks": e.yNumTicks,
|
|
114
|
-
"domain-line": e.yDomainLine,
|
|
115
|
-
"grid-line": e.yGridLine,
|
|
116
|
-
"tick-line": e.yTickLine
|
|
117
|
-
}, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"])),
|
|
118
|
-
e.hideTooltip ? r("", !0) : (a(), d(i(I), G({ key: 2 }, e.crosshairConfig, { template: B }), null, 16))
|
|
119
|
-
]),
|
|
120
|
-
_: 1
|
|
121
|
-
}, 8, ["data", "padding", "height", "svgDefs", "yDomain", "xDomain"]),
|
|
122
|
-
t.hideLegend ? r("", !0) : (a(), y("div", {
|
|
123
|
-
key: 0,
|
|
124
|
-
style: g({
|
|
125
|
-
display: "flex",
|
|
126
|
-
justifyContent: A.value
|
|
127
|
-
})
|
|
128
|
-
}, [
|
|
129
|
-
c(i(J), {
|
|
130
|
-
style: g([
|
|
131
|
-
t.legendStyle,
|
|
132
|
-
"display: flex; gap: var(--vis-legend-spacing);"
|
|
133
|
-
]),
|
|
134
|
-
items: Object.values(t.categories).map((l) => ({
|
|
135
|
-
...l,
|
|
136
|
-
color: Array.isArray(l.color) ? l.color[0] : l.color
|
|
137
|
-
}))
|
|
138
|
-
}, null, 8, ["style", "items"])
|
|
139
|
-
], 4)),
|
|
140
|
-
M("div", Z, [
|
|
141
|
-
i(C).tooltip ? h(n.$slots, "tooltip", {
|
|
142
|
-
key: 0,
|
|
143
|
-
values: o.value
|
|
144
|
-
}) : o.value ? h(n.$slots, "fallback", { key: 1 }, () => [
|
|
145
|
-
c(Y, {
|
|
146
|
-
data: o.value,
|
|
147
|
-
categories: e.categories,
|
|
148
|
-
toolTipTitle: i(R)(o.value) ?? "",
|
|
149
|
-
yFormatter: t.yFormatter
|
|
150
|
-
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
151
|
-
]) : r("", !0)
|
|
152
|
-
], 512)
|
|
153
|
-
], 6));
|
|
39
|
+
setup(n) {
|
|
40
|
+
const i = n;
|
|
41
|
+
return (e, u) => (p(), r(B, s({ ...e.$attrs, ...i }, { "hide-area": !0 }), l({ _: 2 }, [
|
|
42
|
+
y(e.$slots, (x, o) => ({
|
|
43
|
+
name: o,
|
|
44
|
+
fn: c((t) => [
|
|
45
|
+
m(e.$slots, o, d(h(t)))
|
|
46
|
+
])
|
|
47
|
+
}))
|
|
48
|
+
]), 1040));
|
|
154
49
|
}
|
|
155
50
|
});
|
|
156
51
|
export {
|
|
157
|
-
|
|
52
|
+
g as default
|
|
158
53
|
};
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import { LineChartProps } 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
|
-
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
|
-
readonly onClick?: ((event: MouseEvent, values?: T | undefined) => any) | undefined;
|
|
5
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & LineChartProps<T> & Partial<{}>> & import('vue').PublicProps;
|
|
3
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & LineChartProps<T> & Partial<{}>> & import('vue').PublicProps;
|
|
6
4
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
7
5
|
attrs: any;
|
|
8
|
-
slots:
|
|
9
|
-
|
|
10
|
-
values: T | undefined;
|
|
11
|
-
}): any;
|
|
12
|
-
fallback?(_: {}): any;
|
|
13
|
-
};
|
|
14
|
-
emit: (e: "click", event: MouseEvent, values?: T) => void;
|
|
6
|
+
slots: Partial<Record<number, (_: any) => any>>;
|
|
7
|
+
emit: {};
|
|
15
8
|
}>) => import('vue').VNode & {
|
|
16
9
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
17
10
|
};
|
|
@@ -1,144 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
/**
|
|
4
|
-
* The data to be displayed in the line chart.
|
|
5
|
-
* Each element of the array represents a data point.
|
|
6
|
-
* The structure of 'T' should be compatible with the chart's rendering logic.
|
|
7
|
-
*/
|
|
8
|
-
data: T[];
|
|
9
|
-
/**
|
|
10
|
-
* The height of the chart in pixels.
|
|
11
|
-
*/
|
|
12
|
-
height: number;
|
|
13
|
-
/**
|
|
14
|
-
* Optional label for the x-axis.
|
|
15
|
-
*/
|
|
16
|
-
xLabel?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Optional label for the y-axis.
|
|
19
|
-
*/
|
|
20
|
-
yLabel?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Optional padding applied to the chart.
|
|
23
|
-
* Allows specifying individual padding values for the top, right, bottom, and left sides.
|
|
24
|
-
*/
|
|
25
|
-
padding?: {
|
|
26
|
-
top: number;
|
|
27
|
-
right: number;
|
|
28
|
-
bottom: number;
|
|
29
|
-
left: number;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* A record mapping category keys to `BulletLegendItemInterface` objects.
|
|
33
|
-
* This defines the visual representation and labels for each category in the chart's legend.
|
|
34
|
-
*/
|
|
35
|
-
categories: Record<string, BulletLegendItemInterface>;
|
|
36
|
-
/**
|
|
37
|
-
* A record mapping marker keys to show custom patterns.
|
|
38
|
-
*/
|
|
39
|
-
markerConfig?: Record<string, MarkerConfig>;
|
|
40
|
-
/**
|
|
41
|
-
* @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the x-axis.
|
|
42
|
-
* @param {number} i - The index of the tick in the `ticks` array.
|
|
43
|
-
* @param {(number[]|Date[])} ticks - An array of all tick values for the x-axis.
|
|
44
|
-
* @returns {string} The formatted string representation of the tick.
|
|
45
|
-
*/
|
|
46
|
-
xFormatter?: axisFormatter;
|
|
47
|
-
/**
|
|
48
|
-
* @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the y-axis.
|
|
49
|
-
* @param {number} i - The index of the tick in the `ticks` array.
|
|
50
|
-
* @param {(number[]|Date[])} ticks - An array of all tick values for the y-axis.
|
|
51
|
-
* @returns {string} The formatted string representation of the tick.
|
|
52
|
-
*/
|
|
53
|
-
yFormatter?: axisFormatter;
|
|
54
|
-
/**
|
|
55
|
-
* The type of curve to use for the line chart.
|
|
56
|
-
* See `CurveType` for available options.
|
|
57
|
-
*/
|
|
58
|
-
curveType?: CurveType;
|
|
59
|
-
/**
|
|
60
|
-
* The width of the line in pixels. Default is 2px.
|
|
61
|
-
*/
|
|
62
|
-
lineWidth?: number;
|
|
63
|
-
/**
|
|
64
|
-
* Line dash array, see SVG's stroke-dasharray. Default: `undefined`
|
|
65
|
-
*/
|
|
66
|
-
lineDashArray?: number[][];
|
|
67
|
-
/**
|
|
68
|
-
* The desired number of ticks on the x-axis.
|
|
69
|
-
*/
|
|
70
|
-
xNumTicks?: number;
|
|
71
|
-
/**
|
|
72
|
-
* Force specific ticks on the x-axis.
|
|
73
|
-
*/
|
|
74
|
-
xExplicitTicks?: (number | string | Date)[];
|
|
75
|
-
/**
|
|
76
|
-
* Force only first and last ticks on the x-axis.
|
|
77
|
-
*/
|
|
78
|
-
minMaxTicksOnly?: boolean;
|
|
79
|
-
/**
|
|
80
|
-
* The desired number of ticks on the y-axis.
|
|
81
|
-
*/
|
|
82
|
-
yNumTicks?: number;
|
|
83
|
-
/**
|
|
84
|
-
* If `true`, hides the chart tooltip.
|
|
85
|
-
*/
|
|
86
|
-
hideTooltip?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* If `true`, hides the chart legend.
|
|
89
|
-
*/
|
|
90
|
-
hideLegend?: boolean;
|
|
91
|
-
/**
|
|
92
|
-
* Optional position for the legend, if applicable.
|
|
93
|
-
* See `LegendPosition` for available options.
|
|
94
|
-
*/
|
|
95
|
-
legendPosition?: LegendPosition;
|
|
96
|
-
/**
|
|
97
|
-
* Optional style object for the legend container. Allows custom CSS styling.
|
|
98
|
-
*/
|
|
99
|
-
legendStyle?: string | Record<string, string>;
|
|
100
|
-
/**
|
|
101
|
-
* If `true`, displays grid lines along the x-axis.
|
|
102
|
-
*/
|
|
103
|
-
xGridLine?: boolean;
|
|
104
|
-
/**
|
|
105
|
-
* If `true`, displays a domain line (axis line) along the x-axis.
|
|
106
|
-
*/
|
|
107
|
-
xDomainLine?: boolean;
|
|
108
|
-
/**
|
|
109
|
-
* If `true`, displays grid lines along the y-axis.
|
|
110
|
-
*/
|
|
111
|
-
yGridLine?: boolean;
|
|
112
|
-
/**
|
|
113
|
-
* If `true`, displays a domain line (axis line) along the y-axis.
|
|
114
|
-
*/
|
|
115
|
-
yDomainLine?: boolean;
|
|
116
|
-
/**
|
|
117
|
-
* If `true`, displays tick lines on the x-axis.
|
|
118
|
-
*/
|
|
119
|
-
xTickLine?: boolean;
|
|
120
|
-
/**
|
|
121
|
-
* If `true`, displays tick lines on the y-axis.
|
|
122
|
-
*/
|
|
123
|
-
yTickLine?: 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
|
-
/**
|
|
133
|
-
* Crosshair configuration object for customizing the appearance of the crosshair line.
|
|
134
|
-
*/
|
|
135
|
-
crosshairConfig?: CrosshairConfig;
|
|
136
|
-
/**
|
|
137
|
-
* The domain for the y-axis, specified as a tuple of two values.
|
|
138
|
-
*/
|
|
139
|
-
yDomain?: [number | undefined, number | undefined];
|
|
140
|
-
/**
|
|
141
|
-
* The domain for the x-axis, specified as a tuple of two values.
|
|
142
|
-
*/
|
|
143
|
-
xDomain?: [number | undefined, number | undefined];
|
|
144
|
-
}
|
|
1
|
+
import { AreaChartProps } from '../AreaChart/types';
|
|
2
|
+
export type LineChartProps<T> = Omit<AreaChartProps<T>, "hideArea" | "gradientStops">;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { default as AreaChart } from './components/AreaChart/AreaChart.vue';
|
|
2
|
-
import { default as AreaStackedChart } from './components/AreaStackedChart/AreaStackedChart.vue';
|
|
3
2
|
import { default as LineChart } from './components/LineChart/LineChart.vue';
|
|
4
3
|
import { default as BarChart } from './components/BarChart/BarChart.vue';
|
|
5
4
|
import { default as DonutChart } from './components/DonutChart/DonutChart.vue';
|
|
6
5
|
import { default as BubbleChart } from './components/BubbleChart/BubbleChart.vue';
|
|
7
6
|
import { LegendPosition, CurveType, Orientation, BulletLegendItemInterface, MarkerConfig, CrosshairConfig } from './types';
|
|
8
|
-
export { AreaChart,
|
|
7
|
+
export { AreaChart, LineChart, BarChart, DonutChart, BubbleChart, Orientation, CurveType, LegendPosition };
|
|
9
8
|
export type { BulletLegendItemInterface, MarkerConfig, CrosshairConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { default as o } from "./components/
|
|
3
|
-
import { default as u } from "./components/
|
|
4
|
-
import { default as
|
|
5
|
-
import { default as m } from "./components/
|
|
6
|
-
import {
|
|
7
|
-
import { CurveType as h, LegendPosition as n, Orientation as i } from "./types.js";
|
|
1
|
+
import { default as e } from "./components/AreaChart/AreaChart.js";
|
|
2
|
+
import { default as o } from "./components/LineChart/LineChart.js";
|
|
3
|
+
import { default as u } from "./components/BarChart/BarChart.js";
|
|
4
|
+
import { default as d } from "./components/DonutChart/DonutChart.js";
|
|
5
|
+
import { default as m } from "./components/BubbleChart/BubbleChart.js";
|
|
6
|
+
import { CurveType as s, LegendPosition as x, Orientation as C } from "./types.js";
|
|
8
7
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
i as Orientation
|
|
8
|
+
e as AreaChart,
|
|
9
|
+
u as BarChart,
|
|
10
|
+
m as BubbleChart,
|
|
11
|
+
s as CurveType,
|
|
12
|
+
d as DonutChart,
|
|
13
|
+
x as LegendPosition,
|
|
14
|
+
o as LineChart,
|
|
15
|
+
C as Orientation
|
|
18
16
|
};
|
package/package.json
CHANGED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { defineComponent as y, computed as f, createApp as h, createElementBlock as g, openBlock as c, createVNode as i, createElementVNode as x, unref as o, withCtx as B, createBlock as L, createCommentVNode as v, mergeProps as C } from "vue";
|
|
2
|
-
import { VisXYContainer as k, VisArea as b, VisAxis as s, VisCrosshair as T, VisBulletLegend as V } from "@unovis/vue";
|
|
3
|
-
import { CurveType as N } from "@unovis/ts";
|
|
4
|
-
import A from "../Tooltip.js";
|
|
5
|
-
const j = { class: "flex flex-col space-y-4" }, w = { class: "flex items center justify-end" }, H = /* @__PURE__ */ y({
|
|
6
|
-
__name: "AreaStackedChart",
|
|
7
|
-
props: {
|
|
8
|
-
data: {},
|
|
9
|
-
height: {},
|
|
10
|
-
categories: {},
|
|
11
|
-
hideTooltip: { type: Boolean },
|
|
12
|
-
xLabel: {},
|
|
13
|
-
yLabel: {},
|
|
14
|
-
padding: {},
|
|
15
|
-
hideLegend: { type: Boolean },
|
|
16
|
-
xGridLine: { type: Boolean },
|
|
17
|
-
xDomainLine: { type: Boolean },
|
|
18
|
-
yGridLine: { type: Boolean },
|
|
19
|
-
yDomainLine: { type: Boolean },
|
|
20
|
-
xTickLine: { type: Boolean },
|
|
21
|
-
yTickLine: { type: Boolean },
|
|
22
|
-
crosshairConfig: {}
|
|
23
|
-
},
|
|
24
|
-
setup(t) {
|
|
25
|
-
const a = t, l = f(() => (e, u) => {
|
|
26
|
-
if (typeof window > "u" || typeof document > "u")
|
|
27
|
-
return "";
|
|
28
|
-
try {
|
|
29
|
-
const n = h(A, {
|
|
30
|
-
data: e,
|
|
31
|
-
categories: a.categories
|
|
32
|
-
}), r = document.createElement("div");
|
|
33
|
-
n.mount(r);
|
|
34
|
-
const p = r.innerHTML;
|
|
35
|
-
return n.unmount(), p;
|
|
36
|
-
} catch {
|
|
37
|
-
return "";
|
|
38
|
-
}
|
|
39
|
-
}), d = (e) => Number.parseInt(e.time), m = [(e) => e.firstTime, (e) => e.returning];
|
|
40
|
-
return (e, u) => (c(), g("div", j, [
|
|
41
|
-
i(o(k), {
|
|
42
|
-
data: t.data,
|
|
43
|
-
padding: t.padding,
|
|
44
|
-
height: t.height
|
|
45
|
-
}, {
|
|
46
|
-
default: B(() => [
|
|
47
|
-
i(o(b), {
|
|
48
|
-
x: d,
|
|
49
|
-
y: m,
|
|
50
|
-
color: Object.values(a.categories).map((n) => n.color),
|
|
51
|
-
"curve-type": o(N).Linear
|
|
52
|
-
}, null, 8, ["color", "curve-type"]),
|
|
53
|
-
i(o(s), {
|
|
54
|
-
type: "x",
|
|
55
|
-
label: "Time",
|
|
56
|
-
"num-ticks": 12
|
|
57
|
-
}),
|
|
58
|
-
i(o(s), {
|
|
59
|
-
type: "y",
|
|
60
|
-
label: "Number of visitors",
|
|
61
|
-
"num-ticks": 3
|
|
62
|
-
}),
|
|
63
|
-
t.hideTooltip ? v("", !0) : (c(), L(o(T), C({ key: 0 }, t.crosshairConfig, { template: l.value }), null, 16, ["template"]))
|
|
64
|
-
]),
|
|
65
|
-
_: 1
|
|
66
|
-
}, 8, ["data", "padding", "height"]),
|
|
67
|
-
x("div", w, [
|
|
68
|
-
i(o(V), {
|
|
69
|
-
items: Object.values(t.categories)
|
|
70
|
-
}, null, 8, ["items"])
|
|
71
|
-
])
|
|
72
|
-
]));
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
export {
|
|
76
|
-
H as default
|
|
77
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AreaStackedChartProps } 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<{
|
|
3
|
-
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & AreaStackedChartProps<T> & Partial<{}>> & import('vue').PublicProps;
|
|
4
|
-
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
5
|
-
attrs: any;
|
|
6
|
-
slots: {};
|
|
7
|
-
emit: {};
|
|
8
|
-
}>) => import('vue').VNode & {
|
|
9
|
-
__ctx?: Awaited<typeof __VLS_setup>;
|
|
10
|
-
};
|
|
11
|
-
export default _default;
|
|
12
|
-
type __VLS_PrettifyLocal<T> = {
|
|
13
|
-
[K in keyof T]: T[K];
|
|
14
|
-
} & {};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { BulletLegendItemInterface } from '@unovis/ts';
|
|
2
|
-
export interface AreaStackedChartProps<T> {
|
|
3
|
-
/**
|
|
4
|
-
* The data to be displayed in the stacked area chart.
|
|
5
|
-
* Each element of the array represents a data point.
|
|
6
|
-
* The structure of 'T' should be compatible with the chart's rendering logic.
|
|
7
|
-
*/
|
|
8
|
-
data: T[];
|
|
9
|
-
/**
|
|
10
|
-
* The height of the chart in pixels.
|
|
11
|
-
*/
|
|
12
|
-
height: number;
|
|
13
|
-
/**
|
|
14
|
-
* A record mapping category keys to `BulletLegendItemInterface` objects.
|
|
15
|
-
* This defines the visual representation and labels for each category in the chart's legend.
|
|
16
|
-
*/
|
|
17
|
-
categories: Record<string, BulletLegendItemInterface>;
|
|
18
|
-
/**
|
|
19
|
-
* If `true`, hides the chart tooltip.
|
|
20
|
-
*/
|
|
21
|
-
hideTooltip?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Optional label for the x-axis.
|
|
24
|
-
*/
|
|
25
|
-
xLabel?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Optional label for the y-axis.
|
|
28
|
-
*/
|
|
29
|
-
yLabel?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Optional padding applied to the chart.
|
|
32
|
-
* Allows specifying individual padding values for the top, right, bottom, and left sides.
|
|
33
|
-
*/
|
|
34
|
-
padding?: {
|
|
35
|
-
top: number;
|
|
36
|
-
right: number;
|
|
37
|
-
bottom: number;
|
|
38
|
-
left: number;
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* If `true`, hides the chart legend.
|
|
42
|
-
*/
|
|
43
|
-
hideLegend?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* If `true`, displays grid lines along the x-axis.
|
|
46
|
-
*/
|
|
47
|
-
xGridLine?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* If `true`, displays a domain line (axis line) along the x-axis.
|
|
50
|
-
*/
|
|
51
|
-
xDomainLine?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* If `true`, displays grid lines along the y-axis.
|
|
54
|
-
*/
|
|
55
|
-
yGridLine?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* If `true`, displays a domain line (axis line) along the y-axis.
|
|
58
|
-
*/
|
|
59
|
-
yDomainLine?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* If `true`, displays tick lines on the x-axis.
|
|
62
|
-
*/
|
|
63
|
-
xTickLine?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* If `true`, displays tick lines on the y-axis.
|
|
66
|
-
*/
|
|
67
|
-
yTickLine?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Crosshair configuration object for customizing the appearance of the crosshair line.
|
|
70
|
-
*/
|
|
71
|
-
crosshairConfig?: {
|
|
72
|
-
/**
|
|
73
|
-
* The color of the crosshair line. Accepts any valid CSS color string.
|
|
74
|
-
* Example: '#f00', 'rgba(0,0,0,0.5)', 'blue'
|
|
75
|
-
*/
|
|
76
|
-
color?: string;
|
|
77
|
-
/**
|
|
78
|
-
* The stroke color of the crosshair line. Accepts any valid CSS color string.
|
|
79
|
-
*/
|
|
80
|
-
strokeColor?: string;
|
|
81
|
-
/**
|
|
82
|
-
* The stroke width of the crosshair line in pixels.
|
|
83
|
-
*/
|
|
84
|
-
strokeWidth?: number;
|
|
85
|
-
};
|
|
86
|
-
}
|