diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2014-01-17 00:36:10 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2014-01-17 00:36:10 +0100 |
commit | 7dc8868361e0f174e211c9a3d158082df5c21a3c (patch) | |
tree | dd3fe351f8c953fe4756a6774bed32fe7467e0de /static/js/kosten.ls | |
parent | f7d4c3c2c8bbcad07c41498e71c5a311f01e0f4b (diff) | |
download | kosten-7dc8868361e0f174e211c9a3d158082df5c21a3c.tar.gz kosten-7dc8868361e0f174e211c9a3d158082df5c21a3c.tar.bz2 kosten-7dc8868361e0f174e211c9a3d158082df5c21a3c.zip |
First statistics :)
Diffstat (limited to 'static/js/kosten.ls')
-rw-r--r-- | static/js/kosten.ls | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/static/js/kosten.ls b/static/js/kosten.ls index 9d8e097..acfb38f 100644 --- a/static/js/kosten.ls +++ b/static/js/kosten.ls @@ -3,6 +3,17 @@ jQuery.fn.extend do jq = (f) -> !-> $ f +# Call this to localize HighCharts +set_lang = -> + Highcharts .setOptions do + lang: + months: [\Januar, \Februar, \März, \April, \Mai, \Juni, \Juli, \August, \September, \Oktober, \November, \Dezember] + shortMonths: [\Jan, \Feb, \Mär, \Apr, \Mai, \Jun, \Jul, \Aug, \Sep, \Okt, \Nov, \Dez] + weekdays: [\Sonntag, \Montag, \Dienstag, \Mittwoch, \Donnerstag, \Freitag, \Samstag] + rangeSelectorFrom: \von + rangeSelectorTo: \bis + rangeSelectorZoom: null + # Add export addJS = jq -> $ 'input[name=date]' .datepicker do @@ -11,6 +22,8 @@ export addJS = jq -> # Show export showJS = jq -> + set_lang! + $ ".detail .heading" .click -> $ @ .closest \.detail .children \.mark:first .click! @@ -50,6 +63,38 @@ export showJS = jq -> for k,v of ..data \pie ] ] +# Statistics +export statJS = jq -> + set_lang! + + month = 30 * 24 * 60 * 60 * 1000 + + <- $ \.stats .each + $ @ + ..highcharts 'StockChart' do + title: text: null + credits: enabled: false + rangeSelector: + buttons: null + inputDateFormat: "%d. %b %Y" + inputEditDateFormat: "%d.%m.%Y" + inputDateParser: (value) -> + value .= split /\./ + Date.UTC(value[2], # year + value[1] - 1, # month ... 0-based -.- + value[0], #day + 0,0,0,0 # time + ) + xAxis: + minTickInterval: month + minRange: month + series: [ + data : ..data \stats + ] + tooltip: + pointFormat: "<b>{point.y} €</b><br/>" + + # Categories export catsJS = jq -> counter = 0 |