move the stats page to /coastats.html plus some jshint fixes
This commit is contained in:
parent
b6ab53c238
commit
bf8fb8a22e
4 changed files with 61 additions and 71 deletions
|
@ -1,65 +0,0 @@
|
|||
$(document).ready(function () {
|
||||
$.getJSON("../../data/chat_stat_monthly.json", function (data) {
|
||||
updated = data['updated']
|
||||
|
||||
labels = data['labels'];
|
||||
|
||||
graphDisplay($('#byChannel'), data['messagesByChannel'], "Nombre de message par canaux sur 1 an (" + updated + ")");
|
||||
|
||||
graphDisplay($('#byTsunamy'), data['messagesByTsunamy'], "Nombre de message par Tsunami sur 1 an (" + updated + ")");
|
||||
|
||||
graphDisplay($("#usersByChannel"), data['usersByChannel'], "Nombre d'utilisateur actifs par canaux sur 1 an (" + updated + ")");
|
||||
|
||||
graphDisplay($("#usersGlobal"), data['usersGlobal'], "Nombre d'utilisateur actifs sur 1 an (" + updated + ")");
|
||||
});
|
||||
$.getJSON("../../data/chat_stat_daily.json", function (data) {
|
||||
updated = data['updated']
|
||||
|
||||
labels = data['labels'];
|
||||
|
||||
graphDisplay($('#byChannel_daily'), data['messagesByChannel'], "Nombre de message par canaux sur 30 jours (" + updated + ")");
|
||||
|
||||
graphDisplay($('#byTsunamy_daily'), data['messagesByTsunamy'], "Nombre de message par Tsunami sur 30 jours (" + updated + ")");
|
||||
|
||||
graphDisplay($("#usersByChannel_daily"), data['usersByChannel'], "Nombre d'utilisateur actifs par canaux sur 30 jours (" + updated + ")");
|
||||
|
||||
graphDisplay($("#usersGlobal_daily"), data['usersGlobal'], "Nombre d'utilisateur actifs sur 30 jours (" + updated + ")");
|
||||
});
|
||||
});
|
||||
|
||||
function graphDisplay(ctx, data, title) {
|
||||
var chart = new Chart(ctx, {
|
||||
// The type of chart we want to create
|
||||
type: 'bar',
|
||||
|
||||
// The data for our dataset
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: data,
|
||||
},
|
||||
|
||||
// Configuration options go here
|
||||
options: {
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
text: title,
|
||||
position: "top"
|
||||
},
|
||||
responsive: true,
|
||||
scales: {
|
||||
xAxes: [{
|
||||
stacked: true
|
||||
}],
|
||||
yAxes: [{
|
||||
stacked: true,
|
||||
ticks: {
|
||||
stepSize: 500
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
|
||||
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="../../crapaud-fou.css" type="text/css">
|
||||
<link rel="stylesheet" href="crapaud-fou.css" type="text/css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
@ -44,7 +44,7 @@
|
|||
<div class="container">
|
||||
<div class="row pt-2 pb-2">
|
||||
<div class="col-12">
|
||||
<a href="../../"><img src="../../images/crapovecto_small.svg" height="64" class="float-left" /></a>
|
||||
<a href="/"><img src="images/crapovecto_small.svg" height="64" class="float-left" /></a>
|
||||
<h2 class="card-title mt-3 float-right">Les stats de la <a href="https://coa.crapaud-fou.org">mare des crapauds fous</a></h4>
|
||||
|
||||
</div>
|
||||
|
@ -98,14 +98,14 @@
|
|||
Cette page est conçue par mose (design) et Trentry (code)
|
||||
<br>
|
||||
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img
|
||||
alt="Licence Creative Commons" style="border-width:0" src="../../images/cc-by-nc-sa.png"
|
||||
alt="Licence Creative Commons" style="border-width:0" src="images/cc-by-nc-sa.png"
|
||||
class="mr-2" /></a><br>
|
||||
Cette page web est mise à disposition<br>
|
||||
selon les termes de la <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Licence
|
||||
Creative Commons by-nc-sa 4.0</a>.<br>
|
||||
</div>
|
||||
<div class="col-12 col-md-3 text-right tisseurs">
|
||||
<a href="https://tisseurs.org"><img src="../../images/tisseurs.png" class="float-right pt-1 ml-1" width="18" />
|
||||
<a href="https://tisseurs.org"><img src="images/tisseurs.png" class="float-right pt-1 ml-1" width="18" />
|
||||
un site de bas tisseur</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -123,7 +123,7 @@
|
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.min.js"
|
||||
integrity="sha256-xKeoJ50pzbUGkpQxDYHD7o7hxe0LaOGeguUidbq6vis="
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="stats.js"></script>
|
||||
<script src="coastats.js"></script>
|
||||
|
||||
</body>
|
||||
|
55
site/coastats.js
Normal file
55
site/coastats.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
$(document).ready(function () {
|
||||
$.getJSON("data/chat_stat_monthly.json", function (data) {
|
||||
updated = data.updated;
|
||||
labels = data.labels;
|
||||
graphDisplay($('#byChannel'), data.messagesByChannel, "Nombre de messages par canal sur 1 an (" + updated + ")");
|
||||
graphDisplay($('#byTsunamy'), data.messagesByTsunamy, "Nombre de messages par Tsunami sur 1 an (" + updated + ")");
|
||||
graphDisplay($("#usersByChannel"), data.usersByChannel, "Nombre d'utilisateurs actifs par canal sur 1 an (" + updated + ")");
|
||||
graphDisplay($("#usersGlobal"), data.usersGlobal, "Nombre d'utilisateurs actifs sur 1 an (" + updated + ")");
|
||||
});
|
||||
$.getJSON("data/chat_stat_daily.json", function (data) {
|
||||
updated = data.updated;
|
||||
labels = data.labels;
|
||||
graphDisplay($('#byChannel_daily'), data.messagesByChannel, "Nombre de messages par canal sur 30 jours (" + updated + ")");
|
||||
graphDisplay($('#byTsunamy_daily'), data.messagesByTsunamy, "Nombre de messages par Tsunami sur 30 jours (" + updated + ")");
|
||||
graphDisplay($("#usersByChannel_daily"), data.usersByChannel, "Nombre d'utilisateurs actifs par canal sur 30 jours (" + updated + ")");
|
||||
graphDisplay($("#usersGlobal_daily"), data.usersGlobal, "Nombre d'utilisateurs actifs sur 30 jours (" + updated + ")");
|
||||
});
|
||||
});
|
||||
|
||||
function graphDisplay(ctx, data, title) {
|
||||
new Chart(ctx, {
|
||||
// The type of chart we want to create
|
||||
type: 'bar',
|
||||
|
||||
// The data for our dataset
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: data,
|
||||
},
|
||||
|
||||
// Configuration options go here
|
||||
options: {
|
||||
legend: {
|
||||
display: false
|
||||
},
|
||||
title: {
|
||||
display: true,
|
||||
text: title,
|
||||
position: "top"
|
||||
},
|
||||
responsive: true,
|
||||
scales: {
|
||||
xAxes: [{
|
||||
stacked: true
|
||||
}],
|
||||
yAxes: [{
|
||||
stacked: true,
|
||||
ticks: {
|
||||
stepSize: 500
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue