vue-chrts 0.2.5-test.2 → 0.2.5-test.3
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 +73 -72
- package/dist/components/BarChart/BarChart.js +91 -91
- package/dist/components/DonutChart/DonutChart.js +40 -40
- package/dist/components/Timeline/Timeline.js +120 -0
- package/dist/components/Timeline/Timeline.vue.d.ts +33 -0
- package/dist/components/Timeline/Timeline2.js +4 -0
- package/dist/components/Timeline/types.d.ts +24 -0
- package/dist/components/Tooltip.js +23 -23
- package/dist/index.d.ts +2 -1
- package/dist/index.js +12 -10
- package/dist/types.d.ts +2 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +27 -26
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as W, useSlots as x, useTemplateRef as E, ref as M, computed as u, createElementBlock as c, openBlock as s, normalizeClass as w, normalizeStyle as g, createVNode as m, createCommentVNode as d, createElementVNode as X, unref as a, withCtx as z, createBlock as y, Fragment as v, renderList as R, mergeProps as h, renderSlot as T } from "vue";
|
|
2
2
|
import { Position as L, CurveType as C } from "@unovis/ts";
|
|
3
3
|
import { createMarkers as Y, getFirstPropertyValue as U } from "../../utils.js";
|
|
4
4
|
import H from "../Tooltip.js";
|
|
@@ -7,7 +7,7 @@ import { LegendPosition as _ } from "../../types.js";
|
|
|
7
7
|
const ee = {
|
|
8
8
|
ref: "slotWrapper",
|
|
9
9
|
style: { display: "none" }
|
|
10
|
-
},
|
|
10
|
+
}, ie = 0.5, $ = "#3b82f6", se = /* @__PURE__ */ W({
|
|
11
11
|
__name: "AreaChart",
|
|
12
12
|
props: {
|
|
13
13
|
data: {},
|
|
@@ -50,96 +50,97 @@ const ee = {
|
|
|
50
50
|
xDomain: {}
|
|
51
51
|
},
|
|
52
52
|
emits: ["click"],
|
|
53
|
-
setup(
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
(
|
|
53
|
+
setup(D, { emit: b }) {
|
|
54
|
+
const B = b, t = D, O = x(), k = E("slotWrapper"), p = M(), f = u(() => {
|
|
55
|
+
const e = Object.values(t.categories).map(
|
|
56
|
+
(n, i) => `var(--vis-color${i})`
|
|
57
57
|
);
|
|
58
|
-
return Object.values(
|
|
59
|
-
(
|
|
58
|
+
return Object.values(t.categories).map(
|
|
59
|
+
(n, i) => n.color ?? e[i]
|
|
60
60
|
);
|
|
61
|
-
}),
|
|
62
|
-
const
|
|
61
|
+
}), V = u(() => t.markerConfig ? Y(t.markerConfig) : ""), F = u(() => t.legendPosition.startsWith("top")), G = u(() => t.legendPosition.includes("left") ? "flex-start" : t.legendPosition.includes("right") ? "flex-end" : "center"), P = u(() => {
|
|
62
|
+
const e = (i, o) => {
|
|
63
63
|
var r;
|
|
64
64
|
return `
|
|
65
|
-
<linearGradient id="gradient${
|
|
66
|
-
${((r =
|
|
67
|
-
(
|
|
65
|
+
<linearGradient id="gradient${i}-${o}" gradientTransform="rotate(90)">
|
|
66
|
+
${((r = t.gradientStops) == null ? void 0 : r.map(
|
|
67
|
+
(l) => `<stop offset="${l.offset}" stop-color="${o}" stop-opacity="${l.stopOpacity}" />`
|
|
68
68
|
).join("")) ?? ""}
|
|
69
|
-
<stop offset="100%" stop-color="${
|
|
69
|
+
<stop offset="100%" stop-color="${o}" stop-opacity="0" />
|
|
70
70
|
</linearGradient>
|
|
71
71
|
`;
|
|
72
|
-
},
|
|
72
|
+
}, n = (i, o) => {
|
|
73
73
|
var r;
|
|
74
74
|
return `
|
|
75
|
-
<linearGradient id="gradient${
|
|
75
|
+
<linearGradient id="gradient${i}-${o}" gradientTransform="rotate(90)">
|
|
76
76
|
|
|
77
|
-
${((r =
|
|
78
|
-
(
|
|
79
|
-
<stop offset="${
|
|
77
|
+
${((r = t.gradientStops) == null ? void 0 : r.map(
|
|
78
|
+
(l) => `
|
|
79
|
+
<stop offset="${l.offset}" style="stop-color:var(${o});stop-opacity:${l.stopOpacity}" />
|
|
80
80
|
`
|
|
81
81
|
).join("")) ?? ""}
|
|
82
82
|
</linearGradient>
|
|
83
83
|
`;
|
|
84
84
|
};
|
|
85
|
-
return
|
|
86
|
-
(
|
|
85
|
+
return f.value.map(
|
|
86
|
+
(i, o) => i != null && i.includes("#") ? e(o, i) : n(o, i ?? $)
|
|
87
87
|
).join("");
|
|
88
88
|
});
|
|
89
|
-
function
|
|
90
|
-
var
|
|
89
|
+
function S(e) {
|
|
90
|
+
var n;
|
|
91
91
|
return {
|
|
92
|
-
y: (
|
|
93
|
-
color: ((
|
|
92
|
+
y: (i) => Number(i[e]),
|
|
93
|
+
color: ((n = t.categories[e]) == null ? void 0 : n.color) ?? $
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
return typeof window > "u" ? "" :
|
|
96
|
+
function j(e) {
|
|
97
|
+
return typeof window > "u" ? "" : k.value ? k.value.innerHTML : "";
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
return
|
|
99
|
+
function N(e) {
|
|
100
|
+
return p.value = e, j();
|
|
101
101
|
}
|
|
102
|
-
return (
|
|
103
|
-
style:
|
|
102
|
+
return (e, n) => (s(), c("div", {
|
|
103
|
+
style: g({
|
|
104
104
|
display: "flex",
|
|
105
|
-
flexDirection:
|
|
105
|
+
flexDirection: F.value ? "column-reverse" : "column",
|
|
106
106
|
gap: "var(--vis-legend-spacing)"
|
|
107
107
|
}),
|
|
108
|
-
class: w({ markers: !!
|
|
109
|
-
onClick:
|
|
108
|
+
class: w({ markers: !!t.markerConfig }),
|
|
109
|
+
onClick: n[0] || (n[0] = (i) => B("click", i, p.value))
|
|
110
110
|
}, [
|
|
111
|
-
|
|
111
|
+
m(a(q), {
|
|
112
112
|
data: e.data,
|
|
113
113
|
height: e.height,
|
|
114
114
|
padding: e.padding,
|
|
115
|
-
"svg-defs":
|
|
115
|
+
"svg-defs": P.value + V.value,
|
|
116
116
|
"y-domain": e.yDomain,
|
|
117
117
|
"x-domain": e.xDomain
|
|
118
118
|
}, {
|
|
119
119
|
default: z(() => [
|
|
120
|
-
e.hideTooltip ?
|
|
120
|
+
e.hideTooltip ? d("", !0) : (s(), y(a(J), {
|
|
121
121
|
key: 0,
|
|
122
|
-
"horizontal-placement":
|
|
123
|
-
"vertical-placement":
|
|
122
|
+
"horizontal-placement": a(L).Right,
|
|
123
|
+
"vertical-placement": a(L).Top
|
|
124
124
|
}, null, 8, ["horizontal-placement", "vertical-placement"])),
|
|
125
|
-
(
|
|
126
|
-
|
|
127
|
-
x: (r,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
(s(!0), c(v, null, R(Object.keys(t.categories), (i, o) => (s(), c(v, { key: i }, [
|
|
126
|
+
m(a(K), h({
|
|
127
|
+
x: (r, l) => l,
|
|
128
|
+
ref_for: !0
|
|
129
|
+
}, S(i), {
|
|
130
|
+
color: `url(#gradient${o}-${f.value[o]})`,
|
|
131
|
+
opacity: e.hideArea ? 0 : ie,
|
|
132
|
+
"curve-type": e.curveType ?? a(C).MonotoneX
|
|
132
133
|
}), null, 16, ["x", "color", "opacity", "curve-type"]),
|
|
133
|
-
|
|
134
|
-
x: (r,
|
|
135
|
-
y: (r) => r[
|
|
136
|
-
color:
|
|
137
|
-
"curve-type": e.curveType ??
|
|
134
|
+
m(a(Q), {
|
|
135
|
+
x: (r, l) => l,
|
|
136
|
+
y: (r) => r[i],
|
|
137
|
+
color: f.value[o],
|
|
138
|
+
"curve-type": e.curveType ?? a(C).MonotoneX,
|
|
138
139
|
"line-width": e.lineWidth,
|
|
139
|
-
lineDashArray: e.lineDashArray ? e.lineDashArray[
|
|
140
|
+
lineDashArray: e.lineDashArray ? e.lineDashArray[o] : void 0
|
|
140
141
|
}, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"])
|
|
141
142
|
], 64))), 128)),
|
|
142
|
-
e.hideXAxis ?
|
|
143
|
+
e.hideXAxis ? d("", !0) : (s(), y(a(A), {
|
|
143
144
|
key: 1,
|
|
144
145
|
type: "x",
|
|
145
146
|
label: e.xLabel,
|
|
@@ -152,7 +153,7 @@ const ee = {
|
|
|
152
153
|
"tick-line": e.xTickLine,
|
|
153
154
|
"min-max-ticks-only": e.minMaxTicksOnly
|
|
154
155
|
}, null, 8, ["label", "num-ticks", "tick-format", "tick-values", "grid-line", "domain-line", "tick-line", "min-max-ticks-only"])),
|
|
155
|
-
e.hideYAxis ?
|
|
156
|
+
e.hideYAxis ? d("", !0) : (s(), y(a(A), {
|
|
156
157
|
key: 2,
|
|
157
158
|
type: "y",
|
|
158
159
|
label: e.yLabel,
|
|
@@ -162,40 +163,40 @@ const ee = {
|
|
|
162
163
|
"domain-line": e.yDomainLine,
|
|
163
164
|
"tick-line": e.yTickLine
|
|
164
165
|
}, null, 8, ["label", "num-ticks", "tick-format", "grid-line", "domain-line", "tick-line"])),
|
|
165
|
-
e.hideTooltip ?
|
|
166
|
+
e.hideTooltip ? d("", !0) : (s(), y(a(Z), h({ key: 3 }, e.crosshairConfig, { template: N }), null, 16))
|
|
166
167
|
]),
|
|
167
168
|
_: 1
|
|
168
169
|
}, 8, ["data", "height", "padding", "svg-defs", "y-domain", "x-domain"]),
|
|
169
|
-
|
|
170
|
+
t.hideLegend ? d("", !0) : (s(), c("div", {
|
|
170
171
|
key: 0,
|
|
171
|
-
style:
|
|
172
|
+
style: g({
|
|
172
173
|
display: "flex",
|
|
173
|
-
justifyContent:
|
|
174
|
+
justifyContent: G.value
|
|
174
175
|
})
|
|
175
176
|
}, [
|
|
176
|
-
|
|
177
|
-
style:
|
|
178
|
-
|
|
177
|
+
m(a(I), {
|
|
178
|
+
style: g([
|
|
179
|
+
t.legendStyle,
|
|
179
180
|
"display: flex; gap: var(--vis-legend-spacing);"
|
|
180
181
|
]),
|
|
181
|
-
items: Object.values(
|
|
182
|
-
...
|
|
183
|
-
color: Array.isArray(
|
|
182
|
+
items: Object.values(t.categories).map((i) => ({
|
|
183
|
+
...i,
|
|
184
|
+
color: Array.isArray(i.color) ? i.color[0] : i.color
|
|
184
185
|
}))
|
|
185
186
|
}, null, 8, ["style", "items"])
|
|
186
187
|
], 4)),
|
|
187
188
|
X("div", ee, [
|
|
188
|
-
|
|
189
|
+
a(O).tooltip ? T(e.$slots, "tooltip", {
|
|
189
190
|
key: 0,
|
|
190
|
-
values:
|
|
191
|
-
}) :
|
|
192
|
-
|
|
193
|
-
data:
|
|
191
|
+
values: p.value
|
|
192
|
+
}) : p.value ? T(e.$slots, "fallback", { key: 1 }, () => [
|
|
193
|
+
m(H, {
|
|
194
|
+
data: p.value,
|
|
194
195
|
categories: e.categories,
|
|
195
|
-
toolTipTitle:
|
|
196
|
-
yFormatter:
|
|
196
|
+
toolTipTitle: a(U)(p.value) ?? "",
|
|
197
|
+
yFormatter: t.yFormatter
|
|
197
198
|
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
198
|
-
]) :
|
|
199
|
+
]) : d("", !0)
|
|
199
200
|
], 512)
|
|
200
201
|
], 6));
|
|
201
202
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as W, useSlots as X, useTemplateRef as Y, ref as j, computed as
|
|
2
|
-
import { Orientation as
|
|
1
|
+
import { defineComponent as W, useSlots as X, useTemplateRef as Y, ref as j, computed as f, createElementBlock as v, openBlock as n, normalizeStyle as L, createVNode as k, createCommentVNode as y, createElementVNode as H, unref as i, withCtx as $, createBlock as u, Fragment as q, renderList as I, renderSlot as P } from "vue";
|
|
2
|
+
import { Orientation as p, StackedBar as U, GroupedBar as J } from "@unovis/ts";
|
|
3
3
|
import { getFirstPropertyValue as K } from "../../utils.js";
|
|
4
4
|
import { useStackedGrouped as Q } from "./stackedGroupedUtils.js";
|
|
5
|
-
import { VisXYContainer as Z, VisXYLabels as _, VisTooltip as ee, VisStackedBar as
|
|
6
|
-
import
|
|
7
|
-
import { LegendPosition as
|
|
8
|
-
const
|
|
5
|
+
import { VisXYContainer as Z, VisXYLabels as _, VisTooltip as ee, VisStackedBar as C, VisGroupedBar as ae, VisAxis as F, VisBulletLegend as ie } from "@unovis/vue";
|
|
6
|
+
import oe from "../Tooltip.js";
|
|
7
|
+
import { LegendPosition as re } from "../../types.js";
|
|
8
|
+
const te = {
|
|
9
9
|
ref: "slotWrapper",
|
|
10
10
|
style: { display: "none" }
|
|
11
|
-
},
|
|
11
|
+
}, ge = /* @__PURE__ */ W({
|
|
12
12
|
__name: "BarChart",
|
|
13
13
|
props: {
|
|
14
14
|
data: {},
|
|
@@ -35,8 +35,8 @@ const oe = {
|
|
|
35
35
|
radius: {},
|
|
36
36
|
hideLegend: { type: Boolean, default: !1 },
|
|
37
37
|
hideTooltip: { type: Boolean, default: !1 },
|
|
38
|
-
orientation: { default:
|
|
39
|
-
legendPosition: { default:
|
|
38
|
+
orientation: { default: p.Vertical },
|
|
39
|
+
legendPosition: { default: re.BottomCenter },
|
|
40
40
|
legendStyle: { default: void 0 },
|
|
41
41
|
xDomainLine: { type: Boolean },
|
|
42
42
|
yDomainLine: { type: Boolean },
|
|
@@ -52,111 +52,111 @@ const oe = {
|
|
|
52
52
|
xAxis: {}
|
|
53
53
|
},
|
|
54
54
|
emits: ["click"],
|
|
55
|
-
setup(
|
|
56
|
-
const S = G,
|
|
57
|
-
if (
|
|
55
|
+
setup(V, { emit: G }) {
|
|
56
|
+
const S = G, a = V, O = X(), h = Y("slotWrapper"), s = j();
|
|
57
|
+
if (a.valueLabel && !a.xAxis)
|
|
58
58
|
throw new Error(
|
|
59
59
|
"BarChart: 'xAxis' prop is required when 'valueLabel' is enabled. Please provide an 'xAxis' to display value labels."
|
|
60
60
|
);
|
|
61
|
-
if (!
|
|
61
|
+
if (!a.yAxis || a.yAxis.length === 0)
|
|
62
62
|
throw new Error("yAxis is required");
|
|
63
|
-
const
|
|
64
|
-
var
|
|
65
|
-
return (
|
|
66
|
-
},
|
|
63
|
+
const x = f(() => a.yAxis.map((e) => (r) => r[e])), A = (e, r) => {
|
|
64
|
+
var o;
|
|
65
|
+
return (o = Object.values(a.categories)[r]) == null ? void 0 : o.color;
|
|
66
|
+
}, c = f(
|
|
67
67
|
() => Q({
|
|
68
|
-
data:
|
|
69
|
-
categories:
|
|
70
|
-
stackAndGrouped:
|
|
71
|
-
xAxis:
|
|
72
|
-
spacing:
|
|
68
|
+
data: a.data,
|
|
69
|
+
categories: a.categories,
|
|
70
|
+
stackAndGrouped: a.stackAndGrouped,
|
|
71
|
+
xAxis: a.xAxis,
|
|
72
|
+
spacing: a.stackedGroupedSpacing
|
|
73
73
|
}).value
|
|
74
|
-
), w =
|
|
75
|
-
function
|
|
76
|
-
return
|
|
74
|
+
), w = f(() => a.legendPosition.startsWith("top")), D = f(() => a.legendPosition.includes("left") ? "flex-start" : a.legendPosition.includes("right") ? "flex-end" : "center");
|
|
75
|
+
function B(e) {
|
|
76
|
+
return s.value = e, E();
|
|
77
77
|
}
|
|
78
|
-
function E(
|
|
78
|
+
function E(e) {
|
|
79
79
|
return typeof window > "u" ? "" : h.value ? h.value.innerHTML : "";
|
|
80
80
|
}
|
|
81
|
-
const
|
|
82
|
-
(
|
|
83
|
-
x:
|
|
84
|
-
y: Number(
|
|
85
|
-
itemIndex:
|
|
81
|
+
const T = a.yAxis.map((e) => (r) => r[e]), N = T.length, z = a.data.flatMap(
|
|
82
|
+
(e, r) => T.map((o, d) => ({
|
|
83
|
+
x: r,
|
|
84
|
+
y: Number(o(e) ?? 0),
|
|
85
|
+
itemIndex: d
|
|
86
86
|
}))
|
|
87
|
-
), M = (
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
return
|
|
87
|
+
), M = (e) => {
|
|
88
|
+
if (a.stacked || a.stackAndGrouped) return e.x;
|
|
89
|
+
const r = N;
|
|
90
|
+
if (r <= 1) return e.x;
|
|
91
|
+
const d = 1 - (a.groupPadding ?? 0), g = d / r, m = -d / 2, t = g * e.itemIndex + g / 2, b = 1 - (a.barPadding ?? 0), R = (m + t) * b;
|
|
92
|
+
return e.x + R;
|
|
93
93
|
};
|
|
94
|
-
return (
|
|
94
|
+
return (e, r) => (n(), v("div", {
|
|
95
95
|
style: L({
|
|
96
96
|
display: "flex",
|
|
97
97
|
flexDirection: w.value ? "column-reverse" : "column",
|
|
98
98
|
gap: "var(--vis-legend-spacing)"
|
|
99
99
|
}),
|
|
100
|
-
onClick:
|
|
100
|
+
onClick: r[0] || (r[0] = (o) => S("click", o, s.value))
|
|
101
101
|
}, [
|
|
102
|
-
|
|
102
|
+
k(i(Z), {
|
|
103
103
|
padding: e.padding,
|
|
104
104
|
height: e.height
|
|
105
105
|
}, {
|
|
106
106
|
default: $(() => {
|
|
107
|
-
var
|
|
107
|
+
var o, d, g, m;
|
|
108
108
|
return [
|
|
109
|
-
e.valueLabel ? (
|
|
109
|
+
e.valueLabel ? (n(), u(i(_), {
|
|
110
110
|
key: 0,
|
|
111
|
-
data:
|
|
111
|
+
data: i(z),
|
|
112
112
|
x: M,
|
|
113
|
-
y: (
|
|
114
|
-
var
|
|
115
|
-
return
|
|
113
|
+
y: (t) => {
|
|
114
|
+
var l;
|
|
115
|
+
return t.y + (((l = a.valueLabel) == null ? void 0 : l.labelSpacing) ?? 0);
|
|
116
116
|
},
|
|
117
|
-
label: (
|
|
118
|
-
backgroundColor: ((
|
|
119
|
-
color: ((
|
|
120
|
-
labelFontSize: (
|
|
121
|
-
}, null, 8, ["data", "y", "label", "backgroundColor", "color", "labelFontSize"])) :
|
|
122
|
-
|
|
117
|
+
label: (o = a.valueLabel) == null ? void 0 : o.label,
|
|
118
|
+
backgroundColor: ((d = a.valueLabel) == null ? void 0 : d.backgroundColor) ?? "transparent",
|
|
119
|
+
color: ((g = a.valueLabel) == null ? void 0 : g.color) ?? "red",
|
|
120
|
+
labelFontSize: (m = a.valueLabel) == null ? void 0 : m.labelFontSize
|
|
121
|
+
}, null, 8, ["data", "y", "label", "backgroundColor", "color", "labelFontSize"])) : y("", !0),
|
|
122
|
+
k(i(ee), {
|
|
123
123
|
triggers: {
|
|
124
|
-
[
|
|
125
|
-
[
|
|
124
|
+
[i(J).selectors.bar]: B,
|
|
125
|
+
[i(U).selectors.bar]: B
|
|
126
126
|
}
|
|
127
127
|
}, null, 8, ["triggers"]),
|
|
128
|
-
e.stackAndGrouped ? (
|
|
129
|
-
key:
|
|
130
|
-
data:
|
|
131
|
-
x: (
|
|
132
|
-
y:
|
|
133
|
-
color:
|
|
128
|
+
e.stackAndGrouped ? (n(!0), v(q, { key: 1 }, I(c.value.states, (t) => (n(), u(i(C), {
|
|
129
|
+
key: t,
|
|
130
|
+
data: c.value.chartData,
|
|
131
|
+
x: (l, b) => b + c.value.positions[t],
|
|
132
|
+
y: c.value.bars[t],
|
|
133
|
+
color: c.value.colorFunctions[t],
|
|
134
134
|
"rounded-corners": e.radius ?? 0,
|
|
135
135
|
"group-padding": e.groupPadding ?? 0,
|
|
136
136
|
"bar-padding": e.barPadding,
|
|
137
|
-
orientation: e.orientation ??
|
|
138
|
-
}, null, 8, ["data", "x", "y", "color", "rounded-corners", "group-padding", "bar-padding", "orientation"]))), 128)) : e.stacked ? (
|
|
137
|
+
orientation: e.orientation ?? i(p).Vertical
|
|
138
|
+
}, null, 8, ["data", "x", "y", "color", "rounded-corners", "group-padding", "bar-padding", "orientation"]))), 128)) : e.stacked ? (n(), u(i(C), {
|
|
139
139
|
key: 3,
|
|
140
140
|
data: e.data,
|
|
141
|
-
x: (
|
|
142
|
-
y:
|
|
143
|
-
color:
|
|
141
|
+
x: (t, l) => l,
|
|
142
|
+
y: x.value,
|
|
143
|
+
color: A,
|
|
144
144
|
"rounded-corners": e.radius ?? 0,
|
|
145
145
|
"group-padding": e.groupPadding ?? 0,
|
|
146
146
|
"bar-padding": e.barPadding ?? 0.2,
|
|
147
|
-
orientation: e.orientation ??
|
|
148
|
-
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (
|
|
147
|
+
orientation: e.orientation ?? i(p).Vertical
|
|
148
|
+
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (n(), u(i(ae), {
|
|
149
149
|
key: 2,
|
|
150
150
|
data: e.data,
|
|
151
|
-
x: (
|
|
152
|
-
y:
|
|
153
|
-
color:
|
|
151
|
+
x: (t, l) => l,
|
|
152
|
+
y: x.value,
|
|
153
|
+
color: A,
|
|
154
154
|
"rounded-corners": e.radius ?? 0,
|
|
155
155
|
"group-padding": e.groupPadding ?? 0,
|
|
156
156
|
"bar-padding": e.barPadding ?? 0.2,
|
|
157
|
-
orientation: e.orientation ??
|
|
157
|
+
orientation: e.orientation ?? i(p).Vertical
|
|
158
158
|
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
|
|
159
|
-
e.hideXAxis ?
|
|
159
|
+
e.hideXAxis ? y("", !0) : (n(), u(i(F), {
|
|
160
160
|
key: 4,
|
|
161
161
|
type: "x",
|
|
162
162
|
"tick-format": e.xFormatter,
|
|
@@ -168,11 +168,11 @@ const oe = {
|
|
|
168
168
|
"tick-values": e.xExplicitTicks,
|
|
169
169
|
minMaxTicksOnly: e.minMaxTicksOnly
|
|
170
170
|
}, null, 8, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "minMaxTicksOnly"])),
|
|
171
|
-
e.hideYAxis ?
|
|
171
|
+
e.hideYAxis ? y("", !0) : (n(), u(i(F), {
|
|
172
172
|
key: 5,
|
|
173
173
|
type: "y",
|
|
174
174
|
label: e.yLabel,
|
|
175
|
-
"grid-line": e.orientation !==
|
|
175
|
+
"grid-line": e.orientation !== i(p).Horizontal && e.yGridLine,
|
|
176
176
|
"domain-line": !!e.yDomainLine,
|
|
177
177
|
"tick-format": e.yFormatter,
|
|
178
178
|
"num-ticks": e.yNumTicks,
|
|
@@ -182,40 +182,40 @@ const oe = {
|
|
|
182
182
|
}),
|
|
183
183
|
_: 1
|
|
184
184
|
}, 8, ["padding", "height"]),
|
|
185
|
-
|
|
185
|
+
a.hideLegend ? y("", !0) : (n(), v("div", {
|
|
186
186
|
key: 0,
|
|
187
187
|
style: L({
|
|
188
188
|
display: "flex",
|
|
189
189
|
justifyContent: D.value
|
|
190
190
|
})
|
|
191
191
|
}, [
|
|
192
|
-
|
|
192
|
+
k(i(ie), {
|
|
193
193
|
style: L([
|
|
194
|
-
|
|
194
|
+
a.legendStyle,
|
|
195
195
|
"display: flex; gap: var(--vis-legend-spacing);"
|
|
196
196
|
]),
|
|
197
|
-
items: Object.values(
|
|
198
|
-
...
|
|
199
|
-
color: Array.isArray(
|
|
197
|
+
items: Object.values(a.categories).map((o) => ({
|
|
198
|
+
...o,
|
|
199
|
+
color: Array.isArray(o.color) ? o.color[0] : o.color
|
|
200
200
|
}))
|
|
201
201
|
}, null, 8, ["style", "items"])
|
|
202
202
|
], 4)),
|
|
203
|
-
H("div",
|
|
204
|
-
|
|
203
|
+
H("div", te, [
|
|
204
|
+
i(O).tooltip ? P(e.$slots, "tooltip", {
|
|
205
205
|
key: 0,
|
|
206
|
-
values:
|
|
207
|
-
}) :
|
|
208
|
-
|
|
209
|
-
data:
|
|
210
|
-
categories:
|
|
211
|
-
toolTipTitle:
|
|
212
|
-
yFormatter:
|
|
206
|
+
values: s.value
|
|
207
|
+
}) : s.value ? P(e.$slots, "fallback", { key: 1 }, () => [
|
|
208
|
+
k(oe, {
|
|
209
|
+
data: s.value,
|
|
210
|
+
categories: a.categories,
|
|
211
|
+
toolTipTitle: i(K)(s.value) ?? "",
|
|
212
|
+
yFormatter: a.orientation === i(p).Horizontal ? a.xFormatter : a.yFormatter
|
|
213
213
|
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
214
|
-
]) :
|
|
214
|
+
]) : y("", !0)
|
|
215
215
|
], 512)
|
|
216
216
|
], 4));
|
|
217
217
|
}
|
|
218
218
|
});
|
|
219
219
|
export {
|
|
220
|
-
|
|
220
|
+
ge as default
|
|
221
221
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as x, useSlots as D, useTemplateRef as L, ref as T, computed as p, createElementBlock as g, openBlock as c, normalizeStyle as o, createVNode as i, createCommentVNode as f, renderSlot as s, createElementVNode as r, unref as n, withCtx as B, toDisplayString as P } from "vue";
|
|
2
2
|
import { Donut as W } from "@unovis/ts";
|
|
3
3
|
import { DonutType as R } from "./types.js";
|
|
4
4
|
import { VisSingleContainer as A, VisTooltip as H, VisDonut as N, VisBulletLegend as $ } from "@unovis/vue";
|
|
@@ -6,7 +6,7 @@ import { LegendPosition as z } from "../../types.js";
|
|
|
6
6
|
const E = {
|
|
7
7
|
ref: "slotWrapper",
|
|
8
8
|
style: { display: "none" }
|
|
9
|
-
}, j = { style: { display: "flex", "align-items": "center", padding: "10px 15px" } },
|
|
9
|
+
}, j = { style: { display: "flex", "align-items": "center", padding: "10px 15px" } }, G = /* @__PURE__ */ x({
|
|
10
10
|
__name: "DonutChart",
|
|
11
11
|
props: {
|
|
12
12
|
type: {},
|
|
@@ -21,85 +21,85 @@ const E = {
|
|
|
21
21
|
padAngle: {}
|
|
22
22
|
},
|
|
23
23
|
emits: ["click"],
|
|
24
|
-
setup(
|
|
25
|
-
const v = h,
|
|
26
|
-
function
|
|
27
|
-
return
|
|
24
|
+
setup(m, { emit: h }) {
|
|
25
|
+
const v = h, t = m, y = D(), d = L("slotWrapper"), l = T(), C = (e) => e, k = t.type === R.Half;
|
|
26
|
+
function V(e) {
|
|
27
|
+
return l.value = e, b();
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
return typeof window > "u" ? "" :
|
|
29
|
+
function b(e) {
|
|
30
|
+
return typeof window > "u" ? "" : d.value ? d.value.innerHTML : "";
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
return (
|
|
32
|
+
const S = p(() => t.legendPosition.includes("top")), w = p(() => t.legendPosition.includes("left") ? "flex-start" : t.legendPosition.includes("right") ? "flex-end" : "center");
|
|
33
|
+
return (e, u) => (c(), g("div", {
|
|
34
34
|
style: o({
|
|
35
35
|
display: "flex",
|
|
36
|
-
flexDirection:
|
|
36
|
+
flexDirection: S.value ? "column-reverse" : "column",
|
|
37
37
|
gap: "var(--vis-legend-spacing)"
|
|
38
38
|
}),
|
|
39
|
-
onClick:
|
|
39
|
+
onClick: u[0] || (u[0] = (a) => v("click", a, l.value))
|
|
40
40
|
}, [
|
|
41
|
-
|
|
42
|
-
data:
|
|
43
|
-
height:
|
|
41
|
+
i(n(A), {
|
|
42
|
+
data: e.data,
|
|
43
|
+
height: e.height,
|
|
44
44
|
margin: {}
|
|
45
45
|
}, {
|
|
46
46
|
default: B(() => [
|
|
47
|
-
|
|
47
|
+
i(n(H), {
|
|
48
48
|
"horizontal-shift": 20,
|
|
49
49
|
"vertical-shift": 20,
|
|
50
50
|
triggers: {
|
|
51
|
-
[
|
|
51
|
+
[n(W).selectors.segment]: V
|
|
52
52
|
}
|
|
53
53
|
}, null, 8, ["triggers"]),
|
|
54
|
-
|
|
55
|
-
value:
|
|
56
|
-
"corner-radius":
|
|
57
|
-
"arc-width":
|
|
58
|
-
color:
|
|
59
|
-
"angle-range":
|
|
60
|
-
"pad-angle":
|
|
54
|
+
i(n(N), {
|
|
55
|
+
value: C,
|
|
56
|
+
"corner-radius": e.radius,
|
|
57
|
+
"arc-width": e.arcWidth ?? 20,
|
|
58
|
+
color: t.labels.map((a) => a.color),
|
|
59
|
+
"angle-range": k ? [-1.5707963267948966, 1.5707963267948966] : [],
|
|
60
|
+
"pad-angle": t.padAngle || 0
|
|
61
61
|
}, null, 8, ["corner-radius", "arc-width", "color", "angle-range", "pad-angle"])
|
|
62
62
|
]),
|
|
63
63
|
_: 1
|
|
64
64
|
}, 8, ["data", "height"]),
|
|
65
|
-
|
|
65
|
+
t.hideLegend ? f("", !0) : (c(), g("div", {
|
|
66
66
|
key: 0,
|
|
67
67
|
style: o({
|
|
68
68
|
display: "flex",
|
|
69
|
-
justifyContent:
|
|
69
|
+
justifyContent: w.value
|
|
70
70
|
})
|
|
71
71
|
}, [
|
|
72
|
-
|
|
72
|
+
i(n($), {
|
|
73
73
|
style: o([
|
|
74
|
-
|
|
74
|
+
t.legendStyle,
|
|
75
75
|
"display: flex; gap: var(--vis-legend-spacing);"
|
|
76
76
|
]),
|
|
77
|
-
items:
|
|
77
|
+
items: e.labels
|
|
78
78
|
}, null, 8, ["style", "items"])
|
|
79
79
|
], 4)),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
s(e.$slots, "default"),
|
|
81
|
+
r("div", E, [
|
|
82
|
+
n(y).tooltip ? s(e.$slots, "tooltip", {
|
|
83
83
|
key: 0,
|
|
84
|
-
values:
|
|
85
|
-
}) :
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
values: l.value
|
|
85
|
+
}) : l.value ? s(e.$slots, "fallback", { key: 1 }, () => [
|
|
86
|
+
r("div", j, [
|
|
87
|
+
r("div", {
|
|
88
88
|
style: o({
|
|
89
89
|
width: "0.5rem",
|
|
90
90
|
height: "0.5rem",
|
|
91
91
|
borderRadius: "9999px",
|
|
92
92
|
marginRight: "0.5rem",
|
|
93
|
-
backgroundColor:
|
|
93
|
+
backgroundColor: t.labels[l.value.index].color
|
|
94
94
|
})
|
|
95
95
|
}, null, 4),
|
|
96
|
-
|
|
96
|
+
r("div", null, P(l.value.data), 1)
|
|
97
97
|
])
|
|
98
|
-
]) :
|
|
98
|
+
]) : f("", !0)
|
|
99
99
|
], 512)
|
|
100
100
|
], 4));
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
export {
|
|
104
|
-
|
|
104
|
+
G as default
|
|
105
105
|
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { defineComponent as L, useSlots as V, useTemplateRef as C, ref as _, computed as c, createElementBlock as u, openBlock as p, normalizeStyle as d, createVNode as i, createCommentVNode as g, createElementVNode as H, unref as o, withCtx as B, renderSlot as f } from "vue";
|
|
2
|
+
import { Timeline as P } from "@unovis/ts";
|
|
3
|
+
import { dateFormatter as S, getFirstPropertyValue as j } from "../../utils.js";
|
|
4
|
+
import A from "../Tooltip.js";
|
|
5
|
+
import { VisXYContainer as F, VisTimeline as $, VisTooltip as N, VisAxis as O, VisBulletLegend as E } from "@unovis/vue";
|
|
6
|
+
import { LegendPosition as R } from "../../types.js";
|
|
7
|
+
const G = /* @__PURE__ */ L({
|
|
8
|
+
__name: "Timeline",
|
|
9
|
+
props: {
|
|
10
|
+
data: {},
|
|
11
|
+
labelWidth: { default: 220 },
|
|
12
|
+
height: {},
|
|
13
|
+
title: { default: "" },
|
|
14
|
+
categories: {},
|
|
15
|
+
x: {},
|
|
16
|
+
length: {},
|
|
17
|
+
type: {},
|
|
18
|
+
getTooltipText: {},
|
|
19
|
+
showLabels: { type: Boolean, default: !0 },
|
|
20
|
+
hideTooltip: { type: Boolean, default: !1 },
|
|
21
|
+
crosshairConfig: {},
|
|
22
|
+
lineWidth: { default: 12 },
|
|
23
|
+
rowHeight: { default: 24 },
|
|
24
|
+
legendPosition: { default: R.TopRight },
|
|
25
|
+
legendStyle: {},
|
|
26
|
+
hideLegend: { type: Boolean }
|
|
27
|
+
},
|
|
28
|
+
emits: ["click", "scroll", "labelHover"],
|
|
29
|
+
setup(h, { emit: m }) {
|
|
30
|
+
const e = h, n = m, y = V(), s = C("slotWrapper"), r = _(), v = c(() => e.legendPosition.startsWith("top")), T = c(() => e.legendPosition.includes("left") ? "flex-start" : e.legendPosition.includes("right") ? "flex-end" : "center"), b = { [P.selectors.label]: k };
|
|
31
|
+
function k(t) {
|
|
32
|
+
return r.value = t, n("labelHover", t), typeof window > "u" ? "" : s.value ? s.value.innerHTML : "";
|
|
33
|
+
}
|
|
34
|
+
function x(t, a, l) {
|
|
35
|
+
n("click", l, { index: a, item: t });
|
|
36
|
+
}
|
|
37
|
+
function W(t) {
|
|
38
|
+
n("scroll", t.deltaY);
|
|
39
|
+
}
|
|
40
|
+
const w = c(() => {
|
|
41
|
+
const t = Object.values(e.categories).map(
|
|
42
|
+
(a, l) => `var(--vis-color${l})`
|
|
43
|
+
);
|
|
44
|
+
return Object.values(e.categories).map(
|
|
45
|
+
(a, l) => a.color ?? t[l]
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
return (t, a) => (p(), u("div", {
|
|
49
|
+
style: d({
|
|
50
|
+
display: "flex",
|
|
51
|
+
flexDirection: v.value ? "column-reverse" : "column",
|
|
52
|
+
gap: "var(--vis-legend-spacing)"
|
|
53
|
+
})
|
|
54
|
+
}, [
|
|
55
|
+
i(o(F), {
|
|
56
|
+
data: e.data,
|
|
57
|
+
height: e.height,
|
|
58
|
+
onWheel: W
|
|
59
|
+
}, {
|
|
60
|
+
default: B(() => [
|
|
61
|
+
i(o($), {
|
|
62
|
+
x: e.x,
|
|
63
|
+
length: e.length,
|
|
64
|
+
lineWidth: e.lineWidth,
|
|
65
|
+
rowHeight: e.rowHeight,
|
|
66
|
+
type: e.type,
|
|
67
|
+
color: w.value,
|
|
68
|
+
labelWidth: e.labelWidth,
|
|
69
|
+
showLabels: e.showLabels,
|
|
70
|
+
onClick: x
|
|
71
|
+
}, null, 8, ["x", "length", "lineWidth", "rowHeight", "type", "color", "labelWidth", "showLabels"]),
|
|
72
|
+
i(o(N), { triggers: b }),
|
|
73
|
+
i(o(O), {
|
|
74
|
+
type: "x",
|
|
75
|
+
tickFormat: o(S),
|
|
76
|
+
numTicks: 10
|
|
77
|
+
}, null, 8, ["tickFormat"])
|
|
78
|
+
]),
|
|
79
|
+
_: 1
|
|
80
|
+
}, 8, ["data", "height"]),
|
|
81
|
+
e.hideLegend ? g("", !0) : (p(), u("div", {
|
|
82
|
+
key: 0,
|
|
83
|
+
style: d({
|
|
84
|
+
display: "flex",
|
|
85
|
+
justifyContent: T.value
|
|
86
|
+
})
|
|
87
|
+
}, [
|
|
88
|
+
i(o(E), {
|
|
89
|
+
style: d([
|
|
90
|
+
e.legendStyle,
|
|
91
|
+
"display: flex; gap: var(--vis-legend-spacing);"
|
|
92
|
+
]),
|
|
93
|
+
items: Object.values(e.categories).map((l) => ({
|
|
94
|
+
...l,
|
|
95
|
+
color: Array.isArray(l.color) ? l.color[0] : l.color
|
|
96
|
+
}))
|
|
97
|
+
}, null, 8, ["style", "items"])
|
|
98
|
+
], 4)),
|
|
99
|
+
H("div", {
|
|
100
|
+
ref_key: "slotWrapper",
|
|
101
|
+
ref: s,
|
|
102
|
+
style: { display: "none" }
|
|
103
|
+
}, [
|
|
104
|
+
o(y).labelTooltip ? f(t.$slots, "labelTooltip", {
|
|
105
|
+
key: 0,
|
|
106
|
+
values: r.value
|
|
107
|
+
}) : r.value ? f(t.$slots, "fallback", { key: 1 }, () => [
|
|
108
|
+
i(A, {
|
|
109
|
+
data: r.value,
|
|
110
|
+
categories: t.categories,
|
|
111
|
+
toolTipTitle: o(j)(r.value) ?? ""
|
|
112
|
+
}, null, 8, ["data", "categories", "toolTipTitle"])
|
|
113
|
+
]) : g("", !0)
|
|
114
|
+
], 512)
|
|
115
|
+
], 4));
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
export {
|
|
119
|
+
G as default
|
|
120
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TimelineProps } from '../../types';
|
|
2
|
+
export interface TimelineCategory {
|
|
3
|
+
name: string;
|
|
4
|
+
color?: string | string[];
|
|
5
|
+
}
|
|
6
|
+
declare const _default: <T extends Record<string, any>>(__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<{
|
|
7
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
8
|
+
readonly onClick?: ((event: MouseEvent, data: {
|
|
9
|
+
index: number;
|
|
10
|
+
item: T;
|
|
11
|
+
}) => any) | undefined;
|
|
12
|
+
readonly onScroll?: ((distance: number) => any) | undefined;
|
|
13
|
+
readonly onLabelHover?: ((item: T | undefined) => any) | undefined;
|
|
14
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick" | "onScroll" | "onLabelHover"> & TimelineProps<T> & Partial<{}>> & import('vue').PublicProps;
|
|
15
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
16
|
+
attrs: any;
|
|
17
|
+
slots: {
|
|
18
|
+
labelTooltip?(_: {
|
|
19
|
+
values: T | undefined;
|
|
20
|
+
}): any;
|
|
21
|
+
fallback?(_: {}): any;
|
|
22
|
+
};
|
|
23
|
+
emit: ((evt: "click", event: MouseEvent, data: {
|
|
24
|
+
index: number;
|
|
25
|
+
item: T;
|
|
26
|
+
}) => void) & ((evt: "scroll", distance: number) => void) & ((evt: "labelHover", item: T | undefined) => void);
|
|
27
|
+
}>) => import('vue').VNode & {
|
|
28
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
29
|
+
};
|
|
30
|
+
export default _default;
|
|
31
|
+
type __VLS_PrettifyLocal<T> = {
|
|
32
|
+
[K in keyof T]: T[K];
|
|
33
|
+
} & {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BulletLegendItemInterface, CrosshairConfig, LegendPosition } from '../../types';
|
|
2
|
+
export interface TimelineLegendItem {
|
|
3
|
+
name: string;
|
|
4
|
+
color: string;
|
|
5
|
+
}
|
|
6
|
+
export interface TimelineProps<T extends Record<string, any>> {
|
|
7
|
+
data: T[];
|
|
8
|
+
labelWidth?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
title?: string;
|
|
11
|
+
categories: Record<string, BulletLegendItemInterface>;
|
|
12
|
+
x: (d: T) => number;
|
|
13
|
+
length: (d: T) => number;
|
|
14
|
+
type: (d: T) => string;
|
|
15
|
+
getTooltipText?: (label: string, index: number, data: T[]) => string;
|
|
16
|
+
showLabels?: boolean;
|
|
17
|
+
hideTooltip?: boolean;
|
|
18
|
+
crosshairConfig?: CrosshairConfig;
|
|
19
|
+
lineWidth?: number;
|
|
20
|
+
rowHeight?: number;
|
|
21
|
+
legendPosition?: LegendPosition;
|
|
22
|
+
legendStyle?: Record<string, string>;
|
|
23
|
+
hideLegend?: boolean;
|
|
24
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as y, computed as b, createElementBlock as r, openBlock as i, createElementVNode as e, toDisplayString as l, Fragment as f, renderList as h, normalizeStyle as n } from "vue";
|
|
2
|
+
const x = { style: { padding: "10px 15px" } }, B = { style: {
|
|
3
3
|
color: "var(--tooltip-value-color)",
|
|
4
4
|
textTransform: "capitalize",
|
|
5
5
|
borderBottom: "borderBottom: 1px solid var(--tooltip-border-color)",
|
|
6
6
|
marginBottom: "0.25rem",
|
|
7
7
|
paddingBottom: "0.25rem"
|
|
8
|
-
} },
|
|
8
|
+
} }, T = /* @__PURE__ */ y({
|
|
9
9
|
__name: "Tooltip",
|
|
10
10
|
props: {
|
|
11
11
|
data: {},
|
|
@@ -13,30 +13,30 @@ const h = { style: { padding: "10px 15px" } }, B = { style: {
|
|
|
13
13
|
toolTipTitle: {},
|
|
14
14
|
yFormatter: { type: Function }
|
|
15
15
|
},
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
18
|
-
([
|
|
16
|
+
setup(d) {
|
|
17
|
+
const a = d, m = ["_index", "_stacked", "_ending"], g = b(() => Object.entries(a.data ?? []).filter(
|
|
18
|
+
([o, u]) => !m.includes(o) && Object.keys(a.categories).includes(o)
|
|
19
19
|
));
|
|
20
|
-
return (
|
|
21
|
-
|
|
22
|
-
(
|
|
23
|
-
var
|
|
24
|
-
return
|
|
25
|
-
key:
|
|
20
|
+
return (o, u) => (i(), r("div", x, [
|
|
21
|
+
e("div", B, l(o.toolTipTitle), 1),
|
|
22
|
+
(i(!0), r(f, null, h(g.value, ([t, s], v) => {
|
|
23
|
+
var p, c;
|
|
24
|
+
return i(), r("div", {
|
|
25
|
+
key: t,
|
|
26
26
|
style: { display: "flex", "align-items": "center", "margin-bottom": "4px" }
|
|
27
27
|
}, [
|
|
28
|
-
|
|
29
|
-
style:
|
|
30
|
-
backgroundColor: typeof ((
|
|
28
|
+
e("span", {
|
|
29
|
+
style: n([{ width: "8px", height: "8px", "border-radius": "4px", "margin-right": "8px" }, {
|
|
30
|
+
backgroundColor: typeof ((p = o.categories[t]) == null ? void 0 : p.color) == "string" && ((c = o.categories[t]) != null && c.color) ? o.categories[t].color : `var(--vis-color${v})`
|
|
31
31
|
}])
|
|
32
32
|
}, null, 4),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
style:
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
style:
|
|
39
|
-
},
|
|
33
|
+
e("div", null, [
|
|
34
|
+
e("span", {
|
|
35
|
+
style: n([{ "font-weight": "600", "margin-right": "8px" }, { color: "var(--tooltip-label-color)" }])
|
|
36
|
+
}, l(o.categories[t].name) + ":", 1),
|
|
37
|
+
e("span", {
|
|
38
|
+
style: n([{ "font-weight": "400" }, { color: "var(--tooltip-value-color)" }])
|
|
39
|
+
}, l(o.yFormatter ? o.yFormatter(s) : s), 1)
|
|
40
40
|
])
|
|
41
41
|
]);
|
|
42
42
|
}), 128))
|
|
@@ -44,5 +44,5 @@ const h = { style: { padding: "10px 15px" } }, B = { style: {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
export {
|
|
47
|
-
|
|
47
|
+
T as default
|
|
48
48
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { default as LineChart } from './components/LineChart/LineChart.vue';
|
|
|
3
3
|
import { default as BarChart } from './components/BarChart/BarChart.vue';
|
|
4
4
|
import { default as DonutChart } from './components/DonutChart/DonutChart.vue';
|
|
5
5
|
import { default as BubbleChart } from './components/BubbleChart/BubbleChart.vue';
|
|
6
|
+
import { default as Timeline } from './components/Timeline/Timeline.vue';
|
|
6
7
|
import { LegendPosition, CurveType, Orientation, BulletLegendItemInterface, MarkerConfig, CrosshairConfig } from './types';
|
|
7
|
-
export { AreaChart, LineChart, BarChart, DonutChart, BubbleChart, Orientation, CurveType, LegendPosition };
|
|
8
|
+
export { AreaChart, LineChart, BarChart, DonutChart, BubbleChart, Timeline, Orientation, CurveType, LegendPosition };
|
|
8
9
|
export type { BulletLegendItemInterface, MarkerConfig, CrosshairConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { default as
|
|
1
|
+
import { default as t } from "./components/AreaChart/AreaChart.js";
|
|
2
2
|
import { default as o } from "./components/LineChart/LineChart.js";
|
|
3
3
|
import { default as u } from "./components/BarChart/BarChart.js";
|
|
4
|
-
import { default as
|
|
5
|
-
import { default as
|
|
6
|
-
import {
|
|
4
|
+
import { default as m } from "./components/DonutChart/DonutChart.js";
|
|
5
|
+
import { default as d } from "./components/BubbleChart/BubbleChart.js";
|
|
6
|
+
import { default as n } from "./components/Timeline/Timeline.js";
|
|
7
|
+
import { CurveType as x, LegendPosition as C, Orientation as h } from "./types.js";
|
|
7
8
|
export {
|
|
8
|
-
|
|
9
|
+
t as AreaChart,
|
|
9
10
|
u as BarChart,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
d as BubbleChart,
|
|
12
|
+
x as CurveType,
|
|
13
|
+
m as DonutChart,
|
|
14
|
+
C as LegendPosition,
|
|
14
15
|
o as LineChart,
|
|
15
|
-
|
|
16
|
+
h as Orientation,
|
|
17
|
+
n as Timeline
|
|
16
18
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { BarChartProps } from './components/BarChart/types';
|
|
|
3
3
|
import { LineChartProps } from './components/LineChart/types';
|
|
4
4
|
import { DonutChartProps } from './components/DonutChart/types';
|
|
5
5
|
import { BubbleChartProps } from './components/BubbleChart/types';
|
|
6
|
+
import { TimelineProps, TimelineLegendItem } from './components/Timeline/types';
|
|
6
7
|
declare enum LegendPosition {
|
|
7
8
|
TopLeft = "top-left",
|
|
8
9
|
TopCenter = "top-center",
|
|
@@ -44,7 +45,7 @@ declare enum Orientation {
|
|
|
44
45
|
Horizontal = "horizontal",
|
|
45
46
|
Vertical = "vertical"
|
|
46
47
|
}
|
|
47
|
-
export { LegendPosition, CurveType, Orientation, type AreaChartProps, type BarChartProps, type LineChartProps, type DonutChartProps, type BulletLegendItemInterface, type BubbleChartProps };
|
|
48
|
+
export { LegendPosition, CurveType, Orientation, type AreaChartProps, type BarChartProps, type LineChartProps, type DonutChartProps, type BulletLegendItemInterface, type BubbleChartProps, type TimelineProps, type TimelineLegendItem };
|
|
48
49
|
export type axisFormatter = ((tick: number, i?: number, ticks?: number[]) => string) | ((tick: Date, i?: number, ticks?: Date[]) => string);
|
|
49
50
|
export interface MarkerConfig {
|
|
50
51
|
type?: "circle" | "square" | "triangle" | "diamond";
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
function
|
|
2
|
-
if (
|
|
3
|
-
const e = Object.keys(
|
|
4
|
-
return
|
|
1
|
+
function m(t) {
|
|
2
|
+
if (t && Object.keys(t).length > 0) {
|
|
3
|
+
const e = Object.keys(t)[0];
|
|
4
|
+
return t[e];
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
const
|
|
8
|
-
switch (
|
|
7
|
+
const o = (t, e, r, n, $) => {
|
|
8
|
+
switch (t) {
|
|
9
9
|
case "circle":
|
|
10
|
-
return `<circle cx="${e / 2}" cy="${e / 2}" r="${(e - r) / 2}" stroke-width="${r}" stroke="${$}" fill="${
|
|
10
|
+
return `<circle cx="${e / 2}" cy="${e / 2}" r="${(e - r) / 2}" stroke-width="${r}" stroke="${$}" fill="${n}" />`;
|
|
11
11
|
case "square":
|
|
12
|
-
return `<rect x="${r / 2}" y="${r / 2}" width="${e - r}" height="${e - r}" stroke-width="${r}" stroke="${$}" fill="${
|
|
12
|
+
return `<rect x="${r / 2}" y="${r / 2}" width="${e - r}" height="${e - r}" stroke-width="${r}" stroke="${$}" fill="${n}" />`;
|
|
13
13
|
case "triangle":
|
|
14
|
-
return `<polygon points="${e / 2},${r / 2} ${e - r / 2},${e - r / 2} ${r / 2},${e - r / 2}" stroke-width="${r}" stroke="${$}" fill="${
|
|
14
|
+
return `<polygon points="${e / 2},${r / 2} ${e - r / 2},${e - r / 2} ${r / 2},${e - r / 2}" stroke-width="${r}" stroke="${$}" fill="${n}" />`;
|
|
15
15
|
case "diamond":
|
|
16
|
-
return `<polygon points="${e / 2},${r / 2} ${e - r / 2},${e / 2} ${e / 2},${e - r / 2} ${r / 2},${e / 2}" stroke-width="${r}" stroke="${$}" fill="${
|
|
16
|
+
return `<polygon points="${e / 2},${r / 2} ${e - r / 2},${e / 2} ${e / 2},${e - r / 2} ${r / 2},${e / 2}" stroke-width="${r}" stroke="${$}" fill="${n}" />`;
|
|
17
17
|
default:
|
|
18
18
|
return "";
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
function
|
|
22
|
-
return Object.entries(
|
|
23
|
-
const
|
|
21
|
+
function p(t) {
|
|
22
|
+
return Object.entries(t).map(([e, r]) => {
|
|
23
|
+
const n = r.type || "circle", $ = r.size || 10, c = r.strokeWidth || 2, a = r.color || "#000", l = r.strokeColor || r.color || "#000";
|
|
24
24
|
return `<marker id="circle-marker-${e}" viewBox="0 0 ${$} ${$}" refX="${$ / 2}" refY="${$ / 2}" markerWidth="${$ / 2}" markerHeight="${$ / 2}">
|
|
25
|
-
${
|
|
25
|
+
${o(n, $, c, a, l)}
|
|
26
26
|
</marker>`;
|
|
27
27
|
}).join(`
|
|
28
28
|
`);
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
30
|
+
function u(t) {
|
|
31
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
const r = Object.keys(
|
|
35
|
-
return
|
|
33
|
+
const f = (t, e) => {
|
|
34
|
+
const r = Object.keys(t[0]).filter(($) => $ !== e), n = Object.keys(t[0][r[0]]);
|
|
35
|
+
return t.map(($) => ({
|
|
36
36
|
month: $.month,
|
|
37
37
|
...r.flatMap(
|
|
38
|
-
(c) =>
|
|
39
|
-
[`${c}${
|
|
38
|
+
(c) => n.map((a) => ({
|
|
39
|
+
[`${c}${u(a)}`]: $[c][a]
|
|
40
40
|
}))
|
|
41
41
|
).reduce((c, a) => ({ ...c, ...a }), {})
|
|
42
42
|
}));
|
|
43
|
-
};
|
|
43
|
+
}, y = (t) => Intl.DateTimeFormat().format(t);
|
|
44
44
|
export {
|
|
45
|
-
|
|
46
|
-
y as
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
p as createMarkers,
|
|
46
|
+
y as dateFormatter,
|
|
47
|
+
f as flattenData,
|
|
48
|
+
m as getFirstPropertyValue,
|
|
49
|
+
o as markerShape
|
|
49
50
|
};
|