vue-chrts 0.1.0-beta.5 → 0.1.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.
- package/dist/components/AreaChart/AreaChart.js +1 -1
- package/dist/components/AreaChart/types.d.ts +1 -1
- package/dist/components/BarChart/BarChart.js +32 -29
- package/dist/components/BarChart/types.d.ts +1 -1
- package/dist/components/LineChart/LineChart.js +1 -1
- package/dist/components/LineChart/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ const m = 24, A = 4, Y = 0.5, H = "#3b82f6", Z = /* @__PURE__ */ E({
|
|
|
16
16
|
curveType: {},
|
|
17
17
|
xNumTicks: { default: (i) => i.data.length > m ? m / A : i.data.length - 1 },
|
|
18
18
|
xExplicitTicks: {},
|
|
19
|
-
minMaxTicksOnly: {},
|
|
19
|
+
minMaxTicksOnly: { type: Boolean },
|
|
20
20
|
yNumTicks: { default: (i) => i.data.length > m ? m / A : i.data.length - 1 },
|
|
21
21
|
hideLegend: { type: Boolean },
|
|
22
22
|
hideTooltip: { type: Boolean },
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Orientation as s, StackedBar as v, GroupedBar as
|
|
3
|
-
import { VisXYContainer as
|
|
4
|
-
import
|
|
5
|
-
import { LegendPosition as
|
|
6
|
-
const M = /* @__PURE__ */
|
|
1
|
+
import { defineComponent as h, computed as u, createApp as b, createElementBlock as y, openBlock as d, normalizeClass as k, createVNode as r, createCommentVNode as B, unref as i, withCtx as T, createBlock as f } from "vue";
|
|
2
|
+
import { Orientation as s, StackedBar as v, GroupedBar as x } from "@unovis/ts";
|
|
3
|
+
import { VisXYContainer as V, VisTooltip as P, VisGroupedBar as A, VisStackedBar as C, VisAxis as L, VisBulletLegend as G } from "@unovis/vue";
|
|
4
|
+
import N from "../Tooltip.js";
|
|
5
|
+
import { LegendPosition as w } from "../../types.js";
|
|
6
|
+
const M = /* @__PURE__ */ h({
|
|
7
7
|
__name: "BarChart",
|
|
8
8
|
props: {
|
|
9
9
|
data: {},
|
|
@@ -15,7 +15,7 @@ const M = /* @__PURE__ */ b({
|
|
|
15
15
|
xFormatter: {},
|
|
16
16
|
yFormatter: {},
|
|
17
17
|
yNumTicks: { default: (a) => a.data.length > 24 ? 24 / 4 : a.data.length - 1 },
|
|
18
|
-
minMaxTicksOnly: {},
|
|
18
|
+
minMaxTicksOnly: { type: Boolean },
|
|
19
19
|
xNumTicks: { default: (a) => a.data.length > 24 ? 24 / 4 : a.data.length - 1 },
|
|
20
20
|
xExplicitTicks: {},
|
|
21
21
|
yAxis: {},
|
|
@@ -33,19 +33,22 @@ const M = /* @__PURE__ */ b({
|
|
|
33
33
|
yGridLine: { type: Boolean, default: !0 }
|
|
34
34
|
},
|
|
35
35
|
setup(a) {
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const o = a;
|
|
37
|
+
if (!o.yAxis || o.yAxis.length === 0)
|
|
38
|
+
throw new Error("yAxis is required");
|
|
39
|
+
const c = u(() => o.yAxis.map((e) => (n) => n[e])), m = (e, n) => Object.values(o.categories)[n].color, p = u(
|
|
40
|
+
() => o.legendPosition === w.Top
|
|
38
41
|
), g = u(() => (e) => {
|
|
39
42
|
if (typeof window > "u" || typeof document > "u")
|
|
40
43
|
return "";
|
|
41
44
|
try {
|
|
42
|
-
const n =
|
|
45
|
+
const n = b(N, {
|
|
43
46
|
data: e,
|
|
44
|
-
categories:
|
|
47
|
+
categories: o.categories
|
|
45
48
|
}), l = document.createElement("div");
|
|
46
49
|
n.mount(l);
|
|
47
|
-
const
|
|
48
|
-
return n.unmount(),
|
|
50
|
+
const t = l.innerHTML;
|
|
51
|
+
return n.unmount(), t;
|
|
49
52
|
} catch {
|
|
50
53
|
return "";
|
|
51
54
|
}
|
|
@@ -53,36 +56,36 @@ const M = /* @__PURE__ */ b({
|
|
|
53
56
|
return (e, n) => (d(), y("div", {
|
|
54
57
|
class: k(["flex flex-col space-y-4", { "flex-col-reverse": p.value }])
|
|
55
58
|
}, [
|
|
56
|
-
|
|
59
|
+
r(i(V), { height: e.height }, {
|
|
57
60
|
default: T(() => [
|
|
58
|
-
|
|
61
|
+
r(i(P), {
|
|
59
62
|
triggers: {
|
|
60
|
-
[i(
|
|
63
|
+
[i(x).selectors.bar]: g.value,
|
|
61
64
|
[i(v).selectors.bar]: g.value
|
|
62
65
|
}
|
|
63
66
|
}, null, 8, ["triggers"]),
|
|
64
|
-
e.stacked ? (d(), f(i(
|
|
67
|
+
e.stacked ? (d(), f(i(C), {
|
|
65
68
|
key: 1,
|
|
66
69
|
data: e.data,
|
|
67
|
-
x: (l,
|
|
68
|
-
y:
|
|
69
|
-
color:
|
|
70
|
+
x: (l, t) => t,
|
|
71
|
+
y: c.value,
|
|
72
|
+
color: m,
|
|
70
73
|
"rounded-corners": e.radius ?? 0,
|
|
71
74
|
"group-padding": e.groupPadding ?? 0,
|
|
72
75
|
"bar-padding": e.barPadding ?? 0.2,
|
|
73
76
|
orientation: e.orientation ?? i(s).Vertical
|
|
74
|
-
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (d(), f(i(
|
|
77
|
+
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (d(), f(i(A), {
|
|
75
78
|
key: 0,
|
|
76
79
|
data: e.data,
|
|
77
|
-
x: (l,
|
|
78
|
-
y:
|
|
79
|
-
color:
|
|
80
|
+
x: (l, t) => t,
|
|
81
|
+
y: c.value,
|
|
82
|
+
color: m,
|
|
80
83
|
"rounded-corners": e.radius ?? 0,
|
|
81
84
|
"group-padding": e.groupPadding ?? 0,
|
|
82
85
|
"bar-padding": e.barPadding ?? 0.2,
|
|
83
86
|
orientation: e.orientation ?? i(s).Vertical
|
|
84
87
|
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
|
|
85
|
-
|
|
88
|
+
r(i(L), {
|
|
86
89
|
type: "x",
|
|
87
90
|
"tick-format": e.xFormatter,
|
|
88
91
|
label: e.xLabel,
|
|
@@ -93,15 +96,15 @@ const M = /* @__PURE__ */ b({
|
|
|
93
96
|
"tick-values": e.xExplicitTicks,
|
|
94
97
|
"min-max-ticks-only": e.minMaxTicksOnly
|
|
95
98
|
}, null, 8, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "min-max-ticks-only"]),
|
|
96
|
-
|
|
99
|
+
r(i(L), {
|
|
97
100
|
type: "y",
|
|
98
101
|
label: e.yLabel,
|
|
99
102
|
"grid-line": e.orientation !== i(s).Horizontal && e.yGridLine,
|
|
100
103
|
"domain-line": !!e.yDomainLine,
|
|
101
|
-
"tick-format":
|
|
104
|
+
"tick-format": () => "",
|
|
102
105
|
"num-ticks": e.yNumTicks,
|
|
103
106
|
"tick-line": e.yTickLine
|
|
104
|
-
}, null, 8, ["label", "grid-line", "domain-line", "
|
|
107
|
+
}, null, 8, ["label", "grid-line", "domain-line", "num-ticks", "tick-line"])
|
|
105
108
|
]),
|
|
106
109
|
_: 1
|
|
107
110
|
}, 8, ["height"]),
|
|
@@ -109,7 +112,7 @@ const M = /* @__PURE__ */ b({
|
|
|
109
112
|
key: 0,
|
|
110
113
|
class: k(["flex items center justify-end", { "pb-4": p.value }])
|
|
111
114
|
}, [
|
|
112
|
-
|
|
115
|
+
r(i(G), {
|
|
113
116
|
items: Object.values(e.categories)
|
|
114
117
|
}, null, 8, ["items"])
|
|
115
118
|
], 2))
|
|
@@ -16,7 +16,7 @@ const X = /* @__PURE__ */ v({
|
|
|
16
16
|
curveType: {},
|
|
17
17
|
xNumTicks: { default: (t) => t.data.length > 24 ? 24 / 4 : t.data.length - 1 },
|
|
18
18
|
xExplicitTicks: {},
|
|
19
|
-
minMaxTicksOnly: {},
|
|
19
|
+
minMaxTicksOnly: { type: Boolean },
|
|
20
20
|
yNumTicks: { default: (t) => t.data.length > 24 ? 24 / 4 : t.data.length - 1 },
|
|
21
21
|
hideTooltip: { type: Boolean },
|
|
22
22
|
hideLegend: { type: Boolean },
|