Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Animate statistics
+ const animateStats = () => {
+ const stats = [
+ { id: 'stat1', target: 1234 },
+ { id: 'stat2', target: 85.7 },
+ { id: 'stat3', target: 12.3 }
+ ];
+
+ stats.forEach(stat => {
+ let current = 0;
+ const element = document.getElementById(stat.id);
+ const increment = stat.target / 100;
+
+ const timer = setInterval(() => {
+ current += increment;
+ if (current >= stat.target) {
+ current = stat.target;
+ clearInterval(timer);
+ }
+ element.textContent = Math.round(current * 10) / 10;
+ }, 20);
+ });
+ };
+
+ // Initialize chart
+ const initChart = () => {
+ const ctx = document.getElementById('dataChart').getContext('2d');
+
+ // Simple line drawing using canvas
+ const drawLine = (ctx, startX, startY, endX, endY, color) => {
+ ctx.beginPath();
+ ctx.moveTo(startX, startY);
+ ctx.lineTo(endX, endY);
+ ctx.strokeStyle = color;
+ ctx.stroke();
+ };
+
+ // Create sample data visualization
+ const width = ctx.canvas.width;
+ const height = ctx.canvas.height;
+
+ ctx.clearRect(0, 0, width, height);
+
+ // Draw axes
+ drawLine(ctx, 50, height - 50, width - 50, height - 50, '#2c3e50'); // X-axis
+ drawLine(ctx, 50, 50, 50, height - 50, '#2c3e50'); // Y-axis
+
+ // Draw sample data curve
+ ctx.beginPath();
+ ctx.moveTo(50, height - 50);
+
+ for (let x = 0; x < width - 100; x++) {
+ const y = Math.sin(x * 0.02) * 50 + height/2;
+ ctx.lineTo(x + 50, y);
+ }
+
+ ctx.strokeStyle = '#3498db';
+ ctx.stroke();
+ };
+
+ // Handle file input
+ document.getElementById('dataInput').addEventListener('change', (event) => {
+ const file = event.target.files[0];
+ if (file) {
+ // Add file processing logic here
+ console.log('File selected:', file.name);
+ }
+ });
+
+ // Handle analyze button
+ document.getElementById('analyzeBtn').addEventListener('click', () => {
+ animateStats();
+ });
+
+ // Initialize
+ initChart();
+
+ // Smooth scroll for navigation
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
+ anchor.addEventListener('click', function (e) {
+ e.preventDefault();
+ document.querySelector(this.getAttribute('href')).scrollIntoView({
+ behavior: 'smooth'
+ });
+ });
+ });
+ });