前言
流程图很恶心,很多时候自己手画了转电子版很难看,电子也懒的画。
那么能不能用Graphviz配合dot语言让它自己出个流程图?
似乎这个功能已经有前人实现过了,叫做AutoFlowChart
那我就做个最简单的?直接生产到dot语言文本那一级,留给用户更多的自定编辑空间吧!
碰壁记录1
我把这流程图交上去,还不得被退学?
digraph G{
label = "Test Go"
splines = ortho
node[fontname="FangSong"]
start[shape=box,style=rounded,label="开始"]
{
rank = same
node[shape=diamond,fontname="FangSong"]
switch1[label="输入数字为1?"]
switch2[label="输入数字为2?"]
switch3[label="输入数字为3?"]
switch4[label="输入数字为4?"]
switch5[label="输入数字为5?"]
switch6[label="输入数字为6?"]
switch7[label="输入数字为7?"]
switch8[label="输入数字为8?"]
switch9[label="输入数字为9?"]
}
node[shape=box,fontname="FangSong"]
operate1[label="录入信息"]
operate2[label="按照姓名查找"]
operate3[label="修改成绩"]
operate4[label="删除成绩"]
operate5[label="将成绩排序"]
operate6[label="统计成绩"]
operate7[label="打开存储的成绩"]
operate8[label="将最新的成绩保存"]
operate9[shape=box,style=rounded,label="退出"]
start -> switch1
switch1 -> switch2[xlabel="No"]
switch2 -> switch3[xlabel="No"]
switch3 -> switch4[xlabel="No"]
switch4 -> switch5[xlabel="No"]
switch5 -> switch6[xlabel="No"]
switch6 -> switch7[xlabel="No"]
switch7 -> switch8[xlabel="No"]
switch8 -> switch9[xlabel="No"]
switch1 -> operate1[xlabel="Yes",len=50,weight=100]
switch2 -> operate2[xlabel="Yes",len=50,weight=100]
switch3 -> operate3[xlabel="Yes",len=50,weight=100]
switch4 -> operate4[xlabel="Yes",len=50,weight=100]
switch5 -> operate5[xlabel="Yes",len=50,weight=100]
switch6 -> operate6[xlabel="Yes",len=50,weight=100]
switch7 -> operate7[xlabel="Yes",len=50,weight=100]
switch8 -> operate8[xlabel="Yes",len=50,weight=100]
switch9 -> operate9[xlabel="Yes",len=50,weight=100]
operate1 -> switch1
operate2 -> switch1
operate3 -> switch1
operate4 -> switch1
operate5 -> switch1
operate6 -> switch1
operate7 -> switch1
operate8 -> switch1
}
编译指令
dot -Tpng try.dot -o try.png