ID for nodes and edges and graphs?

24 views
Skip to first unread message

Rockpsl76

unread,
Jul 19, 2010, 5:04:07 PM7/19/10
to canviz
I've been playing around with Canviz, and its working pretty well for
me so far. The one thing I was disappointed to find out was that IDs
don't pass through Canviz. Any chance of getting IDs to show up as
DIV IDs? It would make node manipulation a lot easier. Right now,
the only way I can figure to uniquely identify nodes or edges is by
hacking the href...

Ryan Schmidt

unread,
Jul 26, 2010, 7:25:24 PM7/26/10
to can...@googlegroups.com


How do you mean, hacking the href?

It's been awhile since I've looked at the Canviz code so I'm trying to remember how things work and why. The HTML that gets created are 1) divs to handle click regions and 2) spans for any text. I've received several reports that the div strategy for handling clicks is insufficient (like ticket #63) and my hope is that image map-based click handling (see ticket #56) would solve this. If we move to that, there won't be any more divs for click regions, leaving only the spans for text. If you're trying to manipulate that text, I can see why you might want to address these spans by id. The thing is, Canviz might not always implement text by creating spans. In the future, I might change it to using text drawn directly on the canvas, since that capability exists in the canvas element now. (It didn't when I started working on Canviz.) Or I might give the developer the option of which method they want. So I don't want to expose access to those spans and give you the impression that I want you to address them, because I don't particularly. Think of them as an implementation detail that's meant to be hidden from you.

Rather, I want you to interact with the JavaScript graph object that Canviz has created for you. Make any changes there, then tell Canviz to re-render it. I'd like to have another more full-featured example that would show off how I intend some of this to work but I haven't created it yet. Note that since I haven't actually tried to do this yet, it might have bugs and not work as I intend...

Ron Newman

unread,
Jul 27, 2010, 11:25:04 AM7/27/10
to can...@googlegroups.com
For what it's worth, the way I did it in IdeaTree ( if I'm remembering this right) was to use Canviz clickable regions for edge labels, and an image map for clickable nodes (because the image map could detect the shape of the node, not just the text, which was a limitation of Canviz at the time).  I used CSS zIndex to make the clickable edge labels detectable above the image map.  Edges are not clickable, just edge labels.

A shortcoming that I'd like to fix is that I can't select multiple items, like you select icons on a desktop.  I don't know if it would be easier to do this with Canviz (when clickable regions are fully implemented), or try some javascript scheme to do it using the image map.

Ryan Schmidt

unread,
Jul 28, 2010, 9:59:03 AM7/28/10
to can...@googlegroups.com

On Jul 27, 2010, at 10:25, Ron Newman wrote:

> A shortcoming that I'd like to fix is that I can't select multiple items, like you select icons on a desktop. I don't know if it would be easier to do this with Canviz (when clickable regions are fully implemented), or try some javascript scheme to do it using the image map.

My feeling is that it's not the job of Canviz to retain a notion of things having been selected, so I'll leave that up to you to track in your application.

Rockpsl76

unread,
Jul 30, 2010, 4:23:17 PM7/30/10
to canviz
Actually, I would be fine with the id being attached to the div as
well. I just want to be able to address a canviz object based off the
ID field in the xdot. I'm going to be interested in click regions
too, but right now I just want to be able to select a group of node
in my text graph viewer and have them highlight in canviz.

What I meant by hacking the href is setting the url value equal to the
ID so that the ID was at least contained within the node div so that I
can access it in the html.

Interacting directly with the canviz object sounds fine to me too. Is
there a way to change node features on the canviz object right now?
Reply all
Reply to author
Forward
0 new messages