From: Marek Janda Date: Wed, 18 Feb 2015 10:21:37 +0000 (+0100) Subject: legend: follow positioning fixes X-Git-Tag: v2.0.0~74^2~1 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=8fb4704f932271e47c6fa32c3fe1705e308b7382;p=dygraphs.git legend: follow positioning fixes --- diff --git a/plugins/legend.js b/plugins/legend.js index b54770f..91e9ddd 100644 --- a/plugins/legend.js +++ b/plugins/legend.js @@ -141,13 +141,13 @@ legend.prototype.select = function(e) { // within the plotter_ area // offset 20 px to the right and down from the first selection point // 20 px is guess based on mouse cursor size - var leftLegend = points[0].x * area.w + 20; - var topLegend = points[0].y * area.h - 20; + var leftLegend = points[0].x * area.w + 50; + var topLegend = points[0].y * area.h - 50; - // if legend floats to end of the window area, it flips to the other + // if legend floats to end of the chart area, it flips to the other // side of the selection point - if ((leftLegend + labelsDivWidth + 1) > (window.scrollX + window.innerWidth)) { - leftLegend = leftLegend - 2 * 20 - labelsDivWidth - (yAxisLabelWidth - area.x); + if ((leftLegend + labelsDivWidth + 1) > area.w) { + leftLegend = leftLegend - 2 * 50 - labelsDivWidth - (yAxisLabelWidth - area.x); } e.dygraph.graphDiv.appendChild(this.legend_div_);