-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunpkg-modules.html
More file actions
60 lines (56 loc) · 1.94 KB
/
Copy pathunpkg-modules.html
File metadata and controls
60 lines (56 loc) · 1.94 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
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font-family: sans-serif;
font-size: 12px;
}
td {
vertical-align: top;
}
</style>
<body>
<script src="//unpkg.com/d3-array@1"></script>
<script src="//unpkg.com/d3-axis@1"></script>
<script src="//unpkg.com/d3-collection@1"></script>
<script src="//unpkg.com/d3-color@1"></script>
<script src="//unpkg.com/d3-dispatch@1"></script>
<script src="//unpkg.com/d3-format@1"></script>
<script src="//unpkg.com/d3-interpolate@1"></script>
<script src="//unpkg.com/d3-latency-heatmap@1"></script>
<script src="//unpkg.com/d3-request@1"></script>
<script src="//unpkg.com/d3-scale@1"></script>
<script src="//unpkg.com/d3-selection@1"></script>
<script src="//unpkg.com/d3-time@1"></script>
<script src="//unpkg.com/d3-time-format@2"></script>
<div id="chart"></div>
<script>
(function() {
var nCols = 100;
var nRows = 50;
var data = [];
var dt = new Date(new Date().getTime() - nCols * 1000);
for (var i = 0; i < nCols; ++i) {
dt = new Date(dt.getTime() + 1000);
for (var j = 0; j < nRows; ++j) {
data.push({
date: dt,
bucket: j,
count: Math.random()
});
}
}
var chart = d3.latencyHeatmap()
.x(function (d) { return d.date; })
.y(function (d) { return +d.bucket; })
.yFormat(function(d) { return d + " s"; })
.count(function(d) { return +d.count; })
.colorRange([d3.rgb('#FFFFFF'), d3.rgb('#5B82A1')])
.tooltipText(function (d) { return "YearMonth: " + d[0].toISOString().substring(0, 7) + "\nBucket: " + d[1] + "\nCount: " + d[2]; })
.rectSize([8, 8]);
d3.select("#chart")
.datum(data)
.call(chart);
})();
</script>
</body>