Change Bug Charts
This commit is contained in:
@@ -92,7 +92,6 @@ export default function AsalDaerahChart() {
|
|||||||
},
|
},
|
||||||
maxWidth: 200,
|
maxWidth: 200,
|
||||||
},
|
},
|
||||||
tickAmount: undefined,
|
|
||||||
},
|
},
|
||||||
fill: {
|
fill: {
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
|
|||||||
@@ -162,7 +162,8 @@ export default function JenisPendaftaranBeasiswaChart({ selectedYear, selectedJe
|
|||||||
axisBorder: {
|
axisBorder: {
|
||||||
show: true,
|
show: true,
|
||||||
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
||||||
}
|
},
|
||||||
|
tickAmount: 5,
|
||||||
},
|
},
|
||||||
fill: {
|
fill: {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
@@ -203,23 +204,6 @@ export default function JenisPendaftaranBeasiswaChart({ selectedYear, selectedJe
|
|||||||
|
|
||||||
const series = processSeriesData();
|
const series = processSeriesData();
|
||||||
|
|
||||||
// Calculate the maximum value from all series for y-axis padding
|
|
||||||
const maxValue = Math.max(
|
|
||||||
...series.flatMap(s => s.data)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add 20% padding to the maximum value
|
|
||||||
const yAxisMax = Math.ceil(maxValue * 1.2);
|
|
||||||
|
|
||||||
// Update chart options with y-axis max
|
|
||||||
const updatedChartOptions: ApexOptions = {
|
|
||||||
...chartOptions,
|
|
||||||
yaxis: {
|
|
||||||
...chartOptions.yaxis,
|
|
||||||
max: yAxisMax
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
||||||
@@ -268,7 +252,7 @@ export default function JenisPendaftaranBeasiswaChart({ selectedYear, selectedJe
|
|||||||
<div className="h-[300px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
<div className="h-[300px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
||||||
{typeof window !== 'undefined' && series.length > 0 && (
|
{typeof window !== 'undefined' && series.length > 0 && (
|
||||||
<Chart
|
<Chart
|
||||||
options={updatedChartOptions}
|
options={chartOptions}
|
||||||
series={series}
|
series={series}
|
||||||
type="bar"
|
type="bar"
|
||||||
height="100%"
|
height="100%"
|
||||||
|
|||||||
@@ -213,20 +213,12 @@ export default function JenisPendaftaranChart() {
|
|||||||
|
|
||||||
setSeries(seriesData);
|
setSeries(seriesData);
|
||||||
|
|
||||||
// Calculate the maximum value from all series
|
|
||||||
const maxValue = Math.max(
|
|
||||||
...seriesData.flatMap(series => series.data)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add 20% padding to the maximum value
|
|
||||||
const xAxisMax = Math.ceil(maxValue * 1.1);
|
|
||||||
|
|
||||||
setOptions(prev => ({
|
setOptions(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
xaxis: {
|
xaxis: {
|
||||||
...prev.xaxis,
|
...prev.xaxis,
|
||||||
categories: tahunAngkatan,
|
categories: tahunAngkatan,
|
||||||
max: xAxisMax
|
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -159,7 +159,8 @@ export default function JenisPendaftaranLulusChart({ selectedYear }: Props) {
|
|||||||
axisBorder: {
|
axisBorder: {
|
||||||
show: true,
|
show: true,
|
||||||
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
||||||
}
|
},
|
||||||
|
tickAmount: 5,
|
||||||
},
|
},
|
||||||
fill: {
|
fill: {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
@@ -200,23 +201,6 @@ export default function JenisPendaftaranLulusChart({ selectedYear }: Props) {
|
|||||||
|
|
||||||
const series = processSeriesData();
|
const series = processSeriesData();
|
||||||
|
|
||||||
// Calculate the maximum value from all series for y-axis padding
|
|
||||||
const maxValue = Math.max(
|
|
||||||
...series.flatMap(s => s.data)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add 20% padding to the maximum value
|
|
||||||
const yAxisMax = Math.ceil(maxValue * 1.2);
|
|
||||||
|
|
||||||
// Update chart options with y-axis max
|
|
||||||
const updatedChartOptions: ApexOptions = {
|
|
||||||
...chartOptions,
|
|
||||||
yaxis: {
|
|
||||||
...chartOptions.yaxis,
|
|
||||||
max: yAxisMax
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
||||||
@@ -265,7 +249,7 @@ export default function JenisPendaftaranLulusChart({ selectedYear }: Props) {
|
|||||||
<div className="h-[300px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
<div className="h-[300px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
||||||
{typeof window !== 'undefined' && series.length > 0 && (
|
{typeof window !== 'undefined' && series.length > 0 && (
|
||||||
<Chart
|
<Chart
|
||||||
options={updatedChartOptions}
|
options={chartOptions}
|
||||||
series={series}
|
series={series}
|
||||||
type="bar"
|
type="bar"
|
||||||
height="100%"
|
height="100%"
|
||||||
|
|||||||
@@ -162,9 +162,6 @@ export default function JenisPendaftaranPrestasiChart({ selectedJenisPrestasi }:
|
|||||||
show: true,
|
show: true,
|
||||||
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
||||||
},
|
},
|
||||||
max: function(val) {
|
|
||||||
return Math.ceil(val * 1.2);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
fill: {
|
fill: {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
|
|||||||
@@ -135,7 +135,9 @@ export default function JenisPendaftaranStatusChart({ selectedYear, selectedStat
|
|||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
colors: theme === 'dark' ? '#fff' : '#000'
|
colors: theme === 'dark' ? '#fff' : '#000'
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
min:0,
|
||||||
|
tickAmount: 5
|
||||||
},
|
},
|
||||||
fill: {
|
fill: {
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
@@ -188,23 +190,6 @@ export default function JenisPendaftaranStatusChart({ selectedYear, selectedStat
|
|||||||
const series = processSeriesData();
|
const series = processSeriesData();
|
||||||
console.log('Processed series data:', series);
|
console.log('Processed series data:', series);
|
||||||
|
|
||||||
// Calculate the maximum value from all series for y-axis padding
|
|
||||||
const maxValue = Math.max(
|
|
||||||
...series.flatMap(s => s.data)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add 20% padding to the maximum value
|
|
||||||
const yAxisMax = Math.ceil(maxValue * 1.2);
|
|
||||||
|
|
||||||
// Update chart options with y-axis max
|
|
||||||
const updatedChartOptions: ApexOptions = {
|
|
||||||
...chartOptions,
|
|
||||||
yaxis: {
|
|
||||||
...chartOptions.yaxis,
|
|
||||||
max: yAxisMax
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
||||||
@@ -253,7 +238,7 @@ export default function JenisPendaftaranStatusChart({ selectedYear, selectedStat
|
|||||||
<div className="h-[350px] w-full max-w-5xl mx-auto">
|
<div className="h-[350px] w-full max-w-5xl mx-auto">
|
||||||
{typeof window !== 'undefined' && (
|
{typeof window !== 'undefined' && (
|
||||||
<Chart
|
<Chart
|
||||||
options={updatedChartOptions}
|
options={chartOptions}
|
||||||
series={series}
|
series={series}
|
||||||
type="bar"
|
type="bar"
|
||||||
height="100%"
|
height="100%"
|
||||||
|
|||||||
@@ -177,7 +177,8 @@ export default function LulusTepatWaktuChart({ selectedYear }: Props) {
|
|||||||
axisBorder: {
|
axisBorder: {
|
||||||
show: true,
|
show: true,
|
||||||
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
||||||
}
|
},
|
||||||
|
tickAmount: 5,
|
||||||
},
|
},
|
||||||
fill: {
|
fill: {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
@@ -218,23 +219,6 @@ export default function LulusTepatWaktuChart({ selectedYear }: Props) {
|
|||||||
|
|
||||||
const series = processSeriesData();
|
const series = processSeriesData();
|
||||||
|
|
||||||
// Calculate the maximum value from all series for y-axis padding
|
|
||||||
const maxValue = Math.max(
|
|
||||||
...series.flatMap(s => s.data)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add 20% padding to the maximum value
|
|
||||||
const yAxisMax = Math.ceil(maxValue * 1.2);
|
|
||||||
|
|
||||||
// Update chart options with y-axis max
|
|
||||||
const updatedChartOptions: ApexOptions = {
|
|
||||||
...chartOptions,
|
|
||||||
yaxis: {
|
|
||||||
...chartOptions.yaxis,
|
|
||||||
max: yAxisMax
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
||||||
@@ -283,7 +267,7 @@ export default function LulusTepatWaktuChart({ selectedYear }: Props) {
|
|||||||
<div className="h-[300px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
<div className="h-[300px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
||||||
{typeof window !== 'undefined' && series.length > 0 && (
|
{typeof window !== 'undefined' && series.length > 0 && (
|
||||||
<Chart
|
<Chart
|
||||||
options={updatedChartOptions}
|
options={chartOptions}
|
||||||
series={series}
|
series={series}
|
||||||
type="bar"
|
type="bar"
|
||||||
height="100%"
|
height="100%"
|
||||||
|
|||||||
@@ -142,7 +142,8 @@ export default function NamaBeasiswaChart({ selectedYear, selectedJenisBeasiswa
|
|||||||
axisTicks: {
|
axisTicks: {
|
||||||
show: true,
|
show: true,
|
||||||
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
||||||
}
|
},
|
||||||
|
tickAmount: 5,
|
||||||
},
|
},
|
||||||
yaxis: {
|
yaxis: {
|
||||||
title: {
|
title: {
|
||||||
@@ -203,23 +204,6 @@ export default function NamaBeasiswaChart({ selectedYear, selectedJenisBeasiswa
|
|||||||
|
|
||||||
const series = processSeriesData();
|
const series = processSeriesData();
|
||||||
|
|
||||||
// Calculate the maximum value from all series for y-axis padding
|
|
||||||
const maxValue = Math.max(
|
|
||||||
...series.flatMap(s => s.data)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add 20% padding to the maximum value
|
|
||||||
const yAxisMax = Math.ceil(maxValue * 1.2);
|
|
||||||
|
|
||||||
// Update chart options with y-axis max
|
|
||||||
const updatedChartOptions: ApexOptions = {
|
|
||||||
...chartOptions,
|
|
||||||
yaxis: {
|
|
||||||
...chartOptions.yaxis,
|
|
||||||
max: yAxisMax
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
||||||
@@ -268,7 +252,7 @@ export default function NamaBeasiswaChart({ selectedYear, selectedJenisBeasiswa
|
|||||||
<div className="h-[400px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
<div className="h-[400px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
||||||
{typeof window !== 'undefined' && series.length > 0 && (
|
{typeof window !== 'undefined' && series.length > 0 && (
|
||||||
<Chart
|
<Chart
|
||||||
options={updatedChartOptions}
|
options={chartOptions}
|
||||||
series={series}
|
series={series}
|
||||||
type="bar"
|
type="bar"
|
||||||
height="100%"
|
height="100%"
|
||||||
|
|||||||
@@ -105,7 +105,9 @@ export default function StatistikMahasiswaChart() {
|
|||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
colors: '#000'
|
colors: '#000'
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
min:0,
|
||||||
|
tickAmount: 5
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
fill: {
|
fill: {
|
||||||
@@ -243,15 +245,6 @@ export default function StatistikMahasiswaChart() {
|
|||||||
// Update categories when data changes
|
// Update categories when data changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (statistikData.length > 0) {
|
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 => ({
|
setChartOptions(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
@@ -262,7 +255,6 @@ export default function StatistikMahasiswaChart() {
|
|||||||
yaxis: [
|
yaxis: [
|
||||||
{
|
{
|
||||||
...prev.yaxis[0],
|
...prev.yaxis[0],
|
||||||
max: yAxisMax
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -21,13 +21,15 @@ export default function StatusMahasiswaChart() {
|
|||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [data, setData] = useState<StatusData[]>([]);
|
const [data, setData] = useState<StatusData[]>([]);
|
||||||
const [series, setSeries] = useState<ApexAxisChartSeries>([]);
|
const [series, setSeries] = useState<ApexAxisChartSeries>([]);
|
||||||
const [options, setOptions] = useState<ApexOptions>({
|
|
||||||
|
const chartOptions: ApexOptions = {
|
||||||
chart: {
|
chart: {
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
stacked: false,
|
stacked: false,
|
||||||
toolbar: {
|
toolbar: {
|
||||||
show: true,
|
show: true,
|
||||||
},
|
},
|
||||||
|
background: theme === 'dark' ? '#0F172B' : '#fff',
|
||||||
},
|
},
|
||||||
plotOptions: {
|
plotOptions: {
|
||||||
bar: {
|
bar: {
|
||||||
@@ -42,7 +44,7 @@ export default function StatusMahasiswaChart() {
|
|||||||
},
|
},
|
||||||
style: {
|
style: {
|
||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
colors: ['#000']
|
colors: [theme === 'dark' ? '#fff' : '#000']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
stroke: {
|
stroke: {
|
||||||
@@ -51,19 +53,19 @@ export default function StatusMahasiswaChart() {
|
|||||||
colors: ['transparent'],
|
colors: ['transparent'],
|
||||||
},
|
},
|
||||||
xaxis: {
|
xaxis: {
|
||||||
categories: [],
|
categories: [...new Set(data.map(item => item.tahun_angkatan))].sort(),
|
||||||
title: {
|
title: {
|
||||||
text: 'Tahun Angkatan',
|
text: 'Tahun Angkatan',
|
||||||
style: {
|
style: {
|
||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color: '#000'
|
color: theme === 'dark' ? '#fff' : '#000'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
labels: {
|
labels: {
|
||||||
style: {
|
style: {
|
||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
colors: '#000'
|
colors: theme === 'dark' ? '#fff' : '#000'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -73,15 +75,15 @@ export default function StatusMahasiswaChart() {
|
|||||||
style: {
|
style: {
|
||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
color: '#000'
|
color: theme === 'dark' ? '#fff' : '#000'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
labels: {
|
labels: {
|
||||||
style: {
|
style: {
|
||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
colors: '#000'
|
colors: theme === 'dark' ? '#fff' : '#000'
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
fill: {
|
fill: {
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
@@ -96,19 +98,19 @@ export default function StatusMahasiswaChart() {
|
|||||||
horizontal: 10,
|
horizontal: 10,
|
||||||
},
|
},
|
||||||
labels: {
|
labels: {
|
||||||
colors: '#000'
|
colors: theme === 'dark' ? '#fff' : '#000'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
colors: ['#008FFB', '#00E396', '#FEB019', '#EF4444'],
|
colors: ['#008FFB', '#00E396', '#FEB019', '#EF4444'],
|
||||||
tooltip: {
|
tooltip: {
|
||||||
theme: 'light',
|
theme: theme === 'dark' ? 'dark' : 'light',
|
||||||
y: {
|
y: {
|
||||||
formatter: function (val: number) {
|
formatter: function (val: number) {
|
||||||
return val + " mahasiswa";
|
return val + " mahasiswa";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
@@ -143,26 +145,6 @@ export default function StatusMahasiswaChart() {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
setSeries(seriesData);
|
setSeries(seriesData);
|
||||||
|
|
||||||
// Calculate the maximum value from all series
|
|
||||||
const maxValue = Math.max(
|
|
||||||
...seriesData.flatMap(series => series.data)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add 20% padding to the maximum value
|
|
||||||
const yAxisMax = Math.ceil(maxValue * 1.2);
|
|
||||||
|
|
||||||
setOptions(prev => ({
|
|
||||||
...prev,
|
|
||||||
xaxis: {
|
|
||||||
...prev.xaxis,
|
|
||||||
categories: tahunAngkatan,
|
|
||||||
},
|
|
||||||
yaxis: {
|
|
||||||
...prev.yaxis,
|
|
||||||
max: yAxisMax
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error in fetchData:', 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 : 'An error occurred while fetching data');
|
||||||
@@ -174,73 +156,6 @@ export default function StatusMahasiswaChart() {
|
|||||||
fetchData();
|
fetchData();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Update theme when it changes
|
|
||||||
useEffect(() => {
|
|
||||||
const currentTheme = theme === 'system' ? systemTheme : theme;
|
|
||||||
const textColor = currentTheme === 'dark' ? '#fff' : '#000';
|
|
||||||
const tooltipTheme = currentTheme === 'dark' ? 'dark' : 'light';
|
|
||||||
|
|
||||||
setOptions(prev => ({
|
|
||||||
...prev,
|
|
||||||
chart: {
|
|
||||||
...prev.chart,
|
|
||||||
background: currentTheme === 'dark' ? '#0F172B' : '#fff',
|
|
||||||
},
|
|
||||||
dataLabels: {
|
|
||||||
...prev.dataLabels,
|
|
||||||
style: {
|
|
||||||
...prev.dataLabels?.style,
|
|
||||||
colors: [textColor]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
xaxis: {
|
|
||||||
...prev.xaxis,
|
|
||||||
title: {
|
|
||||||
...prev.xaxis?.title,
|
|
||||||
style: {
|
|
||||||
...prev.xaxis?.title?.style,
|
|
||||||
color: textColor
|
|
||||||
}
|
|
||||||
},
|
|
||||||
labels: {
|
|
||||||
...prev.xaxis?.labels,
|
|
||||||
style: {
|
|
||||||
...prev.xaxis?.labels?.style,
|
|
||||||
colors: textColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
yaxis: {
|
|
||||||
...(prev.yaxis as ApexYAxis),
|
|
||||||
title: {
|
|
||||||
...(prev.yaxis as ApexYAxis)?.title,
|
|
||||||
style: {
|
|
||||||
...(prev.yaxis as ApexYAxis)?.title?.style,
|
|
||||||
color: textColor
|
|
||||||
}
|
|
||||||
},
|
|
||||||
labels: {
|
|
||||||
...(prev.yaxis as ApexYAxis)?.labels,
|
|
||||||
style: {
|
|
||||||
...(prev.yaxis as ApexYAxis)?.labels?.style,
|
|
||||||
colors: textColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
...prev.legend,
|
|
||||||
labels: {
|
|
||||||
...prev.legend?.labels,
|
|
||||||
colors: textColor
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tooltip: {
|
|
||||||
...prev.tooltip,
|
|
||||||
theme: tooltipTheme
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}, [theme, systemTheme]);
|
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
||||||
@@ -285,10 +200,10 @@ export default function StatusMahasiswaChart() {
|
|||||||
</CardTitle>
|
</CardTitle>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="h-[350px] w-full max-w-5xl mx-auto">
|
<div className="h-[300px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
||||||
{typeof window !== 'undefined' && (
|
{typeof window !== 'undefined' && (
|
||||||
<Chart
|
<Chart
|
||||||
options={options}
|
options={chartOptions}
|
||||||
series={series}
|
series={series}
|
||||||
type="bar"
|
type="bar"
|
||||||
height="100%"
|
height="100%"
|
||||||
|
|||||||
@@ -190,22 +190,6 @@ export default function StatusMahasiswaFilterChart({ selectedYear, selectedStatu
|
|||||||
const series = processSeriesData();
|
const series = processSeriesData();
|
||||||
console.log('Processed series data:', series);
|
console.log('Processed series data:', series);
|
||||||
|
|
||||||
// Calculate the maximum value from all series for y-axis padding
|
|
||||||
const maxValue = Math.max(
|
|
||||||
...series.flatMap(s => s.data)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add 20% padding to the maximum value
|
|
||||||
const yAxisMax = Math.ceil(maxValue * 1.2);
|
|
||||||
|
|
||||||
// Update chart options with y-axis max
|
|
||||||
const updatedChartOptions: ApexOptions = {
|
|
||||||
...chartOptions,
|
|
||||||
yaxis: {
|
|
||||||
...chartOptions.yaxis,
|
|
||||||
max: yAxisMax
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
@@ -255,7 +239,7 @@ export default function StatusMahasiswaFilterChart({ selectedYear, selectedStatu
|
|||||||
<div className="h-[350px] w-full max-w-5xl mx-auto">
|
<div className="h-[350px] w-full max-w-5xl mx-auto">
|
||||||
{typeof window !== 'undefined' && (
|
{typeof window !== 'undefined' && (
|
||||||
<Chart
|
<Chart
|
||||||
options={updatedChartOptions}
|
options={chartOptions}
|
||||||
series={series}
|
series={series}
|
||||||
type="bar"
|
type="bar"
|
||||||
height="100%"
|
height="100%"
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ export default function TingkatPrestasiChart({ selectedJenisPrestasi }: Props) {
|
|||||||
axisTicks: {
|
axisTicks: {
|
||||||
show: true,
|
show: true,
|
||||||
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
yaxis: {
|
yaxis: {
|
||||||
title: {
|
title: {
|
||||||
@@ -161,7 +161,8 @@ export default function TingkatPrestasiChart({ selectedJenisPrestasi }: Props) {
|
|||||||
axisBorder: {
|
axisBorder: {
|
||||||
show: true,
|
show: true,
|
||||||
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
||||||
}
|
},
|
||||||
|
tickAmount: 5,
|
||||||
},
|
},
|
||||||
fill: {
|
fill: {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
@@ -202,23 +203,6 @@ export default function TingkatPrestasiChart({ selectedJenisPrestasi }: Props) {
|
|||||||
|
|
||||||
const series = processSeriesData();
|
const series = processSeriesData();
|
||||||
|
|
||||||
// Calculate the maximum value from all series for y-axis padding
|
|
||||||
const maxValue = Math.max(
|
|
||||||
...series.flatMap(s => s.data)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add 20% padding to the maximum value
|
|
||||||
const yAxisMax = Math.ceil(maxValue * 1.2);
|
|
||||||
|
|
||||||
// Update chart options with y-axis max
|
|
||||||
const updatedChartOptions: ApexOptions = {
|
|
||||||
...chartOptions,
|
|
||||||
yaxis: {
|
|
||||||
...chartOptions.yaxis,
|
|
||||||
max: yAxisMax
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
||||||
@@ -266,7 +250,7 @@ export default function TingkatPrestasiChart({ selectedJenisPrestasi }: Props) {
|
|||||||
<div className="h-[400px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
<div className="h-[400px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
||||||
{typeof window !== 'undefined' && series.length > 0 && (
|
{typeof window !== 'undefined' && series.length > 0 && (
|
||||||
<Chart
|
<Chart
|
||||||
options={updatedChartOptions}
|
options={chartOptions}
|
||||||
series={series}
|
series={series}
|
||||||
type="bar"
|
type="bar"
|
||||||
height="100%"
|
height="100%"
|
||||||
|
|||||||
@@ -174,7 +174,8 @@ export default function TotalBeasiswaChart({ selectedYear, selectedJenisBeasiswa
|
|||||||
axisBorder: {
|
axisBorder: {
|
||||||
show: true,
|
show: true,
|
||||||
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
||||||
}
|
},
|
||||||
|
tickAmount: 5,
|
||||||
},
|
},
|
||||||
fill: {
|
fill: {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
@@ -215,23 +216,6 @@ export default function TotalBeasiswaChart({ selectedYear, selectedJenisBeasiswa
|
|||||||
|
|
||||||
const series = processSeriesData();
|
const series = processSeriesData();
|
||||||
|
|
||||||
// Calculate the maximum value from all series for y-axis padding
|
|
||||||
const maxValue = Math.max(
|
|
||||||
...series.flatMap(s => s.data)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add 20% padding to the maximum value
|
|
||||||
const yAxisMax = Math.ceil(maxValue * 1.2);
|
|
||||||
|
|
||||||
// Update chart options with y-axis max
|
|
||||||
const updatedChartOptions: ApexOptions = {
|
|
||||||
...chartOptions,
|
|
||||||
yaxis: {
|
|
||||||
...chartOptions.yaxis,
|
|
||||||
max: yAxisMax
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
||||||
@@ -280,7 +264,7 @@ export default function TotalBeasiswaChart({ selectedYear, selectedJenisBeasiswa
|
|||||||
<div className="h-[300px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
<div className="h-[300px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
||||||
{typeof window !== 'undefined' && series.length > 0 && (
|
{typeof window !== 'undefined' && series.length > 0 && (
|
||||||
<Chart
|
<Chart
|
||||||
options={updatedChartOptions}
|
options={chartOptions}
|
||||||
series={series}
|
series={series}
|
||||||
type="bar"
|
type="bar"
|
||||||
height="100%"
|
height="100%"
|
||||||
|
|||||||
@@ -173,7 +173,8 @@ export default function TotalPrestasiChart({ selectedJenisPrestasi }: Props) {
|
|||||||
axisBorder: {
|
axisBorder: {
|
||||||
show: true,
|
show: true,
|
||||||
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
color: theme === 'dark' ? '#374151' : '#E5E7EB'
|
||||||
}
|
},
|
||||||
|
tickAmount: 5,
|
||||||
},
|
},
|
||||||
fill: {
|
fill: {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
@@ -214,23 +215,6 @@ export default function TotalPrestasiChart({ selectedJenisPrestasi }: Props) {
|
|||||||
|
|
||||||
const series = processSeriesData();
|
const series = processSeriesData();
|
||||||
|
|
||||||
// Calculate the maximum value from all series for y-axis padding
|
|
||||||
const maxValue = Math.max(
|
|
||||||
...series.flatMap(s => s.data)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add 20% padding to the maximum value
|
|
||||||
const yAxisMax = Math.ceil(maxValue * 1.2);
|
|
||||||
|
|
||||||
// Update chart options with y-axis max
|
|
||||||
const updatedChartOptions: ApexOptions = {
|
|
||||||
...chartOptions,
|
|
||||||
yaxis: {
|
|
||||||
...chartOptions.yaxis,
|
|
||||||
max: yAxisMax
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
||||||
@@ -278,7 +262,7 @@ export default function TotalPrestasiChart({ selectedJenisPrestasi }: Props) {
|
|||||||
<div className="h-[300px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
<div className="h-[300px] sm:h-[350px] md:h-[400px] w-full max-w-5xl mx-auto">
|
||||||
{typeof window !== 'undefined' && series.length > 0 && (
|
{typeof window !== 'undefined' && series.length > 0 && (
|
||||||
<Chart
|
<Chart
|
||||||
options={updatedChartOptions}
|
options={chartOptions}
|
||||||
series={series}
|
series={series}
|
||||||
type="bar"
|
type="bar"
|
||||||
height="100%"
|
height="100%"
|
||||||
|
|||||||
Reference in New Issue
Block a user