Skip to content
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

Positioning of nodes/edges doesn't work #254

Open
marimeireles opened this issue Apr 9, 2021 · 3 comments
Open

Positioning of nodes/edges doesn't work #254

marimeireles opened this issue Apr 9, 2021 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@marimeireles
Copy link
Collaborator

You can create a Node instance and try to set a position with:

node1.position = {"x":1, "y":2000}

Or do something completely else, the node will appear in the same place in the screen.

I have to read more into it but I wonder if it's because we're not interacting with Phosphor correctly.
I don't think the problem is related with the spectate problem of deep objects like dictionaries not being sync. because we have other examples in the code like the data attr. that's also a dict, but it's working fine.

This bug was first issued by @DnlRKorn on the QS channel. Thanks @DnlRKorn! :)

@marimeireles
Copy link
Collaborator Author

I have to jump out for now and will be out for the wknd, but hopefully I can pick this up again a bit on Monday!

@marimeireles marimeireles added bug Something isn't working help wanted Extra attention is needed labels Apr 9, 2021
@martinRenou
Copy link
Collaborator

You might want to check if this code is executed properly with a console.log? https://github.com/QuantStack/ipycytoscape/blob/master/src/graph.ts#L176

@fpom
Copy link

fpom commented Feb 23, 2023

I managed to assign positions to nodes proceeding as follows:

cy = CytoscapeWidget()
# ... populate your graph
pos = {...} # map nodes id to pairs of floats.
for node in cy.graph.nodes:
    x, y = pos[node.data["id"]]
    node.position = {"x" : x, "y" : y}
cy.relayout()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants