Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Simple chart drawing function
+ const drawChart = (canvasId, data) => {
+ const canvas = document.getElementById(canvasId);
+ const ctx = canvas.getContext('2d');
+ const width = canvas.width;
+ const height = canvas.height;
+
+ // Clear canvas
+ ctx.clearRect(0, 0, width, height);
+
+ // Draw chart
+ ctx.beginPath();
+ ctx.strokeStyle = '#3498db';
+ ctx.lineWidth = 2;
+
+ data.forEach((point, index) => {
+ const x = (width / (data.length - 1)) * index;
+ const y = height - (point * height);
+
+ if (index === 0) {
+ ctx.moveTo(x, y);
+ } else {
+ ctx.lineTo(x, y);
+ }
+ });
+
+ ctx.stroke();
+ };
+
+ // Sample data for charts
+ const gdpData = [0.4, 0.5, 0.3, 0.6, 0.8, 0.7, 0.9];
+ const inflationData = [0.2, 0.3, 0.4, 0.3, 0.2, 0.3, 0.2];
+ const employmentData = [0.8, 0.85, 0.82, 0.88, 0.9, 0.92, 0.94];
+ const ratesData = [0.4, 0.45, 0.5, 0.52, 0.525, 0.525, 0.525];
+
+ // Initialize charts
+ drawChart('gdpChart', gdpData);
+ drawChart('inflationChart', inflationData);
+ drawChart('employmentChart', employmentData);
+ drawChart('ratesChart', ratesData);
+
+ // Add resize handler
+ window.addEventListener('resize', () => {
+ drawChart('gdpChart', gdpData);
+ drawChart('inflationChart', inflationData);
+ drawChart('employmentChart', employmentData);
+ drawChart('ratesChart', ratesData);
+ });
+ });