diff options
Diffstat (limited to '')
-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 |