-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.js
72 lines (61 loc) · 1.93 KB
/
stats.js
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
import 'd3-transition';
import { dsvFormat } from 'd3-dsv';
import './highcharts_theme';
import cf from './cf';
import GameAverageChart from './game_averages';
import { AgeChart } from './age_chart.js';
import PlayerChart from './player_chart';
import CountryChart from './country_chart';
import DisciplineChart from './discipline_chart';
import GenderChart from './gender_chart';
import HandChart from './hand_chart';
import NumberContainer from './number';
import LanePairChart from './lane_pair_chart';
import Table from './table';
import cr from './chart_registry';
import * as R from 'redugator/reducers';
import { averageScoreReducer } from './reducers';
import SquadChart from './squad_chart.js';
const ssv = dsvFormat(';')
function init(data){
cf.addData(data);
cr.register(new GameAverageChart());
cr.register(new PlayerChart());
cr.register(new CountryChart());
cr.register(new DisciplineChart());
cr.register(new GenderChart());
cr.register(new SquadChart());
cr.register(new HandChart());
cr.register(new LanePairChart());
cr.register(new AgeChart());
cr.register(new Table());
cr.register(new NumberContainer({
anchor: '#lowGame',
description: 'Low',
reducer: R.min(x => +x.Score),
accessor: d => d ? d.value.min : 0
}));
cr.register(new NumberContainer({
anchor: '#highGame',
description: 'High',
reducer: R.max(x => +x.Score),
accessor: d => d ? d.value.max : 0
}));
cr.register(new NumberContainer({
anchor: '#avgGame',
description: 'Average',
reducer: averageScoreReducer,
accessor: d => d ? d.value.avg : 0
}));
cr.register(new NumberContainer({
anchor: '#totalScore',
description: 'Total',
reducer: R.sum(x => +x.Score),
accessor: d => d ? d.value.sum : 0
}));
cr.renderAll();
}
fetch('playerstats.csv')
.then(response => response.text())
.then(ssv.parse)
.then(init);