('positive');
            }
        }

        function createPieChart(categoryData) {
            if (pieChart) pieChart.destroy();
            pieChart = new Chart('categoryPieChart', {
                type: 'doughnut',
                data: {
                    labels: categoryData.map(c => c.category),
                    datasets: [{
                        data: categoryData.map(c => c.total),
                        backgroundColor: categoryData.map(c => categoryColors[c.category]),
                