* 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)
| 14 | * @returns {HTMLDivElement} the DOM element of the graph |
| 15 | */ |
| 16 | function 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 | |
| 35 | function isPlotDiv(el) { |
| 36 | var el3 = d3.select(el); |
no outgoing calls
no test coverage detected
searching dependent graphs…