-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
40 lines (36 loc) · 952 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const chartData = {
labels: ["Occasions" ,"ISA","2020", "2021", "2022", "2023"],
data: [0,25, 30, 40, 55, 63],
};
const myChart = document.querySelector(".my-chart");
const ul = document.querySelector(".programming-stats .details ul");
new Chart(myChart, {
type: "doughnut",
data: {
labels: chartData.labels,
datasets: [
{
label: "NET SALES & PROFITS",
data: chartData.data,
},
],
},
options: {
borderWidth: 10,
borderRadius: 2,
hoverBorderWidth: 0,
plugins: {
legend: {
display: false,
},
},
},
});
const populateUl = () => {
chartData.labels.forEach((l, i) => {
let li = document.createElement("li");
li.innerHTML = `${l}: <span class='percentage'>${chartData.data[i]}%</span>`;
ul.appendChild(li);
});
};
populateUl();