-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathview.js
More file actions
20 lines (18 loc) · 798 Bytes
/
view.js
File metadata and controls
20 lines (18 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// update the metrics table, this occurs as every tweet come ins
function updateViewMetrics(){
$("#positive").html(metrics.positiveTweetCount);
$("#neutral").html(metrics.neutralTweetCount);
$("#negative").html(metrics.negativeTweetCount);
$("#positivePerSecond").html(metrics.positivePerSecond);
$("#neutralPerSecond").html(metrics.neutralPerSecond);
$("#negativePerSecond").html(metrics.negativePerSecond);
}
// update counter every 1 second
setInterval(function(){
metrics.seconds++;
$("#seconds").html("Seconds: " + metrics.seconds);
},1000);
// Insert tweet into stream container along with color for this tweet
function insertTweet(new_tweet, color){
$("#tweets").append("<p style='color:" + color +"'>" + new_tweet.name + "______________" + new_tweet.text + "</p>");
};