A database symbol for GraphViz
Friday, November 23rd, 2007Download the source for my GraphViz database symbol featured in this article: DatabaseShape.ps
I have started using the GraphViz application, which accepts a list of nodes and arrows, and figures out how to attractively arrange them in a diagram. For example, you can very nearly produce this output:
by supplying this rather modest input file to GraphViz (most of whose length comes from my wanting particular colors)::
digraph Application {
rankdir=LR;
node [shape=box,style=filled,fillcolor="#C0D0C0"];
subgraph clusterClient {
label=”Client”; style=filled; bgcolor=”#D0C0A0″;
“Browser”;
};
subgraph clusterServer {
label=”Server”; style=filled; bgcolor=”#D0C0A0″;
“App”;
“Database” [shape=DatabaseShape,peripheries=0];
};
“Browser” -> “App” [label="HTTP"];
“App” -> “Database” [label="SQL"];
}
I used the words “very nearly” because, in fact, GraphViz only knows how to draw simple shapes like rectangles, and is ignorant of the standard cylinder-shaped database symbol that I have used here by asking for a DatabaseShape. Submitting the above code to GraphViz will, normally, produce three nodes that are all rectangles. To teach it about the database shape, I had to write some PostScript.