[instaviz-users] how to set a default style for a node?
Ryan Schmidt
instaviz-2009a at ryandesign.com
Sun Mar 29 02:46:29 CDT 2009
On Mar 29, 2009, at 02:35, Andy Dent wrote:
> On 29/03/2009, at 1:51 PM, Ryan Schmidt wrote:
>
>> uld be extended to support these kinds of user style
>> definitions. In existing Graphviz syntax, you can only have a single
>> global node or edge style, and then you can override that in
>> individual nodes and edges, but there's no concept of being able to
>> define multiple node or edge style templates and have those templates
>> then used for specific nodes and edges.
>
> That is not quite accurate.
>
> Any time you redefine attributes using node[...] or edge[...], they
> stay in force as defaults for nodes and edges defined afterwards.
>
> I make very heavy use of this to keep diagrams from being cluttered
> with lots of decoration. There's an example file in this style and
> output at:
> http://aussiedesignedsoftware.com/blog/?p=72#more-72
True enough. I totally forgot that when I wrote that. I've made
extensive use of this feature as well.
The problem is it requires you to group your nodes and edges by
style, which could make the graph source file harder to read and
understand. Sometimes it makes more sense to order nodes and edges in
a different way.
> I agree it would be nice to have a way to use something like CSS
> classes to associate a style with a node defined in an arbitrary
> location.
That's what I was going after. And it has been suggested on the
Graphviz lists before. I think some kind of hypothetical syntax may
even have been mentioned, I believe it may even have been by one of
the Graphviz developers.
You could also probably solve this today by pre-processing a dot file
with gvpr, replacing some custom style attribute with the inline
style definitions, before handing it to the layouter.
More information about the instaviz-users
mailing list