diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-05-17 23:07:35 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-05-17 23:07:35 +0000 |
commit | 80e1b696eb2b1bb15822bccd5baa0181bc406792 (patch) | |
tree | 17cf76937ac25cf35f6c8ebb0c8118b488ae66de | |
parent | 5d9ad62cb3940986954c4ba48645fc1506f0ea82 (diff) | |
download | mgatres-80e1b696eb2b1bb15822bccd5baa0181bc406792.tar mgatres-80e1b696eb2b1bb15822bccd5baa0181bc406792.tar.gz mgatres-80e1b696eb2b1bb15822bccd5baa0181bc406792.tar.bz2 mgatres-80e1b696eb2b1bb15822bccd5baa0181bc406792.tar.xz mgatres-80e1b696eb2b1bb15822bccd5baa0181bc406792.zip |
Add donations graphs
git-svn-id: svn+ssh://svn.mageia.org/svn/soft/mga-treasurer/trunk@8323 5b7c3c08-40e5-403b-9995-ace06908e4af
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | tmpl/donations.html | 26 | ||||
-rw-r--r-- | tmpl/donations_by_year.html | 28 | ||||
-rw-r--r-- | tmpl/head_chart.html | 6 |
4 files changed, 63 insertions, 0 deletions
@@ -1,3 +1,6 @@ + +- add donations graphs + Version 0.3 - sort transactions by category diff --git a/tmpl/donations.html b/tmpl/donations.html index fef42b4..435b95d 100644 --- a/tmpl/donations.html +++ b/tmpl/donations.html @@ -2,6 +2,7 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>[% config.sitename %] Donations</title> + [% INCLUDE head_chart.html %] </head> <body> [%- USE date(format='%Y/%m/%d') -%] @@ -20,6 +21,31 @@ </ul> <h3>Donations per year</h3> + + <canvas id="donations_history_bar_chart" height="250" width="[% 80 + donations.by_year.keys.size * 65 %]"></canvas> + + <script> + + var barChartData = { + labels : ["[% donations.by_year.keys.sort.reverse.join('","') %]"], + datasets : [ + { + fillColor : "#151f79", + strokeColor : "#101333", + data : [ + [%- FOR year IN donations.by_year.keys.sort.reverse -%] + [%- donations.by_year.$year.total -%] + [%- IF ! loop.last() -%],[%- END -%] + [%- END %]] + } + ] + + } + + var myLine = new Chart(document.getElementById("donations_history_bar_chart").getContext("2d")).Bar(barChartData); + + </script> + <ul> [%- FOR year IN donations.by_year.keys.sort.reverse %] <li><a href="donations_y_[% year %].html">[% year %]: [% donations.by_year.$year.total %] Euros</a></li> diff --git a/tmpl/donations_by_year.html b/tmpl/donations_by_year.html index f81325c..c9a963f 100644 --- a/tmpl/donations_by_year.html +++ b/tmpl/donations_by_year.html @@ -2,6 +2,7 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>[% config.sitename %]: Donations for [% year %]</title> + [% INCLUDE head_chart.html %] </head> <body> <h1>Mageia.Org donations for year [% year %]</h1> @@ -17,6 +18,33 @@ [%- END -%] </ul> <h3>Donations for each month</h3> + + [% IF donations.by_year.$year.months.size > 1 %] + <canvas id="donations_history_bar_chart" height="250" width="[% 80 + donations.by_year.$year.months.size * 65 %]"></canvas> + + <script> + + var barChartData = { + labels : ["[% donations.by_year.$year.months.sort.join('","') %]"], + datasets : [ + { + fillColor : "#151f79", + strokeColor : "#101333", + data : [ + [%- FOR month IN donations.by_year.$year.months.sort -%] + [%- donations.by_month.$month.total -%] + [%- IF ! loop.last() -%],[%- END -%] + [%- END %]] + } + ] + + } + + var myLine = new Chart(document.getElementById("donations_history_bar_chart").getContext("2d")).Bar(barChartData); + + </script> + [% END %] + <ul> [%- FOR month IN donations.by_month.keys.sort -%] [%- IF donations.by_month.$month.year == year -%] diff --git a/tmpl/head_chart.html b/tmpl/head_chart.html new file mode 100644 index 0000000..a808d98 --- /dev/null +++ b/tmpl/head_chart.html @@ -0,0 +1,6 @@ + <script src="[% config.staticdir_url %]/Chart.js"></script> + <meta name = "viewport" content = "initial-scale = 1, user-scalable = no"> + <style> + canvas{ + } + </style> |