Graphviz的使用
一、背景
最近想画一些架构,流程图之类的, 有些图形比较负责,画起来比较费时间,就找了个简单工具辅助自己画图。Graphviz画的图比较简单,凑合能用,优点就是快适合程序员使用。
二、安装
官方网站(https://graphviz.gitlab.io)下载安装就好了,我全程没有问题。
三、使用
使用就是写DOT语言。
语法规则参考:https://graphviz.gitlab.io/_pages/doc/info/lang.html
四、样例
这里就提高服务器性能-架构这篇文章的图做例子吧。
1.1
digraph simple_demo {
application->{file, databases};
}
1.2
digraph simple_demo {
graph [label="server"];
subgraph cluster_application {
application;
};
subgraph cluster_file {
file;
};
subgraph cluster_databases {
databases;
};
application->{file, databases};
graph [label=""];
}
1.3
digraph simple_demo {
graph [label="server"];
subgraph cluster_application {
application;
};
subgraph cluster_file {
file;
};
subgraph cluster_databases {
databases;
};
application->{file, databases};
application->message_queue;
message_queue->{application_b, application_c};
graph [label=""];
}
1.4 发现有些问题