jrich523
jrich523

Reputation: 590

How do I get a reference to a dygraph based on Div ID it was assigned to?

Is there a way to get a reference to the graph via the div id it was placed in?

new Dygraph(document.getElementById("chartxyz"),.....)

Since that wasnt stored to a var, (or even it if was, but i try to access it from another script)

is there a way i can get a dygraph object via that div id of chartxyz? I'd like to run the setSelection on it to highlight a series.

Thanks

Upvotes: 3

Views: 1366

Answers (1)

danvk
danvk

Reputation: 16945

No, you'll have to maintain the mapping yourself.

var dygraphs = {};
dygraphs['chartxyz'] = new Dygraph(document.getElementById("chartxyz"), .....)

Upvotes: 4

Related Questions