Delete excanvas and related IE workarounds
[dygraphs.git] / plugins / legend.js
index bb86949..71dd7f1 100644 (file)
@@ -125,7 +125,13 @@ legend.prototype.select = function(e) {
   var xValue = e.selectedX;
   var points = e.selectedPoints;
 
-  if (e.dygraph.getOption('legend') === 'follow') {
+  var legendMode = e.dygraph.getOption('legend');
+  if (legendMode === 'never') {
+    this.legend_div_.style.display = 'none';
+    return;
+  }
+
+  if (legendMode === 'follow') {
     // create floating legend div
     var area = e.dygraph.plotter_.area;
     var labelsDivWidth = e.dygraph.getOption('labelsDivWidth');
@@ -146,16 +152,16 @@ 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 = '';
   }
 
   var html = legend.generateLegendHTML(e.dygraph, xValue, points, this.one_em_width_);
   this.legend_div_.innerHTML = html;
+  this.legend_div_.style.display = '';
 };
 
 legend.prototype.deselect = function(e) {
-
-  if (e.dygraph.getOption("legend") === "follow") {
+  var legendMode = e.dygraph.getOption('legend');
+  if (legendMode !== 'always') {
     this.legend_div_.style.display = "none";
   }
 
@@ -293,10 +299,6 @@ legend.generateLegendHTML = function(g, x, sel_points, oneEmWidth) {
  * @private
  */
 generateLegendDashHTML = function(strokePattern, color, oneEmWidth) {
-  // IE 7,8 fail at these divs, so they get boring legend, have not tested 9.
-  var isIE = (/MSIE/.test(navigator.userAgent) && !window.opera);
-  if (isIE) return "—";
-
   // Easy, common case: a solid line
   if (!strokePattern || strokePattern.length <= 1) {
     return "<div style=\"display: inline-block; position: relative; " +