diff options
| author | 2021-10-16 12:00:07 +0200 | |
|---|---|---|
| committer | 2021-10-16 12:00:07 +0200 | |
| commit | 02641de32ecc6e0e4fd9de030399728080b6ed41 (patch) | |
| tree | c01ce17b89c8225f51a796e0bef589498e56a14f /p/scripts/repartition.js | |
| parent | ebf9c70ebd4356d98fa7c2513aaab48fa14c7c9b (diff) | |
Stats: replace flotr2 with chart.js (#3858)
* include Chart.js
* page: main statistics. Flotr.js replaced with Chart.js
* main stats + repartition
* Delete: repartition.js + stats.js
* delete flotr2
* add libs in README
* polish
* code polish
* fixed amount of week days and months
* added manget link for LibreJS
* added: @license-end
* phpcbf + jshint formatting
* delete old code
* fix stats
* fix Comments
* finally I found the issue and fixed its best
* fix the month stats
* Whitespace fixes
* Remove flotr2
* Rename to chart.min.js
* Remove console.log
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'p/scripts/repartition.js')
| -rw-r--r-- | p/scripts/repartition.js | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/p/scripts/repartition.js b/p/scripts/repartition.js deleted file mode 100644 index 0bc4e25c2..000000000 --- a/p/scripts/repartition.js +++ /dev/null @@ -1,75 +0,0 @@ -// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0 -"use strict"; -/* globals Flotr, numberFormat */ -/* jshint esversion:6, strict:global */ - -function initStats() { - if (!window.Flotr) { - if (window.console) { - console.log('FreshRSS waiting for Flotr…'); - } - window.setTimeout(initStats, 50); - return; - } - const jsonRepartition = document.getElementById('jsonRepartition'), - stats = JSON.parse(jsonRepartition.innerHTML); - // Entry per hour - Flotr.draw(document.getElementById('statsEntryPerHour'), - [{ - data: stats.repartitionHour, - bars: {horizontal: false, show: true} - }], - { - grid: {verticalLines: false}, - xaxis: {noTicks: 23, - tickFormatter: function(x1) { - return 1 + parseInt(x1); - }, - 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(x2) { - return stats.days[parseInt(x2)]; - }, - 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(x3) { - return stats.months[parseInt(x3) - 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(); - -window.addEventListener('resize', initStats); -// @license-end |
