In the concentric layout in cytoscape.js, it is possible to set which "layer" of the circle the nodes are in through the concentric variable of the layout:
concentric: function( node ){
return node.data("rank");
}
Is there a similar function to this in ipycytoscape?
not sure if I already replied to your question on github, but this is a known issue, we need to implement a specific case for the concentric style. You can follow the issue here:https://github.com/cytoscape/ipycytoscape/issues/238
Thanks!
Related
Does the remove_face method change the mesh indices?
I get a segmentation fault with this code:
auto face_iterator = m.faces_around_target(m.halfedge(v3));
for (auto i=face_iterator.begin(); i!=face_iterator.end(); i++) {
m.remove_face(*i);
}
According to my understanding of the documentation, as long as I don't call collect_garbage the faces are only marked as removed., therefore no changes to indices. What is happening?
Does remove_face, also remove the face halfedges\ makes them point to null_face? It does not seem to do so, and I don't understand why not..
Thank you.
The face is indeed simply marked as removed but its iterator is invalidated by the removal (remember that iterator goes only over non-removed elements).
As stated in the doc: removes face f from the halfedge data structure without adjusting anything.
You need to use a higher level function such as CGAL::Euler::remove_face().
I render a graph using visjs. The shape of the nodes are of type dot. Each node is given a custom size using the size attribute.
When the graph is rendered some of the nodes overlap. So the graph looks like in the following picture:
I expected a graph like the this picture is showing:
What am I doing wrong?
Try to use the physics configuration.
see this example of visjs.
GOOD LUCK.
To be more specific compared to the TERMIN's answer, in the physics configuration example you can see (at least for the barnesHut solver) that increasing avoidOverlap prevents overlapping even when springConstant is equal to zero and
var options = {
"physics": {
"barnesHut": {
"avoidOverlap": 0.2
}
}
}
is probably enough (but you may increase the value according to your needs).
Using Cytoscape.js, how can I constrain movement of a node to a single (i.e. either the x or y) axis? I'd like to be able to make it so a node can only be dragged vertically or horizontally, but not both. In other words, I'd like to lock a node, but only on a single axis. I'm not sure if this is possible, and wasn't able to find anything in the documentation that mentioned this specifically, so I figured I'd ask.
Thanks in advance!
Use the automove extension, which lets you set whatever restrictions on node positioning that you like. Constraining the x value is as easy as passing a (x, y) => { return { xConst, y }; } function to the extension.
I ended up coming up with a way to approximate the result that I wanted by listening for each node's free event, and setting its position to what I needed it to be. This doesn't restrict dragging of nodes to a single axis, but it does restrict dropping of nodes to a single axis, if that makes sense.
Here is the Cytoscape.js description of the free event:
free : when an element is freed (i.e. let go from being grabbed)
from: http://js.cytoscape.org/#events/collection-events
How can I detect if a button is in a desired area
I have used if( button.frame.orgin.x == area.framee.orgin.x){
if (button.frame.orgin.y == area.frame.orgin.y )};
The Problem with this code is that it is very exact so it is hard to match up the button with the label. So I would like to know how to detect if a button is inside a desired area. And how to make the area bigger than the button. Thanks In advance
Your best option is probably CGRectContainsRect() which would work something like:
if(CGRectContainsRect(someRect, button.frame))
{
//Button is in area.
}
To expand the rect you can use CGRectInset(), passing negative values to increase the frame size by that amount. This function will maintain the center of the original rect.
CGRect newRect = CGRectInset (smallRect, -10.0f, -10.0f);
You can read more about CGGeometry functions in the docs.
Use GCRectContainsRect(frame1, frame2); to see if an object is contained within another object. Or use CGRectIntersectsRect(frame1, frame2); to see if the rects overlap at all.
Is it possible to create Manhattan Style edges in a space tree using inforVis/jit.
It is not an option on: http://philogb.github.com/jit/static/v20/Docs/files/Options/Options-Edge-js.html. But i see that custom edges are possible.
Has anyone already done this?
If you have not figured this out already (and for other readers)...
While passing constructor options, try specifying edge type as bent:line, somewhat like the following.
Edge: {
type: 'bent:line',
overridable: true,
color: "#000000",
lineWidth: 2
}
Use This
https://philogb.github.io/jit/static/v20/Docs/files/Visualizations/Spacetree-js.html#ST.Plot.EdgeTypes
ST.Plot.EdgeTypes
This class contains a list of Graph.Adjacence built-in types. Edge types implemented are ‘none’, ‘line’, ‘arrow’, ‘quadratic:begin’, ‘quadratic:end’, ‘bezier’.
You can add your custom edge types, customizing your visualization to the extreme.