Merge branch 'master' of github.com:danvk/dygraphs
authorDan Vanderkam <danvdk@gmail.com>
Sat, 9 Feb 2013 00:26:07 +0000 (19:26 -0500)
committerDan Vanderkam <danvdk@gmail.com>
Sat, 9 Feb 2013 00:26:07 +0000 (19:26 -0500)
1  2 
dygraph.js

diff --combined dygraph.js
@@@ -963,19 -963,11 +963,19 @@@ Dygraph.prototype.createInterface_ = fu
    };
  
    this.mouseOutHandler_ = function(e) {
 -    dygraph.mouseOut_(e);
 +    // The mouse has left the chart if:
 +    // 1. e.target is inside the chart
 +    // 2. e.relatedTarget is outside the chart
 +    var target = e.target || e.fromElement;
 +    var relatedTarget = e.relatedTarget || e.toElement;
 +    if (Dygraph.isElementContainedBy(target, dygraph.graphDiv) &&
 +        !Dygraph.isElementContainedBy(relatedTarget, dygraph.graphDiv)) {
 +      dygraph.mouseOut_(e);
 +    }
    };
  
 +  this.addEvent(window, 'mouseout', this.mouseOutHandler_);
    this.addEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler_);
 -  this.addEvent(this.mouseEventElement_, 'mouseout', this.mouseOutHandler_);
  
    // Don't recreate and register the resize handler on subsequent calls.
    // This happens when the graph is resized.
@@@ -1013,9 -1005,9 +1013,9 @@@ Dygraph.prototype.destroy = function() 
    this.registeredEvents_ = [];
  
    // remove mouse event handlers (This may not be necessary anymore)
 -  Dygraph.removeEvent(this.mouseEventElement_, 'mouseout', this.mouseOutHandler_);
 +  Dygraph.removeEvent(window, 'mouseout', this.mouseOutHandler_);
    Dygraph.removeEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler_);
 -  Dygraph.removeEvent(this.mouseEventElement_, 'mousemove', this.mouseUpHandler_);
 +  Dygraph.removeEvent(this.mouseEventElement_, 'mouseup', this.mouseUpHandler_);
  
    // remove window handlers
    Dygraph.removeEvent(window,'resize',this.resizeHandler_);
@@@ -3506,9 -3498,12 +3506,12 @@@ Dygraph.prototype.annotations = functio
  /**
   * Get the list of label names for this graph. The first column is the
   * x-axis, so the data series names start at index 1.
+  *
+  * Returns null when labels have not yet been defined.
   */
  Dygraph.prototype.getLabels = function() {
-   return this.attr_("labels").slice();
+   var labels = this.attr_("labels");
+   return labels ? labels.slice() : null;
  };
  
  /**