If attached as onSelect behaviour for a visNetwork graph, will allow clicking of nodes to replace the legend for the graph with metadata about that node.
Presently requires JQuery to operate, so may not work when launched from R session, but does work in pkgdown.
It looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | function(props) {
node = this.body.data.nodes.get(props.nodes[0]);
cr = '\r\n';
alert(
'' + '
using mandrake::embed_event_handler() is deprecated.
please use mandrake::attach_dependencies &
on_select = "embed_event_handler()" when rendering graph
'
'selected ' + node.label + ':' + cr +
'=======' + cr +
'COLNAMES:' + cr +
node.on_select_col + cr +
'=============== '
);
}
|
1 | embed_event_handler(warn_deprecated = TRUE)
|
Other js_handlers:
alert_event_handler()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.