enanceDevices": 0}{{end}},
        trends: {{if .analytics.trends}}{{.analytics.trends}}{{else}}{"revenue": []}{{end}}
    };
    
    // Initialize charts only if elements exist
    initializeCharts(analyticsData);
});

function initializeCharts(data) {
    // Revenue Chart
    const revenueChartElement = document.getElementById('revenueChart');
    if (revenueChartElement) {
        try {
            const revenueCtx = revenueChartElement.getContext('2d');
            const revenueData = data.trends.reven