jQuery(function($) {
    // Only run if we have the chart container
    if ($('#subscription-status-chart').length) {
        var ctx = document.getElementById('subscription-status-chart').getContext('2d');
        var chart = new Chart(ctx, {
            type: 'pie',
            data: {
                labels: ['Active', 'Paused', 'Cancelled'],
                datasets: [{
                    data: [
                        subscriptionData.active,
                        subscriptionData.paused,
                        subscriptionData.cancelled
                    ],
                    backgroundColor: [
                        '#4CAF50',
                        '#FFC107',
                        '#F44336'
                    ]
                }]
            },
            options: {
                responsive: true,
                plugins: {
                    legend: {
                        position: 'bottom',
                    },
                    title: {
                        display: true,
                        text: 'Subscription Status Distribution'
                    }
                }
            }
        });
    }
}); 