X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=7df375236d847421003ee78b798b683641c58426;hb=b1a962155bc64c306bc71f045d9c936e0d6afbe4;hp=88213d61d3cf69117473e0b594ef14d06a3c9457;hpb=f381ac7135156e66c0ed74fe75061fb7b37d0555;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index 88213d6..7df3752 100644 --- a/dygraph.js +++ b/dygraph.js @@ -585,6 +585,22 @@ Dygraph.prototype.cascadeEvents_ = function(name, extra_props) { }; /** + * Fetch a plugin instance of a particular class. Only for testing. + * @private + * @param {!Class} type The type of the plugin. + * @return {Object} Instance of the plugin, or null if there is none. + */ +Dygraph.prototype.getPluginInstance_ = function(type) { + for (var i = 0; i < this.plugins_.length; i++) { + var p = this.plugins_[i]; + if (p.plugin instanceof type) { + return p.plugin; + } + } + return null; +}; + +/** * Returns the zoomed status of the chart for one or both axes. * * Axis is an optional parameter. Can be set to 'x' or 'y'. @@ -1735,7 +1751,7 @@ Dygraph.prototype.eventToDomCoords = function(event) { if (event.offsetX && event.offsetY) { return [ event.offsetX, event.offsetY ]; } else { - var eventElementPos = Dygraph.findPosX(this.mouseEventElement_) + var eventElementPos = Dygraph.findPos(this.mouseEventElement_); var canvasx = Dygraph.pageX(event) - eventElementPos.x; var canvasy = Dygraph.pageY(event) - eventElementPos.y; return [canvasx, canvasy];