/
hello.html
70 lines (63 loc) · 2.15 KB
/
hello.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
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
<html>
<head>
// <script type="text/javascript" src="./jquery.js" ></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script>
$(document).ready(function(){
var url = "http://storify.com/storifydev/-mozfest-social-media-highlight-day-2-.json";
$.ajax({
type: 'GET',
dataType: 'jsonp',
url: url,
success: function(data){
STORIES = data;
var dict = {}
var elements = STORIES.elements;
for (i in elements) {
var name = elements[i].author.name;
console.log(name)
if (dict[name]) {
dict[name]++;
}else{
dict[name]=1;
};
};
function drawVisualization() {
// Create and populate the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Hashtag');
data.addColumn('string', 'Parent');
data.addColumn('number', 'frequency');
var rows = [["Hashtags",null,0]]
for (i in dict){
rows.push([i, "Hashtags", dict[i]]);
}
data.addRows(rows);
var treemap = new google.visualization.TreeMap(document.getElementById('visualization'));
treemap.draw(data, {
minColor: 'red',
midColor: '#ddd',
maxColor: '#0d0',
headerHeight: 15,
fontColor: 'black',
showScale: true});
}
google.load('visualization', '1', {packages:['treemap'], callback:drawVisualization});
}
});
});
</script>
</head>
<body>
<div id="hello">
hello
</div>
<div id="canvas">
canvas
</div>
<div id="">
<div id="visualization" style="width: 600px; height: 400px; margin-left: 200px;"></div>
</div>
</body>
</html>