From cc072c50001a64314bc521d795be79a463720f48 Mon Sep 17 00:00:00 2001 From: Amir Kamran Date: Fri, 23 Jun 2017 05:19:43 +0200 Subject: [PATCH] correction --- .../src/main/webapp/themes/UFAL/lib/js/piwik_charts.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dspace-xmlui/src/main/webapp/themes/UFAL/lib/js/piwik_charts.js b/dspace-xmlui/src/main/webapp/themes/UFAL/lib/js/piwik_charts.js index f50cac9871f8..b197f80e26e0 100644 --- a/dspace-xmlui/src/main/webapp/themes/UFAL/lib/js/piwik_charts.js +++ b/dspace-xmlui/src/main/webapp/themes/UFAL/lib/js/piwik_charts.js @@ -80,9 +80,16 @@ plotViews = function (div, data, color, tf, ti, highlightString) { var ticks = []; if(current_view == "year") { - ticks = Object.keys(data) + try{ + ticks = Object.keys(data) .filter(function(e) { return e !== 'total' && !e.startsWith('nb') }) .sort(function(a,b){return parseInt(a)-parseInt(b)}); + }catch(e){ + var cy = new Date().getFullYear(); + for(var i=cy-5;i<=cy;i++) { + ticks.push("" + i); + } + } } else if(current_view == "month") {