-
Notifications
You must be signed in to change notification settings - Fork 0
/
more-stats.html
193 lines (170 loc) · 8.18 KB
/
more-stats.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta property="og:url" content="https://despinouy.github.io/uruguayo" />
<meta property="og:type" content="article" />
<meta property="og:title" content="Las tablas del Uruguayo" />
<meta property="og:description" content="¿Cansado de buscar las tablas del Campeonato Uruguayo (sobre todo la del descenso)? ¡Acá están!" />
<meta property="og:image" content="https://despinouy.github.io/uruguayo/imgs/auf.jpg" />
<title>Las tablas del Uruguayo</title>
<!-- Begin Bootstrap -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- End Bootstrap -->
<!-- Begin Chart.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js"></script>
<!-- End Chart.js -->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Begin Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-93466496-1', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
<div class="container">
<!-- Static navbar -->
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">Las tablas del Uruguayo</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Inicio</a></li>
<li class="active"><a href="more-stats.html">Más estadísticas</a></li>
<li><a href="https://www.twitter.com/despinoUY">Contacto</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</nav>
<div class="panel panel-default" id="chartParent">
<div class="panel-heading">Gráfico de evolución de posiciones del Torneo Apertura</div>
<!--
<div class="dropdown" style="margin-top: 15px; margin-left: 15px;">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Seleccione un equipo...
<span class="caret"></span>
</button>
<ul class="dropdown-menu" id="team-selector" aria-labelledby="dropdownMenu1">
</ul>
</div>
-->
<canvas id="chartAp" width="100%" height="150px"></canvas>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://getbootstrap.com/dist/js/bootstrap.min.js"></script>
<script type="text/javascript">
// ID of the Google Spreadsheet
var spreadsheetID = "1NHSPAJEYSOqffWPy_pAnVVwsftfk1nisJ9OMWl0d0rQ";
// Make sure it is public or set to Anyone with link can view
var url = "https://spreadsheets.google.com/feeds/list/" + spreadsheetID + "/od6/public/values?alt=json";
function hexToRgbA(hex){
var c;
if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)){
c= hex.substring(1).split('');
if(c.length== 3){
c= [c[0], c[0], c[1], c[1], c[2], c[2]];
}
c= '0x'+c.join('');
return 'rgba('+[(c>>16)&255, (c>>8)&255, c&255].join(',')+',1)';
}
throw new Error('Bad Hex');
};
default_colors = ['#3366CC','#DC3912','#FF9900','#109618','#990099','#3B3EAC','#0099C6','#DD4477','#66AA00','#B82E2E','#316395','#994499','#22AA99','#AAAA11','#6633CC','#E67300','#8B0707','#329262'];
datasets = [];
iter = 0;
function generateGraph(datasets) {
console.log(datasets);
var ctx = document.getElementById("chartAp");
var data = {
labels: ["Fecha 1", "Fecha 2", "Fecha 3", "Fecha 4", "Fecha 5", "Fecha 6", "Fecha 7", "Fecha 8"],
datasets: datasets,
};
var options = {
responsive: true,
legend: {
labels: {
usePointStyle: true,
},
},
scales: {
xAxes: [{
position: 'top',
}],
yAxes: [{
ticks: {
min: 1,
max: 16,
stepSize: 1,
reverse: true,
},
display: true,
}]
}
};
var currentWindowHeight = $(window).height();
var canvas = document.getElementById("chartAp");
var chartHeight = currentWindowHeight - 135;
var lineChartParent = document.getElementById('chartParent');
canvas.width = lineChartParent.clientWidth;
canvas.height = chartHeight;
var myChart = new Chart(ctx, {
type: 'line',
data: data,
options: options,
});
};
$.getJSON(url, function(data) {
var entry = data.feed.entry;
$(entry).each(function(){
elem = {label: '', fill: false, lineTension: 0, data: [], backgroundColor: hexToRgbA(default_colors[iter]), borderColor: hexToRgbA(default_colors[iter]), borderWidth: 1, pointBorderWidth: 2, pointRadius: 2, spanGaps: false};
elem.label = this.gsx$eq3.$t;
elem.data.push(this.gsx$f1.$t);
elem.data.push(this.gsx$f2.$t);
elem.data.push(this.gsx$f3.$t);
elem.data.push(this.gsx$f4.$t);
elem.data.push(this.gsx$f5.$t);
elem.data.push(this.gsx$f6.$t);
elem.data.push(this.gsx$f7.$t);
elem.data.push(this.gsx$f8.$t);
$('#team-selector').append('<li><a href="#" id="teams" team-id="'+iter+'">'+this.gsx$eq3.$t+'</a></li>');
datasets.push(elem);
iter++;
});
generateGraph(datasets);
});
</script>
<script>
</script>
</body>
</html>