forked from dsjoerg/ggtracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwinrate.js
More file actions
43 lines (36 loc) · 1.27 KB
/
winrate.js
File metadata and controls
43 lines (36 loc) · 1.27 KB
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
gg.controller('WinrateController', ['$scope', '$element', '$urlFilter', 'MatchupStats',
function ($scope, $element, $urlFilter, MatchupStats) {
$scope.timeperiod = 'patch_153';
$scope.filter = $urlFilter;
$scope.filter.defaults = {
timeperiod: 'patch_153',
}
$scope.filter.onChange = function(){
$scope.filter.apply($scope);
$scope.refresh();
}
$scope.refresh = function(params) {
$scope.new_ms = new MatchupStats.get($scope.filter.urlParams(), function() {
$scope.ms = $scope.new_ms
$scope.matchups = [["P","Z", "PvZ"], ["Z","T","ZvT"], ["T","P","TvP"]];
$scope.leagues = [0,1,2,3,4,5,6];
$scope.nowdt = Date.parse($scope.ms.now)
});
}
$scope.$watch('timeperiod', function(v) {
$scope.filter.params.timeperiod = $scope.timeperiod;
});
$scope.raceName = function(racechar) {
return Sc2.race_names[racechar];
}
$scope.msdata = function(matchup, league, item) {
if (item == '2sde') {
return (100.0 / Math.sqrt($scope.ms[matchup][league]['num_matches'])).toFixed(1);
}
return $scope.ms[matchup][league][item];
}
$scope.prettyDataDate = function() {
return Highcharts.dateFormat('%A, %b %e, %H:%M UTC', $scope.nowdt);
}
}
]);