Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a good tool for programmatically creating diagrams? [closed]

Tags:

diagram

I would like a tool to create diagram in a programming language, maybe something like lua.

Is there any tool designed for that?

like image 501
FelipeC Avatar asked Mar 26 '10 14:03

FelipeC


2 Answers

Yes, you can generate .dot files for Graphviz. Since these are text files, you can do it from any language. I wrote a post a while ago about auto-generating binary-tree diagrams from C code using Graphviz.

like image 66
Eli Bendersky Avatar answered Oct 21 '22 23:10

Eli Bendersky


A little retro, perhaps, but there's always Pic. It outputs to .eps which can easily be converted to anything you want.

The input is a little old-school, but since it's all-text, it can be targetted by any language (even Lua) that has text output. Here's an example of a diagram of a data-structure.

.PS
boxwid = .5; boxht = .25
down
Base: box "base"
Used: box "used"
Max: box "max"

move to Base.e
move right

right
Mfile: box dashed wid 3 ht 5
move to Mfile.nw; move down .125

Mtab: right; box "nexttab"; box "nextent"
move to Mtab.sw; move down .25

Tab: right; box "adr0"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr1"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr2"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr3"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr4"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr5"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr6"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr7"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr8"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box invis "..."; box invis "..."; box invis "..."
move to Tab.sw; move down .25
Tab: right; box "adrN"; box "mark"; box "sz"

arrow from Base.e to Mfile.nw
arrow from Used.e to Tab.sw down .125
arrow from Max.e to Mfile.sw

.PE

Indexed-Memory Data Structure

like image 29
luser droog Avatar answered Oct 22 '22 01:10

luser droog