Open scottctr opened 4 years ago
Thanks for your message. So, basically, you'd like to set a default node/edge stlye on graph object? And then it's applied to every child without specified style?
Yes, I don't have a well thought out design, but here are some things to consider:
var myGraph = new DotGraph("myGraph", directed: true)
.SetDefaultNodeStyle(new DotNodeStyle(Color.Red, Color.White, Color.Blue, DotNodeShape.Box, DotNodeStyle.Solid))
.SetDefaultEdgeStyle(new DotEdgeStyle(Color.Orange, Color.White, DotEdgeArrowType.Normal, DotEdgeArrowType.Normal))
.SetDefaultSubGraphStyle(new DotSubGraphStyle(Color.Gray, DotSubGraphStyleAttribute.Solid))
// Add a node using default style above
.AddNode("NodeA")
// Add a node using a non-default style
.AddNode("NodeB", new DotNodeStyle(...))
// Add an edge using default style above
.AddEdge("NodeA", "NodeB") // Should find above node elements by name; create new nodes if not found
// add an edge using non-default style
.AddEdge("NodeB", "NodeA", new DotEdgeStyle(...))
//...same pattern for subgraphs
I hope this helps spur some ideas, but feel free to continue the discussion and put me to work once we have a design you're happy with.
I like the idea of making styles separate object/class. I will start some POC and make a draft PR to see how it goes. Sorry for my late answer.
Great library -- thanks for sharing it!
Have you given any thought to allowing for default styles or themes so that users don't have to redefine the same styles for each node and edge?
I'm asking because I'm considering integrating your library in with my state management library. Ideally, my users would be able to define a set of styles for states (nodes), transitions (edges), and conditional transitions (specialized nodes and edges) before calling an export method and end up with something like this diagram.
Let me know your thoughts and I might be able to help implement this functionality.