52 lines
No EOL
1.5 KiB
JavaScript
52 lines
No EOL
1.5 KiB
JavaScript
$(document).ready(function () {
|
|
$.getJSON("../../data/chat_stat_monthly.json", function (datas) {
|
|
updated = datas['updated']
|
|
|
|
labels = datas['labels'];
|
|
|
|
graphDisplay($('#byChannel'), datas['messagesByChannel'], "Nombre de message par canaux (" + updated + ")");
|
|
|
|
graphDisplay($('#byTsunamy'), datas['messagesByTsunamy'], "Nombre de message par Tsunami (" + updated + ")");
|
|
|
|
graphDisplay($("#usersByChannel"), datas['usersByChannel'], "Nombre d'utilisateur actifs par canaux (" + updated + ")");
|
|
|
|
graphDisplay($("#usersGlobal"), datas['usersGlobal'], "Nombre d'utilisateur actifs (" + updated + ")");
|
|
});
|
|
});
|
|
|
|
function graphDisplay(ctx, datas, 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: datas,
|
|
},
|
|
|
|
// 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
|
|
}
|
|
}]
|
|
}
|
|
}
|
|
});
|
|
} |