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

Customize style for relationship #7

Open
mystvearn opened this issue Aug 7, 2024 · 4 comments
Open

Customize style for relationship #7

mystvearn opened this issue Aug 7, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@mystvearn
Copy link

Thank you for this amazing widget.

Is there a way to customize the style for edge (relationship)? For example changing from solid to dotted line or bold the display text.

@fskpf
Copy link
Member

fskpf commented Aug 7, 2024

Currently, edges can only be changed wrt. color and thickness_factor, e.g.

g.add_relationship_configuration('ACTED_IN', thickness_factor=5, color='#AC94F4')

where both mappings could be lambdas as well.

Text styling supports the following properties: fontSize, color, backgroundColor, position, maximumWidth, maximumHeight, wrapping and textAlignment (for more details on the different properties see this notebook).

This works for both, nodes and edges, e.g.

g.add_node_configuration('Movie', text= lambda node : {
        'text': datetime.now().strftime("%Y-%m-%d %H:%M:%S"), 
        'backgroundColor': '#5C268B', 
        'fontSize': 20, 
        'color': '#FF6EC7', 
        'position': 'north', 
        'maximumWidth': 130, 
        'wrapping': 'word', 
        'textAlignment': 'center'
    })  

Unfortunately, the two options you are looking for are currently not supported. However, we may add them in the future, therefore keeping this open as feature request.

@fskpf fskpf added the enhancement New feature or request label Aug 7, 2024
@mystvearn
Copy link
Author

@fskpf Thanks for the intuitive response. How about setting default layout? The hierarchic works perfectly in my case but I can't find a way to set it by default.

@fskpf
Copy link
Member

fskpf commented Aug 9, 2024

This is a missing feature for the yfiles-jupyter-graphs-for-neo4j despite the available functionality in the core yfiles-jupyter-graphs widget (see this notebook).

That said, you can work around this and set the layout on the (private) core field like so:

g.show_cypher("MATCH (s)-[r]->(t) RETURN s,r,t LIMIT 20")
g._widget.hierarchic_layout()

The above-mentioned notebook contains the different available layout calls.

The important part here is that you must set the layout directly after the show_cypher call in the same cell.

@fskpf
Copy link
Member

fskpf commented Oct 16, 2024

The layout can now be specified through a layout kwarg on the instance and specifically for each show_cypher call in v1.4.2.

@fskpf fskpf closed this as completed Oct 16, 2024
@fskpf fskpf reopened this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants