From 91f69a2754b38ea4583ef240f589d4da97f55c9d Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Thu, 28 Aug 2014 00:55:22 +0200 Subject: Add clickable stat points --- static/js/kosten.js | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'static/js/kosten.js') 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: "{point.y} €
" + pointFormat: '{point.y} €
' } }); return x$; -- cgit v1.2.3-54-g00ecf