opendns / dataviz

OpenDNS Data Visualization Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Interface controls and Javascript

btcor opened this issue · comments

Hello,

I have finally gotten OpenGraphiti working, and it looks great. Now my problem is that I'm having some trouble figuring out how to interact with the graph. I have been able to discover some functions through pure trial and error, but there are still a few things that I haven't been able to figure out. One specific function that I would like to be able to do is display the attributes of a node. Could you either tell me if there is a way to do this or direct me to a list of controls for the interface?

My other question is about the Emscripten option that is supposed to allow you to run OpenGraphiti on a web page. I have installed Enscripten and compiled using the "make web" option which produces the graphiti.js and graphiti.js.map files, but I can't figure out exactly what I am supposed to do with these files. Is there some documentation that explains how to use these JavaScript files to implement OpenGraphiti on a web page?

Thank you

Hi btcor !

Question #1 : Currently, there are indirect ways of doing this. If you want to display all the attributes of a node in a text format, you'll have to do it with the python script. Take a look at graphiti/Scripts/demo.py to have an overview of some examples. Functions like get_selected_node and get_node_attribute will be the key.

Question #2 : Please update your repositories to the last revision. The web compilation has been changed and now outputs a HTML file directly displaying the UI in a browser. I recently updated the code to be fully working with Emscripten 1.22.0 ... I apologize for the lack of documentation on this part, I will do my best to describe some basic examples.

Hi btcor !

I made some changes to fix the web integration and make it much simpler to use. It is now running smoothly.

Please sync to the latest repo and run :

$ make webrun

Then load the generated graphiti.html in your favorite browser. You should see the OpenGraphiti UI and one example script that will create a simple graph.

More technical details :

  • I rewrote the binding mechanism, emscripten has a brand new way (Inspired of boost::function) to link C++ with JS code. Check out graphiti/API/Javascript.hh to see what I am talking about. Some functions are still not implemented in the JS wrappers for various reasons, mainly because they use C++ structures. That will come soon.
  • I add a new folder named "Javascript" in graphiti/. That should give you trivial examples to get started ;).
  • You can still use "$ make web" but you will need to manually add some HTML/JS code to load the starting scripts. (See graphiti/Javascript/example.js)
  • You can also use a completely different HTML page to embed OpenGraphiti. The current one is automatically generated by emscripten and serves as a template.

Hope this helps ! Let me know if this works fine for you.

Cheers,

The web example works for me, thanks that's great! :-)