vue-chrts 0.2.4 → 0.2.5-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 +73 -70
- package/dist/components/AreaChart/types.d.ts +4 -0
- package/dist/components/AreaStackedChart/AreaStackedChart.js +31 -31
- package/dist/components/BarChart/BarChart.js +160 -122
- package/dist/components/BarChart/BarChart.vue.d.ts +1 -1
- package/dist/components/BarChart/types.d.ts +27 -11
- package/dist/components/BubbleChart/BubbleChart.js +74 -56
- package/dist/components/BubbleChart/types.d.ts +4 -0
- package/dist/components/DonutChart/DonutChart.js +39 -39
- package/dist/components/LineChart/LineChart.js +62 -58
- package/dist/components/LineChart/types.d.ts +4 -0
- package/dist/components/Tooltip.js +24 -24
- package/dist/types.d.ts +6 -2
- package/dist/types.js +4 -4
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Orientation as
|
|
3
|
-
import { getFirstPropertyValue as
|
|
4
|
-
import { useStackedGrouped as
|
|
5
|
-
import { VisXYContainer as
|
|
6
|
-
import
|
|
7
|
-
import { LegendPosition as
|
|
8
|
-
const
|
|
1
|
+
import { defineComponent as W, useSlots as X, useTemplateRef as Y, ref as j, computed as k, createElementBlock as v, openBlock as l, normalizeStyle as L, createVNode as b, createCommentVNode as f, createElementVNode as H, unref as a, withCtx as $, createBlock as c, Fragment as q, renderList as I, renderSlot as C } from "vue";
|
|
2
|
+
import { Orientation as g, 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 te, VisAxis as V, VisBulletLegend as ae } from "@unovis/vue";
|
|
6
|
+
import ie from "../Tooltip.js";
|
|
7
|
+
import { LegendPosition as ne } from "../../types.js";
|
|
8
|
+
const oe = {
|
|
9
9
|
ref: "slotWrapper",
|
|
10
10
|
style: { display: "none" }
|
|
11
|
-
},
|
|
11
|
+
}, ye = /* @__PURE__ */ W({
|
|
12
12
|
__name: "BarChart",
|
|
13
13
|
props: {
|
|
14
14
|
data: {},
|
|
@@ -25,18 +25,19 @@ const U = {
|
|
|
25
25
|
categories: {},
|
|
26
26
|
xFormatter: {},
|
|
27
27
|
yFormatter: {},
|
|
28
|
-
yNumTicks: {
|
|
28
|
+
yNumTicks: {},
|
|
29
29
|
minMaxTicksOnly: { type: Boolean },
|
|
30
|
-
xNumTicks: {
|
|
30
|
+
xNumTicks: {},
|
|
31
31
|
xExplicitTicks: {},
|
|
32
32
|
yAxis: {},
|
|
33
|
-
groupPadding: {},
|
|
34
|
-
barPadding: {},
|
|
33
|
+
groupPadding: { default: 0 },
|
|
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
|
-
orientation: { default:
|
|
39
|
-
legendPosition: {},
|
|
38
|
+
orientation: { default: g.Vertical },
|
|
39
|
+
legendPosition: { default: ne.BottomCenter },
|
|
40
|
+
legendStyle: { default: void 0 },
|
|
40
41
|
xDomainLine: { type: Boolean },
|
|
41
42
|
yDomainLine: { type: Boolean },
|
|
42
43
|
xTickLine: { type: Boolean },
|
|
@@ -47,137 +48,174 @@ const U = {
|
|
|
47
48
|
hideYAxis: { type: Boolean },
|
|
48
49
|
stackedGroupedSpacing: { default: 0.1 },
|
|
49
50
|
stackAndGrouped: { type: Boolean },
|
|
51
|
+
valueLabel: {},
|
|
50
52
|
xAxis: {}
|
|
51
53
|
},
|
|
52
54
|
emits: ["click"],
|
|
53
|
-
setup(
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
55
|
+
setup(e, { emit: G }) {
|
|
56
|
+
const S = G, t = e, O = X(), h = Y("slotWrapper"), u = j();
|
|
57
|
+
if (t.valueLabel && !t.xAxis)
|
|
58
|
+
throw new Error(
|
|
59
|
+
"BarChart: 'xAxis' prop is required when 'valueLabel' is enabled. Please provide an 'xAxis' to display value labels."
|
|
60
|
+
);
|
|
61
|
+
if (!t.yAxis || t.yAxis.length === 0)
|
|
56
62
|
throw new Error("yAxis is required");
|
|
57
|
-
const
|
|
58
|
-
var
|
|
59
|
-
return (
|
|
60
|
-
},
|
|
61
|
-
() =>
|
|
62
|
-
data:
|
|
63
|
-
categories:
|
|
64
|
-
stackAndGrouped:
|
|
65
|
-
xAxis:
|
|
66
|
-
spacing:
|
|
63
|
+
const A = k(() => t.yAxis.map((i) => (o) => o[i])), B = (i, o) => {
|
|
64
|
+
var n;
|
|
65
|
+
return (n = Object.values(t.categories)[o]) == null ? void 0 : n.color;
|
|
66
|
+
}, y = k(
|
|
67
|
+
() => Q({
|
|
68
|
+
data: t.data,
|
|
69
|
+
categories: t.categories,
|
|
70
|
+
stackAndGrouped: t.stackAndGrouped,
|
|
71
|
+
xAxis: t.xAxis,
|
|
72
|
+
spacing: t.stackedGroupedSpacing
|
|
67
73
|
}).value
|
|
68
|
-
),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
function b(e) {
|
|
72
|
-
return r.value = e, P();
|
|
74
|
+
), w = k(() => t.legendPosition.startsWith("top")), D = k(() => t.legendPosition.includes("left") ? "flex-start" : t.legendPosition.includes("right") ? "flex-end" : "center");
|
|
75
|
+
function T(i) {
|
|
76
|
+
return u.value = i, E();
|
|
73
77
|
}
|
|
74
|
-
function
|
|
75
|
-
return typeof window > "u" ? "" :
|
|
78
|
+
function E(i) {
|
|
79
|
+
return typeof window > "u" ? "" : h.value ? h.value.innerHTML : "";
|
|
76
80
|
}
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
const P = t.yAxis.map((i) => (o) => o[i]), N = P.length, z = t.data.flatMap(
|
|
82
|
+
(i, o) => P.map((n, s) => ({
|
|
83
|
+
x: o,
|
|
84
|
+
y: Number(n(i) ?? 0),
|
|
85
|
+
itemIndex: s
|
|
86
|
+
}))
|
|
87
|
+
), M = (i) => {
|
|
88
|
+
if (t.stacked || t.stackAndGrouped) return i.x;
|
|
89
|
+
const o = N;
|
|
90
|
+
if (o <= 1) return i.x;
|
|
91
|
+
const s = 1 - (t.groupPadding ?? 0), m = s / o, x = -s / 2, r = m * i.itemIndex + m / 2, p = 1 - (t.barPadding ?? 0), R = (x + r) * p;
|
|
92
|
+
return i.x + R;
|
|
93
|
+
};
|
|
94
|
+
return (i, o) => (l(), v("div", {
|
|
95
|
+
style: L({
|
|
79
96
|
display: "flex",
|
|
80
|
-
flexDirection:
|
|
81
|
-
gap: "
|
|
97
|
+
flexDirection: w.value ? "column-reverse" : "column",
|
|
98
|
+
gap: "var(--vis-legend-spacing)"
|
|
82
99
|
}),
|
|
83
|
-
onClick:
|
|
100
|
+
onClick: o[0] || (o[0] = (n) => S("click", n, u.value))
|
|
84
101
|
}, [
|
|
85
|
-
|
|
102
|
+
b(a(Z), {
|
|
86
103
|
padding: e.padding,
|
|
87
104
|
height: e.height
|
|
88
105
|
}, {
|
|
89
|
-
default:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
color:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
106
|
+
default: $(() => {
|
|
107
|
+
var n, s, m, x;
|
|
108
|
+
return [
|
|
109
|
+
e.valueLabel ? (l(), c(a(_), {
|
|
110
|
+
key: 0,
|
|
111
|
+
data: a(z),
|
|
112
|
+
x: M,
|
|
113
|
+
y: (r) => {
|
|
114
|
+
var d;
|
|
115
|
+
return r.y + (((d = t.valueLabel) == null ? void 0 : d.labelSpacing) ?? 0);
|
|
116
|
+
},
|
|
117
|
+
label: (n = t.valueLabel) == null ? void 0 : n.label,
|
|
118
|
+
backgroundColor: ((s = t.valueLabel) == null ? void 0 : s.backgroundColor) ?? "transparent",
|
|
119
|
+
color: ((m = t.valueLabel) == null ? void 0 : m.color) ?? "red",
|
|
120
|
+
labelFontSize: (x = t.valueLabel) == null ? void 0 : x.labelFontSize
|
|
121
|
+
}, null, 8, ["data", "y", "label", "backgroundColor", "color", "labelFontSize"])) : f("", !0),
|
|
122
|
+
b(a(ee), {
|
|
123
|
+
triggers: {
|
|
124
|
+
[a(J).selectors.bar]: T,
|
|
125
|
+
[a(U).selectors.bar]: T
|
|
126
|
+
}
|
|
127
|
+
}, null, 8, ["triggers"]),
|
|
128
|
+
e.stackAndGrouped ? (l(!0), v(q, { key: 1 }, I(y.value.states, (r) => (l(), c(a(F), {
|
|
129
|
+
key: r,
|
|
130
|
+
data: y.value.chartData,
|
|
131
|
+
x: (d, p) => p + y.value.positions[r],
|
|
132
|
+
y: y.value.bars[r],
|
|
133
|
+
color: y.value.colorFunctions[r],
|
|
134
|
+
"rounded-corners": e.radius ?? 0,
|
|
135
|
+
"group-padding": e.groupPadding ?? 0,
|
|
136
|
+
"bar-padding": e.barPadding,
|
|
137
|
+
orientation: e.orientation ?? a(g).Vertical
|
|
138
|
+
}, null, 8, ["data", "x", "y", "color", "rounded-corners", "group-padding", "bar-padding", "orientation"]))), 128)) : e.stacked ? (l(), c(a(F), {
|
|
139
|
+
key: 3,
|
|
140
|
+
data: e.data,
|
|
141
|
+
x: (r, d) => d,
|
|
142
|
+
y: A.value,
|
|
143
|
+
color: B,
|
|
144
|
+
"rounded-corners": e.radius ?? 0,
|
|
145
|
+
"group-padding": e.groupPadding ?? 0,
|
|
146
|
+
"bar-padding": e.barPadding ?? 0.2,
|
|
147
|
+
orientation: e.orientation ?? a(g).Vertical
|
|
148
|
+
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (l(), c(a(te), {
|
|
149
|
+
key: 2,
|
|
150
|
+
data: e.data,
|
|
151
|
+
x: (r, d) => d,
|
|
152
|
+
y: A.value,
|
|
153
|
+
color: B,
|
|
154
|
+
"rounded-corners": e.radius ?? 0,
|
|
155
|
+
"group-padding": e.groupPadding ?? 0,
|
|
156
|
+
"bar-padding": e.barPadding ?? 0.2,
|
|
157
|
+
orientation: e.orientation ?? a(g).Vertical
|
|
158
|
+
}, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
|
|
159
|
+
e.hideXAxis ? f("", !0) : (l(), c(a(V), {
|
|
160
|
+
key: 4,
|
|
161
|
+
type: "x",
|
|
162
|
+
"tick-format": e.xFormatter,
|
|
163
|
+
label: e.xLabel,
|
|
164
|
+
"grid-line": e.xGridLine,
|
|
165
|
+
"domain-line": !!e.xDomainLine,
|
|
166
|
+
"tick-line": e.xTickLine,
|
|
167
|
+
"num-ticks": e.xNumTicks,
|
|
168
|
+
"tick-values": e.xExplicitTicks,
|
|
169
|
+
minMaxTicksOnly: e.minMaxTicksOnly
|
|
170
|
+
}, null, 8, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "minMaxTicksOnly"])),
|
|
171
|
+
e.hideYAxis ? f("", !0) : (l(), c(a(V), {
|
|
172
|
+
key: 5,
|
|
173
|
+
type: "y",
|
|
174
|
+
label: e.yLabel,
|
|
175
|
+
"grid-line": e.orientation !== a(g).Horizontal && e.yGridLine,
|
|
176
|
+
"domain-line": !!e.yDomainLine,
|
|
177
|
+
"tick-format": e.yFormatter,
|
|
178
|
+
"num-ticks": e.yNumTicks,
|
|
179
|
+
"tick-line": e.yTickLine
|
|
180
|
+
}, null, 8, ["label", "grid-line", "domain-line", "tick-format", "num-ticks", "tick-line"]))
|
|
181
|
+
];
|
|
182
|
+
}),
|
|
150
183
|
_: 1
|
|
151
184
|
}, 8, ["padding", "height"]),
|
|
152
|
-
|
|
185
|
+
t.hideLegend ? f("", !0) : (l(), v("div", {
|
|
153
186
|
key: 0,
|
|
154
|
-
style:
|
|
187
|
+
style: L({
|
|
155
188
|
display: "flex",
|
|
156
|
-
|
|
157
|
-
justifyContent: "flex-end",
|
|
158
|
-
paddingBottom: h.value ? "1rem" : void 0
|
|
189
|
+
justifyContent: D.value
|
|
159
190
|
})
|
|
160
191
|
}, [
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
192
|
+
b(a(ae), {
|
|
193
|
+
style: L([
|
|
194
|
+
t.legendStyle,
|
|
195
|
+
"display: flex; gap: var(--vis-legend-spacing);"
|
|
196
|
+
]),
|
|
197
|
+
items: Object.values(t.categories).map((n) => ({
|
|
198
|
+
...n,
|
|
199
|
+
color: Array.isArray(n.color) ? n.color[0] : n.color
|
|
200
|
+
}))
|
|
201
|
+
}, null, 8, ["style", "items"])
|
|
164
202
|
], 4)),
|
|
165
|
-
|
|
166
|
-
|
|
203
|
+
H("div", oe, [
|
|
204
|
+
a(O).tooltip ? C(i.$slots, "tooltip", {
|
|
167
205
|
key: 0,
|
|
168
|
-
values:
|
|
169
|
-
}) :
|
|
170
|
-
|
|
171
|
-
data:
|
|
172
|
-
categories:
|
|
173
|
-
toolTipTitle:
|
|
174
|
-
yFormatter:
|
|
206
|
+
values: u.value
|
|
207
|
+
}) : u.value ? C(i.$slots, "fallback", { key: 1 }, () => [
|
|
208
|
+
b(ie, {
|
|
209
|
+
data: u.value,
|
|
210
|
+
categories: t.categories,
|
|
211
|
+
toolTipTitle: a(K)(u.value) ?? "",
|
|
212
|
+
yFormatter: t.orientation === a(g).Horizontal ? t.xFormatter : t.yFormatter
|
|
175
213
|
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
176
|
-
]) :
|
|
214
|
+
]) : f("", !0)
|
|
177
215
|
], 512)
|
|
178
216
|
], 4));
|
|
179
217
|
}
|
|
180
218
|
});
|
|
181
219
|
export {
|
|
182
|
-
|
|
220
|
+
ye as default
|
|
183
221
|
};
|
|
@@ -101,6 +101,10 @@ type BarChartPropsBase<T> = {
|
|
|
101
101
|
* See `LegendPosition` for available options.
|
|
102
102
|
*/
|
|
103
103
|
legendPosition?: LegendPosition;
|
|
104
|
+
/**
|
|
105
|
+
* Optional style object for the legend container. Allows custom CSS styling.
|
|
106
|
+
*/
|
|
107
|
+
legendStyle?: string | Record<string, string>;
|
|
104
108
|
/**
|
|
105
109
|
* If `true`, displays a domain line (axis line) along the x-axis.
|
|
106
110
|
*/
|
|
@@ -133,23 +137,35 @@ type BarChartPropsBase<T> = {
|
|
|
133
137
|
* If `true`, hide the y-axis.
|
|
134
138
|
*/
|
|
135
139
|
hideYAxis?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Specific spacing between stacked and grouped bars in pixels.
|
|
142
|
+
* Only applicable if `stackAndGrouped` is `true`.
|
|
143
|
+
*/
|
|
136
144
|
stackedGroupedSpacing?: number;
|
|
137
145
|
};
|
|
138
|
-
type
|
|
139
|
-
stackAndGrouped: true;
|
|
146
|
+
export type BarChartProps<T> = BarChartPropsBase<T> & {
|
|
140
147
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
148
|
+
* Whether the bars should be stacked and grouped.
|
|
149
|
+
* If true, `valueLabel` is optional and `xAxis` is required.
|
|
143
150
|
*/
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
151
|
+
stackAndGrouped?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Configuration for the value label display.
|
|
154
|
+
* Required if `stackAndGrouped` is false and `xAxis` is present.
|
|
155
|
+
* Optional otherwise.
|
|
156
|
+
*/
|
|
157
|
+
valueLabel?: ValueLabel;
|
|
148
158
|
/**
|
|
149
|
-
* The
|
|
150
|
-
*
|
|
159
|
+
* The data key for the X-axis.
|
|
160
|
+
* Required if `stackAndGrouped` is true, or if `stackAndGrouped` is false AND `valueLabel` is present.
|
|
151
161
|
*/
|
|
152
162
|
xAxis?: keyof T;
|
|
153
163
|
};
|
|
154
|
-
export type
|
|
164
|
+
export type ValueLabel = {
|
|
165
|
+
label: (d: any, index: number) => string | number;
|
|
166
|
+
labelSpacing?: number;
|
|
167
|
+
backgroundColor?: string;
|
|
168
|
+
color?: string;
|
|
169
|
+
labelFontSize?: number;
|
|
170
|
+
};
|
|
155
171
|
export {};
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Scatter as
|
|
3
|
-
import {
|
|
4
|
-
import { LegendPosition as
|
|
5
|
-
import { getFirstPropertyValue as
|
|
6
|
-
import
|
|
7
|
-
const
|
|
8
|
-
key: 0,
|
|
9
|
-
class: "flex items-center justify-end pb-4"
|
|
10
|
-
}, Y = {
|
|
11
|
-
key: 1,
|
|
12
|
-
class: "flex items-center justify-end pt-4"
|
|
13
|
-
}, q = {
|
|
1
|
+
import { defineComponent as N, useSlots as O, useTemplateRef as S, ref as _, computed as m, createElementBlock as f, openBlock as l, normalizeStyle as c, createVNode as s, createCommentVNode as r, createElementVNode as D, unref as t, withCtx as R, createBlock as d, renderSlot as g } from "vue";
|
|
2
|
+
import { Scatter as w, Position as K } from "@unovis/ts";
|
|
3
|
+
import { VisXYContainer as M, VisTooltip as E, VisScatter as G, VisAxis as k, VisBulletLegend as W } from "@unovis/vue";
|
|
4
|
+
import { LegendPosition as $ } from "../../types.js";
|
|
5
|
+
import { getFirstPropertyValue as j } from "../../utils.js";
|
|
6
|
+
import X from "../Tooltip.js";
|
|
7
|
+
const Y = {
|
|
14
8
|
ref: "slotWrapper",
|
|
15
9
|
class: "hidden"
|
|
16
|
-
},
|
|
10
|
+
}, Z = /* @__PURE__ */ N({
|
|
17
11
|
__name: "BubbleChart",
|
|
18
12
|
props: {
|
|
19
13
|
xAccessor: {},
|
|
@@ -34,7 +28,8 @@ const X = {
|
|
|
34
28
|
categoryKey: {},
|
|
35
29
|
xFormatter: {},
|
|
36
30
|
yFormatter: {},
|
|
37
|
-
legendPosition: { default:
|
|
31
|
+
legendPosition: { default: $.BottomCenter },
|
|
32
|
+
legendStyle: { default: void 0 },
|
|
38
33
|
sizeOptions: {},
|
|
39
34
|
xDomainLine: { type: Boolean, default: !0 },
|
|
40
35
|
yDomainLine: { type: Boolean, default: !0 },
|
|
@@ -52,51 +47,58 @@ const X = {
|
|
|
52
47
|
}) }
|
|
53
48
|
},
|
|
54
49
|
emits: ["click"],
|
|
55
|
-
setup(
|
|
56
|
-
const e =
|
|
57
|
-
var
|
|
50
|
+
setup(x, { emit: L }) {
|
|
51
|
+
const e = x, T = O(), u = S("slotWrapper"), a = _(), h = e.xAccessor, v = e.yAccessor, b = e.sizeAccessor || ((i) => typeof i.comments == "number" ? i.comments : 1), B = (i) => {
|
|
52
|
+
var y, p;
|
|
58
53
|
if (!e.categories || !e.categoryKey)
|
|
59
|
-
return console.warn(
|
|
54
|
+
return console.warn(
|
|
55
|
+
"BubbleChart: categories and categoryKey are required for color mapping"
|
|
56
|
+
), "#cccccc";
|
|
60
57
|
const n = String(i[e.categoryKey]);
|
|
61
|
-
let
|
|
62
|
-
return Object.keys(e.categories).length === 1 && (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
58
|
+
let o = (y = e.categories[n]) == null ? void 0 : y.color;
|
|
59
|
+
return Object.keys(e.categories).length === 1 && (o = (p = e.categories[e.categoryKey]) == null ? void 0 : p.color), o || (console.warn(
|
|
60
|
+
`BubbleChart: No color defined for category "${n}"`
|
|
61
|
+
), "#cccccc");
|
|
62
|
+
}, A = L;
|
|
67
63
|
function C(i) {
|
|
68
|
-
return
|
|
64
|
+
return a.value = i, V();
|
|
65
|
+
}
|
|
66
|
+
function V(i) {
|
|
67
|
+
return typeof window > "u" ? "" : u.value ? u.value.innerHTML : "";
|
|
69
68
|
}
|
|
70
|
-
const
|
|
71
|
-
[
|
|
72
|
-
};
|
|
73
|
-
return (i, n) => (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
const F = {
|
|
70
|
+
[w.selectors.point]: C
|
|
71
|
+
}, z = m(() => e.legendPosition.startsWith("top")), P = m(() => e.legendPosition.includes("left") ? "flex-start" : e.legendPosition.includes("right") ? "flex-end" : "center");
|
|
72
|
+
return (i, n) => (l(), f("div", {
|
|
73
|
+
style: c({
|
|
74
|
+
display: "flex",
|
|
75
|
+
flexDirection: z.value ? "column-reverse" : "column",
|
|
76
|
+
gap: "var(--vis-legend-spacing)"
|
|
77
|
+
})
|
|
78
|
+
}, [
|
|
79
|
+
s(t(M), {
|
|
78
80
|
data: e.data,
|
|
79
81
|
height: e.height || 600,
|
|
80
82
|
padding: e.padding,
|
|
81
83
|
scaleByDomain: !0,
|
|
82
|
-
onClick: n[0] || (n[0] = (
|
|
84
|
+
onClick: n[0] || (n[0] = (o) => A("click", o, a.value))
|
|
83
85
|
}, {
|
|
84
|
-
default:
|
|
85
|
-
e.hideTooltip ? r("", !0) : (
|
|
86
|
+
default: R(() => [
|
|
87
|
+
e.hideTooltip ? r("", !0) : (l(), d(t(E), {
|
|
86
88
|
key: 0,
|
|
87
|
-
triggers:
|
|
89
|
+
triggers: F
|
|
88
90
|
})),
|
|
89
91
|
s(t(G), {
|
|
90
|
-
x: t(
|
|
91
|
-
y: t(
|
|
92
|
-
color:
|
|
93
|
-
size: t(
|
|
94
|
-
labelPosition: e.labelPosition || t(
|
|
92
|
+
x: t(h),
|
|
93
|
+
y: t(v),
|
|
94
|
+
color: B,
|
|
95
|
+
size: t(b),
|
|
96
|
+
labelPosition: e.labelPosition || t(K).Bottom,
|
|
95
97
|
sizeRange: e.sizeRange || [1, 20],
|
|
96
98
|
opacity: e.opacity,
|
|
97
99
|
cursor: "pointer"
|
|
98
100
|
}, null, 8, ["x", "y", "size", "labelPosition", "sizeRange", "opacity"]),
|
|
99
|
-
e.hideXAxis ? r("", !0) : (
|
|
101
|
+
e.hideXAxis ? r("", !0) : (l(), d(t(k), {
|
|
100
102
|
key: 1,
|
|
101
103
|
type: "x",
|
|
102
104
|
label: e.xLabel,
|
|
@@ -108,7 +110,7 @@ const X = {
|
|
|
108
110
|
tickValues: e.xExplicitTicks,
|
|
109
111
|
minMaxTicksOnly: e.minMaxTicksOnly
|
|
110
112
|
}, null, 8, ["label", "tickFormat", "gridLine", "domainLine", "tickLine", "numTicks", "tickValues", "minMaxTicksOnly"])),
|
|
111
|
-
e.hideYAxis ? r("", !0) : (
|
|
113
|
+
e.hideYAxis ? r("", !0) : (l(), d(t(k), {
|
|
112
114
|
key: 2,
|
|
113
115
|
type: "y",
|
|
114
116
|
label: e.yLabel,
|
|
@@ -121,25 +123,41 @@ const X = {
|
|
|
121
123
|
]),
|
|
122
124
|
_: 1
|
|
123
125
|
}, 8, ["data", "height", "padding"]),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
e.hideLegend ? r("", !0) : (l(), f("div", {
|
|
127
|
+
key: 0,
|
|
128
|
+
style: c({
|
|
129
|
+
display: "flex",
|
|
130
|
+
justifyContent: P.value
|
|
131
|
+
})
|
|
132
|
+
}, [
|
|
133
|
+
s(t(W), {
|
|
134
|
+
class: "bulletLegendOverrides",
|
|
135
|
+
style: c([
|
|
136
|
+
e.legendStyle,
|
|
137
|
+
"display: flex; gap: var(--vis-legend-spacing);"
|
|
138
|
+
]),
|
|
139
|
+
items: Object.values(e.categories).map((o) => ({
|
|
140
|
+
...o,
|
|
141
|
+
color: Array.isArray(o.color) ? o.color[0] : o.color
|
|
142
|
+
}))
|
|
143
|
+
}, null, 8, ["style", "items"])
|
|
144
|
+
], 4)),
|
|
145
|
+
D("div", Y, [
|
|
128
146
|
t(T).tooltip ? g(i.$slots, "tooltip", {
|
|
129
147
|
key: 0,
|
|
130
|
-
values:
|
|
131
|
-
}) :
|
|
132
|
-
s(
|
|
133
|
-
data:
|
|
148
|
+
values: a.value
|
|
149
|
+
}) : a.value ? g(i.$slots, "fallback", { key: 1 }, () => [
|
|
150
|
+
s(X, {
|
|
151
|
+
data: a.value,
|
|
134
152
|
categories: e.categories || {},
|
|
135
|
-
toolTipTitle: t(
|
|
153
|
+
toolTipTitle: t(j)(a.value) ?? "",
|
|
136
154
|
yFormatter: e.yFormatter
|
|
137
155
|
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
138
156
|
]) : r("", !0)
|
|
139
157
|
], 512)
|
|
140
|
-
],
|
|
158
|
+
], 4));
|
|
141
159
|
}
|
|
142
160
|
});
|
|
143
161
|
export {
|
|
144
|
-
|
|
162
|
+
Z as default
|
|
145
163
|
};
|
|
@@ -107,6 +107,10 @@ export interface BubbleChartProps<T> {
|
|
|
107
107
|
* See `LegendPosition` for available options.
|
|
108
108
|
*/
|
|
109
109
|
legendPosition?: LegendPosition;
|
|
110
|
+
/**
|
|
111
|
+
* Optional inline CSS styles for the legend container.
|
|
112
|
+
*/
|
|
113
|
+
legendStyle?: Record<string, string>;
|
|
110
114
|
/** Options for controlling bubble sizes. */
|
|
111
115
|
sizeOptions?: SizeOptions;
|
|
112
116
|
/**
|