Graphviz Issue Tracker
Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001811graphvizOtherpublic2010-02-06 20:042011-04-28 04:03
ReporterOren Ben-Kiki 
Assigned Togviz 
PrioritynormalSeverityminorReproducibilityalways
StatusacknowledgedResolutionno change required 
PlatformOS*-*-OS Version
Summary0001811: [New Feature Request] Add a CSS-like "class" attribute
Description
Address the need for specifying styles once, and reuse them in many nodes/edges.
Steps To Reproduce

digraph new_feature_request {
  node [ shape = circle, color = black ];
  node.foo [ shape = rectangle, color = red ];
  node.bar [ shape = diamond, color = green ];
  node.foo.bar [ shape = ellipse ];
  C [ label = "black circle" ];
  R [ label = "red rectangle", class = foo ];
  D [ label = "green diamond", class = "bar" ];
  E [ label = "green ellipse", class = "foo bar" ];
  edge [ style = solid, arrowsize = 1 ];
  edge.foo [ style = dashed ];
  edge.bar [ style = dotted ];
  edge.baz [ arrowsize = 2 ];
  C -> R [ label = "solid big black arrow", class = baz ];
  R -> D [ label = "dotted big black arrow", class = "baz foo" ];
  D -> E [ label = "bold big black arrow", class = "foo baz", style = bold ];
  graph.foo [ /* etc. */ ];
}
Additional Information

Pros of this approach:
<CD>
- It makes it *much* easier to manage graphs with several consistent styles or combinations of styles.
- It is a simple solution (both technically and conceptually).
- It is immediately intuitive to everyone who used CSS.
- It is backward compatible with existing files.
- It is a natural extension of the current syntax.
</CD>

[north]
This is very interesting and we have often thought about a feature like this.

The implementation would probably be a little more complicated than just
changing the parser. What if "classes" are modified after the graph has been read?
(Or can classes be set on objects in a graph that is constructed entirely in memory?)
The graph output routine probably should be aware of classes at least to avoid
writing out all the individual attributes that are class-defined.
TagsNo tags attached.
AUXILLARY-FILES
DATE-FIXED
FIX-COMMENT 
In Parser.y, add the rule:
<CD>
    class_list : T_class symbol class_list { ...remember class... } | /* empty */ ;
(Whete T_class is '.'). Also, change the attr_stmt rule to:
    attr_stmt : attr_class class_list attr_list | attr_set ;
</CD>
Finally, i
FORMER-ID1874
INPUT-FILE
OUTPUT-FILE
STATUS-COMMENT   Request
VERSION     
Attached Files

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2011-04-28 04:03 user1 New Issue
2011-04-28 04:03 user1 Assigned To => user1


MantisBT 1.2.5[^]
Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker