vue-chrts 0.2.1 → 0.2.2-test.0
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.
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as U, useSlots as j, useTemplateRef as w, ref as R, computed as
|
|
2
|
-
import { Position as
|
|
3
|
-
import { createMarkers as
|
|
4
|
-
import
|
|
5
|
-
import { VisXYContainer as
|
|
6
|
-
import { LegendPosition as
|
|
7
|
-
const
|
|
1
|
+
import { defineComponent as U, useSlots as j, useTemplateRef as w, ref as R, computed as u, createElementBlock as m, openBlock as r, normalizeClass as S, normalizeStyle as T, createVNode as p, createCommentVNode as d, createElementVNode as X, unref as i, withCtx as z, createBlock as c, Fragment as L, renderList as I, mergeProps as C, renderSlot as A } from "vue";
|
|
2
|
+
import { Position as D, CurveType as b } from "@unovis/ts";
|
|
3
|
+
import { createMarkers as Y, getFirstPropertyValue as x } from "../../utils.js";
|
|
4
|
+
import H from "../Tooltip.js";
|
|
5
|
+
import { VisXYContainer as K, VisTooltip as q, VisArea as J, VisLine as Q, VisAxis as B, VisCrosshair as Z, VisBulletLegend as _ } from "@unovis/vue";
|
|
6
|
+
import { LegendPosition as ee } from "../../types.js";
|
|
7
|
+
const te = {
|
|
8
8
|
ref: "slotWrapper",
|
|
9
|
-
|
|
10
|
-
}, y = 24, V = 4,
|
|
9
|
+
style: { display: "none" }
|
|
10
|
+
}, y = 24, V = 4, ie = 0.5, F = "#3b82f6", de = /* @__PURE__ */ U({
|
|
11
11
|
__name: "AreaChart",
|
|
12
12
|
props: {
|
|
13
13
|
data: {},
|
|
@@ -22,10 +22,10 @@ const ee = {
|
|
|
22
22
|
curveType: {},
|
|
23
23
|
lineWidth: { default: 2 },
|
|
24
24
|
lineDashArray: {},
|
|
25
|
-
xNumTicks: { default: (
|
|
25
|
+
xNumTicks: { default: (a) => a.data.length > y ? y / V : a.data.length - 1 },
|
|
26
26
|
xExplicitTicks: {},
|
|
27
27
|
minMaxTicksOnly: { type: Boolean },
|
|
28
|
-
yNumTicks: { default: (
|
|
28
|
+
yNumTicks: { default: (a) => a.data.length > y ? y / V : a.data.length - 1 },
|
|
29
29
|
hideLegend: { type: Boolean },
|
|
30
30
|
hideTooltip: { type: Boolean },
|
|
31
31
|
legendPosition: {},
|
|
@@ -42,10 +42,10 @@ const ee = {
|
|
|
42
42
|
}) }
|
|
43
43
|
},
|
|
44
44
|
emits: ["click"],
|
|
45
|
-
setup(
|
|
46
|
-
const G = $,
|
|
47
|
-
() => Object.values(
|
|
48
|
-
), N =
|
|
45
|
+
setup(a, { emit: $ }) {
|
|
46
|
+
const G = $, n = a, O = j(), h = w("slotWrapper"), s = R(), f = u(
|
|
47
|
+
() => Object.values(n.categories).map((e) => e.color)
|
|
48
|
+
), N = u(() => n.markerConfig ? Y(n.markerConfig) : ""), g = u(() => n.legendPosition === ee.Top), E = u(() => {
|
|
49
49
|
const e = (t, o) => `
|
|
50
50
|
<linearGradient id="gradient${t}-${o}" gradientTransform="rotate(90)">
|
|
51
51
|
<stop offset="0%" stop-color="${o}" stop-opacity="1" />
|
|
@@ -65,7 +65,7 @@ const ee = {
|
|
|
65
65
|
var l;
|
|
66
66
|
return {
|
|
67
67
|
y: (t) => Number(t[e]),
|
|
68
|
-
color: ((l =
|
|
68
|
+
color: ((l = n.categories[e]) == null ? void 0 : l.color) ?? F
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
function W(e) {
|
|
@@ -74,40 +74,44 @@ const ee = {
|
|
|
74
74
|
function M(e) {
|
|
75
75
|
return s.value = e, W();
|
|
76
76
|
}
|
|
77
|
-
return (e, l) => (
|
|
78
|
-
|
|
77
|
+
return (e, l) => (r(), m("div", {
|
|
78
|
+
style: T({
|
|
79
|
+
display: "flex",
|
|
80
|
+
flexDirection: g.value ? "column-reverse" : "column"
|
|
81
|
+
}),
|
|
82
|
+
class: S({ markers: !!n.markerConfig }),
|
|
79
83
|
onClick: l[0] || (l[0] = (t) => G("click", t, s.value))
|
|
80
84
|
}, [
|
|
81
|
-
|
|
85
|
+
p(i(K), {
|
|
82
86
|
data: e.data,
|
|
83
87
|
height: e.height,
|
|
84
88
|
padding: e.padding,
|
|
85
89
|
"svg-defs": E.value + N.value
|
|
86
90
|
}, {
|
|
87
|
-
default:
|
|
88
|
-
e.hideTooltip ?
|
|
91
|
+
default: z(() => [
|
|
92
|
+
e.hideTooltip ? d("", !0) : (r(), c(i(q), {
|
|
89
93
|
key: 0,
|
|
90
|
-
"horizontal-placement": i(
|
|
91
|
-
"vertical-placement": i(
|
|
94
|
+
"horizontal-placement": i(D).Right,
|
|
95
|
+
"vertical-placement": i(D).Top
|
|
92
96
|
}, null, 8, ["horizontal-placement", "vertical-placement"])),
|
|
93
|
-
(
|
|
94
|
-
|
|
97
|
+
(r(!0), m(L, null, I(Object.keys(n.categories), (t, o) => (r(), m(L, { key: t }, [
|
|
98
|
+
p(i(J), C({
|
|
95
99
|
x: (k, v) => v
|
|
96
100
|
}, { ref_for: !0 }, P(t), {
|
|
97
101
|
color: `url(#gradient${o}-${f.value[o]})`,
|
|
98
|
-
opacity:
|
|
99
|
-
"curve-type": e.curveType ?? i(
|
|
102
|
+
opacity: ie,
|
|
103
|
+
"curve-type": e.curveType ?? i(b).MonotoneX
|
|
100
104
|
}), null, 16, ["x", "color", "curve-type"]),
|
|
101
|
-
|
|
105
|
+
p(i(Q), {
|
|
102
106
|
x: (k, v) => v,
|
|
103
107
|
y: (k) => k[t],
|
|
104
108
|
color: f.value[o],
|
|
105
|
-
"curve-type": e.curveType ?? i(
|
|
109
|
+
"curve-type": e.curveType ?? i(b).MonotoneX,
|
|
106
110
|
"line-width": e.lineWidth,
|
|
107
111
|
lineDashArray: e.lineDashArray ? e.lineDashArray[o] : void 0
|
|
108
112
|
}, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"])
|
|
109
113
|
], 64))), 128)),
|
|
110
|
-
e.hideXAxis ?
|
|
114
|
+
e.hideXAxis ? d("", !0) : (r(), c(i(B), {
|
|
111
115
|
key: 1,
|
|
112
116
|
type: "x",
|
|
113
117
|
label: e.xLabel,
|
|
@@ -120,7 +124,7 @@ const ee = {
|
|
|
120
124
|
"tick-line": e.xTickLine,
|
|
121
125
|
"min-max-ticks-only": e.minMaxTicksOnly
|
|
122
126
|
}, null, 8, ["label", "num-ticks", "tick-format", "tick-values", "grid-line", "domain-line", "tick-line", "min-max-ticks-only"])),
|
|
123
|
-
e.hideYAxis ?
|
|
127
|
+
e.hideYAxis ? d("", !0) : (r(), c(i(B), {
|
|
124
128
|
key: 2,
|
|
125
129
|
type: "y",
|
|
126
130
|
label: e.yLabel,
|
|
@@ -130,34 +134,40 @@ const ee = {
|
|
|
130
134
|
"domain-line": e.yDomainLine,
|
|
131
135
|
"tick-line": e.yTickLine
|
|
132
136
|
}, null, 8, ["label", "num-ticks", "tick-format", "grid-line", "domain-line", "tick-line"])),
|
|
133
|
-
e.hideTooltip ?
|
|
137
|
+
e.hideTooltip ? d("", !0) : (r(), c(i(Z), C({ key: 3 }, e.crosshairConfig, { template: M }), null, 16))
|
|
134
138
|
]),
|
|
135
139
|
_: 1
|
|
136
140
|
}, 8, ["data", "height", "padding", "svg-defs"]),
|
|
137
|
-
e.hideLegend ?
|
|
141
|
+
e.hideLegend ? d("", !0) : (r(), m("div", {
|
|
138
142
|
key: 0,
|
|
139
|
-
|
|
143
|
+
style: T({
|
|
144
|
+
display: "flex",
|
|
145
|
+
alignItems: "center",
|
|
146
|
+
justifyContent: "flex-end",
|
|
147
|
+
paddingBottom: g.value ? "1rem" : void 0,
|
|
148
|
+
paddingTop: g.value ? void 0 : "1rem"
|
|
149
|
+
})
|
|
140
150
|
}, [
|
|
141
|
-
|
|
151
|
+
p(i(_), {
|
|
142
152
|
items: Object.values(e.categories)
|
|
143
153
|
}, null, 8, ["items"])
|
|
144
|
-
],
|
|
145
|
-
X("div",
|
|
154
|
+
], 4)),
|
|
155
|
+
X("div", te, [
|
|
146
156
|
i(O).tooltip ? A(e.$slots, "tooltip", {
|
|
147
157
|
key: 0,
|
|
148
158
|
values: s.value
|
|
149
159
|
}) : s.value ? A(e.$slots, "fallback", { key: 1 }, () => [
|
|
150
|
-
|
|
160
|
+
p(H, {
|
|
151
161
|
data: s.value,
|
|
152
162
|
categories: e.categories,
|
|
153
|
-
toolTipTitle: i(
|
|
154
|
-
yFormatter:
|
|
163
|
+
toolTipTitle: i(x)(s.value) ?? "",
|
|
164
|
+
yFormatter: n.yFormatter
|
|
155
165
|
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
156
|
-
]) :
|
|
166
|
+
]) : d("", !0)
|
|
157
167
|
], 512)
|
|
158
|
-
],
|
|
168
|
+
], 6));
|
|
159
169
|
}
|
|
160
170
|
});
|
|
161
171
|
export {
|
|
162
|
-
|
|
172
|
+
de as default
|
|
163
173
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as C, useSlots as
|
|
1
|
+
import { defineComponent as C, useSlots as D, useTemplateRef as N, ref as O, computed as T, createElementBlock as y, openBlock as n, normalizeStyle as v, createVNode as g, createCommentVNode as m, createElementVNode as S, unref as i, withCtx as w, createBlock as u, Fragment as E, renderList as M, renderSlot as B } from "vue";
|
|
2
2
|
import { Orientation as l, StackedBar as j, GroupedBar as z } from "@unovis/ts";
|
|
3
3
|
import { getFirstPropertyValue as H } from "../../utils.js";
|
|
4
4
|
import { useStackedGrouped as W } from "./stackedGroupedUtils.js";
|
|
5
|
-
import { VisXYContainer as X, VisTooltip as Y, VisStackedBar as
|
|
5
|
+
import { VisXYContainer as X, VisTooltip as Y, VisStackedBar as L, VisGroupedBar as $, VisAxis as A, VisBulletLegend as R } from "@unovis/vue";
|
|
6
6
|
import q from "../Tooltip.js";
|
|
7
|
-
import { LegendPosition as
|
|
8
|
-
const
|
|
7
|
+
import { LegendPosition as I } from "../../types.js";
|
|
8
|
+
const U = {
|
|
9
9
|
ref: "slotWrapper",
|
|
10
|
-
|
|
11
|
-
},
|
|
10
|
+
style: { display: "none" }
|
|
11
|
+
}, oe = /* @__PURE__ */ C({
|
|
12
12
|
__name: "BarChart",
|
|
13
13
|
props: {
|
|
14
14
|
data: {},
|
|
@@ -50,55 +50,59 @@ const I = {
|
|
|
50
50
|
},
|
|
51
51
|
emits: ["click"],
|
|
52
52
|
setup(t, { emit: V }) {
|
|
53
|
-
const x = V,
|
|
54
|
-
if (!
|
|
53
|
+
const x = V, o = t, P = D(), c = N("slotWrapper"), r = O();
|
|
54
|
+
if (!o.yAxis || o.yAxis.length === 0)
|
|
55
55
|
throw new Error("yAxis is required");
|
|
56
|
-
const k = T(() =>
|
|
57
|
-
var
|
|
58
|
-
return (
|
|
56
|
+
const k = T(() => o.yAxis.map((e) => (d) => d[e])), f = (e, d) => {
|
|
57
|
+
var a;
|
|
58
|
+
return (a = Object.values(o.categories)[d]) == null ? void 0 : a.color;
|
|
59
59
|
}, s = W({
|
|
60
|
-
data:
|
|
61
|
-
categories:
|
|
62
|
-
stackAndGrouped:
|
|
63
|
-
xAxis:
|
|
60
|
+
data: o.data,
|
|
61
|
+
categories: o.categories,
|
|
62
|
+
stackAndGrouped: o.stackAndGrouped,
|
|
63
|
+
xAxis: o.xAxis
|
|
64
64
|
}), h = T(
|
|
65
|
-
() =>
|
|
65
|
+
() => o.legendPosition === I.Top
|
|
66
66
|
);
|
|
67
67
|
function b(e) {
|
|
68
68
|
return r.value = e, G();
|
|
69
69
|
}
|
|
70
70
|
function G(e) {
|
|
71
|
-
return typeof window > "u" ? "" :
|
|
71
|
+
return typeof window > "u" ? "" : c.value ? c.value.innerHTML : "";
|
|
72
72
|
}
|
|
73
|
-
return (e, d) => (n(),
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
return (e, d) => (n(), y("div", {
|
|
74
|
+
style: v({
|
|
75
|
+
display: "flex",
|
|
76
|
+
flexDirection: h.value ? "column-reverse" : "column",
|
|
77
|
+
gap: "1rem"
|
|
78
|
+
}),
|
|
79
|
+
onClick: d[0] || (d[0] = (a) => x("click", a, r.value))
|
|
76
80
|
}, [
|
|
77
81
|
g(i(X), {
|
|
78
82
|
padding: e.padding,
|
|
79
83
|
height: e.height
|
|
80
84
|
}, {
|
|
81
|
-
default:
|
|
85
|
+
default: w(() => [
|
|
82
86
|
g(i(Y), {
|
|
83
87
|
triggers: {
|
|
84
88
|
[i(z).selectors.bar]: b,
|
|
85
89
|
[i(j).selectors.bar]: b
|
|
86
90
|
}
|
|
87
91
|
}, null, 8, ["triggers"]),
|
|
88
|
-
e.stackAndGrouped ? (n(!0),
|
|
89
|
-
key:
|
|
92
|
+
e.stackAndGrouped ? (n(!0), y(E, { key: 0 }, M(i(s).states, (a) => (n(), u(i(L), {
|
|
93
|
+
key: a,
|
|
90
94
|
data: i(s).chartData,
|
|
91
|
-
x: (p, F) => F + i(s).positions[
|
|
92
|
-
y: i(s).bars[
|
|
93
|
-
color: i(s).colorFunctions[
|
|
95
|
+
x: (p, F) => F + i(s).positions[a],
|
|
96
|
+
y: i(s).bars[a],
|
|
97
|
+
color: i(s).colorFunctions[a],
|
|
94
98
|
"rounded-corners": e.radius ?? 0,
|
|
95
99
|
"group-padding": e.groupPadding ?? 0,
|
|
96
100
|
"bar-padding": e.barPadding ?? 0.2,
|
|
97
101
|
orientation: e.orientation ?? i(l).Vertical
|
|
98
|
-
}, null, 8, ["data", "x", "y", "color", "rounded-corners", "group-padding", "bar-padding", "orientation"]))), 128)) : e.stacked ? (n(), u(i(
|
|
102
|
+
}, null, 8, ["data", "x", "y", "color", "rounded-corners", "group-padding", "bar-padding", "orientation"]))), 128)) : e.stacked ? (n(), u(i(L), {
|
|
99
103
|
key: 2,
|
|
100
104
|
data: e.data,
|
|
101
|
-
x: (
|
|
105
|
+
x: (a, p) => p,
|
|
102
106
|
y: k.value,
|
|
103
107
|
color: f,
|
|
104
108
|
"rounded-corners": e.radius ?? 0,
|
|
@@ -108,7 +112,7 @@ const I = {
|
|
|
108
112
|
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (n(), u(i($), {
|
|
109
113
|
key: 1,
|
|
110
114
|
data: e.data,
|
|
111
|
-
x: (
|
|
115
|
+
x: (a, p) => p,
|
|
112
116
|
y: k.value,
|
|
113
117
|
color: f,
|
|
114
118
|
"rounded-corners": e.radius ?? 0,
|
|
@@ -116,7 +120,7 @@ const I = {
|
|
|
116
120
|
"bar-padding": e.barPadding ?? 0.2,
|
|
117
121
|
orientation: e.orientation ?? i(l).Vertical
|
|
118
122
|
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
|
|
119
|
-
e.hideXAxis ?
|
|
123
|
+
e.hideXAxis ? m("", !0) : (n(), u(i(A), {
|
|
120
124
|
key: 3,
|
|
121
125
|
type: "x",
|
|
122
126
|
"tick-format": e.xFormatter,
|
|
@@ -128,7 +132,7 @@ const I = {
|
|
|
128
132
|
"tick-values": e.xExplicitTicks,
|
|
129
133
|
minMaxTicksOnly: e.minMaxTicksOnly
|
|
130
134
|
}, null, 8, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "minMaxTicksOnly"])),
|
|
131
|
-
e.hideYAxis ?
|
|
135
|
+
e.hideYAxis ? m("", !0) : (n(), u(i(A), {
|
|
132
136
|
key: 4,
|
|
133
137
|
type: "y",
|
|
134
138
|
label: e.yLabel,
|
|
@@ -141,30 +145,35 @@ const I = {
|
|
|
141
145
|
]),
|
|
142
146
|
_: 1
|
|
143
147
|
}, 8, ["padding", "height"]),
|
|
144
|
-
e.hideLegend ?
|
|
148
|
+
e.hideLegend ? m("", !0) : (n(), y("div", {
|
|
145
149
|
key: 0,
|
|
146
|
-
|
|
150
|
+
style: v({
|
|
151
|
+
display: "flex",
|
|
152
|
+
alignItems: "center",
|
|
153
|
+
justifyContent: "flex-end",
|
|
154
|
+
paddingBottom: h.value ? "1rem" : void 0
|
|
155
|
+
})
|
|
147
156
|
}, [
|
|
148
157
|
g(i(R), {
|
|
149
|
-
items: Object.values(
|
|
158
|
+
items: Object.values(o.categories)
|
|
150
159
|
}, null, 8, ["items"])
|
|
151
|
-
],
|
|
152
|
-
|
|
153
|
-
i(P).tooltip ?
|
|
160
|
+
], 4)),
|
|
161
|
+
S("div", U, [
|
|
162
|
+
i(P).tooltip ? B(e.$slots, "tooltip", {
|
|
154
163
|
key: 0,
|
|
155
164
|
values: r.value
|
|
156
|
-
}) : r.value ?
|
|
165
|
+
}) : r.value ? B(e.$slots, "fallback", { key: 1 }, () => [
|
|
157
166
|
g(q, {
|
|
158
167
|
data: r.value,
|
|
159
|
-
categories:
|
|
168
|
+
categories: o.categories,
|
|
160
169
|
toolTipTitle: i(H)(r.value) ?? "",
|
|
161
|
-
yFormatter:
|
|
170
|
+
yFormatter: o.orientation === i(l).Horizontal ? o.xFormatter : o.yFormatter
|
|
162
171
|
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
163
|
-
]) :
|
|
172
|
+
]) : m("", !0)
|
|
164
173
|
], 512)
|
|
165
|
-
],
|
|
174
|
+
], 4));
|
|
166
175
|
}
|
|
167
176
|
});
|
|
168
177
|
export {
|
|
169
|
-
|
|
178
|
+
oe as default
|
|
170
179
|
};
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
import { defineComponent as V, useSlots as b, useTemplateRef as w, ref as
|
|
1
|
+
import { defineComponent as V, useSlots as b, useTemplateRef as w, ref as T, createElementBlock as u, openBlock as p, Fragment as D, createElementVNode as n, createCommentVNode as m, createVNode as o, renderSlot as i, unref as l, withCtx as S, normalizeStyle as W, toDisplayString as B } from "vue";
|
|
2
2
|
import { Donut as L } from "@unovis/ts";
|
|
3
|
-
import { DonutType as
|
|
4
|
-
import { VisSingleContainer as H, VisTooltip as N, VisDonut as
|
|
5
|
-
const
|
|
3
|
+
import { DonutType as R } from "./types.js";
|
|
4
|
+
import { VisSingleContainer as H, VisTooltip as N, VisDonut as $, VisBulletLegend as j } from "@unovis/vue";
|
|
5
|
+
const z = {
|
|
6
6
|
ref: "slotWrapper",
|
|
7
|
-
|
|
8
|
-
},
|
|
7
|
+
style: { display: "none" }
|
|
8
|
+
}, A = { style: { display: "flex", "align-items": "center", padding: "10px 15px" } }, E = {
|
|
9
9
|
key: 0,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
style: {
|
|
11
|
+
display: "flex",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
justifyContent: "center",
|
|
14
|
+
marginTop: "1rem"
|
|
15
|
+
}
|
|
16
|
+
}, M = /* @__PURE__ */ V({
|
|
12
17
|
__name: "DonutChart",
|
|
13
18
|
props: {
|
|
14
19
|
type: {},
|
|
@@ -21,65 +26,74 @@ const A = {
|
|
|
21
26
|
padAngle: {}
|
|
22
27
|
},
|
|
23
28
|
emits: ["click"],
|
|
24
|
-
setup(
|
|
25
|
-
const
|
|
26
|
-
function k(e) {
|
|
27
|
-
return t.value = e, C();
|
|
28
|
-
}
|
|
29
|
+
setup(c, { emit: g }) {
|
|
30
|
+
const f = g, r = c, h = b(), s = w("slotWrapper"), t = T(), y = (e) => e, v = r.type === R.Half;
|
|
29
31
|
function C(e) {
|
|
30
|
-
return
|
|
32
|
+
return t.value = e, k();
|
|
33
|
+
}
|
|
34
|
+
function k(e) {
|
|
35
|
+
return typeof window > "u" ? "" : s.value ? s.value.innerHTML : "";
|
|
31
36
|
}
|
|
32
|
-
return (e, d) => (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
return (e, d) => (p(), u(D, null, [
|
|
38
|
+
n("div", {
|
|
39
|
+
style: {
|
|
40
|
+
display: "flex",
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
justifyContent: "center"
|
|
43
|
+
},
|
|
44
|
+
onClick: d[0] || (d[0] = (a) => f("click", a, t.value))
|
|
36
45
|
}, [
|
|
37
|
-
|
|
46
|
+
o(l(H), {
|
|
38
47
|
data: e.data,
|
|
39
48
|
height: e.height,
|
|
40
49
|
margin: {}
|
|
41
50
|
}, {
|
|
42
|
-
default:
|
|
43
|
-
|
|
51
|
+
default: S(() => [
|
|
52
|
+
o(l(N), {
|
|
44
53
|
"horizontal-shift": 20,
|
|
45
54
|
"vertical-shift": 20,
|
|
46
55
|
triggers: {
|
|
47
|
-
[l(L).selectors.segment]:
|
|
56
|
+
[l(L).selectors.segment]: C
|
|
48
57
|
}
|
|
49
58
|
}, null, 8, ["triggers"]),
|
|
50
|
-
|
|
51
|
-
value:
|
|
59
|
+
o(l($), {
|
|
60
|
+
value: y,
|
|
52
61
|
"corner-radius": e.radius,
|
|
53
62
|
"arc-width": e.arcWidth ?? 20,
|
|
54
63
|
color: r.labels.map((a) => a.color),
|
|
55
|
-
"angle-range":
|
|
64
|
+
"angle-range": v ? [-1.5707963267948966, 1.5707963267948966] : [],
|
|
56
65
|
"pad-angle": r.padAngle || 0
|
|
57
66
|
}, null, 8, ["corner-radius", "arc-width", "color", "angle-range", "pad-angle"])
|
|
58
67
|
]),
|
|
59
68
|
_: 1
|
|
60
69
|
}, 8, ["data", "height"]),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
l(h).tooltip ?
|
|
70
|
+
i(e.$slots, "default"),
|
|
71
|
+
n("div", z, [
|
|
72
|
+
l(h).tooltip ? i(e.$slots, "tooltip", {
|
|
64
73
|
key: 0,
|
|
65
74
|
values: t.value
|
|
66
|
-
}) : t.value ?
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
}) : t.value ? i(e.$slots, "fallback", { key: 1 }, () => [
|
|
76
|
+
n("div", A, [
|
|
77
|
+
n("div", {
|
|
78
|
+
style: W({
|
|
79
|
+
width: "0.5rem",
|
|
80
|
+
height: "0.5rem",
|
|
81
|
+
borderRadius: "9999px",
|
|
82
|
+
marginRight: "0.5rem",
|
|
83
|
+
backgroundColor: r.labels[t.value.index].color
|
|
84
|
+
})
|
|
71
85
|
}, null, 4),
|
|
72
|
-
|
|
86
|
+
n("div", null, B(t.value.data), 1)
|
|
73
87
|
])
|
|
74
|
-
]) :
|
|
88
|
+
]) : m("", !0)
|
|
75
89
|
], 512)
|
|
76
90
|
]),
|
|
77
|
-
e.hideLegend ?
|
|
78
|
-
|
|
91
|
+
e.hideLegend ? m("", !0) : (p(), u("div", E, [
|
|
92
|
+
o(l(j), { items: e.labels }, null, 8, ["items"])
|
|
79
93
|
]))
|
|
80
94
|
], 64));
|
|
81
95
|
}
|
|
82
96
|
});
|
|
83
97
|
export {
|
|
84
|
-
|
|
98
|
+
M as default
|
|
85
99
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as P, computed as
|
|
1
|
+
import { defineComponent as P, computed as f, useSlots as O, useTemplateRef as j, ref as w, createElementBlock as p, openBlock as n, normalizeClass as x, normalizeStyle as k, createVNode as s, createCommentVNode as a, createElementVNode as M, unref as i, withCtx as W, createBlock as m, 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
|
-
import { createMarkers as $, getFirstPropertyValue as
|
|
4
|
-
import
|
|
5
|
-
import { VisXYContainer as Y, VisTooltip as
|
|
6
|
-
import { LegendPosition as
|
|
7
|
-
const
|
|
3
|
+
import { createMarkers as $, getFirstPropertyValue as R } from "../../utils.js";
|
|
4
|
+
import S from "../Tooltip.js";
|
|
5
|
+
import { VisXYContainer as Y, VisTooltip as H, VisLine as I, VisAxis as T, VisCrosshair as U, VisBulletLegend as q } from "@unovis/vue";
|
|
6
|
+
import { LegendPosition as J } from "../../types.js";
|
|
7
|
+
const Q = {
|
|
8
8
|
ref: "slotWrapper",
|
|
9
|
-
|
|
10
|
-
},
|
|
9
|
+
style: { display: "none" }
|
|
10
|
+
}, oe = /* @__PURE__ */ P({
|
|
11
11
|
__name: "LineChart",
|
|
12
12
|
props: {
|
|
13
13
|
data: {},
|
|
@@ -48,46 +48,48 @@ const J = {
|
|
|
48
48
|
},
|
|
49
49
|
emits: ["click"],
|
|
50
50
|
setup(o, { emit: L }) {
|
|
51
|
-
const C = L, t = o,
|
|
51
|
+
const C = L, t = o, B = f(() => t.markerConfig ? $(t.markerConfig) : ""), b = O(), c = j("slotWrapper"), l = w();
|
|
52
52
|
function D(e) {
|
|
53
|
-
return typeof window > "u" ? "" :
|
|
53
|
+
return typeof window > "u" ? "" : c.value ? c.value.innerHTML : "";
|
|
54
54
|
}
|
|
55
55
|
function V(e) {
|
|
56
|
-
return
|
|
56
|
+
return l.value = e, D();
|
|
57
57
|
}
|
|
58
|
-
const y =
|
|
59
|
-
() => t.legendPosition ===
|
|
58
|
+
const y = f(
|
|
59
|
+
() => t.legendPosition === J.Top
|
|
60
60
|
), A = Object.values(t.categories).map(
|
|
61
61
|
(e, r) => `var(--vis-color${r})`
|
|
62
62
|
), F = (e) => Object.values(t.categories)[e].color ?? A[e];
|
|
63
|
-
return (e, r) => (n(),
|
|
64
|
-
|
|
65
|
-
"flex
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
return (e, r) => (n(), p("div", {
|
|
64
|
+
style: k({
|
|
65
|
+
display: "flex",
|
|
66
|
+
flexDirection: y.value ? "column-reverse" : "column",
|
|
67
|
+
gap: "1rem"
|
|
68
|
+
}),
|
|
69
|
+
class: x({ markers: !!t.markerConfig }),
|
|
70
|
+
onClick: r[0] || (r[0] = (d) => C("click", d, l.value))
|
|
69
71
|
}, [
|
|
70
72
|
s(i(Y), {
|
|
71
73
|
data: e.data,
|
|
72
74
|
padding: e.padding,
|
|
73
75
|
height: e.height,
|
|
74
|
-
svgDefs:
|
|
76
|
+
svgDefs: B.value
|
|
75
77
|
}, {
|
|
76
|
-
default:
|
|
77
|
-
s(i(
|
|
78
|
+
default: W(() => [
|
|
79
|
+
s(i(H), {
|
|
78
80
|
"horizontal-placement": i(v).Right,
|
|
79
81
|
"vertical-placement": i(v).Top
|
|
80
82
|
}, null, 8, ["horizontal-placement", "vertical-placement"]),
|
|
81
|
-
(n(!0),
|
|
83
|
+
(n(!0), p(z, null, E(Object.keys(t.categories), (d, u) => (n(), m(i(I), {
|
|
82
84
|
key: u,
|
|
83
|
-
x: (
|
|
84
|
-
y: (
|
|
85
|
+
x: (g, N) => N,
|
|
86
|
+
y: (g) => g[d],
|
|
85
87
|
color: F(u),
|
|
86
88
|
"curve-type": e.curveType ?? i(X).MonotoneX,
|
|
87
89
|
"line-width": e.lineWidth,
|
|
88
90
|
lineDashArray: e.lineDashArray ? e.lineDashArray[u] : void 0
|
|
89
91
|
}, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"]))), 128)),
|
|
90
|
-
e.hideXAxis ?
|
|
92
|
+
e.hideXAxis ? a("", !0) : (n(), m(i(T), {
|
|
91
93
|
key: 0,
|
|
92
94
|
type: "x",
|
|
93
95
|
"tick-format": e.xFormatter,
|
|
@@ -100,7 +102,7 @@ const J = {
|
|
|
100
102
|
"tick-values": e.xExplicitTicks,
|
|
101
103
|
"min-max-ticks-only": e.minMaxTicksOnly
|
|
102
104
|
}, null, 8, ["tick-format", "label", "domain-line", "grid-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"])),
|
|
103
|
-
e.hideYAxis ?
|
|
105
|
+
e.hideYAxis ? a("", !0) : (n(), m(i(T), {
|
|
104
106
|
key: 1,
|
|
105
107
|
type: "y",
|
|
106
108
|
"tick-format": e.yFormatter,
|
|
@@ -110,34 +112,39 @@ const J = {
|
|
|
110
112
|
"grid-line": e.yGridLine,
|
|
111
113
|
"tick-line": e.yTickLine
|
|
112
114
|
}, null, 8, ["tick-format", "label", "num-ticks", "domain-line", "grid-line", "tick-line"])),
|
|
113
|
-
e.hideTooltip ?
|
|
115
|
+
e.hideTooltip ? a("", !0) : (n(), m(i(U), G({ key: 2 }, e.crosshairConfig, { template: V }), null, 16))
|
|
114
116
|
]),
|
|
115
117
|
_: 1
|
|
116
118
|
}, 8, ["data", "padding", "height", "svgDefs"]),
|
|
117
|
-
e.hideLegend ?
|
|
119
|
+
e.hideLegend ? a("", !0) : (n(), p("div", {
|
|
118
120
|
key: 0,
|
|
119
|
-
|
|
121
|
+
style: k({
|
|
122
|
+
display: "flex",
|
|
123
|
+
alignItems: "center",
|
|
124
|
+
justifyContent: "flex-end",
|
|
125
|
+
paddingBottom: y.value ? "1rem" : void 0
|
|
126
|
+
})
|
|
120
127
|
}, [
|
|
121
128
|
s(i(q), {
|
|
122
129
|
items: Object.values(e.categories)
|
|
123
130
|
}, null, 8, ["items"])
|
|
124
|
-
],
|
|
125
|
-
|
|
126
|
-
i(
|
|
131
|
+
], 4)),
|
|
132
|
+
M("div", Q, [
|
|
133
|
+
i(b).tooltip ? h(e.$slots, "tooltip", {
|
|
127
134
|
key: 0,
|
|
128
|
-
values:
|
|
129
|
-
}) :
|
|
130
|
-
s(
|
|
131
|
-
data:
|
|
135
|
+
values: l.value
|
|
136
|
+
}) : l.value ? h(e.$slots, "fallback", { key: 1 }, () => [
|
|
137
|
+
s(S, {
|
|
138
|
+
data: l.value,
|
|
132
139
|
categories: e.categories,
|
|
133
|
-
toolTipTitle: i(
|
|
140
|
+
toolTipTitle: i(R)(l.value) ?? "",
|
|
134
141
|
yFormatter: t.yFormatter
|
|
135
142
|
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
136
|
-
]) :
|
|
143
|
+
]) : a("", !0)
|
|
137
144
|
], 512)
|
|
138
|
-
],
|
|
145
|
+
], 6));
|
|
139
146
|
}
|
|
140
147
|
});
|
|
141
148
|
export {
|
|
142
|
-
|
|
149
|
+
oe as default
|
|
143
150
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const f = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
1
|
+
import { defineComponent as v, computed as y, createElementBlock as r, openBlock as i, createElementVNode as e, toDisplayString as l, Fragment as h, renderList as b, normalizeStyle as n } from "vue";
|
|
2
|
+
const f = { style: { padding: "10px 15px" } }, x = { style: {
|
|
3
|
+
color: "var(--tooltip-value-color)",
|
|
4
|
+
textTransform: "capitalize",
|
|
5
|
+
borderBottom: "1px solid rgba(255, 255, 255, 0.05)",
|
|
6
|
+
marginBottom: "0.25rem",
|
|
7
|
+
paddingBottom: "0.25rem"
|
|
8
|
+
} }, B = /* @__PURE__ */ v({
|
|
9
9
|
__name: "Tooltip",
|
|
10
10
|
props: {
|
|
11
11
|
data: {},
|
|
@@ -13,30 +13,30 @@ const f = { class: "px-[15px] py-[10px]" }, _ = {
|
|
|
13
13
|
toolTipTitle: {},
|
|
14
14
|
yFormatter: { type: Function }
|
|
15
15
|
},
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
18
|
-
([
|
|
16
|
+
setup(c) {
|
|
17
|
+
const a = c, d = ["_index", "_stacked", "_ending"], m = y(() => Object.entries(a.data ?? []).filter(
|
|
18
|
+
([t, g]) => !d.includes(t) && Object.keys(a.categories).includes(t)
|
|
19
19
|
));
|
|
20
|
-
return (
|
|
21
|
-
|
|
22
|
-
(i(!0), r(
|
|
23
|
-
var
|
|
20
|
+
return (t, g) => (i(), r("div", f, [
|
|
21
|
+
e("div", x, l(t.toolTipTitle), 1),
|
|
22
|
+
(i(!0), r(h, null, b(m.value, ([o, s], u) => {
|
|
23
|
+
var p;
|
|
24
24
|
return i(), r("div", {
|
|
25
|
-
key:
|
|
25
|
+
key: o,
|
|
26
26
|
style: { display: "flex", "align-items": "center", "margin-bottom": "4px" }
|
|
27
27
|
}, [
|
|
28
|
-
|
|
29
|
-
style:
|
|
30
|
-
backgroundColor: (
|
|
28
|
+
e("span", {
|
|
29
|
+
style: n([{ width: "8px", height: "8px", "border-radius": "4px", "margin-right": "8px" }, {
|
|
30
|
+
backgroundColor: (p = t.categories[o]) != null && p.color ? t.categories[o].color : `var(--vis-color${u})`
|
|
31
31
|
}])
|
|
32
32
|
}, null, 4),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
style:
|
|
36
|
-
}, l(
|
|
37
|
-
|
|
38
|
-
style:
|
|
39
|
-
}, l(
|
|
33
|
+
e("div", null, [
|
|
34
|
+
e("span", {
|
|
35
|
+
style: n([{ "font-weight": "600", "margin-right": "8px" }, { color: "var(--tooltip-label-color)" }])
|
|
36
|
+
}, l(t.categories[o].name) + ":", 1),
|
|
37
|
+
e("span", {
|
|
38
|
+
style: n([{ "font-weight": "400" }, { color: "var(--tooltip-value-color)" }])
|
|
39
|
+
}, l(t.yFormatter ? t.yFormatter(s) : s), 1)
|
|
40
40
|
])
|
|
41
41
|
]);
|
|
42
42
|
}), 128))
|
|
@@ -44,5 +44,5 @@ const f = { class: "px-[15px] py-[10px]" }, _ = {
|
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
export {
|
|
47
|
-
|
|
47
|
+
B as default
|
|
48
48
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-chrts",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2-test.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -27,12 +27,14 @@
|
|
|
27
27
|
"@tailwindcss/vite": "^4.0.15",
|
|
28
28
|
"@tanstack/vue-table": "^8.21.2",
|
|
29
29
|
"@types/node": "^22.13.11",
|
|
30
|
+
"@types/rollup": "^0.54.0",
|
|
30
31
|
"@unovis/ts": "^1.5.2",
|
|
31
32
|
"@unovis/vue": "^1.5.2",
|
|
32
33
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
33
34
|
"@vue/tsconfig": "^0.7.0",
|
|
34
35
|
"@vueuse/core": "^13.0.0",
|
|
35
36
|
"commit-and-tag-version": "^12.5.1",
|
|
37
|
+
"rollup": "^4.46.2",
|
|
36
38
|
"tailwindcss": "^4.0.15",
|
|
37
39
|
"typescript": "~5.7.2",
|
|
38
40
|
"vite": "^6.2.0",
|