Comments (3)
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?
from dotnetgraph.
Yes, I don't have a well thought out design, but here are some things to consider:
- Breakout styles from DotNode, DotEdge, and DotSubGraph
-- DotNodeStyle: Color, FontColor, FillColor, Shape, Style, Height
-- DotEdgeStyle: Color, FontColor, ArrowHead, ArrowTail
-- DotSubGraphStyle: Color, Style - DotNode, DotEdge, and DotSubGraph could have a very minimal default style, but would have an optional constructor param to override the default scale
- DotGraph could implement the builder pattern to
-- set default styles for nodes, edges, and subgraphs
-- add nodes, edges, and subgraphs
-- see psuedo code below
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.
from dotnetgraph.
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.
from dotnetgraph.
Related Issues (20)
- Missing node identifier produces invalid dot file HOT 7
- Character escaping issue HOT 5
- Restore minification as an option HOT 2
- Properties with real type instead of *Attribute for better autocompletion HOT 1
- Missing Attribute Pos HOT 2
- DotArrow should output -- in undirected graphs HOT 2
- Label question HOT 8
- Add support for layouts HOT 2
- Possible missing features HOT 5
- How to specify `rankdir` graph attribute HOT 3
- missing System.Drawing.Color assembly HOT 14
- Make a simple logo out of a free icon
- Create a parser
- Readme vs class - DotSubGraph vs DotSubgraph HOT 2
- DotGraph.getNode(string identifier) or DotEdge.From(string identifier).To(string identifier) HOT 2
- Feature Request: Add support for subgraphs/clusters HOT 2
- Please provide a signed assembly
- doesn't support records? HOT 1
- Edges from port to port
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnetgraph.