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