From: Marcel Werk Date: Thu, 5 Jan 2017 15:48:23 +0000 (+0100) Subject: Fixed badge position in statistics chart X-Git-Tag: 3.0.0~42 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a16e5980fee75a5ef029213498c2ac88da498b78;p=GitHub%2FWoltLab%2FWCF.git Fixed badge position in statistics chart --- diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index 477f3a4f15..64bb1ff583 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -2469,7 +2469,7 @@ WCF.ACP.Stat.Chart = Class.extend({ tickFormatter: function(val) { return WCF.String.addThousandsSeparator(val); } - }, + } }; var $data = [ ]; @@ -2484,13 +2484,24 @@ WCF.ACP.Stat.Chart = Class.extend({ $.plot("#chart", $data, options); - $("#chart").on("plothover", function(event, pos, item) { - if (item) { - $("#chartTooltip").html(item.series.xaxis.tickFormatter(item.datapoint[0], item.series.xaxis) + ', ' + WCF.String.formatNumeric(item.datapoint[1]) + ' ' + item.series.label).css({top: item.pageY + 5, left: item.pageX + 5}).wcfFadeIn(); - } - else { - $("#chartTooltip").hide(); - } + require(['Ui/Alignment'], function (UiAlignment) { + var span = elCreate('span'); + span.style.setProperty('position', 'absolute', ''); + document.body.appendChild(span); + $("#chart").on("plothover", function(event, pos, item) { + if (item) { + span.style.setProperty('top', item.pageY + 'px', ''); + span.style.setProperty('left', item.pageX + 'px', ''); + $("#chartTooltip").html(item.series.xaxis.tickFormatter(item.datapoint[0], item.series.xaxis) + ', ' + WCF.String.formatNumeric(item.datapoint[1]) + ' ' + item.series.label).show(); + UiAlignment.set($("#chartTooltip")[0], span, { + verticalOffset: 5, + horizontal: 'center' + }); + } + else { + $("#chartTooltip").hide(); + } + }); }); if (!$data.length) {