Possible missing features
First of all, thank you for this library, but it seems that some features are missing.
- [x] Applying default attributes to a node, edge, graph etc. is not possible, since the "Identifier" is automatically encapsulated by double quotes. As a solution, maybe only encapsulate the identifier when it is actually necessary? Although, this makes it impossible to identify a node as "node".
digraph a { // default node[shape=box]; } - [ ] The amount of attributes is very limited, for example setting fontname, xlabel etc. is not possible, see https://graphviz.org/doc/info/attrs.html. I think implementing all of those manually is too much work an unnecessary, so a solution might be an option to add custom attributes? e.g.
IDotElement.AddAttribute(string(or DotAttribute enum), object)? - [x] It is possible for a style attribute to have multiple values, separated by a comma, e.g.
[shape=box style="filled, rounded"]. (marking enums as flags?) - [ ] Labels can contain HTML, for example to display a table,
label=<<TABLE>...</TABLE>>, but since the label value is automatically encapsulated with double quotes this is not possible. Maybe adding a HtmlLabelAttribute?
@vfrz I saw you tried to implement default styles by implementing your own logic, but this is already a feature of GraphViz DOT and I think the selling point of a library like this should be simplicity.
Default styles can also be set per subgraph / cluster.
https://stackoverflow.com/questions/26553273/how-to-set-default-node-shape-to-box-instead-of-oval
Hey, Thanks for the issue, currently I don't have much time to work on this project. At first DotNetGraph was just a personal project to be able to print an abstract syntax tree for another project of mine. And so it didn't require a lot of features, that is why a lot is missing.
- I didn't know about default style within the GraphViz DOT language, seems effectively easier than implementing it my own way.
- The idea of allowing custom attributes seems fair and good to reduce DotNetGraph limitations.
- Like the previous idea, having mutliple values using flag enums seems good.
- I am not sure if a specified attribute should exist depending on the format, maybe just have a LabelAttribute with a property specifying the format is more appropriate (easier for checking unicity, what to do if we add a "classic" LabelAttribute and a HtmlLabelAttribute?)
I will try to implement all of these changes asap, in the meanwhile feel free to discuss about it and PR are welcome if you feel like to participate.
@vfrz I made a pull request for determining if an identifier should be surrounded by double quotes.
For the LabelAttribute I was thinking about:
- creating a
LabelFormatenum with Text and Html - adding a
LabelFormatparameter (and property) to the LabelAttribute constructor - modifying DotCompiler to check for
LabelAttribute.Format
is this okay?
Thanks for your pull request, I just merged it.
Using an enum to specify the label format seems good to me.
I think I'll update the nuget package later on, tell me if you need it shortly.
Closing this issue as all items have been resolved with v3 except for the default attributes, it will be handled with #6