Files
html/generated/file_05.txt
WEVIA 01ce7627ea
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
Wave 114 auto
2026-04-12 23:12:51 +02:00

40 lines
919 B
Plaintext

// components/chart.js
const ctx = document.getElementById('mainChart').getContext('2d');
let chart;
export async function updateChart() {
const res = await fetch('/api/metrics');
const data = await res.json();
if (chart) chart.destroy();
chart = new Chart(ctx, {
type: 'line',
data: {
labels: data.timeline,
datasets: [
{
label: 'Utilisation CPU',
data: data.cpu,
borderColor: '#FF6B6B',
tension: 0.1
},
{
label: 'Mémoire (GB)',
data: data.memory,
borderColor: '#4ECDC4',
tension: 0.1
}
]
},
options: { responsive: true, maintainAspectRatio: false }
});
document.getElementById('metrics').innerHTML = `
<p>Dernière mise à jour : ${new Date().toLocaleTimeString()}</p>
`;
}
// Rafraîchissement auto
setInterval(updateChart, 30000);
updateChart();