vue-chrts 0.2.0-test.6 → 0.2.0-test.7
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/index.js.js +753 -0
- package/package.json +1 -1
- package/dist/components/AreaChart/AreaChart.js +0 -163
- package/dist/components/AreaChart/AreaChart2.js +0 -4
- package/dist/components/AreaStackedChart/AreaStackedChart.js +0 -77
- package/dist/components/AreaStackedChart/AreaStackedChart2.js +0 -4
- package/dist/components/BarChart/BarChart.js +0 -170
- package/dist/components/BarChart/BarChart2.js +0 -4
- package/dist/components/BarChart/stackedGroupedUtils.js +0 -67
- package/dist/components/DonutChart/DonutChart.js +0 -83
- package/dist/components/DonutChart/DonutChart2.js +0 -4
- package/dist/components/DonutChart/types.js +0 -4
- package/dist/components/LineChart/LineChart.js +0 -143
- package/dist/components/LineChart/LineChart2.js +0 -4
- package/dist/components/Tooltip.js +0 -48
- package/dist/components/Tooltip2.js +0 -4
- package/dist/index.js +0 -14
- package/dist/types.js +0 -4
- package/dist/utils.js +0 -49
package/package.json
CHANGED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { defineComponent as U, useSlots as j, useTemplateRef as w, ref as R, computed as d, createElementBlock as c, openBlock as a, normalizeClass as T, createVNode as u, createCommentVNode as p, createElementVNode as X, unref as i, withCtx as x, createBlock as m, Fragment as L, renderList as S, mergeProps as C, renderSlot as b } from "vue";
|
|
2
|
-
import { Position as A, CurveType as B } from "@unovis/ts";
|
|
3
|
-
import { createMarkers as Y, getFirstPropertyValue as z } from "../../utils.js";
|
|
4
|
-
import I from "../Tooltip.js";
|
|
5
|
-
import { VisXYContainer as H, VisTooltip as K, VisArea as q, VisLine as J, VisAxis as D, VisCrosshair as Q, VisBulletLegend as Z } from "@unovis/vue";
|
|
6
|
-
import { LegendPosition as _ } from "../../types.js";
|
|
7
|
-
const ee = {
|
|
8
|
-
ref: "slotWrapper",
|
|
9
|
-
class: "hidden"
|
|
10
|
-
}, y = 24, V = 4, te = 0.5, F = "#3b82f6", se = /* @__PURE__ */ U({
|
|
11
|
-
__name: "AreaChart",
|
|
12
|
-
props: {
|
|
13
|
-
data: {},
|
|
14
|
-
height: {},
|
|
15
|
-
xLabel: {},
|
|
16
|
-
yLabel: {},
|
|
17
|
-
padding: { default: () => ({ top: 5, right: 5, bottom: 5, left: 5 }) },
|
|
18
|
-
categories: {},
|
|
19
|
-
markerConfig: {},
|
|
20
|
-
xFormatter: {},
|
|
21
|
-
yFormatter: {},
|
|
22
|
-
curveType: {},
|
|
23
|
-
lineWidth: { default: 2 },
|
|
24
|
-
lineDashArray: {},
|
|
25
|
-
xNumTicks: { default: (n) => n.data.length > y ? y / V : n.data.length - 1 },
|
|
26
|
-
xExplicitTicks: {},
|
|
27
|
-
minMaxTicksOnly: { type: Boolean },
|
|
28
|
-
yNumTicks: { default: (n) => n.data.length > y ? y / V : n.data.length - 1 },
|
|
29
|
-
hideLegend: { type: Boolean },
|
|
30
|
-
hideTooltip: { type: Boolean },
|
|
31
|
-
legendPosition: {},
|
|
32
|
-
xDomainLine: { type: Boolean },
|
|
33
|
-
yDomainLine: { type: Boolean },
|
|
34
|
-
xTickLine: { type: Boolean },
|
|
35
|
-
yTickLine: { type: Boolean },
|
|
36
|
-
xGridLine: { type: Boolean },
|
|
37
|
-
yGridLine: { type: Boolean },
|
|
38
|
-
hideXAxis: { type: Boolean },
|
|
39
|
-
hideYAxis: { type: Boolean },
|
|
40
|
-
crosshairConfig: { default: () => ({
|
|
41
|
-
color: "#666"
|
|
42
|
-
}) }
|
|
43
|
-
},
|
|
44
|
-
emits: ["click"],
|
|
45
|
-
setup(n, { emit: $ }) {
|
|
46
|
-
const G = $, r = n, O = j(), h = w("slotWrapper"), s = R(), f = d(
|
|
47
|
-
() => Object.values(r.categories).map((e) => e.color)
|
|
48
|
-
), N = d(() => r.markerConfig ? Y(r.markerConfig) : ""), g = d(() => r.legendPosition === _.Top), E = d(() => {
|
|
49
|
-
const e = (t, o) => `
|
|
50
|
-
<linearGradient id="gradient${t}-${o}" gradientTransform="rotate(90)">
|
|
51
|
-
<stop offset="0%" stop-color="${o}" stop-opacity="1" />
|
|
52
|
-
<stop offset="100%" stop-color="${o}" stop-opacity="0" />
|
|
53
|
-
</linearGradient>
|
|
54
|
-
`, l = (t, o) => `
|
|
55
|
-
<linearGradient id="gradient${t}-${o}" gradientTransform="rotate(90)">
|
|
56
|
-
<stop offset="0%" style="stop-color:var(--vis-color0);stop-opacity:1" />
|
|
57
|
-
<stop offset="100%" style="stop-color:var(--vis-color0);stop-opacity:0" />
|
|
58
|
-
</linearGradient>
|
|
59
|
-
`;
|
|
60
|
-
return f.value.map(
|
|
61
|
-
(t, o) => t != null && t.includes("#") ? e(o, t) : l(o, t ?? F)
|
|
62
|
-
).join("");
|
|
63
|
-
});
|
|
64
|
-
function P(e) {
|
|
65
|
-
var l;
|
|
66
|
-
return {
|
|
67
|
-
y: (t) => Number(t[e]),
|
|
68
|
-
color: ((l = r.categories[e]) == null ? void 0 : l.color) ?? F
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
function W(e) {
|
|
72
|
-
return typeof window > "u" ? "" : h.value ? h.value.innerHTML : "";
|
|
73
|
-
}
|
|
74
|
-
function M(e) {
|
|
75
|
-
return s.value = e, W();
|
|
76
|
-
}
|
|
77
|
-
return (e, l) => (a(), c("div", {
|
|
78
|
-
class: T(["flex flex-col", { "flex-col-reverse": g.value, markers: !!r.markerConfig }]),
|
|
79
|
-
onClick: l[0] || (l[0] = (t) => G("click", t, s.value))
|
|
80
|
-
}, [
|
|
81
|
-
u(i(H), {
|
|
82
|
-
data: e.data,
|
|
83
|
-
height: e.height,
|
|
84
|
-
padding: e.padding,
|
|
85
|
-
"svg-defs": E.value + N.value
|
|
86
|
-
}, {
|
|
87
|
-
default: x(() => [
|
|
88
|
-
e.hideTooltip ? p("", !0) : (a(), m(i(K), {
|
|
89
|
-
key: 0,
|
|
90
|
-
"horizontal-placement": i(A).Right,
|
|
91
|
-
"vertical-placement": i(A).Top
|
|
92
|
-
}, null, 8, ["horizontal-placement", "vertical-placement"])),
|
|
93
|
-
(a(!0), c(L, null, S(Object.keys(r.categories), (t, o) => (a(), c(L, { key: t }, [
|
|
94
|
-
u(i(q), C({
|
|
95
|
-
x: (k, v) => v
|
|
96
|
-
}, { ref_for: !0 }, P(t), {
|
|
97
|
-
color: `url(#gradient${o}-${f.value[o]})`,
|
|
98
|
-
opacity: te,
|
|
99
|
-
"curve-type": e.curveType ?? i(B).MonotoneX
|
|
100
|
-
}), null, 16, ["x", "color", "curve-type"]),
|
|
101
|
-
u(i(J), {
|
|
102
|
-
x: (k, v) => v,
|
|
103
|
-
y: (k) => k[t],
|
|
104
|
-
color: f.value[o],
|
|
105
|
-
"curve-type": e.curveType ?? i(B).MonotoneX,
|
|
106
|
-
"line-width": e.lineWidth,
|
|
107
|
-
lineDashArray: e.lineDashArray
|
|
108
|
-
}, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"])
|
|
109
|
-
], 64))), 128)),
|
|
110
|
-
e.hideXAxis ? p("", !0) : (a(), m(i(D), {
|
|
111
|
-
key: 1,
|
|
112
|
-
type: "x",
|
|
113
|
-
label: e.xLabel,
|
|
114
|
-
"label-margin": 8,
|
|
115
|
-
"num-ticks": e.xNumTicks,
|
|
116
|
-
"tick-format": e.xFormatter,
|
|
117
|
-
"tick-values": e.xExplicitTicks,
|
|
118
|
-
"grid-line": e.xGridLine,
|
|
119
|
-
"domain-line": e.xDomainLine,
|
|
120
|
-
"tick-line": e.xTickLine,
|
|
121
|
-
"min-max-ticks-only": e.minMaxTicksOnly
|
|
122
|
-
}, null, 8, ["label", "num-ticks", "tick-format", "tick-values", "grid-line", "domain-line", "tick-line", "min-max-ticks-only"])),
|
|
123
|
-
e.hideYAxis ? p("", !0) : (a(), m(i(D), {
|
|
124
|
-
key: 2,
|
|
125
|
-
type: "y",
|
|
126
|
-
label: e.yLabel,
|
|
127
|
-
"num-ticks": e.yNumTicks,
|
|
128
|
-
"tick-format": e.yFormatter,
|
|
129
|
-
"grid-line": e.yGridLine,
|
|
130
|
-
"domain-line": e.yDomainLine,
|
|
131
|
-
"tick-line": e.yTickLine
|
|
132
|
-
}, null, 8, ["label", "num-ticks", "tick-format", "grid-line", "domain-line", "tick-line"])),
|
|
133
|
-
e.hideTooltip ? p("", !0) : (a(), m(i(Q), C({ key: 3 }, e.crosshairConfig, { template: M }), null, 16))
|
|
134
|
-
]),
|
|
135
|
-
_: 1
|
|
136
|
-
}, 8, ["data", "height", "padding", "svg-defs"]),
|
|
137
|
-
e.hideLegend ? p("", !0) : (a(), c("div", {
|
|
138
|
-
key: 0,
|
|
139
|
-
class: T(["flex items-center justify-end", { "pb-4": g.value, "pt-4": !g.value }])
|
|
140
|
-
}, [
|
|
141
|
-
u(i(Z), {
|
|
142
|
-
items: Object.values(e.categories)
|
|
143
|
-
}, null, 8, ["items"])
|
|
144
|
-
], 2)),
|
|
145
|
-
X("div", ee, [
|
|
146
|
-
i(O).tooltip ? b(e.$slots, "tooltip", {
|
|
147
|
-
key: 0,
|
|
148
|
-
values: s.value
|
|
149
|
-
}) : s.value ? b(e.$slots, "fallback", { key: 1 }, () => [
|
|
150
|
-
u(I, {
|
|
151
|
-
data: s.value,
|
|
152
|
-
categories: e.categories,
|
|
153
|
-
toolTipTitle: i(z)(s.value) ?? "",
|
|
154
|
-
yFormatter: r.yFormatter
|
|
155
|
-
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
156
|
-
]) : p("", !0)
|
|
157
|
-
], 512)
|
|
158
|
-
], 2));
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
export {
|
|
162
|
-
se as default
|
|
163
|
-
};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { defineComponent as y, computed as f, createApp as h, createElementBlock as g, openBlock as a, createVNode as n, createElementVNode as B, unref as t, withCtx as L, createBlock as v, createCommentVNode as C, mergeProps as k } from "vue";
|
|
2
|
-
import { VisXYContainer as b, VisArea as x, VisAxis as s, VisCrosshair as T, VisBulletLegend as V } from "@unovis/vue";
|
|
3
|
-
import { CurveType as _ } 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" }, O = /* @__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(c) {
|
|
25
|
-
const i = c, l = f(() => (e, m) => {
|
|
26
|
-
if (typeof window > "u" || typeof document > "u")
|
|
27
|
-
return "";
|
|
28
|
-
try {
|
|
29
|
-
const o = h(N, {
|
|
30
|
-
data: e,
|
|
31
|
-
categories: i.categories
|
|
32
|
-
}), r = document.createElement("div");
|
|
33
|
-
o.mount(r);
|
|
34
|
-
const u = r.innerHTML;
|
|
35
|
-
return o.unmount(), u;
|
|
36
|
-
} catch {
|
|
37
|
-
return "";
|
|
38
|
-
}
|
|
39
|
-
}), p = (e) => Number.parseInt(e.time), d = [(e) => e.firstTime, (e) => e.returning];
|
|
40
|
-
return (e, m) => (a(), g("div", A, [
|
|
41
|
-
n(t(b), {
|
|
42
|
-
data: e.data,
|
|
43
|
-
padding: e.padding,
|
|
44
|
-
height: e.height
|
|
45
|
-
}, {
|
|
46
|
-
default: L(() => [
|
|
47
|
-
n(t(x), {
|
|
48
|
-
x: p,
|
|
49
|
-
y: d,
|
|
50
|
-
color: Object.values(i.categories).map((o) => o.color),
|
|
51
|
-
"curve-type": t(_).Linear
|
|
52
|
-
}, null, 8, ["color", "curve-type"]),
|
|
53
|
-
n(t(s), {
|
|
54
|
-
type: "x",
|
|
55
|
-
label: "Time",
|
|
56
|
-
"num-ticks": 12
|
|
57
|
-
}),
|
|
58
|
-
n(t(s), {
|
|
59
|
-
type: "y",
|
|
60
|
-
label: "Number of visitors",
|
|
61
|
-
"num-ticks": 3
|
|
62
|
-
}),
|
|
63
|
-
e.hideTooltip ? C("", !0) : (a(), v(t(T), k({ key: 0 }, e.crosshairConfig, { template: l.value }), null, 16, ["template"]))
|
|
64
|
-
]),
|
|
65
|
-
_: 1
|
|
66
|
-
}, 8, ["data", "padding", "height"]),
|
|
67
|
-
B("div", j, [
|
|
68
|
-
n(t(V), {
|
|
69
|
-
items: Object.values(e.categories)
|
|
70
|
-
}, null, 8, ["items"])
|
|
71
|
-
])
|
|
72
|
-
]));
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
export {
|
|
76
|
-
O as default
|
|
77
|
-
};
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { defineComponent as C, useSlots as N, useTemplateRef as O, ref as D, computed as T, createElementBlock as m, openBlock as n, normalizeClass as L, createVNode as g, createCommentVNode as c, createElementVNode as w, unref as i, withCtx as E, createBlock as u, Fragment as M, renderList as S, renderSlot as v } from "vue";
|
|
2
|
-
import { Orientation as l, StackedBar as j, GroupedBar as z } from "@unovis/ts";
|
|
3
|
-
import { getFirstPropertyValue as H } from "../../utils.js";
|
|
4
|
-
import { useStackedGrouped as W } from "./stackedGroupedUtils.js";
|
|
5
|
-
import { VisXYContainer as X, VisTooltip as Y, VisStackedBar as B, VisGroupedBar as $, VisAxis as A, VisBulletLegend as R } from "@unovis/vue";
|
|
6
|
-
import q from "../Tooltip.js";
|
|
7
|
-
import { LegendPosition as U } from "../../types.js";
|
|
8
|
-
const I = {
|
|
9
|
-
ref: "slotWrapper",
|
|
10
|
-
class: "hidden"
|
|
11
|
-
}, ae = /* @__PURE__ */ C({
|
|
12
|
-
__name: "BarChart",
|
|
13
|
-
props: {
|
|
14
|
-
data: {},
|
|
15
|
-
stacked: { type: Boolean },
|
|
16
|
-
height: {},
|
|
17
|
-
xLabel: {},
|
|
18
|
-
yLabel: {},
|
|
19
|
-
padding: { default: () => ({
|
|
20
|
-
top: 5,
|
|
21
|
-
right: 5,
|
|
22
|
-
bottom: 5,
|
|
23
|
-
left: 5
|
|
24
|
-
}) },
|
|
25
|
-
categories: {},
|
|
26
|
-
xFormatter: {},
|
|
27
|
-
yFormatter: {},
|
|
28
|
-
yNumTicks: { default: (t) => t.data.length > 24 ? 24 / 4 : t.data.length - 1 },
|
|
29
|
-
minMaxTicksOnly: { type: Boolean },
|
|
30
|
-
xNumTicks: { default: (t) => t.data.length > 24 ? 24 / 4 : t.data.length - 1 },
|
|
31
|
-
xExplicitTicks: {},
|
|
32
|
-
yAxis: {},
|
|
33
|
-
groupPadding: {},
|
|
34
|
-
barPadding: {},
|
|
35
|
-
radius: {},
|
|
36
|
-
hideLegend: { type: Boolean },
|
|
37
|
-
hideTooltip: { type: Boolean, default: !1 },
|
|
38
|
-
orientation: { default: l.Vertical },
|
|
39
|
-
legendPosition: {},
|
|
40
|
-
xDomainLine: { type: Boolean },
|
|
41
|
-
yDomainLine: { type: Boolean },
|
|
42
|
-
xTickLine: { type: Boolean },
|
|
43
|
-
yTickLine: { type: Boolean },
|
|
44
|
-
xGridLine: { type: Boolean },
|
|
45
|
-
yGridLine: { type: Boolean, default: !0 },
|
|
46
|
-
hideXAxis: { type: Boolean },
|
|
47
|
-
hideYAxis: { type: Boolean },
|
|
48
|
-
stackAndGrouped: { type: Boolean },
|
|
49
|
-
xAxis: {}
|
|
50
|
-
},
|
|
51
|
-
emits: ["click"],
|
|
52
|
-
setup(t, { emit: V }) {
|
|
53
|
-
const x = V, a = t, P = N(), y = O("slotWrapper"), r = D();
|
|
54
|
-
if (!a.yAxis || a.yAxis.length === 0)
|
|
55
|
-
throw new Error("yAxis is required");
|
|
56
|
-
const k = T(() => a.yAxis.map((e) => (d) => d[e])), f = (e, d) => {
|
|
57
|
-
var o;
|
|
58
|
-
return (o = Object.values(a.categories)[d]) == null ? void 0 : o.color;
|
|
59
|
-
}, s = W({
|
|
60
|
-
data: a.data,
|
|
61
|
-
categories: a.categories,
|
|
62
|
-
stackAndGrouped: a.stackAndGrouped,
|
|
63
|
-
xAxis: a.xAxis
|
|
64
|
-
}), h = T(
|
|
65
|
-
() => a.legendPosition === U.Top
|
|
66
|
-
);
|
|
67
|
-
function b(e) {
|
|
68
|
-
return r.value = e, G();
|
|
69
|
-
}
|
|
70
|
-
function G(e) {
|
|
71
|
-
return typeof window > "u" ? "" : y.value ? y.value.innerHTML : "";
|
|
72
|
-
}
|
|
73
|
-
return (e, d) => (n(), m("div", {
|
|
74
|
-
class: L(["flex flex-col space-y-4", { "flex-col-reverse": h.value }]),
|
|
75
|
-
onClick: d[0] || (d[0] = (o) => x("click", o, r.value))
|
|
76
|
-
}, [
|
|
77
|
-
g(i(X), {
|
|
78
|
-
padding: e.padding,
|
|
79
|
-
height: e.height
|
|
80
|
-
}, {
|
|
81
|
-
default: E(() => [
|
|
82
|
-
g(i(Y), {
|
|
83
|
-
triggers: {
|
|
84
|
-
[i(z).selectors.bar]: b,
|
|
85
|
-
[i(j).selectors.bar]: b
|
|
86
|
-
}
|
|
87
|
-
}, null, 8, ["triggers"]),
|
|
88
|
-
e.stackAndGrouped ? (n(!0), m(M, { key: 0 }, S(i(s).states, (o) => (n(), u(i(B), {
|
|
89
|
-
key: o,
|
|
90
|
-
data: i(s).chartData,
|
|
91
|
-
x: (p, F) => F + i(s).positions[o],
|
|
92
|
-
y: i(s).bars[o],
|
|
93
|
-
color: i(s).colorFunctions[o],
|
|
94
|
-
"rounded-corners": e.radius ?? 0,
|
|
95
|
-
"group-padding": e.groupPadding ?? 0,
|
|
96
|
-
"bar-padding": e.barPadding ?? 0.2,
|
|
97
|
-
orientation: e.orientation ?? i(l).Vertical
|
|
98
|
-
}, null, 8, ["data", "x", "y", "color", "rounded-corners", "group-padding", "bar-padding", "orientation"]))), 128)) : e.stacked ? (n(), u(i(B), {
|
|
99
|
-
key: 2,
|
|
100
|
-
data: e.data,
|
|
101
|
-
x: (o, p) => p,
|
|
102
|
-
y: k.value,
|
|
103
|
-
color: f,
|
|
104
|
-
"rounded-corners": e.radius ?? 0,
|
|
105
|
-
"group-padding": e.groupPadding ?? 0,
|
|
106
|
-
"bar-padding": e.barPadding ?? 0.2,
|
|
107
|
-
orientation: e.orientation ?? i(l).Vertical
|
|
108
|
-
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (n(), u(i($), {
|
|
109
|
-
key: 1,
|
|
110
|
-
data: e.data,
|
|
111
|
-
x: (o, p) => p,
|
|
112
|
-
y: k.value,
|
|
113
|
-
color: f,
|
|
114
|
-
"rounded-corners": e.radius ?? 0,
|
|
115
|
-
"group-padding": e.groupPadding ?? 0,
|
|
116
|
-
"bar-padding": e.barPadding ?? 0.2,
|
|
117
|
-
orientation: e.orientation ?? i(l).Vertical
|
|
118
|
-
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
|
|
119
|
-
e.hideXAxis ? c("", !0) : (n(), u(i(A), {
|
|
120
|
-
key: 3,
|
|
121
|
-
type: "x",
|
|
122
|
-
"tick-format": e.xFormatter,
|
|
123
|
-
label: e.xLabel,
|
|
124
|
-
"grid-line": e.xGridLine,
|
|
125
|
-
"domain-line": !!e.xDomainLine,
|
|
126
|
-
"tick-line": e.xTickLine,
|
|
127
|
-
"num-ticks": e.xNumTicks,
|
|
128
|
-
"tick-values": e.xExplicitTicks,
|
|
129
|
-
minMaxTicksOnly: e.minMaxTicksOnly
|
|
130
|
-
}, null, 8, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "minMaxTicksOnly"])),
|
|
131
|
-
e.hideYAxis ? c("", !0) : (n(), u(i(A), {
|
|
132
|
-
key: 4,
|
|
133
|
-
type: "y",
|
|
134
|
-
label: e.yLabel,
|
|
135
|
-
"grid-line": e.orientation !== i(l).Horizontal && e.yGridLine,
|
|
136
|
-
"domain-line": !!e.yDomainLine,
|
|
137
|
-
"tick-format": e.yFormatter,
|
|
138
|
-
"num-ticks": e.yNumTicks,
|
|
139
|
-
"tick-line": e.yTickLine
|
|
140
|
-
}, null, 8, ["label", "grid-line", "domain-line", "tick-format", "num-ticks", "tick-line"]))
|
|
141
|
-
]),
|
|
142
|
-
_: 1
|
|
143
|
-
}, 8, ["padding", "height"]),
|
|
144
|
-
e.hideLegend ? c("", !0) : (n(), m("div", {
|
|
145
|
-
key: 0,
|
|
146
|
-
class: L(["flex items center justify-end", { "pb-4": h.value }])
|
|
147
|
-
}, [
|
|
148
|
-
g(i(R), {
|
|
149
|
-
items: Object.values(a.categories)
|
|
150
|
-
}, null, 8, ["items"])
|
|
151
|
-
], 2)),
|
|
152
|
-
w("div", I, [
|
|
153
|
-
i(P).tooltip ? v(e.$slots, "tooltip", {
|
|
154
|
-
key: 0,
|
|
155
|
-
values: r.value
|
|
156
|
-
}) : r.value ? v(e.$slots, "fallback", { key: 1 }, () => [
|
|
157
|
-
g(q, {
|
|
158
|
-
data: r.value,
|
|
159
|
-
categories: a.categories,
|
|
160
|
-
toolTipTitle: i(H)(r.value) ?? "",
|
|
161
|
-
yFormatter: a.orientation === i(l).Horizontal ? a.xFormatter : a.yFormatter
|
|
162
|
-
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
163
|
-
]) : c("", !0)
|
|
164
|
-
], 512)
|
|
165
|
-
], 2));
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
export {
|
|
169
|
-
ae as default
|
|
170
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { computed as u } from "vue";
|
|
2
|
-
import { flattenData as i } from "../../utils.js";
|
|
3
|
-
function b(t) {
|
|
4
|
-
return u(() => {
|
|
5
|
-
const o = f(t.categories), e = l(t.categories, o), r = p(e, t.categories), c = d(e), n = m(r), s = h(o);
|
|
6
|
-
console.log(t, "config");
|
|
7
|
-
const a = t.stackAndGrouped ? i(t.data, t.xAxis) : t.data;
|
|
8
|
-
return {
|
|
9
|
-
states: o,
|
|
10
|
-
groupedByState: e,
|
|
11
|
-
colors: r,
|
|
12
|
-
bars: c,
|
|
13
|
-
colorFunctions: n,
|
|
14
|
-
positions: s,
|
|
15
|
-
chartData: a
|
|
16
|
-
};
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
function f(t) {
|
|
20
|
-
const o = /* @__PURE__ */ new Set();
|
|
21
|
-
return Object.keys(t).forEach((r) => {
|
|
22
|
-
const c = r.match(/([A-Z][a-z]+)$/);
|
|
23
|
-
c && o.add(c[1]);
|
|
24
|
-
}), Array.from(o);
|
|
25
|
-
}
|
|
26
|
-
function l(t, o) {
|
|
27
|
-
const e = {};
|
|
28
|
-
return o.forEach((r) => {
|
|
29
|
-
e[r] = Object.keys(t).filter(
|
|
30
|
-
(c) => c.endsWith(r)
|
|
31
|
-
);
|
|
32
|
-
}), e;
|
|
33
|
-
}
|
|
34
|
-
function p(t, o) {
|
|
35
|
-
const e = {};
|
|
36
|
-
return Object.entries(t).forEach(([r, c]) => {
|
|
37
|
-
e[r] = c.map((n) => {
|
|
38
|
-
var s;
|
|
39
|
-
return ((s = o[n]) == null ? void 0 : s.color) ?? "#ccc";
|
|
40
|
-
});
|
|
41
|
-
}), e;
|
|
42
|
-
}
|
|
43
|
-
function d(t) {
|
|
44
|
-
const o = {};
|
|
45
|
-
return Object.entries(t).forEach(([e, r]) => {
|
|
46
|
-
o[e] = r.map((c) => {
|
|
47
|
-
const n = c.replace(e, "").toLowerCase();
|
|
48
|
-
return (s) => s[n + e];
|
|
49
|
-
});
|
|
50
|
-
}), o;
|
|
51
|
-
}
|
|
52
|
-
function m(t) {
|
|
53
|
-
const o = {};
|
|
54
|
-
return Object.entries(t).forEach(([e, r]) => {
|
|
55
|
-
o[e] = (c, n) => r[n] ?? "#ccc";
|
|
56
|
-
}), o;
|
|
57
|
-
}
|
|
58
|
-
function h(t) {
|
|
59
|
-
const o = t.length, e = 0.4, r = {};
|
|
60
|
-
return t.forEach((c, n) => {
|
|
61
|
-
const s = (n - (o - 1) / 2) * e;
|
|
62
|
-
r[c] = s;
|
|
63
|
-
}), r;
|
|
64
|
-
}
|
|
65
|
-
export {
|
|
66
|
-
b as useStackedGrouped
|
|
67
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { defineComponent as V, useSlots as b, useTemplateRef as D, ref as S, createElementBlock as d, openBlock as c, Fragment as T, createElementVNode as o, createCommentVNode as p, createVNode as r, renderSlot as a, unref as l, withCtx as w, normalizeStyle as B, toDisplayString as L } from "vue";
|
|
2
|
-
import { Donut as $ } from "@unovis/ts";
|
|
3
|
-
import { DonutType as H } from "./types.js";
|
|
4
|
-
import { VisSingleContainer as N, VisTooltip as W, VisDonut as _, VisBulletLegend as j } from "@unovis/vue";
|
|
5
|
-
const z = {
|
|
6
|
-
ref: "slotWrapper",
|
|
7
|
-
class: "hidden"
|
|
8
|
-
}, A = { class: "flex items-center" }, E = {
|
|
9
|
-
key: 0,
|
|
10
|
-
class: "flex items-center justify-center mt-4"
|
|
11
|
-
}, q = /* @__PURE__ */ V({
|
|
12
|
-
__name: "DonutChart",
|
|
13
|
-
props: {
|
|
14
|
-
type: {},
|
|
15
|
-
data: {},
|
|
16
|
-
height: {},
|
|
17
|
-
radius: {},
|
|
18
|
-
hideLegend: { type: Boolean },
|
|
19
|
-
labels: {},
|
|
20
|
-
padAngle: {}
|
|
21
|
-
},
|
|
22
|
-
emits: ["click"],
|
|
23
|
-
setup(f, { emit: m }) {
|
|
24
|
-
const g = m, n = f, h = b(), i = D("slotWrapper"), t = S(), v = (e) => e, y = n.type === H.Half;
|
|
25
|
-
function k(e) {
|
|
26
|
-
return t.value = e, C();
|
|
27
|
-
}
|
|
28
|
-
function C(e) {
|
|
29
|
-
return typeof window > "u" ? "" : i.value ? i.value.innerHTML : "";
|
|
30
|
-
}
|
|
31
|
-
return (e, u) => (c(), d(T, null, [
|
|
32
|
-
o("div", {
|
|
33
|
-
class: "flex items-center justify-center",
|
|
34
|
-
onClick: u[0] || (u[0] = (s) => g("click", s, t.value))
|
|
35
|
-
}, [
|
|
36
|
-
r(l(N), {
|
|
37
|
-
data: e.data,
|
|
38
|
-
height: e.height,
|
|
39
|
-
margin: {}
|
|
40
|
-
}, {
|
|
41
|
-
default: w(() => [
|
|
42
|
-
r(l(W), {
|
|
43
|
-
"horizontal-shift": 20,
|
|
44
|
-
"vertical-shift": 20,
|
|
45
|
-
triggers: {
|
|
46
|
-
[l($).selectors.segment]: k
|
|
47
|
-
}
|
|
48
|
-
}, null, 8, ["triggers"]),
|
|
49
|
-
r(l(_), {
|
|
50
|
-
value: v,
|
|
51
|
-
"corner-radius": e.radius,
|
|
52
|
-
color: n.labels.map((s) => s.color),
|
|
53
|
-
"angle-range": y ? [-1.5707963267948966, 1.5707963267948966] : [],
|
|
54
|
-
"pad-angle": n.padAngle || 0
|
|
55
|
-
}, null, 8, ["corner-radius", "color", "angle-range", "pad-angle"])
|
|
56
|
-
]),
|
|
57
|
-
_: 1
|
|
58
|
-
}, 8, ["data", "height"]),
|
|
59
|
-
a(e.$slots, "default"),
|
|
60
|
-
o("div", z, [
|
|
61
|
-
l(h).tooltip ? a(e.$slots, "tooltip", {
|
|
62
|
-
key: 0,
|
|
63
|
-
values: t.value
|
|
64
|
-
}) : t.value ? a(e.$slots, "fallback", { key: 1 }, () => [
|
|
65
|
-
o("div", A, [
|
|
66
|
-
o("div", {
|
|
67
|
-
class: "w-2 h-2 rounded-full mr-2",
|
|
68
|
-
style: B(`background-color: ${n.labels[t.value.index].color} ;`)
|
|
69
|
-
}, null, 4),
|
|
70
|
-
o("div", null, L(t.value.data), 1)
|
|
71
|
-
])
|
|
72
|
-
]) : p("", !0)
|
|
73
|
-
], 512)
|
|
74
|
-
]),
|
|
75
|
-
e.hideLegend ? p("", !0) : (c(), d("div", E, [
|
|
76
|
-
r(l(j), { items: e.labels }, null, 8, ["items"])
|
|
77
|
-
]))
|
|
78
|
-
], 64));
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
export {
|
|
82
|
-
q as default
|
|
83
|
-
};
|