const monthlyData = {
    labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
    datasets: [{
        label: 'Income (USD)',
        data: [1200, 1500, 1000, 1700, 2100, 1800, 2400, 2200, 1900, 2300, 2500, 2700],
        backgroundColor: 'rgba(54, 162, 235, 0.2)',
        borderColor: 'rgba(54, 162, 235, 1)',
        borderWidth: 1
    }]
};

const yearlyData = {
    labels: ['2019', '2020', '2021', '2022', '2023'],
    datasets: [{
        label: 'Income (USD)',
        data: [15000, 18000, 17000, 20000, 22000],
        backgroundColor: 'rgba(54, 162, 235, 0.2)',
        borderColor: 'rgba(54, 162, 235, 1)',
        borderWidth: 1
    }]
};
const ctx = document.getElementById('incomeChart').getContext('2d');
let incomeChart = new Chart(ctx, {
    type: 'bar',
    data: monthlyData,
    options: {
        scales: {
            y: {
                beginAtZero: true
            }
        }
    }
});
function updateChart() {
    const chartType = document.getElementById('chartType').value;
    if (chartType === 'monthly') {
        incomeChart.data = monthlyData;
    } else {
        incomeChart.data = yearlyData;
    }
    incomeChart.update();
}