I absolutely love Vivagraph JS. Having said that, I've run into a pickle, that is probably WebGL specific.
I'm trying to:
var graph = Viva.Graph.graph();
var layout = Viva.Graph.Layout.forceDirected(graph, {
springLength : 30,
springCoeff : 0.0003,
dragCoeff : 0.005,
gravity : -0.2,
theta: 0.8
});
var graphics = Viva.Graph.View.webglGraphics();
graphics.node( function( node )
{
node.addEventListener( 'click', function ()
{
console.log( 'clicked node: ' + node.id );
});
return Viva.Graph.View.webglSquare( 10, color );
});
var renderer = Viva.Graph.View.renderer( graph,
{
container : document.getElementById( 'graph' ),
graphics : graphics,
layout: layout
});
renderer.run();
I've seen a similar example, using the SVG instead. Using WebGL doesn't seem to work:
Uncaught TypeError: Object [object Object] has no method 'addEventListener'
How can I add an event listener from javascript/jquery to the webgl particle that makes up the node?
Or should I abandon WebGL altogether for my intents and purposes?