diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2014-08-28 00:55:22 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2014-08-28 00:55:22 +0200 |
commit | 91f69a2754b38ea4583ef240f589d4da97f55c9d (patch) | |
tree | f6cda5c7ecdf224fb7b896a14131fc2e34d0118c /static | |
parent | 93cd07c81463959b7281a10557ea1d9471b97322 (diff) | |
download | kosten-91f69a2754b38ea4583ef240f589d4da97f55c9d.tar.gz kosten-91f69a2754b38ea4583ef240f589d4da97f55c9d.tar.bz2 kosten-91f69a2754b38ea4583ef240f589d4da97f55c9d.zip |
Add clickable stat points
Diffstat (limited to 'static')
-rw-r--r-- | static/js/kosten.js | 29 | ||||
-rw-r--r-- | static/js/kosten.ls | 26 |
2 files changed, 43 insertions, 12 deletions
diff --git a/static/js/kosten.js b/static/js/kosten.js index 7d77878..e7170cb 100644 --- a/static/js/kosten.js +++ b/static/js/kosten.js @@ -97,9 +97,19 @@ }); }); out$.statJS = statJS = jq(function(){ - var month; + var month, constDialog; setLang(); month = 30 * 24 * 60 * 60 * 1000; + constDialog = function(){ + var df, diag_opts; + df = Highcharts.dateFormat; + diag_opts = { + title: df('%B %Y', this.x) + }; + $.get(df('/stats/_const/%Y/%d', this.x), function(data){ + $(data).dialog(diag_opts); + }); + }; return $('.stats').each(function(){ var x$; x$ = $(this); @@ -112,11 +122,20 @@ }, rangeSelector: { buttons: [], - inputDateFormat: "%d. %b %Y", - inputEditDateFormat: "%d.%m.%Y", + inputDateFormat: "%b %Y", + inputEditDateFormat: "%m.%Y", inputDateParser: function(value){ value = value.split(/\./); - return Date.UTC(value[2], value[1] - 1, value[0], 0, 0, 0, 0); + return Date.UTC(value[1], value[0] - 1, 1, 0, 0, 0, 0); + } + }, + plotOptions: { + series: { + point: { + events: { + click: constDialog + } + } } }, xAxis: { @@ -127,7 +146,7 @@ data: x$.data('stats') }], tooltip: { - pointFormat: "<b>{point.y} €</b><br/>" + pointFormat: '<b>{point.y} €</b><br/>' } }); return x$; diff --git a/static/js/kosten.ls b/static/js/kosten.ls index dea12f3..01bc10c 100644 --- a/static/js/kosten.ls +++ b/static/js/kosten.ls @@ -76,6 +76,16 @@ export statJS = jq -> month = 30d * 24h * 60min * 60s * 1000ms + const-dialog = !-> + df = Highcharts.date-format + diag_opts = + #title: "Konstante Ausgaben #{df '%b %Y' @x}" + title: df '%B %Y' @x + + data <-! $.get df '/stats/_const/%Y/%d' @x + $ data .dialog diag_opts + + <- $ \.stats .each $ @ ..highcharts 'StockChart' do @@ -83,15 +93,17 @@ export statJS = jq -> credits: enabled: false range-selector: buttons: [] - input-date-format: "%d. %b %Y" - input-edit-date-format: "%d.%m.%Y" + input-date-format: "%b %Y" + input-edit-date-format: "%m.%Y" input-date-parser: (value) -> value .= split /\./ - Date.UTC value[2], # year - value[1] - 1, # month ... 0-based -.- - value[0], #day + Date.UTC value[1], # year + value[0] - 1, # month ... 0-based -.- + 1, #day 0,0,0,0 # time - + plot-options: + series: + point: events: click: const-dialog x-axis: min-tick-interval: month min-range: month @@ -99,7 +111,7 @@ export statJS = jq -> data : ..data \stats ] tooltip: - point-format: "<b>{point.y} €</b><br/>" + point-format: '<b>{point.y} €</b><br/>' # Categories |