Change total mahasiswa

This commit is contained in:
Randa Firman Putra
2025-06-24 00:50:02 +07:00
parent fadca46dc1
commit eb7c884c41
19 changed files with 569 additions and 138 deletions

View File

@@ -68,9 +68,9 @@ export default function StatistikMahasiswaChart() {
},
},
stroke: {
show: true,
width: [0, 0, 2],
colors: ['transparent', 'transparent', '#10B981'],
show: false,
width: [0, 0, 0],
colors: ['transparent', 'transparent', 'transparent'],
curve: 'straight' as const
},
xaxis: {
@@ -124,7 +124,7 @@ export default function StatistikMahasiswaChart() {
colors: '#000'
}
},
colors: ['#3B82F6', '#EC4899', '#10B981'],
colors: ['#3B82F6', '#10B981', '#EC4899'],
tooltip: {
theme: 'light',
y: [
@@ -243,12 +243,28 @@ export default function StatistikMahasiswaChart() {
// Update categories when data changes
useEffect(() => {
if (statistikData.length > 0) {
// Calculate the maximum value from all series
const maxValue = Math.max(
...statistikData.map(item => item.total_mahasiswa),
...statistikData.map(item => item.pria),
...statistikData.map(item => item.wanita)
);
// Add 50% padding to the maximum value
const yAxisMax = Math.ceil(maxValue * 1.2);
setChartOptions(prev => ({
...prev,
xaxis: {
...prev.xaxis,
categories: statistikData.map(item => item.tahun_angkatan)
}
},
yaxis: [
{
...prev.yaxis[0],
max: yAxisMax
}
]
}));
}
}, [statistikData]);
@@ -259,15 +275,15 @@ export default function StatistikMahasiswaChart() {
type: 'bar' as const,
data: statistikData.map(item => item.pria)
},
{
name: 'Total',
type: 'bar' as const,
data: statistikData.map(item => item.total_mahasiswa)
},
{
name: 'Perempuan',
type: 'bar' as const,
data: statistikData.map(item => item.wanita)
},
{
name: 'Total',
type: 'line' as const,
data: statistikData.map(item => item.total_mahasiswa)
}
];