-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
61 lines (55 loc) · 1.42 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Donut Chart Example</title>
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<script src="/socket.io/socket.io.js"></script>
</head>
<body>
<div id="chart"></div>
<script>
const socket = io();
let a = 40,b = 30,c = 20,d = 10;
var options = {
chart: {
type: 'donut',
expandOnClick: true,
},
series: [a, b, c, d],
labels: ['Segment 1', 'Segment 2', 'Segment 3', 'Segment 4'],
colors: ['#6366F1', '#8B5CF6', '#A78BFA', '#C4B5FD'],
plotOptions: {
pie: {
expandOnClick: true,
donut: {
size: '34%',
}
}
},
dataLabels: {
enabled: false // Show or hide data labels
},
legend: {
show: true // Show or hide the legend
},
tooltip: {
enabled: true // Show or hide tooltips
}
};
var chart = new ApexCharts(document.querySelector("#chart"), options);
//chart.render();
socket.on('broadcast msg', (msg) => {
a = msg[0];
b = msg[1];
c = msg[2];
d = msg[3];
console.log(a);
options.series = [a,b,c,d];
var chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();
});
</script>
</body>
</html>