Different styling inside nodes for pyvis

Viewed 16

I would like to have different styling inside a node using pyvis (python3). E.g. different colors (red/blue) and styling (underline/bold). Is this possible in pyvis? is it possible in vis.js?

from pyvis.network import Network


net = Network(directed =True)
t = "Tablename{underrline}\n\nID-Felder{bold}\n\nid13213\nid2{red}\n\nfelder\n\nfeld1\nfeld2{blue}"
net.add_node(t, shape = "box")
net.add_node("b")
net.add_edge(t,"b")


net.width = "2000px"
net.height = "1000px"
net.show_buttons(filter_=['physics'])
net.show("index.html")

Snippet generated html:

// parsing and collecting nodes and edges from the python
        nodes = new vis.DataSet([{"id": "Tablename{underrline}\n\nID-Felder{bold}\n\nid13213\nid2{red}\n\nfelder\n\nfeld1\nfeld2{blue}", "label": "Tablename{underrline}\n\nID-Felder{bold}\n\nid13213\nid2{red}\n\nfelder\n\nfeld1\nfeld2{blue}", "shape": "box"}, {"id": "b", "label": "b", "shape": "dot"}]);
        edges = new vis.DataSet([{"arrows": "to", "from": "Tablename{underrline}\n\nID-Felder{bold}\n\nid13213\nid2{red}\n\nfelder\n\nfeld1\nfeld2{blue}", "to": "b"}]);
0 Answers
Related