Skip to content

Commit 160ee03

Browse files
committed
hover detail
1 parent 2eebca8 commit 160ee03

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

app/assets/javascripts/controllers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//'use strict';
1+
'use strict';
22

33
/** Controllers */
44
angular.module('birdwatch.controllers', ['birdwatch.services', 'charts.barchart', 'charts.wordcloud', 'ui.bootstrap']).
@@ -28,10 +28,10 @@ angular.module('birdwatch.controllers', ['birdwatch.services', 'charts.barchart'
2828
$scope.search();
2929
};
3030

31-
/** update UI every second to keep time ago for tweets accurate */
31+
/** update UI every two seconds to keep time ago for tweets accurate */
3232
var onTimeout = function () {
3333
$scope.tsdata1 = cf.timeseries();
34-
updateTimeout = $timeout(onTimeout, 1000);
34+
updateTimeout = $timeout(onTimeout, 2000);
3535
};
3636
var updateTimeout = onTimeout();
3737

app/assets/javascripts/directives.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,19 @@ angular.module('birdwatch.directives', ['charts.barchart', 'charts.wordcloud'])
6767
renderer: 'bar',
6868
series: [ {
6969
color: 'steelblue',
70-
data: [ { x: 0, y: 0 } ]
70+
name: 'Tweets',
71+
data: [{ x: 0, y: 0 }, { x: 12*60*60, y: 0 }]
7172
} ]
7273
} );
7374
new Rickshaw.Graph.Axis.Time({ graph: graph });
7475
graph.render();
7576

77+
new Rickshaw.Graph.HoverDetail({
78+
graph: graph,
79+
xFormatter: function(x) { return x/3600+ "" },
80+
yFormatter: function(y) { return y === null ? y : y.toFixed(0); }
81+
});
82+
7683
$scope.$watch("tsdata", function() {
7784
if ($scope.tsdata.length > 0) {
7885
graph.series[0].data = $scope.tsdata;

app/assets/javascripts/services/crossfilter.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
//'use strict';
1+
'use strict';
22

33
// crossfilter service
44
angular.module('birdwatch.services').factory('cf', function (utils) {
55
var exports = {};
66

7-
var df = d3.time.format.utc("%a %b %d %H:%M:%S %Z %Y");
8-
97
// crossfilter object: browser side analytics library, holds array type data (w/incremental updates).
108
// dimensions are fast queries on data, e.g. view sorted by followers_count or retweet_count of the original message
119
var cf = crossfilter([]);

0 commit comments

Comments
 (0)