Last active
January 19, 2019 22:12
-
-
Save knbknb/d05be6529087596eb279f6734b6067cf to your computer and use it in GitHub Desktop.
Grab existing visjs DOM object on html page, change visjs options. http://visjs.org/ , R htmlwidgets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Grab existing visjs DOM object on html page, change options | |
// knb 2018-12-08 | |
// http://visjs.org/ Visualisation Library | |
// get similar id e.g. by inspecting HTML page source code that was generated by R htmlwidgets package | |
var = "htmlwidget-4210fec5d0f413c28b94"; | |
var el = document.getElementById("graph" + widget); | |
var network = el.chart; | |
el.nodes.length; // should print a single int | |
el.chart.setOptions({ | |
nodes: { | |
shape: 'dot', | |
size: 30, | |
font: { | |
size: 13 | |
}, | |
borderWidth: 2, | |
shadow:true | |
}, | |
edges: { | |
width: 2, | |
shadow:true | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment