Giter Club home page Giter Club logo

Comments (3)

vfrz avatar vfrz commented on June 8, 2024

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.

scottctr avatar scottctr commented on June 8, 2024

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.

vfrz avatar vfrz commented on June 8, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.