vue-chrts 1.0.2 → 2.0.0-beta.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 +138 -131
- package/dist/components/AreaChart/types.d.ts +13 -3
- package/dist/components/BarChart/BarChart.js +96 -96
- package/dist/components/BarChart/types.d.ts +4 -0
- package/dist/components/BubbleChart/BubbleChart.js +47 -47
- package/dist/components/BubbleChart/types.d.ts +4 -0
- package/dist/components/DonutChart/DonutChart.js +64 -68
- package/dist/components/DonutChart/DonutChart.vue.d.ts +1 -1
- package/dist/components/DonutChart/types.d.ts +5 -1
- package/dist/components/GanttChart/GanttChart.js +65 -64
- package/dist/components/GanttChart/GanttChart.vue.d.ts +1 -1
- package/dist/components/GanttChart/types.d.ts +6 -2
- package/dist/components/LineChart/LineChart.js +6 -5
- package/dist/components/Tooltip.js +59 -33
- package/dist/components/Tooltip.vue.d.ts +1 -1
- package/dist/types.d.ts +12 -7
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +6 -6
- package/package.json +3 -3
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Donut as
|
|
3
|
-
import { DonutType as
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { defineComponent as B, useSlots as D, useTemplateRef as P, ref as W, computed as s, createElementBlock as p, openBlock as m, normalizeStyle as d, createVNode as a, createCommentVNode as v, createElementVNode as y, unref as r, withCtx as b, renderSlot as u } from "vue";
|
|
2
|
+
import { Donut as N } from "@unovis/ts";
|
|
3
|
+
import { DonutType as $ } from "./types.js";
|
|
4
|
+
import j from "../Tooltip.js";
|
|
5
|
+
import { VisSingleContainer as z, VisTooltip as H, VisDonut as E, VisBulletLegend as F } from "@unovis/vue";
|
|
6
|
+
import { LegendPosition as O } from "../../types.js";
|
|
7
|
+
const R = { style: {
|
|
7
8
|
position: "absolute",
|
|
8
9
|
top: "50%",
|
|
9
10
|
left: "50%",
|
|
10
11
|
transform: "translate(-50%, -50%)"
|
|
11
|
-
} },
|
|
12
|
+
} }, M = {
|
|
12
13
|
ref: "slotWrapper",
|
|
13
14
|
style: { display: "none" }
|
|
14
|
-
},
|
|
15
|
+
}, K = /* @__PURE__ */ B({
|
|
15
16
|
__name: "DonutChart",
|
|
16
17
|
props: {
|
|
17
18
|
type: {},
|
|
@@ -20,99 +21,94 @@ const M = { style: {
|
|
|
20
21
|
height: {},
|
|
21
22
|
radius: {},
|
|
22
23
|
hideLegend: { type: Boolean },
|
|
23
|
-
legendPosition: { default:
|
|
24
|
+
legendPosition: { default: O.BottomCenter },
|
|
24
25
|
legendStyle: {},
|
|
25
26
|
categories: {},
|
|
26
|
-
padAngle: {}
|
|
27
|
+
padAngle: {},
|
|
28
|
+
tooltipTitleFormatter: {}
|
|
27
29
|
},
|
|
28
30
|
emits: ["click"],
|
|
29
|
-
setup(
|
|
30
|
-
const C = h,
|
|
31
|
-
function
|
|
32
|
-
|
|
31
|
+
setup(l, { emit: h }) {
|
|
32
|
+
const C = h, t = l, k = D(), c = P("slotWrapper"), i = W(), T = (e) => e, V = t.type === $.Half;
|
|
33
|
+
function x(e) {
|
|
34
|
+
const o = Object.values(t.categories)[e.index].name;
|
|
35
|
+
return i.value = {
|
|
36
|
+
label: o,
|
|
37
|
+
[o]: e.data
|
|
38
|
+
}, A();
|
|
33
39
|
}
|
|
34
|
-
function
|
|
35
|
-
return typeof window > "u" ? "" :
|
|
40
|
+
function A() {
|
|
41
|
+
return typeof window > "u" ? "" : c.value ? c.value.innerHTML : "";
|
|
36
42
|
}
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
return
|
|
43
|
+
const L = s(() => t.legendPosition.includes("top")), S = s(() => t.legendPosition.includes("left") ? "flex-start" : t.legendPosition.includes("right") ? "flex-end" : "center"), g = (e, o = "#ccc") => e ? Array.isArray(e) ? e[0] || o : e : o, f = s(() => Object.values(t.categories)), w = (e, o) => {
|
|
44
|
+
const n = f.value[o];
|
|
45
|
+
if (n)
|
|
46
|
+
return g(n.color);
|
|
41
47
|
};
|
|
42
|
-
return (e, o) => (m(),
|
|
43
|
-
style:
|
|
48
|
+
return (e, o) => (m(), p("div", {
|
|
49
|
+
style: d({
|
|
44
50
|
display: "flex",
|
|
45
|
-
flexDirection:
|
|
51
|
+
flexDirection: L.value ? "column-reverse" : "column",
|
|
46
52
|
gap: "var(--vis-legend-spacing)"
|
|
47
53
|
}),
|
|
48
|
-
onClick: o[0] || (o[0] = (
|
|
54
|
+
onClick: o[0] || (o[0] = (n) => C("click", n, i.value))
|
|
49
55
|
}, [
|
|
50
|
-
a(
|
|
51
|
-
data:
|
|
52
|
-
height:
|
|
56
|
+
a(r(z), {
|
|
57
|
+
data: l.data,
|
|
58
|
+
height: l.height,
|
|
53
59
|
margin: {}
|
|
54
60
|
}, {
|
|
55
|
-
default:
|
|
56
|
-
a(
|
|
61
|
+
default: b(() => [
|
|
62
|
+
a(r(H), {
|
|
57
63
|
"horizontal-shift": 20,
|
|
58
64
|
"vertical-shift": 20,
|
|
59
65
|
triggers: {
|
|
60
|
-
[
|
|
66
|
+
[r(N).selectors.segment]: x
|
|
61
67
|
}
|
|
62
68
|
}, null, 8, ["triggers"]),
|
|
63
|
-
a(
|
|
64
|
-
value:
|
|
65
|
-
"corner-radius":
|
|
66
|
-
"arc-width":
|
|
67
|
-
color:
|
|
68
|
-
"angle-range":
|
|
69
|
-
"pad-angle":
|
|
69
|
+
a(r(E), {
|
|
70
|
+
value: T,
|
|
71
|
+
"corner-radius": l.radius,
|
|
72
|
+
"arc-width": l.arcWidth ?? 20,
|
|
73
|
+
color: w,
|
|
74
|
+
"angle-range": V ? [-1.5707963267948966, 1.5707963267948966] : [],
|
|
75
|
+
"pad-angle": t.padAngle || 0
|
|
70
76
|
}, null, 8, ["corner-radius", "arc-width", "angle-range", "pad-angle"]),
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
y("div", R, [
|
|
78
|
+
u(e.$slots, "default")
|
|
73
79
|
])
|
|
74
80
|
]),
|
|
75
81
|
_: 3
|
|
76
82
|
}, 8, ["data", "height"]),
|
|
77
|
-
|
|
83
|
+
t.hideLegend ? v("", !0) : (m(), p("div", {
|
|
78
84
|
key: 0,
|
|
79
|
-
style:
|
|
85
|
+
style: d({
|
|
80
86
|
display: "flex",
|
|
81
|
-
justifyContent:
|
|
87
|
+
justifyContent: S.value
|
|
82
88
|
})
|
|
83
89
|
}, [
|
|
84
|
-
a(
|
|
85
|
-
style:
|
|
86
|
-
|
|
90
|
+
a(r(F), {
|
|
91
|
+
style: d([
|
|
92
|
+
t.legendStyle,
|
|
87
93
|
"display: flex; gap: var(--vis-legend-spacing);"
|
|
88
94
|
]),
|
|
89
|
-
items:
|
|
90
|
-
...
|
|
91
|
-
color:
|
|
95
|
+
items: f.value.map((n) => ({
|
|
96
|
+
...n,
|
|
97
|
+
color: g(n.color)
|
|
92
98
|
}))
|
|
93
99
|
}, null, 8, ["style", "items"])
|
|
94
100
|
], 4)),
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
y("div", M, [
|
|
102
|
+
r(k).tooltip ? u(e.$slots, "tooltip", {
|
|
97
103
|
key: 0,
|
|
98
|
-
values:
|
|
99
|
-
}) :
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
height: "0.5rem",
|
|
107
|
-
borderRadius: "9999px",
|
|
108
|
-
marginRight: "0.5rem",
|
|
109
|
-
backgroundColor: d((t = u.value[r.value.index]) == null ? void 0 : t.color)
|
|
110
|
-
})
|
|
111
|
-
}, null, 4),
|
|
112
|
-
i("div", null, b(r.value.data), 1)
|
|
113
|
-
])
|
|
114
|
-
];
|
|
115
|
-
}) : v("", !0)
|
|
104
|
+
values: i.value
|
|
105
|
+
}) : i.value ? u(e.$slots, "fallback", { key: 1 }, () => [
|
|
106
|
+
a(j, {
|
|
107
|
+
data: i.value,
|
|
108
|
+
categories: t.categories,
|
|
109
|
+
"title-formatter": t.tooltipTitleFormatter
|
|
110
|
+
}, null, 8, ["data", "categories", "title-formatter"])
|
|
111
|
+
]) : v("", !0)
|
|
116
112
|
], 512)
|
|
117
113
|
], 4));
|
|
118
114
|
}
|
|
@@ -2,7 +2,7 @@ import { DonutChartProps } from './types';
|
|
|
2
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
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
4
|
readonly onClick?: ((event: MouseEvent, values?: any) => any) | undefined;
|
|
5
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & DonutChartProps & Partial<{}>> & import('vue').PublicProps;
|
|
5
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & DonutChartProps<T> & Partial<{}>> & import('vue').PublicProps;
|
|
6
6
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
7
7
|
attrs: any;
|
|
8
8
|
slots: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BulletLegendItemInterface, LegendPosition } from '../../types';
|
|
2
|
-
export type DonutChartProps = {
|
|
2
|
+
export type DonutChartProps<T> = {
|
|
3
3
|
/**
|
|
4
4
|
* The type of donut chart to render.
|
|
5
5
|
* See `DonutType` for available options.
|
|
@@ -44,6 +44,10 @@ export type DonutChartProps = {
|
|
|
44
44
|
* Pad angle. Default: 0
|
|
45
45
|
*/
|
|
46
46
|
padAngle?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Use custom formatter for tooltip titles
|
|
49
|
+
*/
|
|
50
|
+
tooltipTitleFormatter?: (data: T) => string | number;
|
|
47
51
|
};
|
|
48
52
|
declare enum DonutType {
|
|
49
53
|
Half = "half",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Timeline as
|
|
3
|
-
import { dateFormatter as S
|
|
4
|
-
import
|
|
5
|
-
import { VisXYContainer as
|
|
6
|
-
import { LegendPosition as
|
|
7
|
-
const I = /* @__PURE__ */
|
|
1
|
+
import { defineComponent as B, useSlots as V, useTemplateRef as w, ref as A, computed as c, createElementBlock as f, openBlock as p, normalizeStyle as d, createVNode as n, createCommentVNode as h, createElementVNode as F, unref as o, withCtx as H, mergeProps as P, renderSlot as y } from "vue";
|
|
2
|
+
import { Timeline as x } from "@unovis/ts";
|
|
3
|
+
import { dateFormatter as S } from "../../utils.js";
|
|
4
|
+
import N from "../Tooltip.js";
|
|
5
|
+
import { VisXYContainer as j, VisTimeline as O, VisTooltip as $, VisAxis as D, VisBulletLegend as G } from "@unovis/vue";
|
|
6
|
+
import { LegendPosition as M } from "../../types.js";
|
|
7
|
+
const I = /* @__PURE__ */ B({
|
|
8
8
|
__name: "GanttChart",
|
|
9
9
|
props: {
|
|
10
10
|
data: {},
|
|
@@ -15,6 +15,7 @@ const I = /* @__PURE__ */ V({
|
|
|
15
15
|
x: {},
|
|
16
16
|
length: {},
|
|
17
17
|
type: {},
|
|
18
|
+
tooltipTitleFormatter: {},
|
|
18
19
|
getTooltipText: {},
|
|
19
20
|
xNumTicks: {},
|
|
20
21
|
showLabels: { type: Boolean, default: !0 },
|
|
@@ -22,7 +23,7 @@ const I = /* @__PURE__ */ V({
|
|
|
22
23
|
crosshairConfig: {},
|
|
23
24
|
lineWidth: { default: 12 },
|
|
24
25
|
rowHeight: { default: 24 },
|
|
25
|
-
legendPosition: { default:
|
|
26
|
+
legendPosition: { default: M.TopRight },
|
|
26
27
|
legendStyle: {},
|
|
27
28
|
hideLegend: { type: Boolean },
|
|
28
29
|
xTickLine: { type: Boolean },
|
|
@@ -35,102 +36,102 @@ const I = /* @__PURE__ */ V({
|
|
|
35
36
|
yAxisConfig: {}
|
|
36
37
|
},
|
|
37
38
|
emits: ["click", "scroll", "labelHover"],
|
|
38
|
-
setup(
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
function
|
|
42
|
-
|
|
39
|
+
setup(i, { emit: T }) {
|
|
40
|
+
const e = i, s = T, k = V(), u = w("slotWrapper"), r = A(), v = c(() => e.legendPosition.startsWith("top")), b = c(() => e.legendPosition.includes("left") ? "flex-start" : e.legendPosition.includes("right") ? "flex-end" : "center");
|
|
41
|
+
x.selectors.label + "";
|
|
42
|
+
function g(l) {
|
|
43
|
+
r.value = l, s("labelHover", l);
|
|
43
44
|
}
|
|
44
|
-
function L(
|
|
45
|
-
|
|
45
|
+
function L(l, a, t) {
|
|
46
|
+
s("click", t, { index: a, item: l });
|
|
46
47
|
}
|
|
47
|
-
function C(
|
|
48
|
-
|
|
48
|
+
function C(l) {
|
|
49
|
+
s("scroll", l.deltaY);
|
|
49
50
|
}
|
|
50
|
-
const W =
|
|
51
|
-
const
|
|
51
|
+
const W = c(() => {
|
|
52
|
+
const l = Object.values(e.categories).map(
|
|
52
53
|
(a, t) => `var(--vis-color${t})`
|
|
53
54
|
);
|
|
54
|
-
return Object.values(
|
|
55
|
-
(a, t) => a.color ??
|
|
55
|
+
return Object.values(e.categories).map(
|
|
56
|
+
(a, t) => a.color ?? l[t]
|
|
56
57
|
);
|
|
57
58
|
});
|
|
58
|
-
return (
|
|
59
|
-
style:
|
|
59
|
+
return (l, a) => (p(), f("div", {
|
|
60
|
+
style: d({
|
|
60
61
|
display: "flex",
|
|
61
|
-
flexDirection:
|
|
62
|
+
flexDirection: v.value ? "column-reverse" : "column",
|
|
62
63
|
gap: "var(--vis-legend-spacing)"
|
|
63
64
|
})
|
|
64
65
|
}, [
|
|
65
|
-
o(
|
|
66
|
-
data:
|
|
67
|
-
height:
|
|
66
|
+
n(o(j), {
|
|
67
|
+
data: e.data,
|
|
68
|
+
height: e.height,
|
|
68
69
|
onWheel: C
|
|
69
70
|
}, {
|
|
70
|
-
default:
|
|
71
|
-
o(
|
|
72
|
-
x:
|
|
73
|
-
length:
|
|
74
|
-
lineWidth:
|
|
75
|
-
rowHeight:
|
|
76
|
-
type:
|
|
71
|
+
default: H(() => [
|
|
72
|
+
n(o(O), {
|
|
73
|
+
x: e.x,
|
|
74
|
+
length: e.length,
|
|
75
|
+
lineWidth: e.lineWidth,
|
|
76
|
+
rowHeight: e.rowHeight,
|
|
77
|
+
type: e.type,
|
|
77
78
|
color: W.value,
|
|
78
|
-
labelWidth:
|
|
79
|
-
showLabels:
|
|
79
|
+
labelWidth: e.labelWidth,
|
|
80
|
+
showLabels: e.showLabels,
|
|
80
81
|
onClick: L
|
|
81
82
|
}, null, 8, ["x", "length", "lineWidth", "rowHeight", "type", "color", "labelWidth", "showLabels"]),
|
|
82
|
-
o(
|
|
83
|
+
n(o($), {
|
|
83
84
|
triggers: {
|
|
84
|
-
[
|
|
85
|
-
var
|
|
86
|
-
return
|
|
85
|
+
[o(x).selectors.label]: (t) => {
|
|
86
|
+
var m;
|
|
87
|
+
return g(t), t ? (m = u.value) == null ? void 0 : m.innerHTML : "";
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
}, null, 8, ["triggers"]),
|
|
90
|
-
o(
|
|
91
|
+
n(o(D), P({
|
|
91
92
|
type: "x",
|
|
92
|
-
tickFormat:
|
|
93
|
-
numTicks:
|
|
94
|
-
"tick-line":
|
|
95
|
-
"grid-line":
|
|
96
|
-
"domain-line":
|
|
97
|
-
},
|
|
93
|
+
tickFormat: i.xTickFormat || o(S),
|
|
94
|
+
numTicks: i.xNumTicks,
|
|
95
|
+
"tick-line": i.xTickLine,
|
|
96
|
+
"grid-line": i.xGridLine,
|
|
97
|
+
"domain-line": i.xDomainLine
|
|
98
|
+
}, i.xAxisConfig), null, 16, ["tickFormat", "numTicks", "tick-line", "grid-line", "domain-line"])
|
|
98
99
|
]),
|
|
99
100
|
_: 1
|
|
100
101
|
}, 8, ["data", "height"]),
|
|
101
|
-
|
|
102
|
+
e.hideLegend ? h("", !0) : (p(), f("div", {
|
|
102
103
|
key: 0,
|
|
103
|
-
style:
|
|
104
|
+
style: d({
|
|
104
105
|
display: "flex",
|
|
105
106
|
justifyContent: b.value
|
|
106
107
|
})
|
|
107
108
|
}, [
|
|
108
|
-
o(
|
|
109
|
-
style:
|
|
110
|
-
|
|
109
|
+
n(o(G), {
|
|
110
|
+
style: d([
|
|
111
|
+
e.legendStyle,
|
|
111
112
|
"display: flex; gap: var(--vis-legend-spacing);"
|
|
112
113
|
]),
|
|
113
|
-
items: Object.values(
|
|
114
|
+
items: Object.values(e.categories).map((t) => ({
|
|
114
115
|
...t,
|
|
115
116
|
color: Array.isArray(t.color) ? t.color[0] : t.color
|
|
116
117
|
}))
|
|
117
118
|
}, null, 8, ["style", "items"])
|
|
118
119
|
], 4)),
|
|
119
|
-
|
|
120
|
+
F("div", {
|
|
120
121
|
ref_key: "slotWrapper",
|
|
121
|
-
ref:
|
|
122
|
+
ref: u,
|
|
122
123
|
style: { display: "none" }
|
|
123
124
|
}, [
|
|
124
|
-
|
|
125
|
+
o(k).labelTooltip ? y(l.$slots, "labelTooltip", {
|
|
125
126
|
key: 0,
|
|
126
|
-
values:
|
|
127
|
-
}) :
|
|
128
|
-
|
|
129
|
-
data:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}, null, 8, ["data", "
|
|
133
|
-
]) :
|
|
127
|
+
values: r.value
|
|
128
|
+
}) : r.value ? y(l.$slots, "fallback", { key: 1 }, () => [
|
|
129
|
+
n(N, {
|
|
130
|
+
data: r.value,
|
|
131
|
+
"title-formatter": e.tooltipTitleFormatter,
|
|
132
|
+
categories: i.categories
|
|
133
|
+
}, null, 8, ["data", "title-formatter", "categories"])
|
|
134
|
+
]) : h("", !0)
|
|
134
135
|
], 512)
|
|
135
136
|
], 4));
|
|
136
137
|
}
|
|
@@ -11,7 +11,7 @@ declare const _default: <T extends Record<string, any>>(__VLS_props: NonNullable
|
|
|
11
11
|
}) => any) | undefined;
|
|
12
12
|
readonly onScroll?: ((distance: number) => any) | undefined;
|
|
13
13
|
readonly onLabelHover?: ((item: T | undefined) => any) | undefined;
|
|
14
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "
|
|
14
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onScroll" | "onClick" | "onLabelHover"> & GanttChartProps<T> & Partial<{}>> & import('vue').PublicProps;
|
|
15
15
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
|
16
16
|
attrs: any;
|
|
17
17
|
slots: {
|
|
@@ -43,6 +43,10 @@ export interface GanttChartProps<T> {
|
|
|
43
43
|
* @returns {string} The type/category identifier.
|
|
44
44
|
*/
|
|
45
45
|
type: (d: T) => string;
|
|
46
|
+
/**
|
|
47
|
+
* Use custom formatter for tooltip titles
|
|
48
|
+
*/
|
|
49
|
+
tooltipTitleFormatter?: (data: T) => string | number;
|
|
46
50
|
/**
|
|
47
51
|
* Optional custom tooltip text generator function.
|
|
48
52
|
* @param {string} label - The label of the item.
|
|
@@ -102,8 +106,8 @@ export interface GanttChartProps<T> {
|
|
|
102
106
|
xGridLine?: boolean;
|
|
103
107
|
xDomainLine?: boolean;
|
|
104
108
|
/**
|
|
105
|
-
|
|
106
|
-
|
|
109
|
+
* Axis configuration object for customizing the appearance of the axes.
|
|
110
|
+
*/
|
|
107
111
|
xAxisConfig?: AxisConfig;
|
|
108
112
|
/**
|
|
109
113
|
* Axis configuration object for customizing the appearance of the axes.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as n, useSlots as a, createBlock as r, openBlock as l, mergeProps as p, createSlots as s, withCtx as y, renderSlot as c, normalizeProps as m, guardReactiveProps as d } from "vue";
|
|
2
2
|
import x from "../AreaChart/AreaChart.js";
|
|
3
|
-
const
|
|
3
|
+
const g = /* @__PURE__ */ n({
|
|
4
4
|
__name: "LineChart",
|
|
5
5
|
props: {
|
|
6
6
|
data: {},
|
|
@@ -12,6 +12,7 @@ const u = /* @__PURE__ */ t({
|
|
|
12
12
|
markerConfig: {},
|
|
13
13
|
xFormatter: { type: Function },
|
|
14
14
|
yFormatter: { type: Function },
|
|
15
|
+
tooltipTitleFormatter: { type: Function },
|
|
15
16
|
curveType: {},
|
|
16
17
|
lineWidth: {},
|
|
17
18
|
lineDashArray: {},
|
|
@@ -42,8 +43,8 @@ const u = /* @__PURE__ */ t({
|
|
|
42
43
|
return a(), (e, h) => (l(), r(x, p(i, { "hide-area": !0 }), s({ _: 2 }, [
|
|
43
44
|
e.$slots.tooltip ? {
|
|
44
45
|
name: "tooltip",
|
|
45
|
-
fn: y((
|
|
46
|
-
c(e.$slots, "tooltip", m(d(
|
|
46
|
+
fn: y((t) => [
|
|
47
|
+
c(e.$slots, "tooltip", m(d(t)))
|
|
47
48
|
]),
|
|
48
49
|
key: "0"
|
|
49
50
|
} : void 0
|
|
@@ -51,5 +52,5 @@ const u = /* @__PURE__ */ t({
|
|
|
51
52
|
}
|
|
52
53
|
});
|
|
53
54
|
export {
|
|
54
|
-
|
|
55
|
+
g as default
|
|
55
56
|
};
|
|
@@ -1,42 +1,68 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
textTransform: "capitalize",
|
|
5
|
-
borderBottom: "1px solid var(--tooltip-border-color)",
|
|
6
|
-
marginBottom: "0.25rem",
|
|
7
|
-
paddingBottom: "0.25rem"
|
|
8
|
-
} }, T = /* @__PURE__ */ y({
|
|
1
|
+
import { defineComponent as S, computed as c, createElementBlock as l, openBlock as a, createElementVNode as o, toDisplayString as n, Fragment as z, renderList as B, normalizeStyle as w } from "vue";
|
|
2
|
+
import { getFirstPropertyValue as R } from "../utils.js";
|
|
3
|
+
const j = { style: { display: "flex", "align-items": "center" } }, L = /* @__PURE__ */ S({
|
|
9
4
|
__name: "Tooltip",
|
|
10
5
|
props: {
|
|
11
6
|
data: {},
|
|
12
7
|
categories: {},
|
|
13
|
-
|
|
8
|
+
titleFormatter: { type: Function },
|
|
14
9
|
yFormatter: { type: Function }
|
|
15
10
|
},
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
18
|
-
(
|
|
19
|
-
))
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
setup(t) {
|
|
12
|
+
const e = t, p = c(
|
|
13
|
+
() => e.titleFormatter ? e.titleFormatter(e.data) : R(e.data)
|
|
14
|
+
), m = ["_index", "_stacked", "_ending"], g = c(() => Object.entries(e.data ?? []).filter(
|
|
15
|
+
([r, x]) => !m.includes(r) && Object.keys(e.categories).includes(r)
|
|
16
|
+
)), f = {
|
|
17
|
+
color: "var(--vis-tooltip-title-color, #000)",
|
|
18
|
+
textTransform: "var(--vis-tooltip-title-text-transform, capitalize)",
|
|
19
|
+
borderBottom: "var(--vis-tooltip-title-border-bottom, 1px solid #e5e7eb)",
|
|
20
|
+
marginBottom: "var(--vis-tooltip-title-margin-bottom, 0.25rem)",
|
|
21
|
+
paddingBottom: "var(--vis-tooltip-title-padding-bottom, 0.25rem)",
|
|
22
|
+
padding: "var(--vis-tooltip-title-padding, 0.75rem)",
|
|
23
|
+
fontSize: "var(--vis-tooltip-title-font-size, 0.875rem)",
|
|
24
|
+
lineHeight: "var(--vis-tooltip-title-line-height, 100%)",
|
|
25
|
+
fontWeight: "var(--vis-tooltip-title-font-weight, 600)"
|
|
26
|
+
}, u = {
|
|
27
|
+
display: "flex",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
justifyContent: "space-between",
|
|
30
|
+
paddingRight: "var(--vis-tooltip-entry-padding-right, 1rem)",
|
|
31
|
+
paddingLeft: "var(--vis-tooltip-entry-padding-left, 1rem)"
|
|
32
|
+
}, h = {
|
|
33
|
+
width: "var(--vis-tooltip-dot-width, 8px)",
|
|
34
|
+
height: "var(--vis-tooltip-dot-height, 8px)",
|
|
35
|
+
borderRadius: "var(--vis-tooltip-dot-border-radius, 4px)",
|
|
36
|
+
marginRight: "var(--vis-tooltip-dot-margin-right, 8px)"
|
|
37
|
+
}, y = {
|
|
38
|
+
fontWeight: "var(--vis-tooltip-label-font-weight, 400)",
|
|
39
|
+
fontSize: "var(--vis-tooltip-label-font-size, 0.875rem)",
|
|
40
|
+
marginRight: "var(--vis-tooltip-label-margin-right, 1rem)",
|
|
41
|
+
color: "var(--vis-tooltip-label-color)"
|
|
42
|
+
}, b = {
|
|
43
|
+
fontSize: "var(--vis-tooltip-value-font-size, 0.875rem)",
|
|
44
|
+
fontWeight: "var(--vis-tooltip-value-font-weight, 600)",
|
|
45
|
+
color: "var(--vis-tooltip-value-color)"
|
|
46
|
+
};
|
|
47
|
+
return (r, x) => (a(), l("div", null, [
|
|
48
|
+
o("div", { style: f }, n(p.value), 1),
|
|
49
|
+
(a(!0), l(z, null, B(g.value, ([i, s], F) => {
|
|
50
|
+
var v, d;
|
|
51
|
+
return a(), l("div", {
|
|
52
|
+
key: i,
|
|
53
|
+
style: u
|
|
27
54
|
}, [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}, l(o.yFormatter ? o.yFormatter(s) : s), 1)
|
|
55
|
+
o("div", j, [
|
|
56
|
+
o("span", {
|
|
57
|
+
style: w({
|
|
58
|
+
...h,
|
|
59
|
+
backgroundColor: typeof ((v = t.categories[i]) == null ? void 0 : v.color) == "string" && ((d = t.categories[i]) != null && d.color) ? t.categories[i].color : `var(--vis-color${F})`
|
|
60
|
+
})
|
|
61
|
+
}, null, 4),
|
|
62
|
+
o("span", { style: y }, n(t.categories[i].name) + ": ", 1)
|
|
63
|
+
]),
|
|
64
|
+
o("div", null, [
|
|
65
|
+
o("span", { style: b }, n(t.yFormatter ? t.yFormatter(s) : s), 1)
|
|
40
66
|
])
|
|
41
67
|
]);
|
|
42
68
|
}), 128))
|
|
@@ -44,5 +70,5 @@ const x = { style: { padding: "10px 15px" } }, _ = { style: {
|
|
|
44
70
|
}
|
|
45
71
|
});
|
|
46
72
|
export {
|
|
47
|
-
|
|
73
|
+
L as default
|
|
48
74
|
};
|
|
@@ -3,7 +3,7 @@ declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>
|
|
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
|
|
4
4
|
data: T;
|
|
5
5
|
categories: Record<string, BulletLegendItemInterface>;
|
|
6
|
-
|
|
6
|
+
titleFormatter?: (data: T) => string | number;
|
|
7
7
|
yFormatter?: axisFormatter;
|
|
8
8
|
} & Partial<{}>> & import('vue').PublicProps;
|
|
9
9
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -62,13 +62,18 @@ export interface AxisConfig {
|
|
|
62
62
|
minMaxTicksOnlyShowGridLines?: boolean;
|
|
63
63
|
tickValues?: readonly number[] | readonly Date[];
|
|
64
64
|
}
|
|
65
|
-
export
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
export type MarkerConfig = {
|
|
66
|
+
id: string;
|
|
67
|
+
config: {
|
|
68
|
+
[key: string]: {
|
|
69
|
+
type?: "circle" | "square" | "triangle" | "diamond";
|
|
70
|
+
size?: number;
|
|
71
|
+
strokeWidth?: number;
|
|
72
|
+
color?: string;
|
|
73
|
+
strokeColor?: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
72
77
|
export interface CrosshairConfig {
|
|
73
78
|
color?: string;
|
|
74
79
|
strokeColor?: string;
|
package/dist/utils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { MarkerConfig } from './types';
|
|
|
2
2
|
export declare function getDistributedIndices(length: number, numTicks: number): 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
|
-
export declare function createMarkers(markerConfig:
|
|
5
|
+
export declare function createMarkers(markerConfig: MarkerConfig): string;
|
|
6
6
|
export declare const flattenData: (data: any[], xAxis: string) => {
|
|
7
7
|
month: any;
|
|
8
8
|
}[];
|