I am using the network canvas of visjs. On click of one of the nodes, I would like to display a bootstrap popover containing a bunch of information about that node. I tried adding the popover properties to the network control:
<div id="mynetwork" data-toggle="popover" title="Popover Header" data-content="Some content inside the popover"></div>
and handling the click event from vis:
function doOnClick(params) {
$('#mynetwork').popover({
template: '<div id="sys_popover" class="popover timelineItemPopover" role="tooltip" style="top: 376.5px; left: 100px; display: block;"><div class="arrow"></div><div class="popover-head"><a href="#" class="btn btn-sm glyphicon glyphicon-remove-circle popover-close"></a><h3 class="popover-title"></h3></div><div class="popover-content"></div></div>',
container: false,
viewport: { selector: '#mynetwork', padding: 20 },
html: true,
content: function() {
return $(this).children('.content').children('span[data-content]').attr('data-content');
}
});
}
but the popover is positioned on the right edge of the screen.
What am I doing wrong?
Cheers
Ok, here is the solution I finally came up with:
The onClick event of the network canvas provides params that are helpful:
Works well....
Happy new year!
Anton