From 93b4ca1270745a81be571952e483560c0fc31ab1 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Thu, 12 Apr 2012 07:34:48 +0200 Subject: Split the date at the bottom of the graph and change the orientation to 45° MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/recent_activities.html | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/templates/recent_activities.html b/templates/recent_activities.html index 67643cc..d8b6ace 100644 --- a/templates/recent_activities.html +++ b/templates/recent_activities.html @@ -17,6 +17,8 @@ var dates = ["{{dates_string|join:'","'}}"]; + + var data = {{evolution}}, w = 500, h = 300, @@ -43,8 +45,20 @@ bar.anchor("bottom").add(pv.Label) .textMargin(5) .textAlign("right") .textBaseline("middle") - .textAngle(-Math.PI / 2) - .text(function() dates[this.index]); + .textAngle(-Math.PI / 3) + .text(function() xlabel(this.index)); + +function xlabel(ind){ + if (!dates[ind -1]){ + return dates[ind]; + } + prev = dates[ind - 1]; + cur = dates[ind]; + if (prev.substring(0,7) == cur.substring(0,7)){ + cur = cur.substring(8); + } + return cur; +} var title = vis.add(pv.Label) .left(250) -- cgit