vue-chrts 0.2.3 → 0.2.5-test.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 +79 -72
- package/dist/components/AreaChart/types.d.ts +13 -1
- package/dist/components/AreaStackedChart/AreaStackedChart.js +31 -31
- package/dist/components/BarChart/BarChart.js +160 -122
- package/dist/components/BarChart/BarChart.vue.d.ts +1 -1
- package/dist/components/BarChart/stackedGroupedUtils.d.ts +1 -1
- package/dist/components/BarChart/stackedGroupedUtils.js +40 -39
- package/dist/components/BarChart/types.d.ts +28 -12
- package/dist/components/BubbleChart/BubbleChart.js +74 -56
- package/dist/components/BubbleChart/types.d.ts +4 -0
- package/dist/components/DonutChart/DonutChart.js +39 -39
- package/dist/components/LineChart/LineChart.js +67 -59
- package/dist/components/LineChart/types.d.ts +13 -1
- package/dist/components/Tooltip.js +24 -24
- package/dist/types.d.ts +7 -3
- package/dist/types.js +4 -4
- package/package.json +3 -3
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Scatter as
|
|
3
|
-
import {
|
|
4
|
-
import { LegendPosition as
|
|
5
|
-
import { getFirstPropertyValue as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
8
|
-
key: 0,
|
|
9
|
-
class: "flex items-center justify-end pb-4"
|
|
10
|
-
}, Y = {
|
|
11
|
-
key: 1,
|
|
12
|
-
class: "flex items-center justify-end pt-4"
|
|
13
|
-
}, q = {
|
|
1
|
+
import { defineComponent as N, useSlots as O, useTemplateRef as S, ref as _, computed as m, createElementBlock as f, openBlock as l, normalizeStyle as c, createVNode as s, createCommentVNode as r, createElementVNode as D, unref as t, withCtx as R, createBlock as d, renderSlot as g } from "vue";
|
|
2
|
+
import { Scatter as w, Position as K } from "@unovis/ts";
|
|
3
|
+
import { VisXYContainer as M, VisTooltip as E, VisScatter as G, VisAxis as k, VisBulletLegend as W } from "@unovis/vue";
|
|
4
|
+
import { LegendPosition as $ } from "../../types.js";
|
|
5
|
+
import { getFirstPropertyValue as j } from "../../utils.js";
|
|
6
|
+
import X from "../Tooltip.js";
|
|
7
|
+
const Y = {
|
|
14
8
|
ref: "slotWrapper",
|
|
15
9
|
class: "hidden"
|
|
16
|
-
},
|
|
10
|
+
}, Z = /* @__PURE__ */ N({
|
|
17
11
|
__name: "BubbleChart",
|
|
18
12
|
props: {
|
|
19
13
|
xAccessor: {},
|
|
@@ -34,7 +28,8 @@ const X = {
|
|
|
34
28
|
categoryKey: {},
|
|
35
29
|
xFormatter: {},
|
|
36
30
|
yFormatter: {},
|
|
37
|
-
legendPosition: { default:
|
|
31
|
+
legendPosition: { default: $.BottomCenter },
|
|
32
|
+
legendStyle: { default: void 0 },
|
|
38
33
|
sizeOptions: {},
|
|
39
34
|
xDomainLine: { type: Boolean, default: !0 },
|
|
40
35
|
yDomainLine: { type: Boolean, default: !0 },
|
|
@@ -52,51 +47,58 @@ const X = {
|
|
|
52
47
|
}) }
|
|
53
48
|
},
|
|
54
49
|
emits: ["click"],
|
|
55
|
-
setup(
|
|
56
|
-
const e =
|
|
57
|
-
var
|
|
50
|
+
setup(x, { emit: L }) {
|
|
51
|
+
const e = x, T = O(), u = S("slotWrapper"), a = _(), h = e.xAccessor, v = e.yAccessor, b = e.sizeAccessor || ((i) => typeof i.comments == "number" ? i.comments : 1), B = (i) => {
|
|
52
|
+
var y, p;
|
|
58
53
|
if (!e.categories || !e.categoryKey)
|
|
59
|
-
return console.warn(
|
|
54
|
+
return console.warn(
|
|
55
|
+
"BubbleChart: categories and categoryKey are required for color mapping"
|
|
56
|
+
), "#cccccc";
|
|
60
57
|
const n = String(i[e.categoryKey]);
|
|
61
|
-
let
|
|
62
|
-
return Object.keys(e.categories).length === 1 && (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
58
|
+
let o = (y = e.categories[n]) == null ? void 0 : y.color;
|
|
59
|
+
return Object.keys(e.categories).length === 1 && (o = (p = e.categories[e.categoryKey]) == null ? void 0 : p.color), o || (console.warn(
|
|
60
|
+
`BubbleChart: No color defined for category "${n}"`
|
|
61
|
+
), "#cccccc");
|
|
62
|
+
}, A = L;
|
|
67
63
|
function C(i) {
|
|
68
|
-
return
|
|
64
|
+
return a.value = i, V();
|
|
65
|
+
}
|
|
66
|
+
function V(i) {
|
|
67
|
+
return typeof window > "u" ? "" : u.value ? u.value.innerHTML : "";
|
|
69
68
|
}
|
|
70
|
-
const
|
|
71
|
-
[
|
|
72
|
-
};
|
|
73
|
-
return (i, n) => (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
const F = {
|
|
70
|
+
[w.selectors.point]: C
|
|
71
|
+
}, z = m(() => e.legendPosition.startsWith("top")), P = m(() => e.legendPosition.includes("left") ? "flex-start" : e.legendPosition.includes("right") ? "flex-end" : "center");
|
|
72
|
+
return (i, n) => (l(), f("div", {
|
|
73
|
+
style: c({
|
|
74
|
+
display: "flex",
|
|
75
|
+
flexDirection: z.value ? "column-reverse" : "column",
|
|
76
|
+
gap: "var(--vis-legend-spacing)"
|
|
77
|
+
})
|
|
78
|
+
}, [
|
|
79
|
+
s(t(M), {
|
|
78
80
|
data: e.data,
|
|
79
81
|
height: e.height || 600,
|
|
80
82
|
padding: e.padding,
|
|
81
83
|
scaleByDomain: !0,
|
|
82
|
-
onClick: n[0] || (n[0] = (
|
|
84
|
+
onClick: n[0] || (n[0] = (o) => A("click", o, a.value))
|
|
83
85
|
}, {
|
|
84
|
-
default:
|
|
85
|
-
e.hideTooltip ? r("", !0) : (
|
|
86
|
+
default: R(() => [
|
|
87
|
+
e.hideTooltip ? r("", !0) : (l(), d(t(E), {
|
|
86
88
|
key: 0,
|
|
87
|
-
triggers:
|
|
89
|
+
triggers: F
|
|
88
90
|
})),
|
|
89
91
|
s(t(G), {
|
|
90
|
-
x: t(
|
|
91
|
-
y: t(
|
|
92
|
-
color:
|
|
93
|
-
size: t(
|
|
94
|
-
labelPosition: e.labelPosition || t(
|
|
92
|
+
x: t(h),
|
|
93
|
+
y: t(v),
|
|
94
|
+
color: B,
|
|
95
|
+
size: t(b),
|
|
96
|
+
labelPosition: e.labelPosition || t(K).Bottom,
|
|
95
97
|
sizeRange: e.sizeRange || [1, 20],
|
|
96
98
|
opacity: e.opacity,
|
|
97
99
|
cursor: "pointer"
|
|
98
100
|
}, null, 8, ["x", "y", "size", "labelPosition", "sizeRange", "opacity"]),
|
|
99
|
-
e.hideXAxis ? r("", !0) : (
|
|
101
|
+
e.hideXAxis ? r("", !0) : (l(), d(t(k), {
|
|
100
102
|
key: 1,
|
|
101
103
|
type: "x",
|
|
102
104
|
label: e.xLabel,
|
|
@@ -108,7 +110,7 @@ const X = {
|
|
|
108
110
|
tickValues: e.xExplicitTicks,
|
|
109
111
|
minMaxTicksOnly: e.minMaxTicksOnly
|
|
110
112
|
}, null, 8, ["label", "tickFormat", "gridLine", "domainLine", "tickLine", "numTicks", "tickValues", "minMaxTicksOnly"])),
|
|
111
|
-
e.hideYAxis ? r("", !0) : (
|
|
113
|
+
e.hideYAxis ? r("", !0) : (l(), d(t(k), {
|
|
112
114
|
key: 2,
|
|
113
115
|
type: "y",
|
|
114
116
|
label: e.yLabel,
|
|
@@ -121,25 +123,41 @@ const X = {
|
|
|
121
123
|
]),
|
|
122
124
|
_: 1
|
|
123
125
|
}, 8, ["data", "height", "padding"]),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
e.hideLegend ? r("", !0) : (l(), f("div", {
|
|
127
|
+
key: 0,
|
|
128
|
+
style: c({
|
|
129
|
+
display: "flex",
|
|
130
|
+
justifyContent: P.value
|
|
131
|
+
})
|
|
132
|
+
}, [
|
|
133
|
+
s(t(W), {
|
|
134
|
+
class: "bulletLegendOverrides",
|
|
135
|
+
style: c([
|
|
136
|
+
e.legendStyle,
|
|
137
|
+
"display: flex; gap: var(--vis-legend-spacing);"
|
|
138
|
+
]),
|
|
139
|
+
items: Object.values(e.categories).map((o) => ({
|
|
140
|
+
...o,
|
|
141
|
+
color: Array.isArray(o.color) ? o.color[0] : o.color
|
|
142
|
+
}))
|
|
143
|
+
}, null, 8, ["style", "items"])
|
|
144
|
+
], 4)),
|
|
145
|
+
D("div", Y, [
|
|
128
146
|
t(T).tooltip ? g(i.$slots, "tooltip", {
|
|
129
147
|
key: 0,
|
|
130
|
-
values:
|
|
131
|
-
}) :
|
|
132
|
-
s(
|
|
133
|
-
data:
|
|
148
|
+
values: a.value
|
|
149
|
+
}) : a.value ? g(i.$slots, "fallback", { key: 1 }, () => [
|
|
150
|
+
s(X, {
|
|
151
|
+
data: a.value,
|
|
134
152
|
categories: e.categories || {},
|
|
135
|
-
toolTipTitle: t(
|
|
153
|
+
toolTipTitle: t(j)(a.value) ?? "",
|
|
136
154
|
yFormatter: e.yFormatter
|
|
137
155
|
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
138
156
|
]) : r("", !0)
|
|
139
157
|
], 512)
|
|
140
|
-
],
|
|
158
|
+
], 4));
|
|
141
159
|
}
|
|
142
160
|
});
|
|
143
161
|
export {
|
|
144
|
-
|
|
162
|
+
Z as default
|
|
145
163
|
};
|
|
@@ -107,6 +107,10 @@ export interface BubbleChartProps<T> {
|
|
|
107
107
|
* See `LegendPosition` for available options.
|
|
108
108
|
*/
|
|
109
109
|
legendPosition?: LegendPosition;
|
|
110
|
+
/**
|
|
111
|
+
* Optional inline CSS styles for the legend container.
|
|
112
|
+
*/
|
|
113
|
+
legendStyle?: Record<string, string>;
|
|
110
114
|
/** Options for controlling bubble sizes. */
|
|
111
115
|
sizeOptions?: SizeOptions;
|
|
112
116
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as V, useSlots as b, useTemplateRef as
|
|
2
|
-
import { Donut as
|
|
3
|
-
import { DonutType as
|
|
4
|
-
import { VisSingleContainer as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as V, useSlots as b, useTemplateRef as x, ref as w, createElementBlock as c, openBlock as m, Fragment as T, createElementVNode as a, createCommentVNode as g, createVNode as r, renderSlot as s, unref as n, withCtx as D, normalizeStyle as S, toDisplayString as W } from "vue";
|
|
2
|
+
import { Donut as B } from "@unovis/ts";
|
|
3
|
+
import { DonutType as L } from "./types.js";
|
|
4
|
+
import { VisSingleContainer as R, VisTooltip as H, VisDonut as N, VisBulletLegend as $ } from "@unovis/vue";
|
|
5
|
+
const j = {
|
|
6
6
|
ref: "slotWrapper",
|
|
7
7
|
style: { display: "none" }
|
|
8
|
-
},
|
|
8
|
+
}, z = { style: { display: "flex", "align-items": "center", padding: "10px 15px" } }, A = {
|
|
9
9
|
key: 0,
|
|
10
10
|
style: {
|
|
11
11
|
display: "flex",
|
|
@@ -13,7 +13,7 @@ const z = {
|
|
|
13
13
|
justifyContent: "center",
|
|
14
14
|
marginTop: "1rem"
|
|
15
15
|
}
|
|
16
|
-
},
|
|
16
|
+
}, U = /* @__PURE__ */ V({
|
|
17
17
|
__name: "DonutChart",
|
|
18
18
|
props: {
|
|
19
19
|
type: {},
|
|
@@ -26,74 +26,74 @@ const z = {
|
|
|
26
26
|
padAngle: {}
|
|
27
27
|
},
|
|
28
28
|
emits: ["click"],
|
|
29
|
-
setup(
|
|
30
|
-
const f =
|
|
29
|
+
setup(t, { emit: p }) {
|
|
30
|
+
const f = p, i = t, h = b(), d = x("slotWrapper"), l = w(), y = (e) => e, v = i.type === L.Half;
|
|
31
31
|
function C(e) {
|
|
32
|
-
return
|
|
32
|
+
return l.value = e, k();
|
|
33
33
|
}
|
|
34
34
|
function k(e) {
|
|
35
|
-
return typeof window > "u" ? "" :
|
|
35
|
+
return typeof window > "u" ? "" : d.value ? d.value.innerHTML : "";
|
|
36
36
|
}
|
|
37
|
-
return (e,
|
|
38
|
-
|
|
37
|
+
return (e, u) => (m(), c(T, null, [
|
|
38
|
+
a("div", {
|
|
39
39
|
style: {
|
|
40
40
|
display: "flex",
|
|
41
41
|
alignItems: "center",
|
|
42
42
|
justifyContent: "center"
|
|
43
43
|
},
|
|
44
|
-
onClick:
|
|
44
|
+
onClick: u[0] || (u[0] = (o) => f("click", o, l.value))
|
|
45
45
|
}, [
|
|
46
|
-
|
|
47
|
-
data:
|
|
48
|
-
height:
|
|
46
|
+
r(n(R), {
|
|
47
|
+
data: t.data,
|
|
48
|
+
height: t.height,
|
|
49
49
|
margin: {}
|
|
50
50
|
}, {
|
|
51
|
-
default:
|
|
52
|
-
|
|
51
|
+
default: D(() => [
|
|
52
|
+
r(n(H), {
|
|
53
53
|
"horizontal-shift": 20,
|
|
54
54
|
"vertical-shift": 20,
|
|
55
55
|
triggers: {
|
|
56
|
-
[
|
|
56
|
+
[n(B).selectors.segment]: C
|
|
57
57
|
}
|
|
58
58
|
}, null, 8, ["triggers"]),
|
|
59
|
-
|
|
59
|
+
r(n(N), {
|
|
60
60
|
value: y,
|
|
61
|
-
"corner-radius":
|
|
62
|
-
"arc-width":
|
|
63
|
-
color:
|
|
61
|
+
"corner-radius": t.radius,
|
|
62
|
+
"arc-width": t.arcWidth ?? 20,
|
|
63
|
+
color: i.labels.map((o) => o.color),
|
|
64
64
|
"angle-range": v ? [-1.5707963267948966, 1.5707963267948966] : [],
|
|
65
|
-
"pad-angle":
|
|
65
|
+
"pad-angle": i.padAngle || 0
|
|
66
66
|
}, null, 8, ["corner-radius", "arc-width", "color", "angle-range", "pad-angle"])
|
|
67
67
|
]),
|
|
68
68
|
_: 1
|
|
69
69
|
}, 8, ["data", "height"]),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
s(e.$slots, "default"),
|
|
71
|
+
a("div", j, [
|
|
72
|
+
n(h).tooltip ? s(e.$slots, "tooltip", {
|
|
73
73
|
key: 0,
|
|
74
|
-
values:
|
|
75
|
-
}) :
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
style:
|
|
74
|
+
values: l.value
|
|
75
|
+
}) : l.value ? s(e.$slots, "fallback", { key: 1 }, () => [
|
|
76
|
+
a("div", z, [
|
|
77
|
+
a("div", {
|
|
78
|
+
style: S({
|
|
79
79
|
width: "0.5rem",
|
|
80
80
|
height: "0.5rem",
|
|
81
81
|
borderRadius: "9999px",
|
|
82
82
|
marginRight: "0.5rem",
|
|
83
|
-
backgroundColor:
|
|
83
|
+
backgroundColor: i.labels[l.value.index].color
|
|
84
84
|
})
|
|
85
85
|
}, null, 4),
|
|
86
|
-
|
|
86
|
+
a("div", null, W(l.value.data), 1)
|
|
87
87
|
])
|
|
88
|
-
]) :
|
|
88
|
+
]) : g("", !0)
|
|
89
89
|
], 512)
|
|
90
90
|
]),
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
t.hideLegend ? g("", !0) : (m(), c("div", A, [
|
|
92
|
+
r(n($), { items: t.labels }, null, 8, ["items"])
|
|
93
93
|
]))
|
|
94
94
|
], 64));
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
export {
|
|
98
|
-
|
|
98
|
+
U as default
|
|
99
99
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as N, computed as u, useSlots as O, useTemplateRef as W, ref as j, createElementBlock as y, openBlock as a, normalizeClass as w, normalizeStyle as g, createVNode as c, createCommentVNode as r, createElementVNode as M, unref as i, withCtx as S, createBlock as d, Fragment as z, renderList as E, mergeProps as G, renderSlot as h } from "vue";
|
|
2
2
|
import { Position as v, CurveType as X } from "@unovis/ts";
|
|
3
3
|
import { createMarkers as $, getFirstPropertyValue as R } from "../../utils.js";
|
|
4
|
-
import
|
|
5
|
-
import { VisXYContainer as
|
|
6
|
-
import { LegendPosition as
|
|
7
|
-
const
|
|
4
|
+
import Y from "../Tooltip.js";
|
|
5
|
+
import { VisXYContainer as H, VisTooltip as U, VisLine as q, VisAxis as x, VisCrosshair as I, VisBulletLegend as J } from "@unovis/vue";
|
|
6
|
+
import { LegendPosition as Q } from "../../types.js";
|
|
7
|
+
const Z = {
|
|
8
8
|
ref: "slotWrapper",
|
|
9
9
|
style: { display: "none" }
|
|
10
|
-
},
|
|
10
|
+
}, le = /* @__PURE__ */ N({
|
|
11
11
|
__name: "LineChart",
|
|
12
12
|
props: {
|
|
13
13
|
data: {},
|
|
@@ -27,13 +27,14 @@ const Q = {
|
|
|
27
27
|
curveType: {},
|
|
28
28
|
lineWidth: { default: 2 },
|
|
29
29
|
lineDashArray: {},
|
|
30
|
-
xNumTicks: { default: (
|
|
30
|
+
xNumTicks: { default: (e) => e.data.length > 24 ? 24 / 4 : e.data.length - 1 },
|
|
31
31
|
xExplicitTicks: {},
|
|
32
32
|
minMaxTicksOnly: { type: Boolean },
|
|
33
|
-
yNumTicks: { default: (
|
|
33
|
+
yNumTicks: { default: (e) => e.data.length > 24 ? 24 / 4 : e.data.length - 1 },
|
|
34
34
|
hideTooltip: { type: Boolean },
|
|
35
|
-
hideLegend: { type: Boolean },
|
|
36
|
-
legendPosition: {},
|
|
35
|
+
hideLegend: { type: Boolean, default: !1 },
|
|
36
|
+
legendPosition: { default: Q.BottomCenter },
|
|
37
|
+
legendStyle: { default: void 0 },
|
|
37
38
|
xGridLine: { type: Boolean },
|
|
38
39
|
xDomainLine: { type: Boolean },
|
|
39
40
|
yGridLine: { type: Boolean },
|
|
@@ -44,52 +45,54 @@ const Q = {
|
|
|
44
45
|
hideYAxis: { type: Boolean },
|
|
45
46
|
crosshairConfig: { default: () => ({
|
|
46
47
|
color: "#666"
|
|
47
|
-
}) }
|
|
48
|
+
}) },
|
|
49
|
+
yDomain: {},
|
|
50
|
+
xDomain: {}
|
|
48
51
|
},
|
|
49
52
|
emits: ["click"],
|
|
50
|
-
setup(
|
|
51
|
-
const
|
|
52
|
-
function
|
|
53
|
-
return typeof window > "u" ? "" :
|
|
53
|
+
setup(e, { emit: T }) {
|
|
54
|
+
const L = T, t = e, D = u(() => t.markerConfig ? $(t.markerConfig) : ""), C = O(), f = W("slotWrapper"), o = j();
|
|
55
|
+
function p(n) {
|
|
56
|
+
return typeof window > "u" ? "" : f.value ? f.value.innerHTML : "";
|
|
54
57
|
}
|
|
55
|
-
function
|
|
56
|
-
return
|
|
58
|
+
function B(n) {
|
|
59
|
+
return o.value = n, p();
|
|
57
60
|
}
|
|
58
|
-
const
|
|
59
|
-
() =>
|
|
60
|
-
),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return (e, r) => (n(), p("div", {
|
|
64
|
-
style: k({
|
|
61
|
+
const b = u(() => t.legendPosition.startsWith("top")), A = u(() => t.legendPosition.includes("left") ? "flex-start" : t.legendPosition.includes("right") ? "flex-end" : "center"), V = Object.values(t.categories).map(
|
|
62
|
+
(n, s) => `var(--vis-color${s})`
|
|
63
|
+
), F = (n) => Object.values(t.categories)[n].color ?? V[n];
|
|
64
|
+
return (n, s) => (a(), y("div", {
|
|
65
|
+
style: g({
|
|
65
66
|
display: "flex",
|
|
66
|
-
flexDirection:
|
|
67
|
-
gap: "
|
|
67
|
+
flexDirection: b.value ? "column-reverse" : "column",
|
|
68
|
+
gap: "var(--vis-legend-spacing)"
|
|
68
69
|
}),
|
|
69
|
-
class:
|
|
70
|
-
onClick:
|
|
70
|
+
class: w({ markers: !!t.markerConfig }),
|
|
71
|
+
onClick: s[0] || (s[0] = (l) => L("click", l, o.value))
|
|
71
72
|
}, [
|
|
72
|
-
|
|
73
|
+
c(i(H), {
|
|
73
74
|
data: e.data,
|
|
74
75
|
padding: e.padding,
|
|
75
76
|
height: e.height,
|
|
76
|
-
svgDefs:
|
|
77
|
+
svgDefs: D.value,
|
|
78
|
+
yDomain: e.yDomain,
|
|
79
|
+
xDomain: e.xDomain
|
|
77
80
|
}, {
|
|
78
|
-
default:
|
|
79
|
-
|
|
81
|
+
default: S(() => [
|
|
82
|
+
c(i(U), {
|
|
80
83
|
"horizontal-placement": i(v).Right,
|
|
81
84
|
"vertical-placement": i(v).Top
|
|
82
85
|
}, null, 8, ["horizontal-placement", "vertical-placement"]),
|
|
83
|
-
(
|
|
84
|
-
key:
|
|
85
|
-
x: (
|
|
86
|
-
y: (
|
|
87
|
-
color: F(
|
|
86
|
+
(a(!0), y(z, null, E(Object.keys(t.categories), (l, m) => (a(), d(i(q), {
|
|
87
|
+
key: m,
|
|
88
|
+
x: (k, P) => P,
|
|
89
|
+
y: (k) => k[l],
|
|
90
|
+
color: F(m),
|
|
88
91
|
"curve-type": e.curveType ?? i(X).MonotoneX,
|
|
89
92
|
"line-width": e.lineWidth,
|
|
90
|
-
lineDashArray: e.lineDashArray ? e.lineDashArray[
|
|
93
|
+
lineDashArray: e.lineDashArray ? e.lineDashArray[m] : void 0
|
|
91
94
|
}, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"]))), 128)),
|
|
92
|
-
e.hideXAxis ?
|
|
95
|
+
e.hideXAxis ? r("", !0) : (a(), d(i(x), {
|
|
93
96
|
key: 0,
|
|
94
97
|
type: "x",
|
|
95
98
|
"tick-format": e.xFormatter,
|
|
@@ -102,7 +105,7 @@ const Q = {
|
|
|
102
105
|
"tick-values": e.xExplicitTicks,
|
|
103
106
|
"min-max-ticks-only": e.minMaxTicksOnly
|
|
104
107
|
}, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"])),
|
|
105
|
-
e.hideYAxis ?
|
|
108
|
+
e.hideYAxis ? r("", !0) : (a(), d(i(x), {
|
|
106
109
|
key: 1,
|
|
107
110
|
type: "y",
|
|
108
111
|
"tick-format": e.yFormatter,
|
|
@@ -112,39 +115,44 @@ const Q = {
|
|
|
112
115
|
"grid-line": e.yGridLine,
|
|
113
116
|
"tick-line": e.yTickLine
|
|
114
117
|
}, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"])),
|
|
115
|
-
e.hideTooltip ?
|
|
118
|
+
e.hideTooltip ? r("", !0) : (a(), d(i(I), G({ key: 2 }, e.crosshairConfig, { template: B }), null, 16))
|
|
116
119
|
]),
|
|
117
120
|
_: 1
|
|
118
|
-
}, 8, ["data", "padding", "height", "svgDefs"]),
|
|
119
|
-
|
|
121
|
+
}, 8, ["data", "padding", "height", "svgDefs", "yDomain", "xDomain"]),
|
|
122
|
+
t.hideLegend ? r("", !0) : (a(), y("div", {
|
|
120
123
|
key: 0,
|
|
121
|
-
style:
|
|
124
|
+
style: g({
|
|
122
125
|
display: "flex",
|
|
123
|
-
|
|
124
|
-
justifyContent: "flex-end",
|
|
125
|
-
paddingBottom: y.value ? "1rem" : void 0
|
|
126
|
+
justifyContent: A.value
|
|
126
127
|
})
|
|
127
128
|
}, [
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
c(i(J), {
|
|
130
|
+
style: g([
|
|
131
|
+
t.legendStyle,
|
|
132
|
+
"display: flex; gap: var(--vis-legend-spacing);"
|
|
133
|
+
]),
|
|
134
|
+
items: Object.values(t.categories).map((l) => ({
|
|
135
|
+
...l,
|
|
136
|
+
color: Array.isArray(l.color) ? l.color[0] : l.color
|
|
137
|
+
}))
|
|
138
|
+
}, null, 8, ["style", "items"])
|
|
131
139
|
], 4)),
|
|
132
|
-
M("div",
|
|
133
|
-
i(
|
|
140
|
+
M("div", Z, [
|
|
141
|
+
i(C).tooltip ? h(n.$slots, "tooltip", {
|
|
134
142
|
key: 0,
|
|
135
|
-
values:
|
|
136
|
-
}) :
|
|
137
|
-
|
|
138
|
-
data:
|
|
143
|
+
values: o.value
|
|
144
|
+
}) : o.value ? h(n.$slots, "fallback", { key: 1 }, () => [
|
|
145
|
+
c(Y, {
|
|
146
|
+
data: o.value,
|
|
139
147
|
categories: e.categories,
|
|
140
|
-
toolTipTitle: i(R)(
|
|
148
|
+
toolTipTitle: i(R)(o.value) ?? "",
|
|
141
149
|
yFormatter: t.yFormatter
|
|
142
150
|
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
143
|
-
]) :
|
|
151
|
+
]) : r("", !0)
|
|
144
152
|
], 512)
|
|
145
153
|
], 6));
|
|
146
154
|
}
|
|
147
155
|
});
|
|
148
156
|
export {
|
|
149
|
-
|
|
157
|
+
le as default
|
|
150
158
|
};
|
|
@@ -71,7 +71,7 @@ export interface LineChartProps<T> {
|
|
|
71
71
|
/**
|
|
72
72
|
* Force specific ticks on the x-axis.
|
|
73
73
|
*/
|
|
74
|
-
xExplicitTicks?: number;
|
|
74
|
+
xExplicitTicks?: (number | string | Date)[];
|
|
75
75
|
/**
|
|
76
76
|
* Force only first and last ticks on the x-axis.
|
|
77
77
|
*/
|
|
@@ -93,6 +93,10 @@ export interface LineChartProps<T> {
|
|
|
93
93
|
* See `LegendPosition` for available options.
|
|
94
94
|
*/
|
|
95
95
|
legendPosition?: LegendPosition;
|
|
96
|
+
/**
|
|
97
|
+
* Optional style object for the legend container. Allows custom CSS styling.
|
|
98
|
+
*/
|
|
99
|
+
legendStyle?: string | Record<string, string>;
|
|
96
100
|
/**
|
|
97
101
|
* If `true`, displays grid lines along the x-axis.
|
|
98
102
|
*/
|
|
@@ -129,4 +133,12 @@ export interface LineChartProps<T> {
|
|
|
129
133
|
* Crosshair configuration object for customizing the appearance of the crosshair line.
|
|
130
134
|
*/
|
|
131
135
|
crosshairConfig?: CrosshairConfig;
|
|
136
|
+
/**
|
|
137
|
+
* The domain for the y-axis, specified as a tuple of two values.
|
|
138
|
+
*/
|
|
139
|
+
yDomain?: [number | undefined, number | undefined];
|
|
140
|
+
/**
|
|
141
|
+
* The domain for the x-axis, specified as a tuple of two values.
|
|
142
|
+
*/
|
|
143
|
+
xDomain?: [number | undefined, number | undefined];
|
|
132
144
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as v, computed as y, createElementBlock as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as v, computed as y, createElementBlock as i, openBlock as l, createElementVNode as o, toDisplayString as n, Fragment as b, renderList as f, normalizeStyle as a } from "vue";
|
|
2
|
+
const h = { style: { padding: "10px 15px" } }, B = { style: {
|
|
3
3
|
color: "var(--tooltip-value-color)",
|
|
4
4
|
textTransform: "capitalize",
|
|
5
|
-
borderBottom: "1px solid
|
|
5
|
+
borderBottom: "borderBottom: 1px solid var(--tooltip-border-color)",
|
|
6
6
|
marginBottom: "0.25rem",
|
|
7
7
|
paddingBottom: "0.25rem"
|
|
8
|
-
} },
|
|
8
|
+
} }, F = /* @__PURE__ */ v({
|
|
9
9
|
__name: "Tooltip",
|
|
10
10
|
props: {
|
|
11
11
|
data: {},
|
|
@@ -13,30 +13,30 @@ const f = { style: { padding: "10px 15px" } }, x = { style: {
|
|
|
13
13
|
toolTipTitle: {},
|
|
14
14
|
yFormatter: { type: Function }
|
|
15
15
|
},
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
18
|
-
([
|
|
16
|
+
setup(t) {
|
|
17
|
+
const c = t, g = ["_index", "_stacked", "_ending"], p = y(() => Object.entries(c.data ?? []).filter(
|
|
18
|
+
([r, u]) => !g.includes(r) && Object.keys(c.categories).includes(r)
|
|
19
19
|
));
|
|
20
|
-
return (
|
|
21
|
-
|
|
22
|
-
(
|
|
23
|
-
var
|
|
24
|
-
return
|
|
25
|
-
key:
|
|
20
|
+
return (r, u) => (l(), i("div", h, [
|
|
21
|
+
o("div", B, n(t.toolTipTitle), 1),
|
|
22
|
+
(l(!0), i(b, null, f(p.value, ([e, s], x) => {
|
|
23
|
+
var d, m;
|
|
24
|
+
return l(), i("div", {
|
|
25
|
+
key: e,
|
|
26
26
|
style: { display: "flex", "align-items": "center", "margin-bottom": "4px" }
|
|
27
27
|
}, [
|
|
28
|
-
|
|
29
|
-
style:
|
|
30
|
-
backgroundColor: (
|
|
28
|
+
o("span", {
|
|
29
|
+
style: a([{ width: "8px", height: "8px", "border-radius": "4px", "margin-right": "8px" }, {
|
|
30
|
+
backgroundColor: typeof ((d = t.categories[e]) == null ? void 0 : d.color) == "string" && ((m = t.categories[e]) != null && m.color) ? t.categories[e].color : `var(--vis-color${x})`
|
|
31
31
|
}])
|
|
32
32
|
}, null, 4),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
style:
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
style:
|
|
39
|
-
},
|
|
33
|
+
o("div", null, [
|
|
34
|
+
o("span", {
|
|
35
|
+
style: a([{ "font-weight": "600", "margin-right": "8px" }, { color: "var(--tooltip-label-color)" }])
|
|
36
|
+
}, n(t.categories[e].name) + ":", 1),
|
|
37
|
+
o("span", {
|
|
38
|
+
style: a([{ "font-weight": "400" }, { color: "var(--tooltip-value-color)" }])
|
|
39
|
+
}, n(t.yFormatter ? t.yFormatter(s) : s), 1)
|
|
40
40
|
])
|
|
41
41
|
]);
|
|
42
42
|
}), 128))
|
|
@@ -44,5 +44,5 @@ const f = { style: { padding: "10px 15px" } }, x = { style: {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
export {
|
|
47
|
-
|
|
47
|
+
F as default
|
|
48
48
|
};
|