-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
86 lines (80 loc) · 2.11 KB
/
script.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const hamburgerOpen = () =>
(document.getElementById("navbarLinks").style.display = "flex");
const hamburgerClose = () =>
(document.getElementById("navbarLinks").style.display = "none");
const data1 = {
label: ["94% in liquidity",'6% not Stacked'],
datasets: [
{
label: ["94% in liquidity",'6% not Stacked'],
data: [400, 50],
backgroundColor: ["rgb(35, 169, 222)", "rgb(57, 35, 222)"],
hoverBorderWidth: 5, // Increase the border width on hover
hoverBorderColor: ["rgb(35, 169, 222)", "rgb(57, 35, 222)"],
hoverOffset: 4,
borderWidth: 0,
},
],
};
const configure1 = {
type: "doughnut",
data: data1,
options: {
cutout: 90,
plugins: {
legend: false,
centerText: {
display: true,
text: "Distribution",
color: "white",
font: {
size: 16,
},
},
},
},
};
let myDoughnutChart1;
// Get the canvas element
const cntx1 = document.getElementById("myDoughnutChart1").getContext("2d");
if (myDoughnutChart1) myDoughnutChart1.destroy();
// Create and display the Doughnut chart
myDoughnutChart1 = new Chart(cntx1, configure1);
const data2 = {
labels: ["Red", "Blue", "Yellow"],
datasets: [
{
label: ["49.5% USDC","50.49% ETH",],
data: [50, 50],
backgroundColor: ["rgb(57, 35, 222)","rgb(35, 169, 222)", ],
hoverBorderWidth: 5, // Increase the border width on hover
hoverBorderColor: ["rgba(57, 35, 222,.5)","rgba(35, 169, 222,.5)", ], // Set a shadow color on hover
hoverOffset: 4,
borderWidth: 0,
},
],
};
const configure2 = {
type: "doughnut",
data: data2,
options: {
cutout: 90,
plugins: {
legend: false,
centerText: {
display: true,
text: "Distribution",
color: "white",
font: {
size: 16,
},
},
},
},
};
let myDoughnutChart2;
// Get the canvas element
const cntx2 = document.getElementById("myDoughnutChart2").getContext("2d");
if (myDoughnutChart2) myDoughnutChart2.destroy();
// Create and display the Doughnut chart
myDoughnutChart2 = new Chart(cntx2, configure2);