Browser-based graph visualisation

66 views
Skip to first unread message

Øystein Nytrø

unread,
Oct 10, 2014, 7:33:55 AM10/10/14
to swi-p...@googlegroups.com
Does anyone have experience with interfacing eg. cytoscape.js or canviz.js to SWI-Prolog?

And more challenging, setting up interaction with a graph? For example folding, unfolding, deleting, adding elements.

I am trying to make an interactive cause-effect diagram (for medical interventions and their effects), and
experimentation by direct manipulation would be very nice.


Jan Wielemaker

unread,
Oct 10, 2014, 9:01:58 AM10/10/14
to Øystein Nytrø, swi-p...@googlegroups.com
What is the problem? It is easy enough to setup HTTP handlers that
exchange JSON. I can recommend SWI7 for that because the dict datatype
makes it all a lot more natural.

I only have direct experience with generating SVG using graphviz (dot)
and include than into the page. Interacting with JavaScript libraries
isn't too hard. Depending on the problem, you can also use Pengines
(pengines.swi-prolog.org).

Cheers --- Jan

Øystein Nytrø

unread,
Oct 10, 2014, 11:00:23 AM10/10/14
to swi-p...@googlegroups.com, oeystei...@gmail.com


kl. 15:01:58 UTC+2 fredag 10. oktober 2014 skrev Jan Wielemaker følgende:
On 10/10/2014 01:33 PM, Øystein Nytrø wrote:

What is the problem? It is easy enough to setup HTTP handlers that
exchange JSON. I can recommend SWI7 for that because the dict datatype
makes it all a lot more natural.

No big problem, - just unsure about a proper protocol for the interaction. And fishing for experience :-)

I only have direct experience with generating SVG using graphviz (dot)
and include than into the page.

I have also done that (glancing at Cliopatria), but graphviz does not offer any easy interaction, just redrawing with
often surprising results.
 
 Interacting with JavaScript libraries
isn't too hard.  Depending on the problem, you can also use Pengines
(pengines.swi-prolog.org).

Pengines could probably make the interaction smoother, since it would keep most changes (fold/unfold) to the client side.
Still, - ideas and experience most welcome...
 
        Cheers --- Jan

--- Øystein Nytrø
 

Anne Ogborn

unread,
Oct 11, 2014, 1:36:19 AM10/11/14
to Øystein Nytrø, swi-p...@googlegroups.com

Oystein, you might look at my whiteboard application, which allows collaborative editing of
node and arc graphs, with data stored on server.

https://github.com/Anniepoo/whiteboard

It uses canvas to do some of the drawing.

It's unfinished - there's no delete function, and the text function's not working, but it's a good start at such a tool.

I haven't done much with it of late.

________________________________
From: Øystein Nytrø <oeystei...@gmail.com>
To: swi-p...@googlegroups.com
Sent: Friday, October 10, 2014 4:33 AM
Subject: [SWIPL] Browser-based graph visualisation


--
You received this message because you are subscribed to the Google Groups "SWI-Prolog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+...@googlegroups.com.
Visit this group at http://groups.google.com/group/swi-prolog.
For more options, visit https://groups.google.com/d/optout.

S K

unread,
Oct 12, 2014, 7:15:43 AM10/12/14
to swi-p...@googlegroups.com
You can use websockets in SWI7 and send javascript. On the client side you call js eval function.
 
ws.onmessage = function (evt) {
if (evt.data) {
var str = evt.data;
eval(str);

I did a benchmark and was able to update an svg-graph at 1kHz. (Webkit based browser).
Reply all
Reply to author
Forward
0 new messages