const form = document.getElementById('healthForm'); const dataTable = document.getElementById('dataTable'); const healthChart = document.getElementById('healthChart').getContext('2d'); let dataRecords = []; // Inisialisasi grafik Chart.js let chart = new Chart(healthChart, { type: 'line', data: { labels: [], // Label untuk tanggal datasets: [ { label: 'Sistolik (mmHg)', data: [], borderColor: '#ff4c4c', backgroundColor: 'rgba(255, 76, 76, 0.2)', fill: true, tension: 0.4 }, { label: 'Diastolik (mmHg)', data: [], borderColor: '#ffa500', backgroundColor: 'rgba(255, 165, 0, 0.2)', fill: true, tension: 0.4 }, { label: 'Kolesterol (mg/dL)', data: [], borderColor: '#00aaff', backgroundColor: 'rgba(0, 170, 255, 0.2)', fill: true, tension: 0.4 } ] }, options: { responsive: true, scales: { y: { beginAtZero: true } } } }); // Menangani Submit Form form.addEventListener('submit', function (e) { e.preventDefault(); const sistolik = parseInt(document.getElementById('sistolik').value); const diastolik = parseInt(document.getElementById('diastolik').value); const kolesterol = parseInt(document.getElementById('kolesterol').value); const tanggal = new Date().toLocaleDateString(); const newData = { tanggal, sistolik, diastolik, kolesterol }; dataRecords