Change total mahasiswa
This commit is contained in:
@@ -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)
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user