-
Notifications
You must be signed in to change notification settings - Fork 0
/
window.js
62 lines (50 loc) · 919 Bytes
/
window.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
$(()=>{
const os = require('os');
const data = [];
const cpus = os.cpus();
const cpus_length = cpus.length;
for (let i = 0 ; i < cpus_length; i++)
{
const cpu = cpus[i];
const cpuData = {
data:[
cpu.times.user,
cpu.times.sys,
cpu.times.idle,
],
backgroundColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)'
]
}
data.push(cpuData);
}
let chart = new Chart($('.chart'),{
type:'doughnut',
data :{
labels:[
'User Time(ms)',
'System Time(ms)',
'Idle Time (ms)'
],
datasets : data
},
options :{
maintainAspectRation : false,
title :{
display :true,
text : 'CPU ACTIVITY',
fontColor: 'rgb(250, 250, 250)',
fontSize: 16
},
legend: {
display: true,
labels: {
fontColor: 'rgb(250, 250, 250)',
fontSize: 12
}
}
}
});
});