oxfordinternetinstitute / InteractiveVis

The InteractiveVis project, funded by JISC from May to September 2012, aims to allow easy creation of interactive visualisations for geospatial and network data using native web technologies (HTML5, CSS3, and SVG) and allow these visualisations to be self-contained so that they may run entirely offline in ebooks and other media. The project will survey existing solutions and build the necessary components to fill in missing features and smooth over incompatibilities in between existing libraries. The project will further provide online hosted wizards to allow for the easy creation of these interactive visualizations. All code is open source and released under the GNU GPL v3 license.
http://blogs.oii.ox.ac.uk/vis
131 stars 51 forks source link

Edge labels #50

Open psychemedia opened 10 years ago

psychemedia commented 10 years ago

Is is possible to easily display edge labels either:

1) attached to each edge, or 2) in the info box (so for example a list of edge attribute info associated with each node listed in the info box).

What I'd like to do is pass in a graph where the edge labels are descriptive text, and when I search for a node to see the other nodes it's connected to, get a list of those nodes along with the appropriate edge description.

(I guess the general case would be multi-edges with different labels, in which case it would be nice to list each label edge associated with a particular node).

computermacgyver commented 10 years ago

Thanks for writing and suggesting this. I am working on edge labels directly for edges, but it is part of a large overhaul of the underlying sigmajs code to replace the drawing functions with a full canvas library (using kineticjs right now). Links with this issue

The idea of adding labels to the info box is much easier and probably something that could be added fairly quickly. If you have a bit of JavaScript experience, the basic change needs to happen are:

The only issue I can see arising is how to handle parallel edges in multigraphs (e.g., what should happen if edge a-->b has attribute x, but another parallel edge also connecting a-->b has attribute y). As long as this doesn't occur in your graphs the above changes should work fine.

If you can make the changes and contribute back the code that would be great. If you'd prefer, I'm happy to make the changes as well; I just need to find time to do the testing, etc. Cheers.

vulpessepluv commented 7 years ago

Follow up question : I seem to be stuck with the same question as psychemedia - was the adapted code ever contributed back, or else are the changes that need to be done somehow available?

Greets, v

computermacgyver commented 7 years ago

Hi vulpessepluv, the changes are described above, but this is one variation that I didn't actually code up myself. The version of sigmajs we use in the plugin at the moment makes it very hard to detect edge hover events, but the newest version of sigmajs makes this easier. We are working on a new version of the plugin, but it is not yet ready for release. Until then, the changes above would work if you only have one edge attribute to display. If you have more than one edge attribute, I would recommend a custom interface using the newest version of sigma for now.

vulpessepluv commented 7 years ago

Hi Scott, thanks a lot for the fast answere! It seems the exact line numbers have changed a bit due to changes over time.

The only problem I experience is to include '('+c.attribute+')' the right way at the right position, I'd be eternally grateful for a hint, since it's really the last thing I need for my project!

f.push('<li class="membership"><a href="#' + c.name + '" onmouseover="sigInst._core.plotter.drawHoverNode(sigInst._core.graph.nodesIndex[\'' + c.id + '\'])\" onclick=\"nodeActive(\'' + c.id + '\')" onmouseout="sigInst.refresh()">' + c.name + "</a></li>");

Greets, v

TianzhuQin commented 5 years ago

I guess the code has been changed for long years. But this issue also make me crazy one time. Here is my code for the last step.@vulpessepluv

f.push('<li class="membership"><a href="#' + c.name + '" onmouseover="sigInst._core.plotter.drawHoverNode(sigInst._core.graph.nodesIndex[\'' + c.id + '\'])\" onclick=\"nodeActive(\'' + c.id + '\')" onmouseout="sigInst.refresh()">' + c.name + "</a> (" + c.group + ")</li>");