X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=7df375236d847421003ee78b798b683641c58426;hb=dcebad806f64b407b0d0c279d3f27c02a8a54229;hp=456a56c8f44e2c595e3ffaacb0937bba044ef8f7;hpb=fc1c2420cb32dd154c8d88e51780f8a3788a94fe;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index 456a56c..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.findPos(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];