Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set attributes for all nodes and edges #107

Open
marcelom97 opened this issue Nov 6, 2024 · 1 comment · May be fixed by #109
Open

Set attributes for all nodes and edges #107

marcelom97 opened this issue Nov 6, 2024 · 1 comment · May be fixed by #109
Labels
enhancement New feature or request

Comments

@marcelom97
Copy link
Contributor

Is there a way to set global attributes for nodes and edges?

I want to do something like this

digraph G {
  node [style = filled];
  edge [color = "red"];

  ...
}
@marcelom97
Copy link
Contributor Author

I found that you can set them using Graph.Attr method https://github.com/goccy/go-graphviz/blob/master/cgraph/cgraph.go#L1127

The first argument of type int is to specify if you want to apply the attributes to graph, node or edge

I suggest to define the kind as a new type

ex:

type Kind int

const (
	KindGraph Kind = iota
	KindNode
	KindEdge
)

Also add documentation to Graph.Attr

@goccy goccy added the enhancement New feature or request label Nov 14, 2024
@marcelom97 marcelom97 linked a pull request Dec 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants