      chart.setOption(chartOptions);
                    return chart;
                };
        
                // Create the initial chart
                let chart = initializeChart();
        
                // Add event listener for the dark mode toggle button
                document.getElementById('darkModeToggle').addEventListener('click', () => {
                    setTimeout(() => {
                        chart.dispose(); // Dispose of the current chart instance
                        chart 