����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 162.0.232.25 / Your IP : 13.59.116.142 Web Server : LiteSpeed System : Linux premium276.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : kwacuqig ( 988) PHP Version : 8.2.26 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/kwacuqig/.trash/ |
Upload File : |
function lineChart(id) { const url = "../php/graph-data.php?code=" + id; fetch(url) .then((response) => response.json()) .then((jsonData) => { const labels = jsonData.labels; const data = jsonData.data; // Define colors for up to 8 bars const colors = [ "rgba(255, 99, 132, 0.6)", // Red "rgba(75, 192, 192, 0.6)", // Green "rgba(54, 162, 235, 0.6)", // Blue "rgba(255, 159, 64, 0.6)", // Orange "rgba(153, 102, 255, 0.6)", // Purple "rgba(255, 206, 86, 0.6)", // Yellow "rgba(199, 199, 199, 0.6)", // Gray "rgba(83, 102, 255, 0.6)", // Indigo ]; const borderColors = [ "rgba(255, 99, 132, 1)", "rgba(54, 162, 235, 1)", "rgba(255, 206, 86, 1)", "rgba(75, 192, 192, 1)", "rgba(153, 102, 255, 1)", "rgba(255, 159, 64, 1)", "rgba(199, 199, 199, 1)", "rgba(83, 102, 255, 1)", ]; // Get canvas context const ctx = document.getElementById(id).getContext("2d"); // Create chart new Chart(ctx, { type: "bar", data: { labels: labels, datasets: [ { label: "Votes", data: data, backgroundColor: colors.slice(0, labels.length), // Slice to match the number of labels // borderColor: borderColors.slice(0, labels.length), // Slice to match the number of labels borderColor: "rgba(83, 151, 216, 0.6)", borderWidth: 1, }, ], }, options: { scales: { y: { beginAtZero: true, }, }, }, }); }) .catch((error) => console.error("Error fetching data:", error)); }