From: Dan Vanderkam Date: Sun, 23 Nov 2014 20:56:22 +0000 (-0500) Subject: cleanup X-Git-Tag: v1.1.0~12^2 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=626b90aa2b1747d7ba8bcb939c8560fa16bbdb94;p=dygraphs.git cleanup --- diff --git a/dygraph.js b/dygraph.js index 65634eb..b1af8de 100644 --- a/dygraph.js +++ b/dygraph.js @@ -314,8 +314,6 @@ Dygraph.DEFAULT_ATTRS = { // TODO(danvk): support 'onmouseover' and 'never', and remove synonyms. legend: 'onmouseover', // the only relevant value at the moment is 'always'. - legendFollow: false, - stepPlot: false, avoidMinZero: false, xRangePad: 0, diff --git a/plugins/legend.js b/plugins/legend.js index a5b434c..bb86949 100644 --- a/plugins/legend.js +++ b/plugins/legend.js @@ -125,19 +125,19 @@ legend.prototype.select = function(e) { var xValue = e.selectedX; var points = e.selectedPoints; - if (e.dygraph.getOption("legend") === "follow") { + if (e.dygraph.getOption('legend') === 'follow') { // create floating legend div var area = e.dygraph.plotter_.area; - var labelsDivWidth = e.dygraph.getOption("labelsDivWidth"); - var yAxisLabelWidth = e.dygraph.getOption("yAxisLabelWidth"); + var labelsDivWidth = e.dygraph.getOption('labelsDivWidth'); + var yAxisLabelWidth = e.dygraph.getOptionForAxis('axisLabelWidth', 'y'); // determine floating [left, top] coordinates of the legend div // within the plotter_ area - // offset 20 px to the left and down from the first selection point + // 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; - // if legend floats to end of the plotting area, it flips to the other + // if legend floats to end of the window 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); @@ -146,10 +146,9 @@ legend.prototype.select = function(e) { e.dygraph.graphDiv.appendChild(this.legend_div_); this.legend_div_.style.left = yAxisLabelWidth + leftLegend + "px"; this.legend_div_.style.top = topLegend + "px"; - this.legend_div_.style.display = "block"; + this.legend_div_.style.display = ''; } - var html = generateLegendHTML(e.dygraph, xValue, points, this.one_em_width_); var html = legend.generateLegendHTML(e.dygraph, xValue, points, this.one_em_width_); this.legend_div_.innerHTML = html; }; diff --git a/tests/customLabelFollow.html b/tests/customLabelFollow.html index 9ac31bb..76d3822 100644 --- a/tests/customLabelFollow.html +++ b/tests/customLabelFollow.html @@ -36,8 +36,7 @@ errorBars: true, labelsDivWidth: 100, labelsSeparateLines: true, - legend: "follow", - yAxisLabelWidth: 20 + legend: "follow" } );