testing yuk

This commit is contained in:
Randa Firman Putra
2025-09-14 16:59:31 +07:00
parent 248fed0d0b
commit 60211ae829
63 changed files with 315 additions and 315 deletions

View File

@@ -6,7 +6,7 @@ import { ApexOptions } from 'apexcharts';
import { useTheme } from 'next-themes';
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
// Dynamically import ApexCharts to avoid SSR issues
// Import ApexCharts secara dinamis untuk menghindari masalah SSR
const Chart = dynamic(() => import('react-apexcharts'), { ssr: false });
interface AsalDaerahData {
@@ -126,7 +126,7 @@ export default function AsalDaerahPerAngkatanChart({ tahunAngkatan }: Props) {
fill: {
opacity: 1,
},
colors: ['#3B82F6'], // Blue color for bars
colors: ['#3B82F6'], // Warna biru untuk bar
tooltip: {
theme: theme === 'dark' ? 'dark' : 'light',
y: {
@@ -137,7 +137,7 @@ export default function AsalDaerahPerAngkatanChart({ tahunAngkatan }: Props) {
}
});
// Update theme when it changes
// Perbarui tema saat berubah
useEffect(() => {
setOptions(prev => ({
...prev,
@@ -212,12 +212,12 @@ export default function AsalDaerahPerAngkatanChart({ tahunAngkatan }: Props) {
const result = await response.json();
if (!Array.isArray(result)) {
throw new Error('Invalid data format received from server');
throw new Error('Format data tidak valid diterima dari server');
}
setData(result);
// Process data for chart
// Proses data untuk chart
const kabupaten = result.map(item => item.kabupaten);
const jumlah = result.map(item => item.jumlah);
@@ -248,7 +248,7 @@ export default function AsalDaerahPerAngkatanChart({ tahunAngkatan }: Props) {
}));
} catch (err) {
console.error('Error in fetchData:', err);
setError(err instanceof Error ? err.message : 'An error occurred while fetching data');
setError(err instanceof Error ? err.message : 'Terjadi kesalahan saat mengambil data');
} finally {
setLoading(false);
}
@@ -299,11 +299,11 @@ export default function AsalDaerahPerAngkatanChart({ tahunAngkatan }: Props) {
);
}
// Calculate dynamic height based on number of kabupaten
// Hitung tinggi dinamis berdasarkan jumlah kabupaten
const calculateHeight = () => {
const minHeight = 100;
const barHeight = 15; // Height per bar in pixels
const padding = 50; // Extra space for title, legend, etc.
const barHeight = 15; // Tinggi per bar dalam piksel
const padding = 50; // Ruang ekstra untuk judul, legenda, dll
const dynamicHeight = Math.max(minHeight, (data.length * barHeight) + padding);
return `${dynamicHeight}px`;
};