vue-chrts 0.2.5 → 1.0.0-test.2
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 +87 -69
- package/dist/components/DonutChart/types.d.ts +16 -8
- package/dist/components/GanttChart/GanttChart.js +140 -0
- package/dist/components/GanttChart/GanttChart.vue.d.ts +33 -0
- package/dist/components/GanttChart/GanttChart2.js +4 -0
- package/dist/components/GanttChart/types.d.ts +112 -0
- package/dist/components/LineChart/LineChart.js +27 -129
- package/dist/components/LineChart/LineChart.vue.d.ts +9 -8
- package/dist/components/LineChart/types.d.ts +2 -140
- package/dist/components/Tooltip.js +9 -9
- package/dist/index.d.ts +2 -2
- package/dist/index.js +13 -13
- 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,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.
|
|
@@ -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
|
*/
|
|
@@ -138,6 +142,14 @@ type BarChartPropsBase<T> = {
|
|
|
138
142
|
* Only applicable if `stackAndGrouped` is `true`.
|
|
139
143
|
*/
|
|
140
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;
|
|
141
153
|
};
|
|
142
154
|
export type BarChartProps<T> = BarChartPropsBase<T> & {
|
|
143
155
|
/**
|
|
@@ -1,16 +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
|
-
}, W = {
|
|
1
|
+
import { defineComponent as O, useSlots as S, useTemplateRef as D, ref as R, computed as f, createElementBlock as m, openBlock as l, normalizeStyle as c, createVNode as s, createCommentVNode as r, createElementVNode as w, unref as i, withCtx as K, createBlock as d, mergeProps as g, renderSlot as k } from "vue";
|
|
2
|
+
import { Scatter as M, Position as _ } from "@unovis/ts";
|
|
3
|
+
import { VisXYContainer as E, VisTooltip as G, VisScatter as W, VisAxis as x, VisBulletLegend as $ } from "@unovis/vue";
|
|
4
|
+
import { LegendPosition as j } from "../../types.js";
|
|
5
|
+
import { getFirstPropertyValue as X } from "../../utils.js";
|
|
6
|
+
import Y from "../Tooltip.js";
|
|
7
|
+
const q = {
|
|
11
8
|
ref: "slotWrapper",
|
|
12
9
|
class: "hidden"
|
|
13
|
-
},
|
|
10
|
+
}, ee = /* @__PURE__ */ O({
|
|
14
11
|
__name: "BubbleChart",
|
|
15
12
|
props: {
|
|
16
13
|
xAccessor: {},
|
|
@@ -31,7 +28,8 @@ const j = {
|
|
|
31
28
|
categoryKey: {},
|
|
32
29
|
xFormatter: {},
|
|
33
30
|
yFormatter: {},
|
|
34
|
-
legendPosition: { default:
|
|
31
|
+
legendPosition: { default: j.BottomCenter },
|
|
32
|
+
legendStyle: { default: void 0 },
|
|
35
33
|
sizeOptions: {},
|
|
36
34
|
xDomainLine: { type: Boolean, default: !0 },
|
|
37
35
|
yDomainLine: { type: Boolean, default: !0 },
|
|
@@ -46,63 +44,63 @@ const j = {
|
|
|
46
44
|
hideTooltip: { type: Boolean, default: !1 },
|
|
47
45
|
crosshairConfig: { default: () => ({
|
|
48
46
|
color: "#666"
|
|
49
|
-
}) }
|
|
47
|
+
}) },
|
|
48
|
+
xAxisConfig: {},
|
|
49
|
+
yAxisConfig: {}
|
|
50
50
|
},
|
|
51
51
|
emits: ["click"],
|
|
52
|
-
setup(
|
|
53
|
-
const e =
|
|
54
|
-
var
|
|
52
|
+
setup(L, { emit: T }) {
|
|
53
|
+
const e = L, h = S(), u = D("slotWrapper"), n = R(), v = e.xAccessor, b = e.yAccessor, B = e.sizeAccessor || ((t) => typeof t.comments == "number" ? t.comments : 1), A = (t) => {
|
|
54
|
+
var y, p;
|
|
55
55
|
if (!e.categories || !e.categoryKey)
|
|
56
56
|
return console.warn(
|
|
57
57
|
"BubbleChart: categories and categoryKey are required for color mapping"
|
|
58
58
|
), "#cccccc";
|
|
59
|
-
const
|
|
60
|
-
let
|
|
61
|
-
return Object.keys(e.categories).length === 1 && (
|
|
62
|
-
`BubbleChart: No color defined for category "${
|
|
59
|
+
const a = String(t[e.categoryKey]);
|
|
60
|
+
let o = (y = e.categories[a]) == null ? void 0 : y.color;
|
|
61
|
+
return Object.keys(e.categories).length === 1 && (o = (p = e.categories[e.categoryKey]) == null ? void 0 : p.color), o || (console.warn(
|
|
62
|
+
`BubbleChart: No color defined for category "${a}"`
|
|
63
63
|
), "#cccccc");
|
|
64
|
-
},
|
|
65
|
-
function
|
|
66
|
-
return
|
|
64
|
+
}, C = T;
|
|
65
|
+
function V(t) {
|
|
66
|
+
return n.value = t, F();
|
|
67
67
|
}
|
|
68
|
-
function F(
|
|
68
|
+
function F(t) {
|
|
69
69
|
return typeof window > "u" ? "" : u.value ? u.value.innerHTML : "";
|
|
70
70
|
}
|
|
71
|
-
const
|
|
72
|
-
[
|
|
73
|
-
};
|
|
74
|
-
return (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
])) : l("", !0),
|
|
83
|
-
s(t(M), {
|
|
71
|
+
const P = {
|
|
72
|
+
[M.selectors.point]: V
|
|
73
|
+
}, z = f(() => e.legendPosition.startsWith("top")), N = f(() => e.legendPosition.includes("left") ? "flex-start" : e.legendPosition.includes("right") ? "flex-end" : "center");
|
|
74
|
+
return (t, a) => (l(), m("div", {
|
|
75
|
+
style: c({
|
|
76
|
+
display: "flex",
|
|
77
|
+
flexDirection: z.value ? "column-reverse" : "column",
|
|
78
|
+
gap: "var(--vis-legend-spacing)"
|
|
79
|
+
})
|
|
80
|
+
}, [
|
|
81
|
+
s(i(E), {
|
|
84
82
|
data: e.data,
|
|
85
83
|
height: e.height || 600,
|
|
86
84
|
padding: e.padding,
|
|
87
85
|
scaleByDomain: !0,
|
|
88
|
-
onClick:
|
|
86
|
+
onClick: a[0] || (a[0] = (o) => C("click", o, n.value))
|
|
89
87
|
}, {
|
|
90
|
-
default:
|
|
91
|
-
e.hideTooltip ?
|
|
88
|
+
default: K(() => [
|
|
89
|
+
e.hideTooltip ? r("", !0) : (l(), d(i(G), {
|
|
92
90
|
key: 0,
|
|
93
|
-
triggers:
|
|
91
|
+
triggers: P
|
|
94
92
|
})),
|
|
95
|
-
s(
|
|
96
|
-
x:
|
|
97
|
-
y:
|
|
98
|
-
color:
|
|
99
|
-
size:
|
|
100
|
-
labelPosition: e.labelPosition ||
|
|
93
|
+
s(i(W), {
|
|
94
|
+
x: i(v),
|
|
95
|
+
y: i(b),
|
|
96
|
+
color: A,
|
|
97
|
+
size: i(B),
|
|
98
|
+
labelPosition: e.labelPosition || i(_).Bottom,
|
|
101
99
|
sizeRange: e.sizeRange || [1, 20],
|
|
102
100
|
opacity: e.opacity,
|
|
103
101
|
cursor: "pointer"
|
|
104
102
|
}, null, 8, ["x", "y", "size", "labelPosition", "sizeRange", "opacity"]),
|
|
105
|
-
e.hideXAxis ?
|
|
103
|
+
e.hideXAxis ? r("", !0) : (l(), d(i(x), g({
|
|
106
104
|
key: 1,
|
|
107
105
|
type: "x",
|
|
108
106
|
label: e.xLabel,
|
|
@@ -113,8 +111,8 @@ const j = {
|
|
|
113
111
|
numTicks: e.xNumTicks,
|
|
114
112
|
tickValues: e.xExplicitTicks,
|
|
115
113
|
minMaxTicksOnly: e.minMaxTicksOnly
|
|
116
|
-
}, null,
|
|
117
|
-
e.hideYAxis ?
|
|
114
|
+
}, t.xAxisConfig), null, 16, ["label", "tickFormat", "gridLine", "domainLine", "tickLine", "numTicks", "tickValues", "minMaxTicksOnly"])),
|
|
115
|
+
e.hideYAxis ? r("", !0) : (l(), d(i(x), g({
|
|
118
116
|
key: 2,
|
|
119
117
|
type: "y",
|
|
120
118
|
label: e.yLabel,
|
|
@@ -123,26 +121,45 @@ const j = {
|
|
|
123
121
|
domainLine: !!e.yDomainLine,
|
|
124
122
|
tickLine: e.yTickLine,
|
|
125
123
|
numTicks: e.yNumTicks
|
|
126
|
-
}, null,
|
|
124
|
+
}, t.yAxisConfig), null, 16, ["label", "tickFormat", "gridLine", "domainLine", "tickLine", "numTicks"]))
|
|
127
125
|
]),
|
|
128
126
|
_: 1
|
|
129
127
|
}, 8, ["data", "height", "padding"]),
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
e.hideLegend ? r("", !0) : (l(), m("div", {
|
|
129
|
+
key: 0,
|
|
130
|
+
style: c({
|
|
131
|
+
display: "flex",
|
|
132
|
+
justifyContent: N.value
|
|
133
|
+
})
|
|
134
|
+
}, [
|
|
135
|
+
s(i($), {
|
|
136
|
+
class: "bulletLegendOverrides",
|
|
137
|
+
style: c([
|
|
138
|
+
e.legendStyle,
|
|
139
|
+
"display: flex; gap: var(--vis-legend-spacing);"
|
|
140
|
+
]),
|
|
141
|
+
items: Object.values(e.categories).map((o) => ({
|
|
142
|
+
...o,
|
|
143
|
+
color: Array.isArray(o.color) ? o.color[0] : o.color
|
|
144
|
+
}))
|
|
145
|
+
}, null, 8, ["style", "items"])
|
|
146
|
+
], 4)),
|
|
147
|
+
w("div", q, [
|
|
148
|
+
i(h).tooltip ? k(t.$slots, "tooltip", {
|
|
132
149
|
key: 0,
|
|
133
|
-
values:
|
|
134
|
-
}) :
|
|
135
|
-
s(
|
|
136
|
-
data:
|
|
150
|
+
values: n.value
|
|
151
|
+
}) : n.value ? k(t.$slots, "fallback", { key: 1 }, () => [
|
|
152
|
+
s(Y, {
|
|
153
|
+
data: n.value,
|
|
137
154
|
categories: e.categories || {},
|
|
138
|
-
toolTipTitle:
|
|
155
|
+
toolTipTitle: i(X)(n.value) ?? "",
|
|
139
156
|
yFormatter: e.yFormatter
|
|
140
157
|
}, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
|
|
141
|
-
]) :
|
|
158
|
+
]) : r("", !0)
|
|
142
159
|
], 512)
|
|
143
|
-
],
|
|
160
|
+
], 4));
|
|
144
161
|
}
|
|
145
162
|
});
|
|
146
163
|
export {
|
|
147
|
-
|
|
164
|
+
ee as default
|
|
148
165
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BubbleChartProps } from './types';
|
|
2
|
-
declare const _default: <T
|
|
2
|
+
declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
4
4
|
readonly onClick?: ((event: MouseEvent, values?: T | undefined) => any) | undefined;
|
|
5
5
|
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & BubbleChartProps<T> & Partial<{}>> & import('vue').PublicProps;
|
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
import { axisFormatter, BulletLegendItemInterface, LegendPosition } from '../../types';
|
|
1
|
+
import { axisFormatter, BulletLegendItemInterface, LegendPosition, CrosshairConfig, AxisConfig } from '../../types';
|
|
2
2
|
import { NumericAccessor, Position } from '@unovis/ts';
|
|
3
|
-
export type DataRecord = {
|
|
4
|
-
species: string;
|
|
5
|
-
island: string;
|
|
6
|
-
beakLength: number | undefined;
|
|
7
|
-
beakDepth: number | undefined;
|
|
8
|
-
flipperLength: number | undefined;
|
|
9
|
-
bodyMass: number | undefined;
|
|
10
|
-
sex: string;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Configuration for bubble sizes.
|
|
14
|
-
*/
|
|
15
3
|
export interface SizeOptions {
|
|
16
4
|
minRadius?: number;
|
|
17
5
|
maxRadius?: number;
|
|
@@ -107,6 +95,10 @@ export interface BubbleChartProps<T> {
|
|
|
107
95
|
* See `LegendPosition` for available options.
|
|
108
96
|
*/
|
|
109
97
|
legendPosition?: LegendPosition;
|
|
98
|
+
/**
|
|
99
|
+
* Optional inline CSS styles for the legend container.
|
|
100
|
+
*/
|
|
101
|
+
legendStyle?: Record<string, string>;
|
|
110
102
|
/** Options for controlling bubble sizes. */
|
|
111
103
|
sizeOptions?: SizeOptions;
|
|
112
104
|
/**
|
|
@@ -154,9 +146,15 @@ export interface BubbleChartProps<T> {
|
|
|
154
146
|
*/
|
|
155
147
|
hideTooltip?: boolean;
|
|
156
148
|
/**
|
|
157
|
-
*
|
|
149
|
+
* Crosshair configuration object for customizing the appearance of the crosshair line.
|
|
158
150
|
*/
|
|
159
|
-
crosshairConfig?:
|
|
160
|
-
|
|
161
|
-
|
|
151
|
+
crosshairConfig?: CrosshairConfig;
|
|
152
|
+
/**
|
|
153
|
+
* Axis configuration object for customizing the appearance of the axes.
|
|
154
|
+
*/
|
|
155
|
+
xAxisConfig?: AxisConfig;
|
|
156
|
+
/**
|
|
157
|
+
* Axis configuration object for customizing the appearance of the axes.
|
|
158
|
+
*/
|
|
159
|
+
yAxisConfig?: AxisConfig;
|
|
162
160
|
}
|
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Donut as
|
|
3
|
-
import { DonutType as
|
|
1
|
+
import { defineComponent as T, useSlots as B, useTemplateRef as P, ref as W, computed as c, createElementBlock as f, openBlock as m, normalizeStyle as s, createVNode as a, createCommentVNode as v, createElementVNode as i, unref as l, withCtx as _, renderSlot as p, toDisplayString as b } from "vue";
|
|
2
|
+
import { Donut as R } from "@unovis/ts";
|
|
3
|
+
import { DonutType as z } from "./types.js";
|
|
4
4
|
import { VisSingleContainer as H, VisTooltip as N, VisDonut as $, VisBulletLegend as j } from "@unovis/vue";
|
|
5
|
-
|
|
5
|
+
import { LegendPosition as E } from "../../types.js";
|
|
6
|
+
const M = { class: "absolute top-1/2 left-1/2 -translate-1/2" }, O = {
|
|
6
7
|
ref: "slotWrapper",
|
|
7
8
|
style: { display: "none" }
|
|
8
|
-
},
|
|
9
|
-
key: 0,
|
|
10
|
-
style: {
|
|
11
|
-
display: "flex",
|
|
12
|
-
alignItems: "center",
|
|
13
|
-
justifyContent: "center",
|
|
14
|
-
marginTop: "1rem"
|
|
15
|
-
}
|
|
16
|
-
}, M = /* @__PURE__ */ V({
|
|
9
|
+
}, U = { style: { display: "flex", "align-items": "center", padding: "10px 15px" } }, K = /* @__PURE__ */ T({
|
|
17
10
|
__name: "DonutChart",
|
|
18
11
|
props: {
|
|
19
12
|
type: {},
|
|
@@ -22,78 +15,103 @@ const z = {
|
|
|
22
15
|
height: {},
|
|
23
16
|
radius: {},
|
|
24
17
|
hideLegend: { type: Boolean },
|
|
25
|
-
|
|
18
|
+
legendPosition: { default: E.BottomCenter },
|
|
19
|
+
legendStyle: {},
|
|
20
|
+
categories: {},
|
|
26
21
|
padAngle: {}
|
|
27
22
|
},
|
|
28
23
|
emits: ["click"],
|
|
29
|
-
setup(
|
|
30
|
-
const
|
|
31
|
-
function
|
|
32
|
-
return
|
|
24
|
+
setup(h, { emit: y }) {
|
|
25
|
+
const C = y, n = h, k = B(), g = P("slotWrapper"), r = W(), V = (e) => e, x = n.type === z.Half;
|
|
26
|
+
function S(e) {
|
|
27
|
+
return r.value = e, w();
|
|
33
28
|
}
|
|
34
|
-
function
|
|
35
|
-
return typeof window > "u" ? "" :
|
|
29
|
+
function w(e) {
|
|
30
|
+
return typeof window > "u" ? "" : g.value ? g.value.innerHTML : "";
|
|
36
31
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
const A = c(() => n.legendPosition.includes("top")), D = c(() => n.legendPosition.includes("left") ? "flex-start" : n.legendPosition.includes("right") ? "flex-end" : "center"), d = (e, o = "#ccc") => e ? Array.isArray(e) ? e[0] || o : e : o, u = c(() => Object.values(n.categories)), L = (e, o) => {
|
|
33
|
+
const t = u.value[o];
|
|
34
|
+
if (t)
|
|
35
|
+
return d(t.color);
|
|
36
|
+
};
|
|
37
|
+
return (e, o) => (m(), f("div", {
|
|
38
|
+
style: s({
|
|
39
|
+
display: "flex",
|
|
40
|
+
flexDirection: A.value ? "column-reverse" : "column",
|
|
41
|
+
gap: "var(--vis-legend-spacing)"
|
|
42
|
+
}),
|
|
43
|
+
onClick: o[0] || (o[0] = (t) => C("click", t, r.value))
|
|
44
|
+
}, [
|
|
45
|
+
a(l(H), {
|
|
46
|
+
data: e.data,
|
|
47
|
+
height: e.height,
|
|
48
|
+
margin: {}
|
|
49
|
+
}, {
|
|
50
|
+
default: _(() => [
|
|
51
|
+
a(l(N), {
|
|
52
|
+
"horizontal-shift": 20,
|
|
53
|
+
"vertical-shift": 20,
|
|
54
|
+
triggers: {
|
|
55
|
+
[l(R).selectors.segment]: S
|
|
56
|
+
}
|
|
57
|
+
}, null, 8, ["triggers"]),
|
|
58
|
+
a(l($), {
|
|
59
|
+
value: V,
|
|
60
|
+
"corner-radius": e.radius,
|
|
61
|
+
"arc-width": e.arcWidth ?? 20,
|
|
62
|
+
color: L,
|
|
63
|
+
"angle-range": x ? [-1.5707963267948966, 1.5707963267948966] : [],
|
|
64
|
+
"pad-angle": n.padAngle || 0
|
|
65
|
+
}, null, 8, ["corner-radius", "arc-width", "angle-range", "pad-angle"]),
|
|
66
|
+
i("div", M, [
|
|
67
|
+
p(e.$slots, "default")
|
|
68
|
+
])
|
|
69
|
+
]),
|
|
70
|
+
_: 3
|
|
71
|
+
}, 8, ["data", "height"]),
|
|
72
|
+
n.hideLegend ? v("", !0) : (m(), f("div", {
|
|
73
|
+
key: 0,
|
|
74
|
+
style: s({
|
|
40
75
|
display: "flex",
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
onClick: d[0] || (d[0] = (a) => f("click", a, t.value))
|
|
76
|
+
justifyContent: D.value
|
|
77
|
+
})
|
|
45
78
|
}, [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}, {
|
|
51
|
-
default: S(() => [
|
|
52
|
-
o(l(N), {
|
|
53
|
-
"horizontal-shift": 20,
|
|
54
|
-
"vertical-shift": 20,
|
|
55
|
-
triggers: {
|
|
56
|
-
[l(L).selectors.segment]: C
|
|
57
|
-
}
|
|
58
|
-
}, null, 8, ["triggers"]),
|
|
59
|
-
o(l($), {
|
|
60
|
-
value: y,
|
|
61
|
-
"corner-radius": e.radius,
|
|
62
|
-
"arc-width": e.arcWidth ?? 20,
|
|
63
|
-
color: r.labels.map((a) => a.color),
|
|
64
|
-
"angle-range": v ? [-1.5707963267948966, 1.5707963267948966] : [],
|
|
65
|
-
"pad-angle": r.padAngle || 0
|
|
66
|
-
}, null, 8, ["corner-radius", "arc-width", "color", "angle-range", "pad-angle"])
|
|
79
|
+
a(l(j), {
|
|
80
|
+
style: s([
|
|
81
|
+
n.legendStyle,
|
|
82
|
+
"display: flex; gap: var(--vis-legend-spacing);"
|
|
67
83
|
]),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
84
|
+
items: u.value.map((t) => ({
|
|
85
|
+
...t,
|
|
86
|
+
color: d(t.color)
|
|
87
|
+
}))
|
|
88
|
+
}, null, 8, ["style", "items"])
|
|
89
|
+
], 4)),
|
|
90
|
+
i("div", O, [
|
|
91
|
+
l(k).tooltip ? p(e.$slots, "tooltip", {
|
|
92
|
+
key: 0,
|
|
93
|
+
values: r.value
|
|
94
|
+
}) : r.value ? p(e.$slots, "fallback", { key: 1 }, () => {
|
|
95
|
+
var t;
|
|
96
|
+
return [
|
|
97
|
+
i("div", U, [
|
|
98
|
+
i("div", {
|
|
99
|
+
style: s({
|
|
79
100
|
width: "0.5rem",
|
|
80
101
|
height: "0.5rem",
|
|
81
102
|
borderRadius: "9999px",
|
|
82
103
|
marginRight: "0.5rem",
|
|
83
|
-
backgroundColor:
|
|
104
|
+
backgroundColor: d((t = u.value[r.value.index]) == null ? void 0 : t.color)
|
|
84
105
|
})
|
|
85
106
|
}, null, 4),
|
|
86
|
-
|
|
107
|
+
i("div", null, b(r.value.data), 1)
|
|
87
108
|
])
|
|
88
|
-
]
|
|
89
|
-
|
|
90
|
-
])
|
|
91
|
-
|
|
92
|
-
o(l(j), { items: e.labels }, null, 8, ["items"])
|
|
93
|
-
]))
|
|
94
|
-
], 64));
|
|
109
|
+
];
|
|
110
|
+
}) : v("", !0)
|
|
111
|
+
], 512)
|
|
112
|
+
], 4));
|
|
95
113
|
}
|
|
96
114
|
});
|
|
97
115
|
export {
|
|
98
|
-
|
|
116
|
+
K as default
|
|
99
117
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { BulletLegendItemInterface, LegendPosition } from '../../types';
|
|
1
2
|
export type DonutChartProps = {
|
|
2
3
|
/**
|
|
3
4
|
* The type of donut chart to render.
|
|
4
5
|
* See `DonutType` for available options.
|
|
5
6
|
*/
|
|
6
|
-
type?:
|
|
7
|
+
type?: DonutType;
|
|
7
8
|
/**
|
|
8
9
|
* The data to be displayed in the donut chart.
|
|
9
10
|
* Each number in the array represents a segment value.
|
|
@@ -14,8 +15,8 @@ export type DonutChartProps = {
|
|
|
14
15
|
*/
|
|
15
16
|
arcWidth?: number;
|
|
16
17
|
/**
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
* The height of the chart in pixels.
|
|
19
|
+
*/
|
|
19
20
|
height: number;
|
|
20
21
|
/**
|
|
21
22
|
* The radius of the donut in pixels.
|
|
@@ -26,12 +27,19 @@ export type DonutChartProps = {
|
|
|
26
27
|
*/
|
|
27
28
|
hideLegend?: boolean;
|
|
28
29
|
/**
|
|
29
|
-
*
|
|
30
|
+
* Optional position for the legend, if applicable.
|
|
31
|
+
* See `LegendPosition` for available options.
|
|
32
|
+
*/
|
|
33
|
+
legendPosition?: LegendPosition;
|
|
34
|
+
/**
|
|
35
|
+
* Optional style object for the legend container. Allows custom CSS styling.
|
|
36
|
+
*/
|
|
37
|
+
legendStyle?: string | Record<string, string>;
|
|
38
|
+
/**
|
|
39
|
+
* A record mapping category keys to `BulletLegendItemInterface` objects.
|
|
40
|
+
* This defines the visual representation and labels for each category in the chart's legend.
|
|
30
41
|
*/
|
|
31
|
-
|
|
32
|
-
name: string;
|
|
33
|
-
color: string;
|
|
34
|
-
}[];
|
|
42
|
+
categories: Record<string, BulletLegendItemInterface>;
|
|
35
43
|
/**
|
|
36
44
|
* Pad angle. Default: 0
|
|
37
45
|
*/
|