aboutsummaryrefslogtreecommitdiff
path: root/p/scripts/repartition.js
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2016-07-23 17:11:38 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2016-07-23 17:11:38 +0200
commit3f705cf03ccd919e0930bc3e95b98daff9f0560a (patch)
treee12c530198e3d5ee7032d5aaa381e7ecc8781cdf /p/scripts/repartition.js
parentca6ca218dca17c3806191f72fa2b3fe02acc1692 (diff)
parent43f3be7098a908321c29a14a1fbe542389479155 (diff)
Merge branch 'dev'
Diffstat (limited to 'p/scripts/repartition.js')
-rw-r--r--p/scripts/repartition.js72
1 files changed, 72 insertions, 0 deletions
diff --git a/p/scripts/repartition.js b/p/scripts/repartition.js
new file mode 100644
index 000000000..a391de2f2
--- /dev/null
+++ b/p/scripts/repartition.js
@@ -0,0 +1,72 @@
+"use strict";
+function initStats() {
+ if (!window.Flotr) {
+ if (window.console) {
+ console.log('FreshRSS waiting for Flotr…');
+ }
+ window.setTimeout(initStats, 50);
+ return;
+ }
+ var jsonRepartition = document.getElementById('jsonRepartition'),
+ stats = JSON.parse(jsonRepartition.innerHTML);
+ jsonRepartition.outerHTML = '';
+ // Entry per hour
+ Flotr.draw(document.getElementById('statsEntryPerHour'),
+ [{
+ data: stats.repartitionHour,
+ bars: {horizontal: false, show: true}
+ }],
+ {
+ grid: {verticalLines: false},
+ xaxis: {noTicks: 23,
+ tickFormatter: function(x) {
+ var x = parseInt(x);
+ return x + 1;
+ },
+ min: -0.9,
+ max: 23.9,
+ tickDecimals: 0},
+ yaxis: {min: 0},
+ mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}}
+ });
+ // Entry per day of week
+ Flotr.draw(document.getElementById('statsEntryPerDayOfWeek'),
+ [{
+ data: stats.repartitionDayOfWeek,
+ bars: {horizontal: false, show: true}
+ }],
+ {
+ grid: {verticalLines: false},
+ xaxis: {noTicks: 6,
+ tickFormatter: function(x) {
+ var x = parseInt(x);
+ return stats.days[x];
+ },
+ min: -0.9,
+ max: 6.9,
+ tickDecimals: 0},
+ yaxis: {min: 0},
+ mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}}
+ });
+ // Entry per month
+ Flotr.draw(document.getElementById('statsEntryPerMonth'),
+ [{
+ data: stats.repartitionMonth,
+ bars: {horizontal: false, show: true}
+ }],
+ {
+ grid: {verticalLines: false},
+ xaxis: {noTicks: 12,
+ tickFormatter: function(x) {
+ var x = parseInt(x);
+ return stats.months[(x - 1)];
+ },
+ min: 0.1,
+ max: 12.9,
+ tickDecimals: 0},
+ yaxis: {min: 0},
+ mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}}
+ });
+
+}
+initStats();