Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Expect disruption to service on Thursday, Feb. 9!

Importing style within script


Is there a way to import style/stylesheet/style.grass in a script? I'm new to Neo4j and I'm trying to write a simple Python script with different styling for different relationships, but I've found I've had to manually change the styling after running the queries. Is there a way to change styling within the script/queries so that I don't have to manually change it every time I run the script on a different instance? Thank you.



grass files are a form of css (style sheets), used during rendering of the web page (not part of a cypher query). Each javascript graph display library may have slightly different needs (and may not take a grass file exactly). Here is a list of viz options Graph Visualization Tools - Developer Guides I'm guessing you are using one of the common libraries (e.g. d3.js, cytoscape.js), and displaying the graph on a web page? In that case the nuanced details will vary a bit by library. It is best to check the docs for the one you choose to use. I've been using cytoscape.js because I was already using the desktop application Cytoscape...

cytoscape.js has an example Cytoscape.js tutorial demo showing a user selected active style sheet drop down select list. The Cytoscape application can export the style sheets for use with cytoscape.js, "most" of the styling configurations in Cytoscape (the application) works in cytoscape.js (the javascript developer library). See caveats on in their docs.

what is your stack? using flask or django? or?


Hi Joel, thanks for the response.
I'm currently just trying to get the graph to show up locally, so I'm not currently using a js library. I just want the graph to show up on my local Neo4j browser. My goal is to have a standalone Python script that captures all the styling and querying that creates the nodes/relationships, but I'm not sure if this is possible. Are there any alternatives if not?