javascript - make sigma.js compatible with ruby on rails -
please me,this drives me nuts.
i have ruby on rails application , following code sigma.js example visualize graph files.i not know why graph not render
some notes:
1.java script files sigma.min , parsegexf located correctly,looking @ source code of browser can see them
2.the data file "file.gexf" problem think .i not know else try following helpers did not work
asset_path asset_url i tried pass absolute path of file.gexf still did not work
<% content_for :header %> <%= javascript_include_tag "sigma.min", "data-turbolinks-track" => true %> <%= javascript_include_tag "sigma.parsegexf", "data-turbolinks-track" => true %> <% end %> <div class="container"> <div class="row"> <div class="sigma-parent" id="sigma-example-parent"> <div class="sigma-expand" id="sigma-example"></div> </div> </div> <script type="text/javascript"> function init() { // instanciate sigma.js , customize rendering : var siginst = sigma.init(document.getelementbyid('sigma-example')).drawingproperties({ ... defaultedgetype: 'curve' }).graphproperties({ ... }).mouseproperties({ maxratio: 32 }); // parse gexf encoded file fill graph // (requires "sigma.parsegexf.js" included) siginst.parsegexf('file.gexf'); //highlights nodes hovered+ edges // bind events : var greycolor = '#666'; siginst.bind('overnodes',function(event){ ... // draw graph : siginst.draw(); } if (document.addeventlistener) { document.addeventlistener("domcontentloaded", init, false); } else { window.onload = init; } </script> //some stylinmg here <style type="text/css"> .sigma-parent { position: relative; ... } .sigma-expand { position: absolute; ... } .buttons-container{ padding-bottom: 8px; ... } </style>
Comments
Post a Comment