@object-ui/plugin-charts 4.0.3 → 4.0.4
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/CHANGELOG.md +20 -0
- package/dist/AdvancedChartImpl-DkX8ZQ5Y.js +412 -0
- package/dist/{ChartImpl-AHzX3Kht.js → ChartImpl-ZGY2c86F.js} +31 -32
- package/dist/index.js +101 -448
- package/dist/index.umd.cjs +2 -56
- package/package.json +6 -6
- package/dist/AdvancedChartImpl-BLyJ4LaI.js +0 -3981
- package/dist/BarChart-C9W1kOQ6.js +0 -16506
- package/dist/shim-oa8knWTF.js +0 -284
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @object-ui/plugin-charts
|
|
2
2
|
|
|
3
|
+
## 4.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d2b6ece: fix: externalize all bare imports in library builds
|
|
8
|
+
|
|
9
|
+
Library builds (vite lib mode) now externalize every non-relative import instead of bundling third-party CJS dependencies into the published dist. This avoids inlined `require("react")` / `require("react-dom")` calls that cause `Calling \`require\` for "react" in an environment that doesn't expose the \`require\` function` runtime errors when consumer apps re-bundle the published dist.
|
|
10
|
+
|
|
11
|
+
Specifically fixes:
|
|
12
|
+
- `@object-ui/plugin-dashboard` no longer inlines `react-grid-layout` (and its transitive `react-draggable` / `react-resizable` CJS bundles). `react-grid-layout` is now declared as a peer dependency so consumers install a single ESM-friendly copy.
|
|
13
|
+
- `@object-ui/components`, `@object-ui/plugin-calendar`, `@object-ui/plugin-charts`, `@object-ui/plugin-designer` no longer inline `react-i18next` / `i18next` / `use-sync-external-store` CJS shims.
|
|
14
|
+
- All plugin packages now use a unified `external: (id) => !/^[./]/.test(id) && !id.startsWith(__dirname)` rule, ensuring future additions of CJS deps are automatically externalized.
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [d2b6ece]
|
|
17
|
+
- @object-ui/components@4.0.4
|
|
18
|
+
- @object-ui/types@4.0.4
|
|
19
|
+
- @object-ui/core@4.0.4
|
|
20
|
+
- @object-ui/i18n@4.0.4
|
|
21
|
+
- @object-ui/react@4.0.4
|
|
22
|
+
|
|
3
23
|
## 4.0.3
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
3
|
+
import { Area as i, AreaChart as a, Bar as o, BarChart as s, CartesianGrid as c, Cell as l, Legend as u, Line as d, LineChart as f, Pie as p, PieChart as m, PolarAngleAxis as h, PolarGrid as g, PolarRadiusAxis as _, Radar as v, RadarChart as y, ResponsiveContainer as b, Scatter as x, ScatterChart as S, Tooltip as C, XAxis as w, YAxis as T, ZAxis as E } from "recharts";
|
|
4
|
+
//#region src/ChartContainerImpl.tsx
|
|
5
|
+
var D = (...e) => e.filter(Boolean).join(" "), O = {
|
|
6
|
+
light: "",
|
|
7
|
+
dark: ".dark"
|
|
8
|
+
}, k = e.createContext(null);
|
|
9
|
+
function A() {
|
|
10
|
+
let t = e.useContext(k);
|
|
11
|
+
if (!t) throw Error("useChart must be used within a <ChartContainer />");
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
14
|
+
function j({ id: t, className: i, children: a, config: o, ...s }) {
|
|
15
|
+
let c = e.useId(), l = `chart-${t || c.replace(/:/g, "")}`;
|
|
16
|
+
return /* @__PURE__ */ n(k.Provider, {
|
|
17
|
+
value: { config: o },
|
|
18
|
+
children: /* @__PURE__ */ r("div", {
|
|
19
|
+
"data-slot": "chart",
|
|
20
|
+
"data-chart": l,
|
|
21
|
+
className: D("flex w-full h-[350px] justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", i),
|
|
22
|
+
...s,
|
|
23
|
+
children: [/* @__PURE__ */ n(M, {
|
|
24
|
+
id: l,
|
|
25
|
+
config: o
|
|
26
|
+
}), /* @__PURE__ */ n(b, {
|
|
27
|
+
width: "100%",
|
|
28
|
+
height: "100%",
|
|
29
|
+
children: a
|
|
30
|
+
})]
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
var M = ({ id: e, config: t }) => {
|
|
35
|
+
let r = Object.entries(t).filter(([, e]) => e.theme || e.color);
|
|
36
|
+
return r.length ? /* @__PURE__ */ n("style", { dangerouslySetInnerHTML: { __html: Object.entries(O).map(([t, n]) => `
|
|
37
|
+
${n} [data-chart=${e}] {
|
|
38
|
+
${r.map(([e, n]) => {
|
|
39
|
+
let r = n.theme?.[t] || n.color;
|
|
40
|
+
return r ? ` --color-${e}: ${r};` : null;
|
|
41
|
+
}).join("\n")}
|
|
42
|
+
}
|
|
43
|
+
`).join("\n") } }) : null;
|
|
44
|
+
}, N = C;
|
|
45
|
+
function P({ active: i, payload: a, className: o, indicator: s = "dot", hideLabel: c = !1, hideIndicator: l = !1, label: u, labelFormatter: d, labelClassName: f, formatter: p, color: m, nameKey: h, labelKey: g }) {
|
|
46
|
+
let { config: _ } = A(), v = e.useMemo(() => {
|
|
47
|
+
if (c || !a?.length) return null;
|
|
48
|
+
let [e] = a, t = L(_, e, `${g || e?.dataKey || e?.name || "value"}`), r = !g && typeof u == "string" ? _[u]?.label || u : t?.label;
|
|
49
|
+
return d ? /* @__PURE__ */ n("div", {
|
|
50
|
+
className: D("font-medium", f),
|
|
51
|
+
children: d(r, a)
|
|
52
|
+
}) : r ? /* @__PURE__ */ n("div", {
|
|
53
|
+
className: D("font-medium", f),
|
|
54
|
+
children: r
|
|
55
|
+
}) : null;
|
|
56
|
+
}, [
|
|
57
|
+
u,
|
|
58
|
+
d,
|
|
59
|
+
a,
|
|
60
|
+
c,
|
|
61
|
+
f,
|
|
62
|
+
_,
|
|
63
|
+
g
|
|
64
|
+
]);
|
|
65
|
+
if (!i || !a?.length) return null;
|
|
66
|
+
let y = a.length === 1 && s !== "dot";
|
|
67
|
+
return /* @__PURE__ */ r("div", {
|
|
68
|
+
className: D("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl", o),
|
|
69
|
+
children: [y ? null : v, /* @__PURE__ */ n("div", {
|
|
70
|
+
className: "grid gap-1.5",
|
|
71
|
+
children: a.filter((e) => e.type !== "none").map((e, i) => {
|
|
72
|
+
let a = L(_, e, `${h || e.name || e.dataKey || "value"}`), o = m || e.payload.fill || e.color;
|
|
73
|
+
return /* @__PURE__ */ n("div", {
|
|
74
|
+
className: D("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5", s === "dot" ? "items-center" : ""),
|
|
75
|
+
children: p && e?.value !== void 0 && e.name ? p(e.value, e.name, e, i, e.payload) : /* @__PURE__ */ r(t, { children: [a?.icon ? /* @__PURE__ */ n(a.icon, {}) : !l && /* @__PURE__ */ n("div", {
|
|
76
|
+
className: D("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)", s === "dot" ? "h-2.5 w-2.5" : "", s === "line" ? "w-1" : "", s === "dashed" ? "w-0 border-[1.5px] border-dashed bg-transparent" : "", y && s === "dashed" ? "my-0.5" : ""),
|
|
77
|
+
style: {
|
|
78
|
+
"--color-bg": o,
|
|
79
|
+
"--color-border": o
|
|
80
|
+
}
|
|
81
|
+
}), /* @__PURE__ */ r("div", {
|
|
82
|
+
className: D("flex flex-1 justify-between leading-none", y ? "items-end" : "items-center"),
|
|
83
|
+
children: [/* @__PURE__ */ r("div", {
|
|
84
|
+
className: "grid gap-1.5",
|
|
85
|
+
children: [y ? v : null, /* @__PURE__ */ n("span", {
|
|
86
|
+
className: "text-muted-foreground",
|
|
87
|
+
children: a?.label || e.name
|
|
88
|
+
})]
|
|
89
|
+
}), e.value && /* @__PURE__ */ n("span", {
|
|
90
|
+
className: "text-foreground font-mono font-medium tabular-nums",
|
|
91
|
+
children: e.value.toLocaleString()
|
|
92
|
+
})]
|
|
93
|
+
})] })
|
|
94
|
+
}, e.dataKey);
|
|
95
|
+
})
|
|
96
|
+
})]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
var F = u;
|
|
100
|
+
function I({ className: e, hideIcon: t = !1, payload: i, verticalAlign: a = "bottom", nameKey: o }) {
|
|
101
|
+
let { config: s } = A();
|
|
102
|
+
return i?.length ? /* @__PURE__ */ n("div", {
|
|
103
|
+
className: D("flex items-center justify-center gap-4", a === "top" ? "pb-3" : "pt-3", e),
|
|
104
|
+
children: i.filter((e) => e.type !== "none").map((e) => {
|
|
105
|
+
let i = L(s, e, `${o || e.dataKey || "value"}`);
|
|
106
|
+
return /* @__PURE__ */ r("div", {
|
|
107
|
+
className: D("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),
|
|
108
|
+
children: [i?.icon && !t ? /* @__PURE__ */ n(i.icon, {}) : /* @__PURE__ */ n("div", {
|
|
109
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
110
|
+
style: { backgroundColor: e.color }
|
|
111
|
+
}), i?.label]
|
|
112
|
+
}, e.value);
|
|
113
|
+
})
|
|
114
|
+
}) : null;
|
|
115
|
+
}
|
|
116
|
+
function L(e, t, n) {
|
|
117
|
+
if (typeof t != "object" || !t) return;
|
|
118
|
+
let r = "payload" in t && typeof t.payload == "object" && t.payload !== null ? t.payload : void 0, i = n;
|
|
119
|
+
return n in t && typeof t[n] == "string" ? i = t[n] : r && n in r && typeof r[n] == "string" && (i = r[n]), i in e ? e[i] : e[n];
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/AdvancedChartImpl.tsx
|
|
123
|
+
var R = "hsl(var(--primary))", z = {
|
|
124
|
+
slate: "#64748b",
|
|
125
|
+
gray: "#6b7280",
|
|
126
|
+
zinc: "#71717a",
|
|
127
|
+
neutral: "#737373",
|
|
128
|
+
stone: "#78716c",
|
|
129
|
+
red: "#ef4444",
|
|
130
|
+
orange: "#f97316",
|
|
131
|
+
amber: "#f59e0b",
|
|
132
|
+
yellow: "#eab308",
|
|
133
|
+
lime: "#84cc16",
|
|
134
|
+
green: "#22c55e",
|
|
135
|
+
emerald: "#10b981",
|
|
136
|
+
teal: "#14b8a6",
|
|
137
|
+
cyan: "#06b6d4",
|
|
138
|
+
sky: "#0ea5e9",
|
|
139
|
+
blue: "#3b82f6",
|
|
140
|
+
indigo: "#6366f1",
|
|
141
|
+
violet: "#8b5cf6",
|
|
142
|
+
purple: "#a855f7",
|
|
143
|
+
fuchsia: "#d946ef",
|
|
144
|
+
pink: "#ec4899",
|
|
145
|
+
rose: "#f43f5e"
|
|
146
|
+
}, B = (e) => z[e] || e;
|
|
147
|
+
function V({ chartType: t = "bar", data: u = [], config: b = {}, xAxisKey: C = "name", series: D = [], className: O = "" }) {
|
|
148
|
+
let k = Array.isArray(u) ? u : [], [A, M] = e.useState(!1);
|
|
149
|
+
e.useEffect(() => {
|
|
150
|
+
let e = () => M(window.innerWidth < 640);
|
|
151
|
+
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
152
|
+
}, []);
|
|
153
|
+
let L = {
|
|
154
|
+
bar: s,
|
|
155
|
+
line: f,
|
|
156
|
+
area: a,
|
|
157
|
+
pie: m,
|
|
158
|
+
donut: m,
|
|
159
|
+
radar: y,
|
|
160
|
+
scatter: S,
|
|
161
|
+
combo: s
|
|
162
|
+
}[t] || s, z = e.useMemo(() => k.some((e) => String(e[C] || "").length > 5), [k, C]), V = () => [
|
|
163
|
+
"hsl(var(--chart-1))",
|
|
164
|
+
"hsl(var(--chart-2))",
|
|
165
|
+
"hsl(var(--chart-3))",
|
|
166
|
+
"hsl(var(--chart-4))",
|
|
167
|
+
"hsl(var(--chart-5))"
|
|
168
|
+
];
|
|
169
|
+
if (t === "pie" || t === "donut") {
|
|
170
|
+
let e = t === "donut" ? 60 : 0;
|
|
171
|
+
return /* @__PURE__ */ n(j, {
|
|
172
|
+
config: b,
|
|
173
|
+
className: O,
|
|
174
|
+
children: /* @__PURE__ */ r(m, { children: [
|
|
175
|
+
/* @__PURE__ */ n(N, {
|
|
176
|
+
cursor: !1,
|
|
177
|
+
content: /* @__PURE__ */ n(P, { hideLabel: !0 })
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ n(p, {
|
|
180
|
+
data: k,
|
|
181
|
+
dataKey: D[0]?.dataKey || "value",
|
|
182
|
+
nameKey: C || "name",
|
|
183
|
+
innerRadius: e,
|
|
184
|
+
strokeWidth: 5,
|
|
185
|
+
paddingAngle: 2,
|
|
186
|
+
outerRadius: 80,
|
|
187
|
+
children: k.map((e, t) => {
|
|
188
|
+
let r = b[e[C]]?.color;
|
|
189
|
+
if (!r) {
|
|
190
|
+
let e = V();
|
|
191
|
+
r = e[t % e.length];
|
|
192
|
+
}
|
|
193
|
+
return /* @__PURE__ */ n(l, { fill: B(r) }, `cell-${t}`);
|
|
194
|
+
})
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ n(F, {
|
|
197
|
+
content: /* @__PURE__ */ n(I, { nameKey: C }),
|
|
198
|
+
...A && {
|
|
199
|
+
verticalAlign: "bottom",
|
|
200
|
+
wrapperStyle: {
|
|
201
|
+
fontSize: "11px",
|
|
202
|
+
paddingTop: "8px"
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
] })
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
return t === "radar" ? /* @__PURE__ */ n(j, {
|
|
210
|
+
config: b,
|
|
211
|
+
className: O,
|
|
212
|
+
children: /* @__PURE__ */ r(y, {
|
|
213
|
+
data: k,
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ n(g, {}),
|
|
216
|
+
/* @__PURE__ */ n(h, { dataKey: C }),
|
|
217
|
+
/* @__PURE__ */ n(_, {}),
|
|
218
|
+
/* @__PURE__ */ n(N, { content: /* @__PURE__ */ n(P, {}) }),
|
|
219
|
+
/* @__PURE__ */ n(F, {
|
|
220
|
+
content: /* @__PURE__ */ n(I, {}),
|
|
221
|
+
...A && {
|
|
222
|
+
verticalAlign: "bottom",
|
|
223
|
+
wrapperStyle: {
|
|
224
|
+
fontSize: "11px",
|
|
225
|
+
paddingTop: "8px"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}),
|
|
229
|
+
D.map((e) => {
|
|
230
|
+
let t = B(b[e.dataKey]?.color || R);
|
|
231
|
+
return /* @__PURE__ */ n(v, {
|
|
232
|
+
dataKey: e.dataKey,
|
|
233
|
+
stroke: t,
|
|
234
|
+
fill: t,
|
|
235
|
+
fillOpacity: .6
|
|
236
|
+
}, e.dataKey);
|
|
237
|
+
})
|
|
238
|
+
]
|
|
239
|
+
})
|
|
240
|
+
}) : t === "scatter" ? /* @__PURE__ */ n(j, {
|
|
241
|
+
config: b,
|
|
242
|
+
className: O,
|
|
243
|
+
children: /* @__PURE__ */ r(S, { children: [
|
|
244
|
+
/* @__PURE__ */ n(c, { vertical: !1 }),
|
|
245
|
+
/* @__PURE__ */ n(w, {
|
|
246
|
+
type: "number",
|
|
247
|
+
dataKey: C,
|
|
248
|
+
name: String(b[C]?.label || C),
|
|
249
|
+
tickLine: !1,
|
|
250
|
+
axisLine: !1,
|
|
251
|
+
interval: A ? Math.ceil(k.length / 5) : 0
|
|
252
|
+
}),
|
|
253
|
+
/* @__PURE__ */ n(T, {
|
|
254
|
+
type: "number",
|
|
255
|
+
dataKey: D[0]?.dataKey || "value",
|
|
256
|
+
name: String(b[D[0]?.dataKey]?.label || D[0]?.dataKey),
|
|
257
|
+
tickLine: !1,
|
|
258
|
+
axisLine: !1
|
|
259
|
+
}),
|
|
260
|
+
/* @__PURE__ */ n(E, {
|
|
261
|
+
type: "number",
|
|
262
|
+
range: [60, 400]
|
|
263
|
+
}),
|
|
264
|
+
/* @__PURE__ */ n(N, { content: /* @__PURE__ */ n(P, {}) }),
|
|
265
|
+
/* @__PURE__ */ n(F, {
|
|
266
|
+
content: /* @__PURE__ */ n(I, {}),
|
|
267
|
+
...A && {
|
|
268
|
+
verticalAlign: "bottom",
|
|
269
|
+
wrapperStyle: {
|
|
270
|
+
fontSize: "11px",
|
|
271
|
+
paddingTop: "8px"
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}),
|
|
275
|
+
D.map((e, t) => {
|
|
276
|
+
let r = V(), i = B(b[e.dataKey]?.color || r[t % r.length]);
|
|
277
|
+
return /* @__PURE__ */ n(x, {
|
|
278
|
+
name: b[e.dataKey]?.label || e.dataKey,
|
|
279
|
+
data: k,
|
|
280
|
+
fill: i
|
|
281
|
+
}, e.dataKey);
|
|
282
|
+
})
|
|
283
|
+
] })
|
|
284
|
+
}) : t === "combo" ? /* @__PURE__ */ n(j, {
|
|
285
|
+
config: b,
|
|
286
|
+
className: O,
|
|
287
|
+
children: /* @__PURE__ */ r(s, {
|
|
288
|
+
data: k,
|
|
289
|
+
children: [
|
|
290
|
+
/* @__PURE__ */ n(c, { vertical: !1 }),
|
|
291
|
+
/* @__PURE__ */ n(w, {
|
|
292
|
+
dataKey: C,
|
|
293
|
+
tickLine: !1,
|
|
294
|
+
tickMargin: 10,
|
|
295
|
+
axisLine: !1,
|
|
296
|
+
interval: A ? Math.ceil(k.length / 5) : 0,
|
|
297
|
+
tickFormatter: (e) => !e || typeof e != "string" ? e : A && e.length > 8 ? e.slice(0, 8) + "…" : e,
|
|
298
|
+
...!A && z && {
|
|
299
|
+
angle: -35,
|
|
300
|
+
textAnchor: "end",
|
|
301
|
+
height: 60
|
|
302
|
+
}
|
|
303
|
+
}),
|
|
304
|
+
/* @__PURE__ */ n(T, {
|
|
305
|
+
yAxisId: "left",
|
|
306
|
+
tickLine: !1,
|
|
307
|
+
axisLine: !1
|
|
308
|
+
}),
|
|
309
|
+
/* @__PURE__ */ n(T, {
|
|
310
|
+
yAxisId: "right",
|
|
311
|
+
orientation: "right",
|
|
312
|
+
tickLine: !1,
|
|
313
|
+
axisLine: !1
|
|
314
|
+
}),
|
|
315
|
+
/* @__PURE__ */ n(N, { content: /* @__PURE__ */ n(P, {}) }),
|
|
316
|
+
/* @__PURE__ */ n(F, {
|
|
317
|
+
content: /* @__PURE__ */ n(I, {}),
|
|
318
|
+
...A && {
|
|
319
|
+
verticalAlign: "bottom",
|
|
320
|
+
wrapperStyle: {
|
|
321
|
+
fontSize: "11px",
|
|
322
|
+
paddingTop: "8px"
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}),
|
|
326
|
+
D.map((e, t) => {
|
|
327
|
+
let r = B(b[e.dataKey]?.color || R), a = e.chartType || (t === 0 ? "bar" : "line"), s = a === "bar" ? "left" : "right";
|
|
328
|
+
return a === "line" ? /* @__PURE__ */ n(d, {
|
|
329
|
+
yAxisId: s,
|
|
330
|
+
type: "monotone",
|
|
331
|
+
dataKey: e.dataKey,
|
|
332
|
+
stroke: r,
|
|
333
|
+
strokeWidth: 2,
|
|
334
|
+
dot: !1
|
|
335
|
+
}, e.dataKey) : a === "area" ? /* @__PURE__ */ n(i, {
|
|
336
|
+
yAxisId: s,
|
|
337
|
+
type: "monotone",
|
|
338
|
+
dataKey: e.dataKey,
|
|
339
|
+
fill: r,
|
|
340
|
+
stroke: r,
|
|
341
|
+
fillOpacity: .4
|
|
342
|
+
}, e.dataKey) : /* @__PURE__ */ n(o, {
|
|
343
|
+
yAxisId: s,
|
|
344
|
+
dataKey: e.dataKey,
|
|
345
|
+
fill: r,
|
|
346
|
+
radius: 4
|
|
347
|
+
}, e.dataKey);
|
|
348
|
+
})
|
|
349
|
+
]
|
|
350
|
+
})
|
|
351
|
+
}) : /* @__PURE__ */ n(j, {
|
|
352
|
+
config: b,
|
|
353
|
+
className: O,
|
|
354
|
+
children: /* @__PURE__ */ r(L, {
|
|
355
|
+
data: k,
|
|
356
|
+
children: [
|
|
357
|
+
/* @__PURE__ */ n(c, { vertical: !1 }),
|
|
358
|
+
/* @__PURE__ */ n(w, {
|
|
359
|
+
dataKey: C,
|
|
360
|
+
tickLine: !1,
|
|
361
|
+
tickMargin: 10,
|
|
362
|
+
axisLine: !1,
|
|
363
|
+
interval: A ? Math.ceil(k.length / 5) : 0,
|
|
364
|
+
tickFormatter: (e) => !e || typeof e != "string" ? e : A && e.length > 8 ? e.slice(0, 8) + "…" : e,
|
|
365
|
+
...!A && z && {
|
|
366
|
+
angle: -35,
|
|
367
|
+
textAnchor: "end",
|
|
368
|
+
height: 60
|
|
369
|
+
}
|
|
370
|
+
}),
|
|
371
|
+
/* @__PURE__ */ n(N, { content: /* @__PURE__ */ n(P, {}) }),
|
|
372
|
+
/* @__PURE__ */ n(F, {
|
|
373
|
+
content: /* @__PURE__ */ n(I, {}),
|
|
374
|
+
...A && {
|
|
375
|
+
verticalAlign: "bottom",
|
|
376
|
+
wrapperStyle: {
|
|
377
|
+
fontSize: "11px",
|
|
378
|
+
paddingTop: "8px"
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}),
|
|
382
|
+
D.map((e, r) => {
|
|
383
|
+
let a = V(), s = B(b[e.dataKey]?.color || a[r % a.length] || R);
|
|
384
|
+
if (t === "bar") {
|
|
385
|
+
let t = D.length === 1 && k.length > 1;
|
|
386
|
+
return /* @__PURE__ */ n(o, {
|
|
387
|
+
dataKey: e.dataKey,
|
|
388
|
+
fill: s,
|
|
389
|
+
radius: 4,
|
|
390
|
+
children: t && k.map((e, t) => /* @__PURE__ */ n(l, { fill: B(a[t % a.length]) }, `cell-${t}`))
|
|
391
|
+
}, e.dataKey);
|
|
392
|
+
}
|
|
393
|
+
return t === "line" ? /* @__PURE__ */ n(d, {
|
|
394
|
+
type: "monotone",
|
|
395
|
+
dataKey: e.dataKey,
|
|
396
|
+
stroke: s,
|
|
397
|
+
strokeWidth: 2,
|
|
398
|
+
dot: !1
|
|
399
|
+
}, e.dataKey) : t === "area" ? /* @__PURE__ */ n(i, {
|
|
400
|
+
type: "monotone",
|
|
401
|
+
dataKey: e.dataKey,
|
|
402
|
+
fill: s,
|
|
403
|
+
stroke: s,
|
|
404
|
+
fillOpacity: .4
|
|
405
|
+
}, e.dataKey) : null;
|
|
406
|
+
})
|
|
407
|
+
]
|
|
408
|
+
})
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
//#endregion
|
|
412
|
+
export { V as default };
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { Bar as n, BarChart as r, CartesianGrid as i, Legend as a, ResponsiveContainer as o, Tooltip as s, XAxis as c, YAxis as l } from "recharts";
|
|
3
3
|
//#region src/ChartImpl.tsx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
children: /* @__PURE__ */ (0, l.jsx)(n, {
|
|
4
|
+
function u({ data: u = [], dataKey: d = "value", xAxisKey: f = "name", height: p = 400, className: m = "", color: h = "hsl(var(--primary))" }) {
|
|
5
|
+
return /* @__PURE__ */ e("div", {
|
|
6
|
+
className: `p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${m}`,
|
|
7
|
+
children: /* @__PURE__ */ e(o, {
|
|
9
8
|
width: "100%",
|
|
10
|
-
height:
|
|
11
|
-
children: /* @__PURE__ */ (
|
|
12
|
-
data:
|
|
9
|
+
height: p,
|
|
10
|
+
children: /* @__PURE__ */ t(r, {
|
|
11
|
+
data: u,
|
|
13
12
|
margin: {
|
|
14
13
|
top: 10,
|
|
15
14
|
right: 10,
|
|
@@ -17,65 +16,65 @@ function u({ data: e = [], dataKey: u = "value", xAxisKey: d = "name", height: f
|
|
|
17
16
|
bottom: 5
|
|
18
17
|
},
|
|
19
18
|
children: [
|
|
20
|
-
/* @__PURE__ */ (
|
|
19
|
+
/* @__PURE__ */ t("defs", { children: [/* @__PURE__ */ t("linearGradient", {
|
|
21
20
|
id: "barGradient",
|
|
22
21
|
x1: "0",
|
|
23
22
|
y1: "0",
|
|
24
23
|
x2: "0",
|
|
25
24
|
y2: "1",
|
|
26
25
|
children: [
|
|
27
|
-
/* @__PURE__ */ (
|
|
26
|
+
/* @__PURE__ */ e("stop", {
|
|
28
27
|
offset: "0%",
|
|
29
|
-
stopColor:
|
|
28
|
+
stopColor: h,
|
|
30
29
|
stopOpacity: 1
|
|
31
30
|
}),
|
|
32
|
-
/* @__PURE__ */ (
|
|
31
|
+
/* @__PURE__ */ e("stop", {
|
|
33
32
|
offset: "90%",
|
|
34
|
-
stopColor:
|
|
33
|
+
stopColor: h,
|
|
35
34
|
stopOpacity: .6
|
|
36
35
|
}),
|
|
37
|
-
/* @__PURE__ */ (
|
|
36
|
+
/* @__PURE__ */ e("stop", {
|
|
38
37
|
offset: "100%",
|
|
39
|
-
stopColor:
|
|
38
|
+
stopColor: h,
|
|
40
39
|
stopOpacity: .3
|
|
41
40
|
})
|
|
42
41
|
]
|
|
43
|
-
}), /* @__PURE__ */ (
|
|
42
|
+
}), /* @__PURE__ */ t("filter", {
|
|
44
43
|
id: "glow",
|
|
45
44
|
height: "130%",
|
|
46
45
|
children: [
|
|
47
|
-
/* @__PURE__ */ (
|
|
46
|
+
/* @__PURE__ */ e("feGaussianBlur", {
|
|
48
47
|
in: "SourceAlpha",
|
|
49
48
|
stdDeviation: "3",
|
|
50
49
|
result: "blur"
|
|
51
50
|
}),
|
|
52
|
-
/* @__PURE__ */ (
|
|
51
|
+
/* @__PURE__ */ e("feOffset", {
|
|
53
52
|
in: "blur",
|
|
54
53
|
dx: "0",
|
|
55
54
|
dy: "0",
|
|
56
55
|
result: "offsetBlur"
|
|
57
56
|
}),
|
|
58
|
-
/* @__PURE__ */ (
|
|
59
|
-
floodColor:
|
|
57
|
+
/* @__PURE__ */ e("feFlood", {
|
|
58
|
+
floodColor: h,
|
|
60
59
|
floodOpacity: "0.5",
|
|
61
60
|
result: "offsetColor"
|
|
62
61
|
}),
|
|
63
|
-
/* @__PURE__ */ (
|
|
62
|
+
/* @__PURE__ */ e("feComposite", {
|
|
64
63
|
in: "offsetColor",
|
|
65
64
|
in2: "offsetBlur",
|
|
66
65
|
operator: "in",
|
|
67
66
|
result: "offsetBlur"
|
|
68
67
|
}),
|
|
69
|
-
/* @__PURE__ */ (
|
|
68
|
+
/* @__PURE__ */ t("feMerge", { children: [/* @__PURE__ */ e("feMergeNode", { in: "offsetBlur" }), /* @__PURE__ */ e("feMergeNode", { in: "SourceGraphic" })] })
|
|
70
69
|
]
|
|
71
70
|
})] }),
|
|
72
|
-
/* @__PURE__ */ (
|
|
71
|
+
/* @__PURE__ */ e(i, {
|
|
73
72
|
strokeDasharray: "3 3",
|
|
74
73
|
stroke: "hsl(var(--border))",
|
|
75
74
|
vertical: !1
|
|
76
75
|
}),
|
|
77
|
-
/* @__PURE__ */ (
|
|
78
|
-
dataKey:
|
|
76
|
+
/* @__PURE__ */ e(c, {
|
|
77
|
+
dataKey: f,
|
|
79
78
|
tick: {
|
|
80
79
|
fill: "hsl(var(--muted-foreground))",
|
|
81
80
|
fontSize: 12,
|
|
@@ -85,7 +84,7 @@ function u({ data: e = [], dataKey: u = "value", xAxisKey: d = "name", height: f
|
|
|
85
84
|
axisLine: { stroke: "hsl(var(--border))" },
|
|
86
85
|
dy: 10
|
|
87
86
|
}),
|
|
88
|
-
/* @__PURE__ */ (
|
|
87
|
+
/* @__PURE__ */ e(l, {
|
|
89
88
|
tick: {
|
|
90
89
|
fill: "hsl(var(--muted-foreground))",
|
|
91
90
|
fontSize: 12,
|
|
@@ -94,7 +93,7 @@ function u({ data: e = [], dataKey: u = "value", xAxisKey: d = "name", height: f
|
|
|
94
93
|
tickLine: !1,
|
|
95
94
|
axisLine: !1
|
|
96
95
|
}),
|
|
97
|
-
/* @__PURE__ */ (
|
|
96
|
+
/* @__PURE__ */ e(s, {
|
|
98
97
|
cursor: {
|
|
99
98
|
fill: "hsl(var(--muted))",
|
|
100
99
|
opacity: .2
|
|
@@ -109,12 +108,12 @@ function u({ data: e = [], dataKey: u = "value", xAxisKey: d = "name", height: f
|
|
|
109
108
|
},
|
|
110
109
|
itemStyle: { color: "hsl(var(--primary))" }
|
|
111
110
|
}),
|
|
112
|
-
/* @__PURE__ */ (
|
|
111
|
+
/* @__PURE__ */ e(a, { wrapperStyle: {
|
|
113
112
|
paddingTop: "20px",
|
|
114
113
|
fontFamily: "monospace"
|
|
115
114
|
} }),
|
|
116
|
-
/* @__PURE__ */ (
|
|
117
|
-
dataKey:
|
|
115
|
+
/* @__PURE__ */ e(n, {
|
|
116
|
+
dataKey: d,
|
|
118
117
|
fill: "url(#barGradient)",
|
|
119
118
|
radius: [
|
|
120
119
|
4,
|