![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/brickabois.com/public_html/assets/js/ |
/**
* Interactive Data Visualization
*/
function createStatChart(canvasId, data, color) {
const canvas = document.getElementById(canvasId);
if (!canvas) return;
const ctx = canvas.getContext('2d');
const centerX = canvas.width / 2;
const centerY = canvas.height / 2;
const radius = Math.min(centerX, centerY) - 10;
// Draw circular progress
const progress = data / 100; // Assuming max value of 100 for visualization
const startAngle = -Math.PI / 2;
const endAngle = startAngle + (2 * Math.PI * progress);
// Background circle
ctx.beginPath();
ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
ctx.strokeStyle = 'rgba(255, 255, 255, 0.1)';
ctx.lineWidth = 8;
ctx.stroke();
// Progress arc
ctx.beginPath();
ctx.arc(centerX, centerY, radius, startAngle, endAngle);
ctx.strokeStyle = color;
ctx.lineWidth = 8;
ctx.lineCap = 'round';
ctx.stroke();
}
// Animated progress bars
function animateProgressBars() {
const progressBars = document.querySelectorAll('.progress-bar-fill');
progressBars.forEach(bar => {
const target = parseInt(bar.getAttribute('data-progress')) || 0;
let current = 0;
const increment = target / 50;
const timer = setInterval(() => {
current += increment;
if (current >= target) {
current = target;
clearInterval(timer);
}
bar.style.width = current + '%';
}, 20);
});
}
// Initialize on scroll into view
const chartObserver = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
animateProgressBars();
chartObserver.unobserve(entry.target);
}
});
}, { threshold: 0.5 });
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.stats-grid').forEach(grid => {
chartObserver.observe(grid);
});
});