-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathexample.html
44 lines (40 loc) · 918 Bytes
/
example.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
<html>
<head>
<title>Histogram</title>
<style>
body {
padding: 100px;
background: #2f2c2b;
font: 100 14px Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
color: white;
}
.histogram {
margin: 5px 0;
}
</style>
<link rel="stylesheet" type="text/css" href="histogram.css">
</head>
<body>
<h1>Histogram</h1>
<script src="build/build.js"></script>
<script>
var Histogram = require('histogram');
var h = new Histogram;
h.bins(150);
h.size(650, 160);
h.add(rand(10, 1), { color: '#6abb8a' });
h.add(rand(20, 2), { color: '#f7e7a0' });
h.add(rand(5, .5), { color: '#81e7da' });
document.body.appendChild(h.render());
function rand(a, b) {
var d = [];
var n = 1000;
while (n--) {
d.push(a + Math.random() * (15 * b));
}
return d;
}
</script>
</body>
</html>