-
Notifications
You must be signed in to change notification settings - Fork 66
/
example.html
27 lines (26 loc) · 909 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
<html>
<head>
<meta charset="UTF-8">
<title>Word Cloud</title>
<script src="../lib/d3/d3.js" charset="utf-8"></script>
<script src="../lib/d3/d3.layout.cloud.js"></script>
<script src="../d3.wordcloud.js"></script>
<script src="example.words.js"></script>
</head>
<body style="text-align: center">
<h1>Word Cloud</h1>
<div id='wordcloud'></div>
<p>This is a word cloud of the first two chapters of Oliver Twist. Some words are clickable.</p>
<p><a href="https://github.com/wvengen/d3-wordcloud">https://github.com/wvengen/d3-wordcloud</a></p>
<script>
d3.wordcloud()
.size([500, 300])
.fill(d3.scale.ordinal().range(["#884400", "#448800", "#888800", "#444400"]))
.words(words)
.onwordclick(function(d, i) {
if (d.href) { window.location = d.href; }
})
.start();
</script>
</body>
</html>