neo4j / neo4j-browser

Neo4j Browser is the general purpose user interface for working with Neo4j. Query, visualize, administrate and monitor the database.
https://neo4j.com
GNU General Public License v3.0
678 stars 345 forks source link

Save and restore a visualization state #858

Closed mehdibalouchi closed 3 years ago

mehdibalouchi commented 5 years ago

I want to save position of nodes in a visualization somehow and later restore those positions. consider the user gets a visualization and starts to move nodes on screen, he can Export PNG of the visualization. I want to make the user able to save the visualization he made somehow (in a file or something) and when he restores that, all nodes are in the position he saved. Is there any straight solution you guys can help me with?

oskarhane commented 5 years ago

Hi, the position of elements in the viz is not something we track in neo4j-browser. What is the user goal here, why do you want this feature? It sounds like Neo4j Bloom is a better tool for you: https://neo4j.com/bloom/

rsworden59 commented 5 years ago

I think I can relate to their request. I am building two graphs. One contains the real data I am extracting from a system, which I am building up a little at a time. The other documents the nodes and relationships I intend to have: the schema documented in advance. It's pretty complex, created in cypher-shell with several dozen nodes and relationships between them all. In Neo4j Browser I've color-coded the different types of nodes, and I've color-coded the arrows to show which ones are implemented so far in the real graph. I drag the nodes into a pleasing, understandable arrangement so that others can see where there are implied hierarchies and other relationships in a way they can relate to. Whenever I create more nodes and rels, I have to refresh the browser display. Then re-dragging the nodes to the useful arrangement takes several minutes.

So as the styling preserves the line sizes and colors, it would be cool to have it preserve the latest positions, maybe as an option. That way when I refresh the viz from the graph, the ones I've fixed in place would resume their positions, and newly created nodes would place themselves randomly near the nodes they relate to.

I realize this feature would NOT be useful for other types of graphs such as my real one based on real data. But for hand-drawn... er, hand-cypher'd graphs, it could be very helpful.

Yes, I played with Bloom, but so far I don't find it useful.

mehdibalouchi commented 5 years ago

the position of elements in the viz is not something we track in neo4j-browser.

How can I do this? Where is the code that adjusts node positions? I cant't find that. I'm trying to find that part of code that adjusts the initial position of nodes in the visualization, so that maybe I can do some hacks and solve my problem.

oskarhane commented 5 years ago

Thanks for the additional input here, and a use case @rsworden59!

@mehdibalouchi: The layout is using d3's force layout and happens in this file: https://github.com/neo4j/neo4j-browser/blob/master/src/browser/modules/D3Visualization/lib/visualization/components/layout.js

ghost commented 3 years ago

it seems don't sloved yet ?

OskarDamkjaer commented 3 years ago

This is an interesting idea, but I'm afraid it to be a quite complex feature and not something we can prioritize implementing. If anyone wants to give it a shot and hack together a demo, we could perhaps reconsider