vue-chrts 0.2.5-test.3 → 1.0.0-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 +49 -48
- package/dist/components/AreaChart/types.d.ts +11 -9
- package/dist/components/BarChart/BarChart.js +62 -57
- package/dist/components/BarChart/stackedGroupedUtils.d.ts +2 -3
- package/dist/components/BarChart/types.d.ts +9 -1
- package/dist/components/BubbleChart/BubbleChart.js +51 -49
- package/dist/components/BubbleChart/BubbleChart.vue.d.ts +1 -1
- package/dist/components/BubbleChart/types.d.ts +11 -17
- package/dist/components/DonutChart/DonutChart.js +53 -43
- package/dist/components/DonutChart/DonutChart.vue.d.ts +1 -1
- package/dist/components/DonutChart/types.d.ts +10 -12
- package/dist/components/LineChart/LineChart.js +11 -9
- package/dist/components/Timeline/Timeline.js +83 -63
- package/dist/components/Timeline/types.d.ts +95 -3
- package/dist/components/Tooltip.js +6 -6
- package/dist/types.d.ts +16 -11
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Position as
|
|
1
|
+
import { defineComponent as N, useSlots as W, useTemplateRef as E, ref as M, computed as u, createElementBlock as y, openBlock as s, normalizeClass as w, normalizeStyle as k, createVNode as m, createCommentVNode as d, createElementVNode as X, unref as n, withCtx as z, createBlock as c, Fragment as h, renderList as R, mergeProps as f, renderSlot as T } from "vue";
|
|
2
|
+
import { Position as C, CurveType as L } from "@unovis/ts";
|
|
3
3
|
import { createMarkers as Y, getFirstPropertyValue as U } from "../../utils.js";
|
|
4
4
|
import H from "../Tooltip.js";
|
|
5
5
|
import { VisXYContainer as q, VisTooltip as J, VisArea as K, VisLine as Q, VisAxis as A, VisCrosshair as Z, VisBulletLegend as I } from "@unovis/vue";
|
|
@@ -7,7 +7,7 @@ import { LegendPosition as _ } from "../../types.js";
|
|
|
7
7
|
const ee = {
|
|
8
8
|
ref: "slotWrapper",
|
|
9
9
|
style: { display: "none" }
|
|
10
|
-
}, ie = 0.5, $ = "#3b82f6", se = /* @__PURE__ */
|
|
10
|
+
}, ie = 0.5, $ = "#3b82f6", se = /* @__PURE__ */ N({
|
|
11
11
|
__name: "AreaChart",
|
|
12
12
|
props: {
|
|
13
13
|
data: {},
|
|
@@ -46,19 +46,21 @@ const ee = {
|
|
|
46
46
|
crosshairConfig: { default: () => ({
|
|
47
47
|
color: "#666"
|
|
48
48
|
}) },
|
|
49
|
+
xAxisConfig: {},
|
|
50
|
+
yAxisConfig: {},
|
|
49
51
|
yDomain: {},
|
|
50
52
|
xDomain: {}
|
|
51
53
|
},
|
|
52
54
|
emits: ["click"],
|
|
53
55
|
setup(D, { emit: b }) {
|
|
54
|
-
const B = b, t = D, O =
|
|
56
|
+
const B = b, t = D, O = W(), v = E("slotWrapper"), p = M(), g = u(() => {
|
|
55
57
|
const e = Object.values(t.categories).map(
|
|
56
|
-
(
|
|
58
|
+
(a, i) => `var(--vis-color${i})`
|
|
57
59
|
);
|
|
58
60
|
return Object.values(t.categories).map(
|
|
59
|
-
(
|
|
61
|
+
(a, i) => a.color ?? e[i]
|
|
60
62
|
);
|
|
61
|
-
}), V = u(() => t.markerConfig ? Y(t.markerConfig) : ""),
|
|
63
|
+
}), V = u(() => t.markerConfig ? Y(t.markerConfig) : ""), x = u(() => t.legendPosition.startsWith("top")), F = u(() => t.legendPosition.includes("left") ? "flex-start" : t.legendPosition.includes("right") ? "flex-end" : "center"), G = u(() => {
|
|
62
64
|
const e = (i, o) => {
|
|
63
65
|
var r;
|
|
64
66
|
return `
|
|
@@ -69,7 +71,7 @@ const ee = {
|
|
|
69
71
|
<stop offset="100%" stop-color="${o}" stop-opacity="0" />
|
|
70
72
|
</linearGradient>
|
|
71
73
|
`;
|
|
72
|
-
},
|
|
74
|
+
}, a = (i, o) => {
|
|
73
75
|
var r;
|
|
74
76
|
return `
|
|
75
77
|
<linearGradient id="gradient${i}-${o}" gradientTransform="rotate(90)">
|
|
@@ -82,65 +84,64 @@ const ee = {
|
|
|
82
84
|
</linearGradient>
|
|
83
85
|
`;
|
|
84
86
|
};
|
|
85
|
-
return
|
|
86
|
-
(i, o) => i != null && i.includes("#") ? e(o, i) :
|
|
87
|
+
return g.value.map(
|
|
88
|
+
(i, o) => i != null && i.includes("#") ? e(o, i) : a(o, i ?? $)
|
|
87
89
|
).join("");
|
|
88
90
|
});
|
|
89
|
-
function
|
|
90
|
-
var
|
|
91
|
+
function P(e) {
|
|
92
|
+
var a;
|
|
91
93
|
return {
|
|
92
94
|
y: (i) => Number(i[e]),
|
|
93
|
-
color: ((
|
|
95
|
+
color: ((a = t.categories[e]) == null ? void 0 : a.color) ?? $
|
|
94
96
|
};
|
|
95
97
|
}
|
|
96
|
-
function
|
|
97
|
-
return typeof window > "u" ? "" :
|
|
98
|
+
function S(e) {
|
|
99
|
+
return typeof window > "u" ? "" : v.value ? v.value.innerHTML : "";
|
|
98
100
|
}
|
|
99
|
-
function
|
|
100
|
-
return p.value = e,
|
|
101
|
+
function j(e) {
|
|
102
|
+
return p.value = e, S();
|
|
101
103
|
}
|
|
102
|
-
return (e,
|
|
103
|
-
style:
|
|
104
|
+
return (e, a) => (s(), y("div", {
|
|
105
|
+
style: k({
|
|
104
106
|
display: "flex",
|
|
105
|
-
flexDirection:
|
|
107
|
+
flexDirection: x.value ? "column-reverse" : "column",
|
|
106
108
|
gap: "var(--vis-legend-spacing)"
|
|
107
109
|
}),
|
|
108
110
|
class: w({ markers: !!t.markerConfig }),
|
|
109
|
-
onClick:
|
|
111
|
+
onClick: a[0] || (a[0] = (i) => B("click", i, p.value))
|
|
110
112
|
}, [
|
|
111
|
-
m(
|
|
113
|
+
m(n(q), {
|
|
112
114
|
data: e.data,
|
|
113
115
|
height: e.height,
|
|
114
116
|
padding: e.padding,
|
|
115
|
-
"svg-defs":
|
|
117
|
+
"svg-defs": G.value + V.value,
|
|
116
118
|
"y-domain": e.yDomain,
|
|
117
119
|
"x-domain": e.xDomain
|
|
118
120
|
}, {
|
|
119
121
|
default: z(() => [
|
|
120
|
-
e.hideTooltip ? d("", !0) : (s(),
|
|
122
|
+
e.hideTooltip ? d("", !0) : (s(), c(n(J), {
|
|
121
123
|
key: 0,
|
|
122
|
-
"horizontal-placement":
|
|
123
|
-
"vertical-placement":
|
|
124
|
+
"horizontal-placement": n(C).Right,
|
|
125
|
+
"vertical-placement": n(C).Top
|
|
124
126
|
}, null, 8, ["horizontal-placement", "vertical-placement"])),
|
|
125
|
-
(s(!0),
|
|
126
|
-
m(
|
|
127
|
-
x: (r, l) => l
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
color: `url(#gradient${o}-${f.value[o]})`,
|
|
127
|
+
(s(!0), y(h, null, R(Object.keys(t.categories), (i, o) => (s(), y(h, { key: i }, [
|
|
128
|
+
m(n(K), f({
|
|
129
|
+
x: (r, l) => l
|
|
130
|
+
}, { ref_for: !0 }, P(i), {
|
|
131
|
+
color: `url(#gradient${o}-${g.value[o]})`,
|
|
131
132
|
opacity: e.hideArea ? 0 : ie,
|
|
132
|
-
"curve-type": e.curveType ??
|
|
133
|
+
"curve-type": e.curveType ?? n(L).MonotoneX
|
|
133
134
|
}), null, 16, ["x", "color", "opacity", "curve-type"]),
|
|
134
|
-
m(
|
|
135
|
+
m(n(Q), {
|
|
135
136
|
x: (r, l) => l,
|
|
136
137
|
y: (r) => r[i],
|
|
137
|
-
color:
|
|
138
|
-
"curve-type": e.curveType ??
|
|
138
|
+
color: g.value[o],
|
|
139
|
+
"curve-type": e.curveType ?? n(L).MonotoneX,
|
|
139
140
|
"line-width": e.lineWidth,
|
|
140
141
|
lineDashArray: e.lineDashArray ? e.lineDashArray[o] : void 0
|
|
141
142
|
}, null, 8, ["x", "y", "color", "curve-type", "line-width", "lineDashArray"])
|
|
142
143
|
], 64))), 128)),
|
|
143
|
-
e.hideXAxis ? d("", !0) : (s(),
|
|
144
|
+
e.hideXAxis ? d("", !0) : (s(), c(n(A), f({
|
|
144
145
|
key: 1,
|
|
145
146
|
type: "x",
|
|
146
147
|
label: e.xLabel,
|
|
@@ -152,8 +153,8 @@ const ee = {
|
|
|
152
153
|
"domain-line": e.xDomainLine,
|
|
153
154
|
"tick-line": e.xTickLine,
|
|
154
155
|
"min-max-ticks-only": e.minMaxTicksOnly
|
|
155
|
-
}, null,
|
|
156
|
-
e.hideYAxis ? d("", !0) : (s(),
|
|
156
|
+
}, e.xAxisConfig), null, 16, ["label", "num-ticks", "tick-format", "tick-values", "grid-line", "domain-line", "tick-line", "min-max-ticks-only"])),
|
|
157
|
+
e.hideYAxis ? d("", !0) : (s(), c(n(A), f({
|
|
157
158
|
key: 2,
|
|
158
159
|
type: "y",
|
|
159
160
|
label: e.yLabel,
|
|
@@ -162,20 +163,20 @@ const ee = {
|
|
|
162
163
|
"grid-line": e.yGridLine,
|
|
163
164
|
"domain-line": e.yDomainLine,
|
|
164
165
|
"tick-line": e.yTickLine
|
|
165
|
-
}, null,
|
|
166
|
-
e.hideTooltip ? d("", !0) : (s(),
|
|
166
|
+
}, e.yAxisConfig), null, 16, ["label", "num-ticks", "tick-format", "grid-line", "domain-line", "tick-line"])),
|
|
167
|
+
e.hideTooltip ? d("", !0) : (s(), c(n(Z), f({ key: 3 }, e.crosshairConfig, { template: j }), null, 16))
|
|
167
168
|
]),
|
|
168
169
|
_: 1
|
|
169
170
|
}, 8, ["data", "height", "padding", "svg-defs", "y-domain", "x-domain"]),
|
|
170
|
-
t.hideLegend ? d("", !0) : (s(),
|
|
171
|
+
t.hideLegend ? d("", !0) : (s(), y("div", {
|
|
171
172
|
key: 0,
|
|
172
|
-
style:
|
|
173
|
+
style: k({
|
|
173
174
|
display: "flex",
|
|
174
|
-
justifyContent:
|
|
175
|
+
justifyContent: F.value
|
|
175
176
|
})
|
|
176
177
|
}, [
|
|
177
|
-
m(
|
|
178
|
-
style:
|
|
178
|
+
m(n(I), {
|
|
179
|
+
style: k([
|
|
179
180
|
t.legendStyle,
|
|
180
181
|
"display: flex; gap: var(--vis-legend-spacing);"
|
|
181
182
|
]),
|
|
@@ -186,14 +187,14 @@ const ee = {
|
|
|
186
187
|
}, null, 8, ["style", "items"])
|
|
187
188
|
], 4)),
|
|
188
189
|
X("div", ee, [
|
|
189
|
-
|
|
190
|
+
n(O).tooltip ? T(e.$slots, "tooltip", {
|
|
190
191
|
key: 0,
|
|
191
192
|
values: p.value
|
|
192
193
|
}) : p.value ? T(e.$slots, "fallback", { key: 1 }, () => [
|
|
193
194
|
m(H, {
|
|
194
195
|
data: p.value,
|
|
195
196
|
categories: e.categories,
|
|
196
|
-
toolTipTitle:
|
|
197
|
+
toolTipTitle: n(U)(p.value) ?? "",
|
|
197
198
|
yFormatter: t.yFormatter
|
|
198
199
|
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
199
200
|
]) : d("", !0)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { axisFormatter, CrosshairConfig, LegendPosition, MarkerConfig } from '../../types';
|
|
1
|
+
import { axisFormatter, CrosshairConfig, LegendPosition, MarkerConfig, AxisConfig } from '../../types';
|
|
2
2
|
import { BulletLegendItemInterface, CurveType } from '@unovis/ts';
|
|
3
3
|
export interface AreaChartProps<T> {
|
|
4
4
|
/**
|
|
@@ -39,17 +39,11 @@ export interface AreaChartProps<T> {
|
|
|
39
39
|
*/
|
|
40
40
|
markerConfig?: Record<string, MarkerConfig>;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @param {number} i - The index of the tick in the `ticks` array.
|
|
44
|
-
* @param {(number[]|Date[])} ticks - An array of all tick values for the x-axis.
|
|
45
|
-
* @returns {string} The formatted string representation of the tick.
|
|
42
|
+
* A function that formats the x-axis tick labels.
|
|
46
43
|
*/
|
|
47
44
|
xFormatter?: axisFormatter;
|
|
48
45
|
/**
|
|
49
|
-
*
|
|
50
|
-
* @param {number} i - The index of the tick in the `ticks` array.
|
|
51
|
-
* @param {(number[]|Date[])} ticks - An array of all tick values for the y-axis.
|
|
52
|
-
* @returns {string} The formatted string representation of the tick.
|
|
46
|
+
* A function that formats the y-axis tick labels.
|
|
53
47
|
*/
|
|
54
48
|
yFormatter?: axisFormatter;
|
|
55
49
|
/**
|
|
@@ -145,6 +139,14 @@ export interface AreaChartProps<T> {
|
|
|
145
139
|
* Crosshair configuration object for customizing the appearance of the crosshair line.
|
|
146
140
|
*/
|
|
147
141
|
crosshairConfig?: CrosshairConfig;
|
|
142
|
+
/**
|
|
143
|
+
* Axis configuration object for customizing the appearance of the axes.
|
|
144
|
+
*/
|
|
145
|
+
xAxisConfig?: AxisConfig;
|
|
146
|
+
/**
|
|
147
|
+
* Axis configuration object for customizing the appearance of the axes.
|
|
148
|
+
*/
|
|
149
|
+
yAxisConfig?: AxisConfig;
|
|
148
150
|
/**
|
|
149
151
|
* The domain for the y-axis, specified as a tuple of two values.
|
|
150
152
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as W, useSlots as X, useTemplateRef as
|
|
1
|
+
import { defineComponent as W, useSlots as X, useTemplateRef as H, ref as Y, computed as f, createElementBlock as v, openBlock as l, normalizeStyle as L, createVNode as k, createCommentVNode as y, createElementVNode as j, unref as i, withCtx as $, createBlock as u, Fragment as q, renderList as I, mergeProps as P, renderSlot as C } from "vue";
|
|
2
2
|
import { Orientation as p, StackedBar as U, GroupedBar as J } from "@unovis/ts";
|
|
3
3
|
import { getFirstPropertyValue as K } from "../../utils.js";
|
|
4
4
|
import { useStackedGrouped as Q } from "./stackedGroupedUtils.js";
|
|
5
|
-
import { VisXYContainer as Z, VisXYLabels as _, VisTooltip as ee, VisStackedBar as
|
|
5
|
+
import { VisXYContainer as Z, VisXYLabels as _, VisTooltip as ee, VisStackedBar as F, VisGroupedBar as ae, VisAxis as V, VisBulletLegend as ie } from "@unovis/vue";
|
|
6
6
|
import oe from "../Tooltip.js";
|
|
7
7
|
import { LegendPosition as re } from "../../types.js";
|
|
8
|
-
const
|
|
8
|
+
const ne = {
|
|
9
9
|
ref: "slotWrapper",
|
|
10
10
|
style: { display: "none" }
|
|
11
11
|
}, ge = /* @__PURE__ */ W({
|
|
@@ -47,22 +47,24 @@ const te = {
|
|
|
47
47
|
hideXAxis: { type: Boolean },
|
|
48
48
|
hideYAxis: { type: Boolean },
|
|
49
49
|
stackedGroupedSpacing: { default: 0.1 },
|
|
50
|
+
xAxisConfig: {},
|
|
51
|
+
yAxisConfig: {},
|
|
50
52
|
stackAndGrouped: { type: Boolean },
|
|
51
53
|
valueLabel: {},
|
|
52
54
|
xAxis: {}
|
|
53
55
|
},
|
|
54
56
|
emits: ["click"],
|
|
55
|
-
setup(
|
|
56
|
-
const
|
|
57
|
+
setup(G, { emit: S }) {
|
|
58
|
+
const O = S, a = G, D = X(), x = H("slotWrapper"), s = Y();
|
|
57
59
|
if (a.valueLabel && !a.xAxis)
|
|
58
60
|
throw new Error(
|
|
59
61
|
"BarChart: 'xAxis' prop is required when 'valueLabel' is enabled. Please provide an 'xAxis' to display value labels."
|
|
60
62
|
);
|
|
61
63
|
if (!a.yAxis || a.yAxis.length === 0)
|
|
62
64
|
throw new Error("yAxis is required");
|
|
63
|
-
const
|
|
64
|
-
var
|
|
65
|
-
return (
|
|
65
|
+
const h = f(() => a.yAxis.map((e) => (t) => t[e])), A = (e, t) => {
|
|
66
|
+
var r;
|
|
67
|
+
return (r = Object.values(a.categories)[t]) == null ? void 0 : r.color;
|
|
66
68
|
}, c = f(
|
|
67
69
|
() => Q({
|
|
68
70
|
data: a.data,
|
|
@@ -71,92 +73,95 @@ const te = {
|
|
|
71
73
|
xAxis: a.xAxis,
|
|
72
74
|
spacing: a.stackedGroupedSpacing
|
|
73
75
|
}).value
|
|
74
|
-
),
|
|
76
|
+
), E = f(() => a.legendPosition.startsWith("top")), N = f(() => a.legendPosition.includes("left") ? "flex-start" : a.legendPosition.includes("right") ? "flex-end" : "center");
|
|
75
77
|
function B(e) {
|
|
76
|
-
|
|
78
|
+
s.value = e;
|
|
77
79
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
(e, r) => T.map((o, d) => ({
|
|
83
|
-
x: r,
|
|
84
|
-
y: Number(o(e) ?? 0),
|
|
80
|
+
const T = a.yAxis.map((e) => (t) => t[e]), M = T.length, w = a.data.flatMap(
|
|
81
|
+
(e, t) => T.map((r, d) => ({
|
|
82
|
+
x: t,
|
|
83
|
+
y: Number(r(e) ?? 0),
|
|
85
84
|
itemIndex: d
|
|
86
85
|
}))
|
|
87
|
-
),
|
|
86
|
+
), z = (e) => {
|
|
88
87
|
if (a.stacked || a.stackAndGrouped) return e.x;
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
const d = 1 - (a.groupPadding ?? 0), g = d /
|
|
88
|
+
const t = M;
|
|
89
|
+
if (t <= 1) return e.x;
|
|
90
|
+
const d = 1 - (a.groupPadding ?? 0), g = d / t, m = -d / 2, o = g * e.itemIndex + g / 2, b = 1 - (a.barPadding ?? 0), R = (m + o) * b;
|
|
92
91
|
return e.x + R;
|
|
93
92
|
};
|
|
94
|
-
return (e,
|
|
93
|
+
return (e, t) => (l(), v("div", {
|
|
95
94
|
style: L({
|
|
96
95
|
display: "flex",
|
|
97
|
-
flexDirection:
|
|
96
|
+
flexDirection: E.value ? "column-reverse" : "column",
|
|
98
97
|
gap: "var(--vis-legend-spacing)"
|
|
99
98
|
}),
|
|
100
|
-
onClick:
|
|
99
|
+
onClick: t[0] || (t[0] = (r) => O("click", r, s.value))
|
|
101
100
|
}, [
|
|
102
101
|
k(i(Z), {
|
|
103
102
|
padding: e.padding,
|
|
104
103
|
height: e.height
|
|
105
104
|
}, {
|
|
106
105
|
default: $(() => {
|
|
107
|
-
var
|
|
106
|
+
var r, d, g, m;
|
|
108
107
|
return [
|
|
109
|
-
e.valueLabel ? (
|
|
108
|
+
e.valueLabel ? (l(), u(i(_), {
|
|
110
109
|
key: 0,
|
|
111
|
-
data: i(
|
|
112
|
-
x:
|
|
113
|
-
y: (
|
|
114
|
-
var
|
|
115
|
-
return
|
|
110
|
+
data: i(w),
|
|
111
|
+
x: z,
|
|
112
|
+
y: (o) => {
|
|
113
|
+
var n;
|
|
114
|
+
return o.y + (((n = a.valueLabel) == null ? void 0 : n.labelSpacing) ?? 0);
|
|
116
115
|
},
|
|
117
|
-
label: (
|
|
116
|
+
label: (r = a.valueLabel) == null ? void 0 : r.label,
|
|
118
117
|
backgroundColor: ((d = a.valueLabel) == null ? void 0 : d.backgroundColor) ?? "transparent",
|
|
119
118
|
color: ((g = a.valueLabel) == null ? void 0 : g.color) ?? "red",
|
|
120
119
|
labelFontSize: (m = a.valueLabel) == null ? void 0 : m.labelFontSize
|
|
121
120
|
}, null, 8, ["data", "y", "label", "backgroundColor", "color", "labelFontSize"])) : y("", !0),
|
|
122
121
|
k(i(ee), {
|
|
123
122
|
triggers: {
|
|
124
|
-
[i(J).selectors.bar]:
|
|
125
|
-
|
|
123
|
+
[i(J).selectors.bar]: (o) => {
|
|
124
|
+
var n;
|
|
125
|
+
return B(o), o ? (n = x.value) == null ? void 0 : n.innerHTML : "";
|
|
126
|
+
},
|
|
127
|
+
[i(U).selectors.bar]: (o) => {
|
|
128
|
+
var n;
|
|
129
|
+
return B(o), o ? (n = x.value) == null ? void 0 : n.innerHTML : "";
|
|
130
|
+
}
|
|
126
131
|
}
|
|
127
132
|
}, null, 8, ["triggers"]),
|
|
128
|
-
e.stackAndGrouped ? (
|
|
129
|
-
key:
|
|
133
|
+
e.stackAndGrouped ? (l(!0), v(q, { key: 1 }, I(c.value.states, (o) => (l(), u(i(F), {
|
|
134
|
+
key: o,
|
|
130
135
|
data: c.value.chartData,
|
|
131
|
-
x: (
|
|
132
|
-
y: c.value.bars[
|
|
133
|
-
color: c.value.colorFunctions[
|
|
136
|
+
x: (n, b) => b + c.value.positions[o],
|
|
137
|
+
y: c.value.bars[o],
|
|
138
|
+
color: c.value.colorFunctions[o],
|
|
134
139
|
"rounded-corners": e.radius ?? 0,
|
|
135
140
|
"group-padding": e.groupPadding ?? 0,
|
|
136
141
|
"bar-padding": e.barPadding,
|
|
137
142
|
orientation: e.orientation ?? i(p).Vertical
|
|
138
|
-
}, null, 8, ["data", "x", "y", "color", "rounded-corners", "group-padding", "bar-padding", "orientation"]))), 128)) : e.stacked ? (
|
|
143
|
+
}, null, 8, ["data", "x", "y", "color", "rounded-corners", "group-padding", "bar-padding", "orientation"]))), 128)) : e.stacked ? (l(), u(i(F), {
|
|
139
144
|
key: 3,
|
|
140
145
|
data: e.data,
|
|
141
|
-
x: (
|
|
142
|
-
y:
|
|
146
|
+
x: (o, n) => n,
|
|
147
|
+
y: h.value,
|
|
143
148
|
color: A,
|
|
144
149
|
"rounded-corners": e.radius ?? 0,
|
|
145
150
|
"group-padding": e.groupPadding ?? 0,
|
|
146
151
|
"bar-padding": e.barPadding ?? 0.2,
|
|
147
152
|
orientation: e.orientation ?? i(p).Vertical
|
|
148
|
-
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (
|
|
153
|
+
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (l(), u(i(ae), {
|
|
149
154
|
key: 2,
|
|
150
155
|
data: e.data,
|
|
151
|
-
x: (
|
|
152
|
-
y:
|
|
156
|
+
x: (o, n) => n,
|
|
157
|
+
y: h.value,
|
|
153
158
|
color: A,
|
|
154
159
|
"rounded-corners": e.radius ?? 0,
|
|
155
160
|
"group-padding": e.groupPadding ?? 0,
|
|
156
161
|
"bar-padding": e.barPadding ?? 0.2,
|
|
157
162
|
orientation: e.orientation ?? i(p).Vertical
|
|
158
163
|
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
|
|
159
|
-
e.hideXAxis ? y("", !0) : (
|
|
164
|
+
e.hideXAxis ? y("", !0) : (l(), u(i(V), P({
|
|
160
165
|
key: 4,
|
|
161
166
|
type: "x",
|
|
162
167
|
"tick-format": e.xFormatter,
|
|
@@ -167,8 +172,8 @@ const te = {
|
|
|
167
172
|
"num-ticks": e.xNumTicks,
|
|
168
173
|
"tick-values": e.xExplicitTicks,
|
|
169
174
|
minMaxTicksOnly: e.minMaxTicksOnly
|
|
170
|
-
}, null,
|
|
171
|
-
e.hideYAxis ? y("", !0) : (
|
|
175
|
+
}, e.xAxisConfig), null, 16, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "minMaxTicksOnly"])),
|
|
176
|
+
e.hideYAxis ? y("", !0) : (l(), u(i(V), P({
|
|
172
177
|
key: 5,
|
|
173
178
|
type: "y",
|
|
174
179
|
label: e.yLabel,
|
|
@@ -177,16 +182,16 @@ const te = {
|
|
|
177
182
|
"tick-format": e.yFormatter,
|
|
178
183
|
"num-ticks": e.yNumTicks,
|
|
179
184
|
"tick-line": e.yTickLine
|
|
180
|
-
}, null,
|
|
185
|
+
}, e.yAxisConfig), null, 16, ["label", "grid-line", "domain-line", "tick-format", "num-ticks", "tick-line"]))
|
|
181
186
|
];
|
|
182
187
|
}),
|
|
183
188
|
_: 1
|
|
184
189
|
}, 8, ["padding", "height"]),
|
|
185
|
-
a.hideLegend ? y("", !0) : (
|
|
190
|
+
a.hideLegend ? y("", !0) : (l(), v("div", {
|
|
186
191
|
key: 0,
|
|
187
192
|
style: L({
|
|
188
193
|
display: "flex",
|
|
189
|
-
justifyContent:
|
|
194
|
+
justifyContent: N.value
|
|
190
195
|
})
|
|
191
196
|
}, [
|
|
192
197
|
k(i(ie), {
|
|
@@ -194,17 +199,17 @@ const te = {
|
|
|
194
199
|
a.legendStyle,
|
|
195
200
|
"display: flex; gap: var(--vis-legend-spacing);"
|
|
196
201
|
]),
|
|
197
|
-
items: Object.values(a.categories).map((
|
|
198
|
-
...
|
|
199
|
-
color: Array.isArray(
|
|
202
|
+
items: Object.values(a.categories).map((r) => ({
|
|
203
|
+
...r,
|
|
204
|
+
color: Array.isArray(r.color) ? r.color[0] : r.color
|
|
200
205
|
}))
|
|
201
206
|
}, null, 8, ["style", "items"])
|
|
202
207
|
], 4)),
|
|
203
|
-
|
|
204
|
-
i(
|
|
208
|
+
j("div", ne, [
|
|
209
|
+
i(D).tooltip ? C(e.$slots, "tooltip", {
|
|
205
210
|
key: 0,
|
|
206
211
|
values: s.value
|
|
207
|
-
}) : s.value ?
|
|
212
|
+
}) : s.value ? C(e.$slots, "fallback", { key: 1 }, () => [
|
|
208
213
|
k(oe, {
|
|
209
214
|
data: s.value,
|
|
210
215
|
categories: a.categories,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ComputedRef } from 'vue';
|
|
2
|
+
import { BulletLegendItemInterface } from '../../types';
|
|
2
3
|
export interface StackedGroupedConfig<T> {
|
|
3
4
|
data: T[];
|
|
4
|
-
categories: Record<string,
|
|
5
|
-
color?: string | Array<string>;
|
|
6
|
-
}>;
|
|
5
|
+
categories: Record<string, BulletLegendItemInterface>;
|
|
7
6
|
stackAndGrouped: boolean;
|
|
8
7
|
xAxis?: keyof T;
|
|
9
8
|
spacing?: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BulletLegendItemInterface, Orientation, LegendPosition, axisFormatter } from '../../types';
|
|
1
|
+
import { BulletLegendItemInterface, Orientation, LegendPosition, axisFormatter, AxisConfig } from '../../types';
|
|
2
2
|
type BarChartPropsBase<T> = {
|
|
3
3
|
/**
|
|
4
4
|
* The data to be displayed in the bar chart.
|
|
@@ -142,6 +142,14 @@ type BarChartPropsBase<T> = {
|
|
|
142
142
|
* Only applicable if `stackAndGrouped` is `true`.
|
|
143
143
|
*/
|
|
144
144
|
stackedGroupedSpacing?: number;
|
|
145
|
+
/**
|
|
146
|
+
* Axis configuration object for customizing the appearance of the axes.
|
|
147
|
+
*/
|
|
148
|
+
xAxisConfig?: AxisConfig;
|
|
149
|
+
/**
|
|
150
|
+
* Axis configuration object for customizing the appearance of the axes.
|
|
151
|
+
*/
|
|
152
|
+
yAxisConfig?: AxisConfig;
|
|
145
153
|
};
|
|
146
154
|
export type BarChartProps<T> = BarChartPropsBase<T> & {
|
|
147
155
|
/**
|