From: gregor herrmann Date: Thu, 2 Aug 2018 11:23:40 +0000 (+0200) Subject: format tooltip names depending on water/air X-Git-Url: https://git.toastfreeware.priv.at/chrisu/seepark.git/commitdiff_plain/0851c4f3b1edeae5f12107cd38a2fb241c724244 format tooltip names depending on water/air --- diff --git a/web/static/seepark_web.js b/web/static/seepark_web.js index e663296..816b6a5 100644 --- a/web/static/seepark_web.js +++ b/web/static/seepark_web.js @@ -88,10 +88,17 @@ function dayschart(element, title, days, xtickformat) { }, tooltip: { format: { + // TODO: maybe move to top name: function (name, ratio, id, index) { - var re = /\d m/; - var res = re.exec(name); - return res; + var prefix = ''; + if (element.substr(0, 7) == 'chart_w') { + var re = /\d m/; + prefix = 'Wasser '; + } else { + var re = /Luft/; + }; + var result = re.exec(name); + return prefix + result; }, value: function (value, ratio, id, index) { return value.toFixed(2) + '°';