MCPcopy Index your code
hub / github.com/plotly/plotly.js / getGraphDiv

Function getGraphDiv

src/lib/dom.js:16–33  ·  view source on GitHub ↗

* Allow referencing a graph DOM element either directly * or by its id string * * @param {HTMLDivElement|string} gd: a graph element or its id * * @returns {HTMLDivElement} the DOM element of the graph

(gd)

Source from the content-addressed store, hash-verified

14 * @returns {HTMLDivElement} the DOM element of the graph
15 */
16function getGraphDiv(gd) {
17 var gdElement;
18
19 if(typeof gd === 'string') {
20 gdElement = document.getElementById(gd);
21
22 if(gdElement === null) {
23 throw new Error('No DOM element with id \'' + gd + '\' exists on the page.');
24 }
25
26 return gdElement;
27 } else if(gd === null || gd === undefined) {
28 throw new Error('DOM element provided is null or undefined');
29 }
30
31 // otherwise assume that gd is a DOM element
32 return gd;
33}
34
35function isPlotDiv(el) {
36 var el3 = d3.select(el);

Callers 2

unhover.jsFile · 0.85
index.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…