yWorks / yfiles-jupyter-graphs

The home of the Jupyter notebook graph visualization widget powered by yFiles for HTML
https://www.yworks.com/products/yfiles-graphs-for-jupyter
Other
162 stars 15 forks source link

Support more style mappings for nodes #11

Closed fskpf closed 2 years ago

fskpf commented 2 years ago

Currently, there are only size and color mappings for the existing circular nodes.

This is quite limited. A style mapping with more options (e.g. shape, image, ... ?) would be really beneficial in some scenarios.

andrawaag commented 2 years ago

I support this feature request. I was hoping the following snippet would do that `schemaViz = GraphWidget()

notetypes = [ "diamond", "rectangle", "circle"] def custom_node_mapping(index, node): """assign node style based on type""" return notetypes[node['properties']['type']]

schemaViz.set_node_type_mapping(custom_node_mapping)

schemaViz.nodes = nodes schemaViz.edges = edges schemaViz.get_node_type_mapping()`