diff options
Diffstat (limited to 'static')
-rw-r--r-- | static/js/kosten.js | 54 | ||||
-rw-r--r-- | static/js/kosten.ls | 24 |
2 files changed, 59 insertions, 19 deletions
diff --git a/static/js/kosten.js b/static/js/kosten.js index a1c30fb..936e38c 100644 --- a/static/js/kosten.js +++ b/static/js/kosten.js @@ -1,4 +1,4 @@ -// Generated by LiveScript 1.2.0 +// Generated by LiveScript 1.4.0 (function(){ var jq, setLang, extendDate, addJS, showJS, statJS, catsJS, out$ = typeof exports != 'undefined' && exports || this; jQuery.fn.extend({ @@ -135,12 +135,12 @@ }); }); out$.statJS = statJS = jq(function(){ - var month, constDialog; + var df, month, constDialog; setLang(); + df = Highcharts.dateFormat; month = 30 * 24 * 60 * 60 * 1000; constDialog = function(){ - var df, time; - df = Highcharts.dateFormat; + var time; time = this.x; $.get(df('/stats/_const/%Y/%m', time), function(data){ $(data).dialog({ @@ -169,11 +169,7 @@ }, plotOptions: { series: { - point: { - events: { - click: constDialog - } - } + stacking: 'normal' } }, chart: { @@ -194,12 +190,42 @@ minTickInterval: month, minRange: month }, - series: [{ - data: x$.data('stats'), - step: 'left' - }], + yAxis: { + reversedStacks: false, + tickInterval: 250 + }, + series: [ + { + data: x$.data('consts'), + step: 'left', + name: 'Konstant', + point: { + events: { + click: constDialog + } + } + }, { + data: x$.data('expenses'), + name: 'Variabel', + step: 'left' + } + ], tooltip: { - pointFormat: '<b>{point.y} €</b><br/>' + shared: true, + formatter: function(){ + var header, body, p, footer; + header = "<span style=\"font-size: 10px\">" + df('%B %Y', this.x) + "</span><br/>"; + body = (function(){ + var i$, ref$, len$, results$ = []; + for (i$ = 0, len$ = (ref$ = this.points).length; i$ < len$; ++i$) { + p = ref$[i$]; + results$.push(p.series.name + ": <b>" + p.point.y + " €</b><br/>"); + } + return results$; + }.call(this)).join(''); + footer = "<strong>Summe: " + this.points[0].total + "</strong>"; + return header + body + footer; + } } }); }); diff --git a/static/js/kosten.ls b/static/js/kosten.ls index 163d670..699fcd4 100644 --- a/static/js/kosten.ls +++ b/static/js/kosten.ls @@ -113,10 +113,10 @@ export showJS = jq !-> export statJS = jq !-> set-lang! + df = Highcharts.date-format month = 30d * 24h * 60min * 60s * 1000ms const-dialog = !-> - df = Highcharts.date-format time = @x data <-! $.get df '/stats/_const/%Y/%m' time @@ -140,7 +140,7 @@ export statJS = jq !-> 0,0,0,0 # time plot-options: series: - point: events: click: const-dialog + stacking: \normal chart: events: click: !-> @@ -151,13 +151,27 @@ export statJS = jq !-> x-axis: min-tick-interval: month min-range: month + y-axis: + reversed-stacks: false + tick-interval: 250 series: [ - data: ..data \stats + # const + * data: ..data \consts + step: \left + name: \Konstant + point: events: click: const-dialog + # normal exps + * data: ..data \expenses + name: \Variabel step: \left ] tooltip: - point-format: '<b>{point.y} €</b><br/>' - + shared: true + formatter: -> + header = "<span style=\"font-size: 10px\">#{df '%B %Y' @x}</span><br/>" + body = ["#{p.series.name}: <b>#{p.point.y} €</b><br/>" for p in @points] .join '' + footer = "<strong>Summe: #{@points.0.total}</strong>" + header + body + footer # Categories export catsJS = jq !-> |