summaryrefslogtreecommitdiff
path: root/p/scripts/repartition.js
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-03-11 22:57:20 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2016-03-11 22:57:20 +0100
commit8dcc0fd65a36adedb12e5d54bafb39e7e553d38b (patch)
treebf47fd99928a6782a309cdd1171516029d4f9611 /p/scripts/repartition.js
parent919c9c83013ea310f01c309f00dea3f8afa9033e (diff)
parent8f4c61a4154641ac22e6d541b6994add3c4803cb (diff)
Merge pull request #1119 from FreshRSS/dev1.3.1-beta
Merge dev in 1.3.1-beta
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();