-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opaque Links? #6
Comments
This is interesting. To answer your question: There is no way to set links opacity or stroke width in version I think we need an API to hide links. Since they are very expensive (memory wise). Each link requires 6 Float32 values to store position, and 6 Float32 values to store color in @palafranchise are you going to hide links dynamically or their state is know beforehand and does not change once rendered? |
Interesting! In this case I am not going to hide links dynamically. I'm parsing and graphing a genealogy tree (GEDCOM) and adding a hidden link between husband and wife nodes helps to separate the parents from the children in a family group. I have attached a small example graph. Each surname is represented by its own color. You can see where I am "hiding" edges by making them black. |
I'm somewhat stuck with this issue. Imagine an API like this: var renderGraph = require('ngrpah.pixel');
var renderer = renderGraph(graph, {
link: renderLink
});
function renderLink(link) {
// link is an instance of graph's link. The output of the function is
// a "ui" object. If falsy value returned, the renderer does not
// render it at all
if (link.data === 'invisible') return; // this could be your own condition
return {
from: 0xff0000,
to: 0x00ff00
}
} What do you think about this one? |
I think this would perfectly! |
This is a major, breaking change. The configuration of the links/nodes is now achieved via options argument (see #6 (comment) ) Furthermore options are now "active", if consumer modifies properties of UI object they are immediately forwarded to webgl renderer and will be applied on next RAF cycle
I've just pushed updated version with this API. The following should hide link between var graph = require('ngraph.graph')();
graph.addLink(1, 2);
graph.addLink(2, 3, 'hidden');
var renderGraph = require('ngraph.pixel');
var renderer = renderGraph(graph, {
link: function createLinkUI(link) {
if (link.data === 'hidden') return; // don't need to render!
// otherwise return default link:
return {
fromColor: 0xFFFFFF,
toColor: 0xFFFFFF
};
}
}); The API of the library has changed too, but I hope it would make it more flexible in future. I'll add changelog later, but major changes is: The update API is in the readme Please let me know how it feels. |
Closing the issue. Let me know if you'd have any feedback. |
Just stumbled upon this library - great work @anvaka! I really like the modular structure, it's very easy to work with. I've been playing around with hiding nodes and links based on the examples posted here, but have noticed that it is not yet possible to hide/unhide nodes and links 'on the fly'. I can easily hide elements on first render, but have not managed to hide/unhide elements afterwards. This would have multiple advantages:
Do you think 'on the fly' hiding and unhiding would be a viable addition? |
In relation to the above: been trying to get quick node/edge filtering to work as well, but no luck so far. Tried playing around with the edge legends, but that seems to simply remove/re-add nodes and edges from the graph and is costly when filtering e.g. large clusters. What do you think @anvaka? |
Hi Andrei,
ngraph.pixel is awesome!
Is there a way to set the opacity on links? Or, set the stroke width? I'm trying to create some links that are not visible. So far the best I have been able to do is set the link color to the background color for the links I want to "hide".
Happy holidays,
Andrew
The text was updated successfully, but these errors were encountered: