-
Notifications
You must be signed in to change notification settings - Fork 4
/
fetch.html
156 lines (128 loc) · 4.78 KB
/
fetch.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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<head>
<!-- Plotly.js -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<div id="container">
<div id="header">
<div id="title"><p><img src="images/logo.png" width= 45px height=45px/> Fetchbook</p></div>
<div id="profilepill">
<img src="profilepicture.jpg" />
<div id="texts">
<p>Logged in as <span>Danny Sutanto</span></p>
<p id="logout">Click here to <a href="index.html">Logout</a></p>
</div>
</div>
</div>
<!-- ================================================== -->
<div id="greeting">
<h2>"Hi Danny Sutanto!"</h2>
<h3>Click the button below to select a Facebook page to analyze:</h3>
<div id="dropdown_container">
<div class="dropdown">
<button onclick="showdropdown()" class="dropbtn">Select a Facebook Page</button>
<div id="myDropdown" class="dropdown-content">
<a href="fetch%20Mohini.html">Texas Mohini Group</a>
<a href="fetch%20UT.html">UT Austin Official Page</a>
<a href="fetch%20NBA.html">NBA Memes Group</a>
<a href="fetch.html">Reset</a>
</div>
</div>
</div>
</div>
<!-- ================================================== -->
<div id="plotgrid">
<div class="empties"></div>
<div class="empties"></div>
</div>
<!-- ================================================== -->
<div id="footer">
<h3>EE461L PROJECT FETCHBOOK</h3>
<h4>Justin Liang, Zhaofeng Liang, Ashvin Roharia, Nicholas Sutanto, Zach Dewey</h4>
</div>
</div>
<!-- ===================================================== -->
<script>
/* When the user clicks on the button, toggle between hiding and showing the dropdown content */
function showdropdown() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown menu if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
/*
<!-- GRAPH 1 -->
function makeplot() {
Plotly.d3.csv("103420729696747_facebook_statuses.csv", function(data){ processData(data) } );
};
function processData(allRows) {
console.log(allRows);
var x = [], y = [];
for (var i=0; i<allRows.length; i++) {
row = allRows[i];
x.push( row['status_published'] );
y.push( row['num_reactions'] );
}
console.log( 'X',x, 'Y',y );
makePlotly( x, y, );
}
function makePlotly( x, y ){
var plotDiv = document.getElementById("plot");
var traces = [{
x: x,
y: y
}];
Plotly.newPlot('figure1', traces,
{title: 'Number of Reactions'});
};
makeplot();
<!-- GRAPH 2 -->
Plotly.d3.csv("103420729696747_facebook_statuses.csv", function(err, rows){
function unpack(rows, key) {
return rows.map(function(row) { return row[key]; });
}
var trace1 = {
name: "Likes",
type: "scatter",
mode: "lines",
x: unpack(rows, 'status_published'),
y: unpack(rows, 'num_reactions'),
line: {color: '#17BECF'}
}
var trace2 = {
name: "Comments",
type: "scatter",
mode: "lines",
x: unpack(rows, 'status_published'),
y: unpack(rows, 'num_comments'),
line: {color: '#7F7F7F'}
}
var data = [trace1,trace2];
var layout = {
title: 'Number of Reactions & Comments',
xaxis: {
title: 'Date',
type: 'date'
},
yaxis: {
autorange: true,
title: 'Number of People',
type: 'linear'
}
};
Plotly.newPlot('figure2', data, layout);
})
*/
</script>
</body>