-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhdd.html
More file actions
139 lines (127 loc) · 3.08 KB
/
hdd.html
File metadata and controls
139 lines (127 loc) · 3.08 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<html>
<head>
<title>Hard Disk Usage Heat Map</title>
<style>
#hdd1 {width:2048; height:1024}
#hdd2 {width:1024; height:768}
#hdd3 {width:1024; height:768}
#hdd4 {width:1024; height:768}
</style>
<script src="heatmap.js"></script>
<script src="http://su.bdimg.com/static/superplus/js/lib/jquery-1.10.2_d88366fd.js"></script>
</head>
<body>
<div id = "table">
<table>
<tr>
<td>Hard Disk 1</td>
<td>Hard Disk 2</td>
</tr>
<tr>
<td>
<div id="hdd1" />
</td>
<td>
<div id="hdd2" />
</td>
</tr>
<tr>
<td>Hard Disk 3</td>
<td>Hard Disk 4</td>
</tr>
<tr>
<td>
<div id="hdd3" />
</td>
<td>
<div id="hdd4" />
</td>
</tr>
</table>
</div>
<script>
function createPoint(x_val, y_val, val_val, radius_val)
{
var point = {
x:x_val,
y:y_val,
value:val_val,
radius:radius_val,
}
return point;
}
function load(hddId, points) {
var heatmapInstance = h337.create(
{
container: document.getElementById(hddId),
blur:.85,
gradient: {
// enter n keys between 0 and 1 here
// for gradient color customization
0:"#FFECEC",
0.0625:"#FFD2D2",
0.125:"#FFB5B5",
0.1875:"#FF9797",
0.25:"#FF7575",
0.3125:"#FF5151",
0.375:"#FF2D2D",
0.4375:"#FF0000",
0.5:"#EA0000",
0.5625:"#CE0000",
0.625:"#AE0000",
0.6875:"#930000",
0.75:"#750000",
0.8125:"#600000",
0.875:"#4D0000",
0.9375:"#2F0000",
},
});
//var points = [];
// var max = 0;
// var width = 2048;
// var height = 1024;
//
// var len = 2000000
// while (len--) {
// var val = Math.floor(Math.random()*1000);
// // now also with custom radius
// //var radius = Math.floor(Math.random()*70);
// radius = 1;
//
// max = Math.max(max, val);
// var point = {
// x: Math.floor(Math.random()*width),
// y: Math.floor(Math.random()*height),
// value: val,
// // radius configuration on point basis
// radius: radius
// };
// points.push(point);
//console.log(point);
// }
// console.log('max: ' + max);
// max = 100;
// points.push(createPoint(150,150,40,1));
// points.push(createPoint(250,250,80,1));
// heatmap data format
var data = {
max: 100,
data: points
};
// if you have a set of datapoints always use setData instead of addData
// for data initialization
heatmapInstance.setData(data);
}
$.getJSON("data/hdd.json", function( points ) {
load("hdd1", points);
})
.fail(function(jqxhr, textStatus, error) {
var err = textStatus + "," + error;
console.log("request failed: " + err);
});
//load("hdd2")
//load("hdd3")
//load("hdd4")
</script>
</body>
</html>