vue-chrts 2.0.0 → 2.1.0-beta.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AreaChart/AreaChart.js +116 -107
- package/dist/components/DualChart/DualChart.js +206 -0
- package/dist/components/DualChart/DualChart.vue.d.ts +21 -0
- package/dist/components/DualChart/DualChart2.js +4 -0
- package/dist/components/DualChart/types.d.ts +187 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +16 -14
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +35 -31
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Position as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { VisXYContainer as
|
|
6
|
-
import { LegendPosition as
|
|
7
|
-
const
|
|
1
|
+
import { defineComponent as H, useSlots as I, useTemplateRef as K, ref as q, getCurrentInstance as J, computed as c, createElementBlock as f, openBlock as d, normalizeClass as Q, normalizeStyle as p, createVNode as u, createCommentVNode as m, createElementVNode as Z, unref as l, withCtx as _, createBlock as k, Fragment as T, renderList as ee, mergeProps as v, renderSlot as B } from "vue";
|
|
2
|
+
import { Position as D, CurveType as h } from "@unovis/ts";
|
|
3
|
+
import { createScopedMarkers as te } from "../../utils.js";
|
|
4
|
+
import ie from "../Tooltip.js";
|
|
5
|
+
import { VisXYContainer as ne, VisTooltip as ae, VisArea as O, VisLine as V, VisAxis as F, VisCrosshair as oe, VisBulletLegend as re } from "@unovis/vue";
|
|
6
|
+
import { LegendPosition as le } from "../../types.js";
|
|
7
|
+
const se = ["id"], ce = {
|
|
8
8
|
ref: "slotWrapper",
|
|
9
9
|
style: { display: "none" }
|
|
10
|
-
},
|
|
10
|
+
}, S = 0.5, C = "#3b82f6", ke = /* @__PURE__ */ H({
|
|
11
11
|
__name: "AreaChart",
|
|
12
12
|
props: {
|
|
13
13
|
data: {},
|
|
@@ -34,7 +34,7 @@ const ne = ["id"], oe = {
|
|
|
34
34
|
yNumTicks: {},
|
|
35
35
|
hideLegend: { type: Boolean, default: !1 },
|
|
36
36
|
hideTooltip: { type: Boolean },
|
|
37
|
-
legendPosition: { default:
|
|
37
|
+
legendPosition: { default: le.BottomCenter },
|
|
38
38
|
legendStyle: { default: void 0 },
|
|
39
39
|
xDomainLine: { type: Boolean },
|
|
40
40
|
yDomainLine: { type: Boolean },
|
|
@@ -54,128 +54,137 @@ const ne = ["id"], oe = {
|
|
|
54
54
|
stacked: { type: Boolean }
|
|
55
55
|
},
|
|
56
56
|
emits: ["click"],
|
|
57
|
-
setup(e, { emit:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
setup(e, { emit: j }) {
|
|
58
|
+
var b;
|
|
59
|
+
const G = j, a = e, N = I(), A = K("slotWrapper"), y = q(), L = `area-${((b = J()) == null ? void 0 : b.uid) ?? Math.random().toString(36).slice(2)}`, g = c(() => {
|
|
60
|
+
const t = Object.values(a.categories).map(
|
|
61
|
+
(o, n) => `var(--vis-color${n})`
|
|
61
62
|
);
|
|
62
|
-
return Object.values(
|
|
63
|
-
(
|
|
63
|
+
return Object.values(a.categories).map(
|
|
64
|
+
(o, n) => o.color ?? t[n]
|
|
64
65
|
);
|
|
65
|
-
}),
|
|
66
|
-
var
|
|
67
|
-
return (
|
|
68
|
-
}),
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
}), M = c(() => {
|
|
67
|
+
var t;
|
|
68
|
+
return (t = a.markerConfig) != null && t.config ? te(a.markerConfig, L) : "";
|
|
69
|
+
}), W = c(() => {
|
|
70
|
+
var o;
|
|
71
|
+
if (!((o = a.markerConfig) != null && o.config)) return {};
|
|
72
|
+
const t = {};
|
|
73
|
+
for (const n of Object.keys(a.markerConfig.config))
|
|
74
|
+
t[`--vis-marker-${n}`] = `url("#${a.markerConfig.id}--${L}--${n}")`;
|
|
75
|
+
return t;
|
|
76
|
+
}), P = c(() => a.legendPosition.startsWith("top")), w = c(() => a.legendPosition.includes("left") ? "flex-start" : a.legendPosition.includes("right") ? "flex-end" : "center"), X = c(() => {
|
|
77
|
+
const t = (n, i) => {
|
|
78
|
+
var r;
|
|
71
79
|
return `
|
|
72
|
-
<linearGradient id="gradient${
|
|
73
|
-
${((
|
|
74
|
-
(s) => `<stop offset="${s.offset}" stop-color="${
|
|
80
|
+
<linearGradient id="gradient${n}-${i}" gradientTransform="rotate(90)">
|
|
81
|
+
${((r = a.gradientStops) == null ? void 0 : r.map(
|
|
82
|
+
(s) => `<stop offset="${s.offset}" stop-color="${i}" stop-opacity="${s.stopOpacity}" />`
|
|
75
83
|
).join("")) ?? ""}
|
|
76
|
-
<stop offset="100%" stop-color="${
|
|
84
|
+
<stop offset="100%" stop-color="${i}" stop-opacity="0" />
|
|
77
85
|
</linearGradient>
|
|
78
86
|
`;
|
|
79
|
-
},
|
|
80
|
-
var
|
|
87
|
+
}, o = (n, i) => {
|
|
88
|
+
var r;
|
|
81
89
|
return `
|
|
82
|
-
<linearGradient id="gradient${
|
|
90
|
+
<linearGradient id="gradient${n}-${i}" gradientTransform="rotate(90)">
|
|
83
91
|
|
|
84
|
-
${((
|
|
92
|
+
${((r = a.gradientStops) == null ? void 0 : r.map(
|
|
85
93
|
(s) => `
|
|
86
|
-
<stop offset="${s.offset}" style="stop-color:var(${
|
|
94
|
+
<stop offset="${s.offset}" style="stop-color:var(${i});stop-opacity:${s.stopOpacity}" />
|
|
87
95
|
`
|
|
88
96
|
).join("")) ?? ""}
|
|
89
97
|
</linearGradient>
|
|
90
98
|
`;
|
|
91
99
|
};
|
|
92
100
|
return g.value.map(
|
|
93
|
-
(
|
|
101
|
+
(n, i) => n != null && n.includes("#") ? t(i, n) : o(i, n ?? C)
|
|
94
102
|
).join("");
|
|
95
103
|
});
|
|
96
|
-
function
|
|
97
|
-
var
|
|
104
|
+
function E(t) {
|
|
105
|
+
var o;
|
|
98
106
|
return {
|
|
99
|
-
y: (
|
|
100
|
-
color: ((
|
|
107
|
+
y: (n) => Number(n[t]),
|
|
108
|
+
color: ((o = a.categories[t]) == null ? void 0 : o.color) ?? C
|
|
101
109
|
};
|
|
102
110
|
}
|
|
103
|
-
const
|
|
104
|
-
(
|
|
105
|
-
)),
|
|
106
|
-
const
|
|
107
|
-
return
|
|
108
|
-
let
|
|
109
|
-
for (let s = 0; s <=
|
|
110
|
-
|
|
111
|
-
return
|
|
111
|
+
const Y = c(() => Object.keys(a.categories).map(
|
|
112
|
+
(t) => (o) => Number(o[t])
|
|
113
|
+
)), z = c(() => {
|
|
114
|
+
const t = Object.keys(a.categories);
|
|
115
|
+
return t.map((o, n) => (i) => {
|
|
116
|
+
let r = 0;
|
|
117
|
+
for (let s = 0; s <= n; s++)
|
|
118
|
+
r += Number(i[t[s]]) || 0;
|
|
119
|
+
return r;
|
|
112
120
|
});
|
|
113
|
-
}),
|
|
114
|
-
function
|
|
115
|
-
return typeof window > "u" ? "" :
|
|
121
|
+
}), $ = c(() => (t, o) => g.value[o] ?? C);
|
|
122
|
+
function R(t) {
|
|
123
|
+
return typeof window > "u" ? "" : A.value ? A.value.innerHTML : "";
|
|
116
124
|
}
|
|
117
|
-
function
|
|
118
|
-
return
|
|
125
|
+
function U(t) {
|
|
126
|
+
return y.value = t, R();
|
|
119
127
|
}
|
|
120
|
-
return (
|
|
121
|
-
var
|
|
122
|
-
return
|
|
128
|
+
return (t, o) => {
|
|
129
|
+
var n;
|
|
130
|
+
return d(), f("div", {
|
|
123
131
|
style: p({
|
|
124
132
|
display: "flex",
|
|
125
|
-
flexDirection:
|
|
126
|
-
gap: "var(--vis-legend-spacing)"
|
|
133
|
+
flexDirection: P.value ? "column-reverse" : "column",
|
|
134
|
+
gap: "var(--vis-legend-spacing)",
|
|
135
|
+
...W.value
|
|
127
136
|
}),
|
|
128
|
-
class:
|
|
129
|
-
id: (
|
|
130
|
-
onClick:
|
|
137
|
+
class: Q({ "stacked-area-chart": e.stacked }),
|
|
138
|
+
id: (n = e.markerConfig) == null ? void 0 : n.id,
|
|
139
|
+
onClick: o[0] || (o[0] = (i) => G("click", i, y.value))
|
|
131
140
|
}, [
|
|
132
|
-
u(
|
|
141
|
+
u(l(ne), {
|
|
133
142
|
data: e.data,
|
|
134
143
|
height: e.height,
|
|
135
144
|
padding: e.padding,
|
|
136
|
-
"svg-defs":
|
|
145
|
+
"svg-defs": X.value + M.value,
|
|
137
146
|
"y-domain": e.yDomain,
|
|
138
147
|
"x-domain": e.xDomain
|
|
139
148
|
}, {
|
|
140
|
-
default:
|
|
141
|
-
e.hideTooltip ?
|
|
149
|
+
default: _(() => [
|
|
150
|
+
e.hideTooltip ? m("", !0) : (d(), k(l(ae), {
|
|
142
151
|
key: 0,
|
|
143
|
-
"horizontal-placement":
|
|
144
|
-
"vertical-placement":
|
|
152
|
+
"horizontal-placement": l(D).Right,
|
|
153
|
+
"vertical-placement": l(D).Top
|
|
145
154
|
}, null, 8, ["horizontal-placement", "vertical-placement"])),
|
|
146
|
-
e.stacked ? (
|
|
147
|
-
u(
|
|
148
|
-
x: (
|
|
149
|
-
y:
|
|
150
|
-
color:
|
|
151
|
-
opacity: e.hideArea ? 0 :
|
|
152
|
-
"curve-type": e.curveType ??
|
|
155
|
+
e.stacked ? (d(), f(T, { key: 1 }, [
|
|
156
|
+
u(l(O), {
|
|
157
|
+
x: (i, r) => r,
|
|
158
|
+
y: Y.value,
|
|
159
|
+
color: $.value,
|
|
160
|
+
opacity: e.hideArea ? 0 : S,
|
|
161
|
+
"curve-type": e.curveType ?? l(h).MonotoneX
|
|
153
162
|
}, null, 8, ["x", "y", "color", "opacity", "curve-type"]),
|
|
154
|
-
u(
|
|
155
|
-
x: (
|
|
156
|
-
y:
|
|
157
|
-
color:
|
|
158
|
-
"curve-type": e.curveType ??
|
|
163
|
+
u(l(V), {
|
|
164
|
+
x: (i, r) => r,
|
|
165
|
+
y: z.value,
|
|
166
|
+
color: $.value,
|
|
167
|
+
"curve-type": e.curveType ?? l(h).MonotoneX,
|
|
159
168
|
"line-width": e.lineWidth
|
|
160
169
|
}, null, 8, ["x", "y", "color", "curve-type", "line-width"])
|
|
161
|
-
], 64)) : (
|
|
162
|
-
u(
|
|
170
|
+
], 64)) : (d(!0), f(T, { key: 2 }, ee(Object.keys(a.categories), (i, r) => (d(), f(T, { key: i }, [
|
|
171
|
+
u(l(O), v({
|
|
163
172
|
x: (s, x) => x
|
|
164
|
-
}, { ref_for: !0 },
|
|
165
|
-
color: `url(#gradient${
|
|
166
|
-
opacity: e.hideArea ? 0 :
|
|
167
|
-
"curve-type": e.curveType ??
|
|
173
|
+
}, { ref_for: !0 }, E(i), {
|
|
174
|
+
color: `url(#gradient${r}-${g.value[r]})`,
|
|
175
|
+
opacity: e.hideArea ? 0 : S,
|
|
176
|
+
"curve-type": e.curveType ?? l(h).MonotoneX
|
|
168
177
|
}), null, 16, ["x", "color", "opacity", "curve-type"]),
|
|
169
|
-
u(
|
|
178
|
+
u(l(V), {
|
|
170
179
|
x: (s, x) => x,
|
|
171
|
-
y: (s) => s[
|
|
172
|
-
color: g.value[
|
|
173
|
-
"curve-type": e.curveType ??
|
|
180
|
+
y: (s) => s[i],
|
|
181
|
+
color: g.value[r],
|
|
182
|
+
"curve-type": e.curveType ?? l(h).MonotoneX,
|
|
174
183
|
"line-width": e.lineWidth,
|
|
175
|
-
lineDashArray: e.lineDashArray ? e.lineDashArray[
|
|
184
|
+
lineDashArray: e.lineDashArray ? e.lineDashArray[r] : void 0
|
|
176
185
|
}, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"])
|
|
177
186
|
], 64))), 128)),
|
|
178
|
-
e.hideXAxis ?
|
|
187
|
+
e.hideXAxis ? m("", !0) : (d(), k(l(F), v({
|
|
179
188
|
key: 3,
|
|
180
189
|
type: "x",
|
|
181
190
|
label: e.xLabel,
|
|
@@ -188,7 +197,7 @@ const ne = ["id"], oe = {
|
|
|
188
197
|
"tick-line": e.xTickLine,
|
|
189
198
|
"min-max-ticks-only": e.minMaxTicksOnly
|
|
190
199
|
}, e.xAxisConfig), null, 16, ["label", "num-ticks", "tick-format", "tick-values", "grid-line", "domain-line", "tick-line", "min-max-ticks-only"])),
|
|
191
|
-
e.hideYAxis ?
|
|
200
|
+
e.hideYAxis ? m("", !0) : (d(), k(l(F), v({
|
|
192
201
|
key: 4,
|
|
193
202
|
type: "y",
|
|
194
203
|
label: e.yLabel,
|
|
@@ -198,45 +207,45 @@ const ne = ["id"], oe = {
|
|
|
198
207
|
"domain-line": e.yDomainLine,
|
|
199
208
|
"tick-line": e.yTickLine
|
|
200
209
|
}, e.yAxisConfig), null, 16, ["label", "num-ticks", "tick-format", "grid-line", "domain-line", "tick-line"])),
|
|
201
|
-
e.hideTooltip ?
|
|
210
|
+
e.hideTooltip ? m("", !0) : (d(), k(l(oe), v({ key: 5 }, e.crosshairConfig, { template: U }), null, 16))
|
|
202
211
|
]),
|
|
203
212
|
_: 1
|
|
204
213
|
}, 8, ["data", "height", "padding", "svg-defs", "y-domain", "x-domain"]),
|
|
205
|
-
|
|
214
|
+
a.hideLegend ? m("", !0) : (d(), f("div", {
|
|
206
215
|
key: 0,
|
|
207
216
|
style: p({
|
|
208
217
|
display: "flex",
|
|
209
|
-
justifyContent:
|
|
218
|
+
justifyContent: w.value
|
|
210
219
|
})
|
|
211
220
|
}, [
|
|
212
|
-
u(
|
|
221
|
+
u(l(re), {
|
|
213
222
|
style: p([
|
|
214
|
-
|
|
223
|
+
a.legendStyle,
|
|
215
224
|
"display: flex; gap: var(--vis-legend-spacing);"
|
|
216
225
|
]),
|
|
217
|
-
items: Object.values(
|
|
218
|
-
...
|
|
219
|
-
color: Array.isArray(
|
|
226
|
+
items: Object.values(a.categories).map((i) => ({
|
|
227
|
+
...i,
|
|
228
|
+
color: Array.isArray(i.color) ? i.color[0] : i.color
|
|
220
229
|
}))
|
|
221
230
|
}, null, 8, ["style", "items"])
|
|
222
231
|
], 4)),
|
|
223
|
-
|
|
224
|
-
|
|
232
|
+
Z("div", ce, [
|
|
233
|
+
l(N).tooltip ? B(t.$slots, "tooltip", {
|
|
225
234
|
key: 0,
|
|
226
|
-
values:
|
|
227
|
-
}) :
|
|
228
|
-
u(
|
|
229
|
-
data:
|
|
235
|
+
values: y.value
|
|
236
|
+
}) : y.value ? B(t.$slots, "fallback", { key: 1 }, () => [
|
|
237
|
+
u(ie, {
|
|
238
|
+
data: y.value,
|
|
230
239
|
categories: e.categories,
|
|
231
|
-
"title-formatter":
|
|
232
|
-
yFormatter:
|
|
240
|
+
"title-formatter": a.tooltipTitleFormatter,
|
|
241
|
+
yFormatter: a.yFormatter
|
|
233
242
|
}, null, 8, ["data", "categories", "title-formatter", "yFormatter"])
|
|
234
|
-
]) :
|
|
243
|
+
]) : m("", !0)
|
|
235
244
|
], 512)
|
|
236
|
-
], 14,
|
|
245
|
+
], 14, se);
|
|
237
246
|
};
|
|
238
247
|
}
|
|
239
248
|
});
|
|
240
249
|
export {
|
|
241
|
-
|
|
250
|
+
ke as default
|
|
242
251
|
};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { defineComponent as N, useSlots as W, useTemplateRef as E, ref as G, computed as c, createElementBlock as m, openBlock as o, normalizeStyle as f, createVNode as x, createCommentVNode as u, createElementVNode as z, unref as a, withCtx as H, createBlock as d, Fragment as X, renderList as j, mergeProps as k, renderSlot as p } from "vue";
|
|
2
|
+
import { Orientation as y, CurveType as A, Position as L, StackedBar as q, GroupedBar as $ } from "@unovis/ts";
|
|
3
|
+
import { VisXYContainer as R, VisTooltip as U, VisGroupedBar as I, VisStackedBar as J, VisLine as K, VisAxis as B, VisCrosshair as Q, VisBulletLegend as Z } from "@unovis/vue";
|
|
4
|
+
import _ from "../Tooltip.js";
|
|
5
|
+
import { LegendPosition as ee } from "../../types.js";
|
|
6
|
+
const te = {
|
|
7
|
+
ref: "slotWrapper",
|
|
8
|
+
style: { display: "none" }
|
|
9
|
+
}, de = /* @__PURE__ */ N({
|
|
10
|
+
__name: "DualChart",
|
|
11
|
+
props: {
|
|
12
|
+
data: {},
|
|
13
|
+
height: {},
|
|
14
|
+
xLabel: {},
|
|
15
|
+
yLabel: {},
|
|
16
|
+
yLabelSecondary: {},
|
|
17
|
+
padding: { default: () => ({
|
|
18
|
+
top: 5,
|
|
19
|
+
right: 5,
|
|
20
|
+
bottom: 5,
|
|
21
|
+
left: 5
|
|
22
|
+
}) },
|
|
23
|
+
barCategories: {},
|
|
24
|
+
lineCategories: {},
|
|
25
|
+
barYAxis: {},
|
|
26
|
+
lineYAxis: {},
|
|
27
|
+
xFormatter: {},
|
|
28
|
+
yFormatter: {},
|
|
29
|
+
tooltipTitleFormatter: {},
|
|
30
|
+
curveType: { default: A.MonotoneX },
|
|
31
|
+
lineWidth: { default: 2 },
|
|
32
|
+
xNumTicks: {},
|
|
33
|
+
xExplicitTicks: {},
|
|
34
|
+
minMaxTicksOnly: { type: Boolean },
|
|
35
|
+
yNumTicks: {},
|
|
36
|
+
hideLegend: { type: Boolean, default: !1 },
|
|
37
|
+
hideTooltip: { type: Boolean, default: !1 },
|
|
38
|
+
legendPosition: { default: ee.BottomCenter },
|
|
39
|
+
legendStyle: { default: void 0 },
|
|
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
|
+
crosshairConfig: {},
|
|
49
|
+
xAxisConfig: {},
|
|
50
|
+
yAxisConfig: {},
|
|
51
|
+
yDomain: {},
|
|
52
|
+
xDomain: {},
|
|
53
|
+
stacked: { type: Boolean },
|
|
54
|
+
groupPadding: { default: 0 },
|
|
55
|
+
barPadding: { default: 0.2 },
|
|
56
|
+
radius: {},
|
|
57
|
+
orientation: { default: y.Vertical }
|
|
58
|
+
},
|
|
59
|
+
emits: ["click"],
|
|
60
|
+
setup(e, { emit: Y }) {
|
|
61
|
+
const P = Y, t = e, V = W(), g = E("slotWrapper"), s = G();
|
|
62
|
+
if (!t.barYAxis || t.barYAxis.length === 0)
|
|
63
|
+
throw console.error("[DualChart] barYAxis prop is required and must contain at least one field key"), new Error("DualChart: 'barYAxis' is required and must contain at least one field key. Provide an array of property keys from your data type (e.g., ['revenue', 'costs'])");
|
|
64
|
+
if (!t.lineYAxis || t.lineYAxis.length === 0)
|
|
65
|
+
throw console.error("[DualChart] lineYAxis prop is required and must contain at least one field key"), new Error("DualChart: 'lineYAxis' is required and must contain at least one field key. Provide an array of property keys from your data type (e.g., ['profit', 'target'])");
|
|
66
|
+
const h = c(() => t.barYAxis.map((n) => (l) => l[n])), D = c(() => t.lineYAxis.map((n) => (l) => l[n])), v = (n, l) => {
|
|
67
|
+
var i;
|
|
68
|
+
return (i = Object.values(t.barCategories)[l]) == null ? void 0 : i.color;
|
|
69
|
+
}, b = c(() => ({
|
|
70
|
+
...t.barCategories,
|
|
71
|
+
...t.lineCategories
|
|
72
|
+
})), F = c(() => t.legendPosition.startsWith("top")), w = c(() => t.legendPosition.includes("left") ? "flex-start" : t.legendPosition.includes("right") ? "flex-end" : "center");
|
|
73
|
+
function C(n) {
|
|
74
|
+
s.value = n;
|
|
75
|
+
}
|
|
76
|
+
function M(n) {
|
|
77
|
+
return typeof window > "u" ? "" : g.value ? g.value.innerHTML : "";
|
|
78
|
+
}
|
|
79
|
+
function O(n) {
|
|
80
|
+
return s.value = n, M();
|
|
81
|
+
}
|
|
82
|
+
return (n, l) => (o(), m("div", {
|
|
83
|
+
style: f({
|
|
84
|
+
display: "flex",
|
|
85
|
+
flexDirection: F.value ? "column-reverse" : "column",
|
|
86
|
+
gap: "var(--vis-legend-spacing)"
|
|
87
|
+
}),
|
|
88
|
+
onClick: l[0] || (l[0] = (i) => P("click", i, s.value))
|
|
89
|
+
}, [
|
|
90
|
+
x(a(R), {
|
|
91
|
+
padding: e.padding,
|
|
92
|
+
height: e.height,
|
|
93
|
+
data: e.data
|
|
94
|
+
}, {
|
|
95
|
+
default: H(() => [
|
|
96
|
+
e.hideTooltip ? u("", !0) : (o(), d(a(U), {
|
|
97
|
+
key: 0,
|
|
98
|
+
triggers: {
|
|
99
|
+
[a($).selectors.bar]: (i) => {
|
|
100
|
+
var r;
|
|
101
|
+
return C(i), i ? (r = g.value) == null ? void 0 : r.innerHTML : "";
|
|
102
|
+
},
|
|
103
|
+
[a(q).selectors.bar]: (i) => {
|
|
104
|
+
var r;
|
|
105
|
+
return C(i), i ? (r = g.value) == null ? void 0 : r.innerHTML : "";
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"horizontal-placement": a(L).Right,
|
|
109
|
+
"vertical-placement": a(L).Top
|
|
110
|
+
}, null, 8, ["triggers", "horizontal-placement", "vertical-placement"])),
|
|
111
|
+
e.stacked ? (o(), d(a(J), {
|
|
112
|
+
key: 2,
|
|
113
|
+
data: e.data,
|
|
114
|
+
x: (i, r) => r,
|
|
115
|
+
y: h.value,
|
|
116
|
+
color: v,
|
|
117
|
+
"rounded-corners": e.radius ?? 0,
|
|
118
|
+
"group-padding": e.groupPadding ?? 0,
|
|
119
|
+
"bar-padding": e.barPadding ?? 0.2,
|
|
120
|
+
orientation: e.orientation ?? a(y).Vertical
|
|
121
|
+
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (o(), d(a(I), {
|
|
122
|
+
key: 1,
|
|
123
|
+
data: e.data,
|
|
124
|
+
x: (i, r) => r,
|
|
125
|
+
y: h.value,
|
|
126
|
+
color: v,
|
|
127
|
+
"rounded-corners": e.radius ?? 0,
|
|
128
|
+
"group-padding": e.groupPadding ?? 0,
|
|
129
|
+
"bar-padding": e.barPadding ?? 0.2,
|
|
130
|
+
orientation: e.orientation ?? a(y).Vertical
|
|
131
|
+
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
|
|
132
|
+
(o(!0), m(X, null, j(D.value, (i, r) => {
|
|
133
|
+
var T;
|
|
134
|
+
return o(), d(a(K), {
|
|
135
|
+
key: `line-${r}`,
|
|
136
|
+
data: e.data,
|
|
137
|
+
x: (ie, S) => S,
|
|
138
|
+
y: i,
|
|
139
|
+
color: (T = Object.values(t.lineCategories)[r]) == null ? void 0 : T.color,
|
|
140
|
+
"curve-type": e.curveType ?? a(A).MonotoneX,
|
|
141
|
+
"line-width": e.lineWidth
|
|
142
|
+
}, null, 8, ["data", "x", "y", "color", "curve-type", "line-width"]);
|
|
143
|
+
}), 128)),
|
|
144
|
+
e.hideXAxis ? u("", !0) : (o(), d(a(B), k({
|
|
145
|
+
key: 3,
|
|
146
|
+
type: "x",
|
|
147
|
+
"tick-format": e.xFormatter,
|
|
148
|
+
label: e.xLabel,
|
|
149
|
+
"grid-line": e.xGridLine,
|
|
150
|
+
"domain-line": !!e.xDomainLine,
|
|
151
|
+
"tick-line": e.xTickLine,
|
|
152
|
+
"num-ticks": e.xNumTicks,
|
|
153
|
+
"tick-values": e.xExplicitTicks,
|
|
154
|
+
minMaxTicksOnly: e.minMaxTicksOnly
|
|
155
|
+
}, e.xAxisConfig), null, 16, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "minMaxTicksOnly"])),
|
|
156
|
+
e.hideYAxis ? u("", !0) : (o(), d(a(B), k({
|
|
157
|
+
key: 4,
|
|
158
|
+
type: "y",
|
|
159
|
+
label: e.yLabel,
|
|
160
|
+
"grid-line": e.orientation !== a(y).Horizontal && e.yGridLine,
|
|
161
|
+
"domain-line": !!e.yDomainLine,
|
|
162
|
+
"tick-format": e.yFormatter,
|
|
163
|
+
"num-ticks": e.yNumTicks,
|
|
164
|
+
"tick-line": e.yTickLine
|
|
165
|
+
}, e.yAxisConfig), null, 16, ["label", "grid-line", "domain-line", "tick-format", "num-ticks", "tick-line"])),
|
|
166
|
+
e.hideTooltip ? u("", !0) : (o(), d(a(Q), k({ key: 5 }, e.crosshairConfig, { template: O }), null, 16))
|
|
167
|
+
]),
|
|
168
|
+
_: 1
|
|
169
|
+
}, 8, ["padding", "height", "data"]),
|
|
170
|
+
t.hideLegend ? u("", !0) : (o(), m("div", {
|
|
171
|
+
key: 0,
|
|
172
|
+
style: f({
|
|
173
|
+
display: "flex",
|
|
174
|
+
justifyContent: w.value
|
|
175
|
+
})
|
|
176
|
+
}, [
|
|
177
|
+
x(a(Z), {
|
|
178
|
+
style: f([
|
|
179
|
+
t.legendStyle,
|
|
180
|
+
"display: flex; gap: var(--vis-legend-spacing);"
|
|
181
|
+
]),
|
|
182
|
+
items: Object.values(b.value).map((i) => ({
|
|
183
|
+
...i,
|
|
184
|
+
color: Array.isArray(i.color) ? i.color[0] : i.color
|
|
185
|
+
}))
|
|
186
|
+
}, null, 8, ["style", "items"])
|
|
187
|
+
], 4)),
|
|
188
|
+
z("div", te, [
|
|
189
|
+
a(V).tooltip ? p(n.$slots, "tooltip", {
|
|
190
|
+
key: 0,
|
|
191
|
+
values: s.value
|
|
192
|
+
}) : s.value ? p(n.$slots, "fallback", { key: 1 }, () => [
|
|
193
|
+
x(_, {
|
|
194
|
+
data: s.value,
|
|
195
|
+
categories: b.value,
|
|
196
|
+
"title-formatter": t.tooltipTitleFormatter,
|
|
197
|
+
yFormatter: t.orientation === a(y).Horizontal ? t.xFormatter : t.yFormatter
|
|
198
|
+
}, null, 8, ["data", "categories", "title-formatter", "yFormatter"])
|
|
199
|
+
]) : u("", !0)
|
|
200
|
+
], 512)
|
|
201
|
+
], 4));
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
export {
|
|
205
|
+
de as default
|
|
206
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DualChartProps } from './types';
|
|
2
|
+
declare const _default: <T extends {}>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
+
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"> & DualChartProps<T> & Partial<{}>> & import('vue').PublicProps;
|
|
6
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
7
|
+
attrs: any;
|
|
8
|
+
slots: {
|
|
9
|
+
tooltip?(_: {
|
|
10
|
+
values: T | undefined;
|
|
11
|
+
}): any;
|
|
12
|
+
fallback?(_: {}): any;
|
|
13
|
+
};
|
|
14
|
+
emit: (e: "click", event: MouseEvent, values?: T) => void;
|
|
15
|
+
}>) => import('vue').VNode & {
|
|
16
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
17
|
+
};
|
|
18
|
+
export default _default;
|
|
19
|
+
type __VLS_PrettifyLocal<T> = {
|
|
20
|
+
[K in keyof T]: T[K];
|
|
21
|
+
} & {};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { axisFormatter, CrosshairConfig, LegendPosition, AxisConfig, BulletLegendItemInterface, Orientation } from '../../types';
|
|
2
|
+
import { CurveType } from '@unovis/ts';
|
|
3
|
+
export interface DualChartProps<T> {
|
|
4
|
+
/**
|
|
5
|
+
* The data to be displayed in the dual chart.
|
|
6
|
+
* Each element of the array represents a data point.
|
|
7
|
+
* The structure of 'T' should be compatible with the chart's rendering logic.
|
|
8
|
+
*/
|
|
9
|
+
data: T[];
|
|
10
|
+
/**
|
|
11
|
+
* The height of the chart in pixels.
|
|
12
|
+
*/
|
|
13
|
+
height: number;
|
|
14
|
+
/**
|
|
15
|
+
* Optional label for the x-axis.
|
|
16
|
+
*/
|
|
17
|
+
xLabel?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional label for the y-axis (used for both bar and line by default).
|
|
20
|
+
*/
|
|
21
|
+
yLabel?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional label for the secondary y-axis (line chart).
|
|
24
|
+
*/
|
|
25
|
+
yLabelSecondary?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Optional padding applied to the chart.
|
|
28
|
+
* Allows specifying individual padding values for the top, right, bottom, and left sides.
|
|
29
|
+
*/
|
|
30
|
+
padding?: {
|
|
31
|
+
top: number;
|
|
32
|
+
right: number;
|
|
33
|
+
bottom: number;
|
|
34
|
+
left: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* A record mapping bar category keys to `BulletLegendItemInterface` objects.
|
|
38
|
+
* This defines the visual representation and labels for bar categories in the chart's legend.
|
|
39
|
+
*/
|
|
40
|
+
barCategories: Record<string, BulletLegendItemInterface>;
|
|
41
|
+
/**
|
|
42
|
+
* A record mapping line category keys to `BulletLegendItemInterface` objects.
|
|
43
|
+
* This defines the visual representation and labels for line categories in the chart's legend.
|
|
44
|
+
*/
|
|
45
|
+
lineCategories: Record<string, BulletLegendItemInterface>;
|
|
46
|
+
/**
|
|
47
|
+
* An array of property keys from the data object type 'T' to be used for the bar chart y-axis values.
|
|
48
|
+
*/
|
|
49
|
+
barYAxis: (keyof T)[];
|
|
50
|
+
/**
|
|
51
|
+
* An array of property keys from the data object type 'T' to be used for the line chart y-axis values.
|
|
52
|
+
*/
|
|
53
|
+
lineYAxis: (keyof T)[];
|
|
54
|
+
/**
|
|
55
|
+
* @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.
|
|
56
|
+
* @param {number} i - The index of the tick in the `ticks` array.
|
|
57
|
+
* @param {(number[]|Date[])} ticks - An array of all tick values for the x-axis.
|
|
58
|
+
* @returns {string} The formatted string representation of the tick.
|
|
59
|
+
*/
|
|
60
|
+
xFormatter?: axisFormatter;
|
|
61
|
+
/**
|
|
62
|
+
* @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.
|
|
63
|
+
* @param {number} i - The index of the tick in the `ticks` array.
|
|
64
|
+
* @param {(number[]|Date[])} ticks - An array of all tick values for the y-axis.
|
|
65
|
+
* @returns {string} The formatted string representation of the tick.
|
|
66
|
+
*/
|
|
67
|
+
yFormatter?: axisFormatter;
|
|
68
|
+
/**
|
|
69
|
+
* Use custom formatter for tooltip titles
|
|
70
|
+
*/
|
|
71
|
+
tooltipTitleFormatter?: (data: T) => string | number;
|
|
72
|
+
/**
|
|
73
|
+
* The type of curve to use for the line chart lines.
|
|
74
|
+
* See `CurveType` for available options.
|
|
75
|
+
*/
|
|
76
|
+
curveType?: CurveType;
|
|
77
|
+
/**
|
|
78
|
+
* The width of the line in pixels. Default is 2px.
|
|
79
|
+
*/
|
|
80
|
+
lineWidth?: number;
|
|
81
|
+
/**
|
|
82
|
+
* The desired number of ticks on the x-axis.
|
|
83
|
+
*/
|
|
84
|
+
xNumTicks?: number;
|
|
85
|
+
/**
|
|
86
|
+
* Force specific ticks on the x-axis.
|
|
87
|
+
*/
|
|
88
|
+
xExplicitTicks?: (number | string | Date)[];
|
|
89
|
+
/**
|
|
90
|
+
* Force only first and last ticks on the x-axis.
|
|
91
|
+
*/
|
|
92
|
+
minMaxTicksOnly?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* The desired number of ticks on the y-axis.
|
|
95
|
+
*/
|
|
96
|
+
yNumTicks?: number;
|
|
97
|
+
/**
|
|
98
|
+
* If `true`, hides the chart legend.
|
|
99
|
+
*/
|
|
100
|
+
hideLegend?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* If `true`, hides the chart tooltip.
|
|
103
|
+
*/
|
|
104
|
+
hideTooltip?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Optional position for the legend, if applicable.
|
|
107
|
+
* See `LegendPosition` for available options.
|
|
108
|
+
*/
|
|
109
|
+
legendPosition?: LegendPosition;
|
|
110
|
+
/**
|
|
111
|
+
* Optional style object for the legend container. Allows custom CSS styling.
|
|
112
|
+
*/
|
|
113
|
+
legendStyle?: string | Record<string, string>;
|
|
114
|
+
/**
|
|
115
|
+
* If `true`, displays a domain line (axis line) along the x-axis.
|
|
116
|
+
*/
|
|
117
|
+
xDomainLine?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* If `true`, displays a domain line (axis line) along the y-axis.
|
|
120
|
+
*/
|
|
121
|
+
yDomainLine?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* If `true`, displays tick lines on the x-axis.
|
|
124
|
+
*/
|
|
125
|
+
xTickLine?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* If `true`, displays tick lines on the y-axis.
|
|
128
|
+
*/
|
|
129
|
+
yTickLine?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* If `true`, displays grid lines along the x-axis.
|
|
132
|
+
*/
|
|
133
|
+
xGridLine?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* If `true`, displays grid lines along the y-axis.
|
|
136
|
+
*/
|
|
137
|
+
yGridLine?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* If `true`, hide the x-axis.
|
|
140
|
+
*/
|
|
141
|
+
hideXAxis?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* If `true`, hide the y-axis.
|
|
144
|
+
*/
|
|
145
|
+
hideYAxis?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Crosshair configuration object for customizing the appearance of the crosshair line.
|
|
148
|
+
*/
|
|
149
|
+
crosshairConfig?: CrosshairConfig;
|
|
150
|
+
/**
|
|
151
|
+
* Axis configuration object for customizing the appearance of the axes.
|
|
152
|
+
*/
|
|
153
|
+
xAxisConfig?: AxisConfig;
|
|
154
|
+
/**
|
|
155
|
+
* Axis configuration object for customizing the appearance of the axes.
|
|
156
|
+
*/
|
|
157
|
+
yAxisConfig?: AxisConfig;
|
|
158
|
+
/**
|
|
159
|
+
* The domain for the y-axis, specified as a tuple of two values.
|
|
160
|
+
*/
|
|
161
|
+
yDomain?: [number | undefined, number | undefined];
|
|
162
|
+
/**
|
|
163
|
+
* The domain for the x-axis, specified as a tuple of two values.
|
|
164
|
+
*/
|
|
165
|
+
xDomain?: [number | undefined, number | undefined];
|
|
166
|
+
/**
|
|
167
|
+
* If `true`, creates stacked bars.
|
|
168
|
+
*/
|
|
169
|
+
stacked?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* The padding between groups of bars in pixels.
|
|
172
|
+
*/
|
|
173
|
+
groupPadding?: number;
|
|
174
|
+
/**
|
|
175
|
+
* Fractional padding between the bars in the range of [0,1). Default: 0.2
|
|
176
|
+
*/
|
|
177
|
+
barPadding?: number;
|
|
178
|
+
/**
|
|
179
|
+
* Rounded corners for top bars. Boolean or number (to set the radius in pixels). Default: 2
|
|
180
|
+
*/
|
|
181
|
+
radius?: number;
|
|
182
|
+
/**
|
|
183
|
+
* The orientation of the bars (vertical or horizontal).
|
|
184
|
+
* See `Orientation` for available options.
|
|
185
|
+
*/
|
|
186
|
+
orientation?: Orientation;
|
|
187
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ 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
6
|
import { default as GanttChart } from './components/GanttChart/GanttChart.vue';
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import { default as DualChart } from './components/DualChart/DualChart.vue';
|
|
8
|
+
import { LegendPosition, CurveType, Orientation, MarkerConfig, CrosshairConfig, DonutType, BulletLegendItemInterface } from './types';
|
|
9
|
+
export { AreaChart, LineChart, BarChart, DonutChart, BubbleChart, GanttChart, DualChart, Orientation, CurveType, LegendPosition, DonutType };
|
|
9
10
|
export type { BulletLegendItemInterface, MarkerConfig, CrosshairConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { default as
|
|
1
|
+
import { default as a } from "./components/AreaChart/AreaChart.js";
|
|
2
2
|
import { default as o } from "./components/LineChart/LineChart.js";
|
|
3
|
-
import { default as
|
|
4
|
-
import { default as
|
|
3
|
+
import { default as u } from "./components/BarChart/BarChart.js";
|
|
4
|
+
import { default as l } from "./components/DonutChart/DonutChart.js";
|
|
5
5
|
import { default as x } from "./components/BubbleChart/BubbleChart.js";
|
|
6
|
-
import { default as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { default as n } from "./components/GanttChart/GanttChart.js";
|
|
7
|
+
import { default as C } from "./components/DualChart/DualChart.js";
|
|
8
|
+
import { CurveType as i, LegendPosition as D, Orientation as b } from "./types.js";
|
|
9
|
+
import { DonutType as B } from "./components/DonutChart/types.js";
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
a as AreaChart,
|
|
12
|
+
u as BarChart,
|
|
12
13
|
x as BubbleChart,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
i as CurveType,
|
|
15
|
+
l as DonutChart,
|
|
16
|
+
B as DonutType,
|
|
17
|
+
C as DualChart,
|
|
18
|
+
n as GanttChart,
|
|
19
|
+
D as LegendPosition,
|
|
18
20
|
o as LineChart,
|
|
19
|
-
|
|
21
|
+
b as Orientation
|
|
20
22
|
};
|
package/dist/utils.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ export declare function getDistributedIndices(length: number, numTicks: number):
|
|
|
3
3
|
export declare function getFirstPropertyValue(obj: unknown): undefined;
|
|
4
4
|
export declare const markerShape: (type: string, size: number, strokeWidth: number, color: string, strokeColor: string) => string;
|
|
5
5
|
export declare function createMarkers(markerConfig: MarkerConfig): string;
|
|
6
|
+
export declare function createScopedMarkers(markerConfig: MarkerConfig, scopeId: string, options?: {
|
|
7
|
+
includeLegacy?: boolean;
|
|
8
|
+
}): string;
|
|
6
9
|
export declare const flattenData: (data: any[], xAxis: string) => {
|
|
7
10
|
month: any;
|
|
8
11
|
}[];
|
package/dist/utils.js
CHANGED
|
@@ -1,50 +1,54 @@
|
|
|
1
|
-
function
|
|
2
|
-
if (
|
|
3
|
-
const
|
|
4
|
-
return
|
|
1
|
+
function i(e) {
|
|
2
|
+
if (e && Object.keys(e).length > 0) {
|
|
3
|
+
const r = Object.keys(e)[0];
|
|
4
|
+
return e[r];
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
-
const
|
|
8
|
-
switch (
|
|
7
|
+
const s = (e, r, t, a, $) => {
|
|
8
|
+
switch (e) {
|
|
9
9
|
case "circle":
|
|
10
|
-
return `<circle cx="${
|
|
10
|
+
return `<circle cx="${r / 2}" cy="${r / 2}" r="${(r - t) / 2}" stroke-width="${t}" stroke="${$}" fill="${a}" />`;
|
|
11
11
|
case "square":
|
|
12
|
-
return `<rect x="${
|
|
12
|
+
return `<rect x="${t / 2}" y="${t / 2}" width="${r - t}" height="${r - t}" stroke-width="${t}" stroke="${$}" fill="${a}" />`;
|
|
13
13
|
case "triangle":
|
|
14
|
-
return `<polygon points="${
|
|
14
|
+
return `<polygon points="${r / 2},${t / 2} ${r - t / 2},${r - t / 2} ${t / 2},${r - t / 2}" stroke-width="${t}" stroke="${$}" fill="${a}" />`;
|
|
15
15
|
case "diamond":
|
|
16
|
-
return `<polygon points="${
|
|
16
|
+
return `<polygon points="${r / 2},${t / 2} ${r - t / 2},${r / 2} ${r / 2},${r - t / 2} ${t / 2},${r / 2}" stroke-width="${t}" stroke="${$}" fill="${a}" />`;
|
|
17
17
|
default:
|
|
18
18
|
return "";
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
return `<marker id="${
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
function f(e, r, t) {
|
|
22
|
+
const a = ($, n) => {
|
|
23
|
+
const o = n.type || "circle", c = n.size || 10, l = n.strokeWidth || 2, u = n.color || "#000", p = n.strokeColor || n.color || "#000";
|
|
24
|
+
return `<marker id="${$}" viewBox="0 0 ${c} ${c}" refX="${c / 2}" refY="${c / 2}" markerWidth="${c / 2}" markerHeight="${c / 2}" orient="auto">
|
|
25
|
+
${s(o, c, l, u, p)}
|
|
26
|
+
</marker>`;
|
|
27
|
+
};
|
|
28
|
+
return Object.entries(e.config).flatMap(([$, n]) => {
|
|
29
|
+
const o = `${e.id}--${r}--${$}`, c = [a(o, n)];
|
|
30
|
+
return c.push(a(`${e.id}-${$}`, n)), c;
|
|
27
31
|
}).join(`
|
|
28
32
|
`);
|
|
29
33
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
34
|
+
function m(e) {
|
|
35
|
+
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
32
36
|
}
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
return
|
|
37
|
+
const y = (e, r) => {
|
|
38
|
+
const t = Object.keys(e[0]).filter(($) => $ !== r), a = Object.keys(e[0][t[0]]);
|
|
39
|
+
return e.map(($) => ({
|
|
36
40
|
month: $.month,
|
|
37
|
-
...
|
|
38
|
-
(
|
|
39
|
-
[`${
|
|
41
|
+
...t.flatMap(
|
|
42
|
+
(n) => a.map((o) => ({
|
|
43
|
+
[`${n}${m(o)}`]: $[n][o]
|
|
40
44
|
}))
|
|
41
|
-
).reduce((
|
|
45
|
+
).reduce((n, o) => ({ ...n, ...o }), {})
|
|
42
46
|
}));
|
|
43
|
-
},
|
|
47
|
+
}, w = (e) => Intl.DateTimeFormat().format(e);
|
|
44
48
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
f as createScopedMarkers,
|
|
50
|
+
w as dateFormatter,
|
|
51
|
+
y as flattenData,
|
|
52
|
+
i as getFirstPropertyValue,
|
|
53
|
+
s as markerShape
|
|
50
54
|
};
|