I am trying to code a flowchart generator for a language using Ruby.
I wanted to know if there were any libraries that I could use to draw various shapes for the various flowchart elements and write out text to those shapes.
I would really prefer not having to write code for drawing basic shapes, if I can help it.
Can someone could point me to some reference documentation with examples of using that library?
Write up your flowchart as a directed or undirected graph in Graphviz. Graphviz has a language, dot that makes it easy to generate graphs. Just generate the dot file, run it through Graphiviz, and you get your image.
graph {
A -- B -- C;
B -- D;
C -- D [constraint=false];
}
renders as
digraph {
A [label="start"];
B [label="eat"];
C [label="drink"];
D [label="be merry"];
A -> B -> C;
C -> D [constraint=false];
B -> D [ arrowhead=none, arrowtail=normal]; // reverse this edge
}
renders as
You can control node shapes and much more in Graphviz.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With