First Commit

This commit is contained in:
Randa Firman Putra
2025-09-06 20:55:57 +07:00
parent 87986da7ee
commit bf248459f8
6 changed files with 63 additions and 4 deletions

View File

@@ -299,6 +299,15 @@ export default function AsalDaerahPerAngkatanChart({ tahunAngkatan }: Props) {
);
}
// Calculate dynamic height based on number of kabupaten
const calculateHeight = () => {
const minHeight = 200;
const barHeight = 25; // Height per bar in pixels
const padding = 100; // Extra space for title, legend, etc.
const dynamicHeight = Math.max(minHeight, (data.length * barHeight) + padding);
return `${dynamicHeight}px`;
};
return (
<Card className="bg-white dark:bg-slate-900 shadow-lg">
<CardHeader>
@@ -307,7 +316,10 @@ export default function AsalDaerahPerAngkatanChart({ tahunAngkatan }: Props) {
</CardTitle>
</CardHeader>
<CardContent>
<div className="h-[300px] sm:h-[300px] md:h-[300px] w-full max-w-5xl mx-auto">
<div
className="w-full max-w-5xl mx-auto"
style={{ height: calculateHeight() }}
>
<Chart
options={options}
series={series}