我已将 DOT 代码文件保存为 utf-8 编码。但它不能输出自定义形状的 png 图像文件。是否有示例来演示用户指定的字符集使用 graphviz?
演示代码在这里。
digraph G {
bgcolor=black;
edge [arrowsize=1, color=red];
node [penwidth=1, color=white, labelloc=b];
BR [shape=box, label="BR", charset="utf-8", image="??.png"];
DS [shape=plaintext, fontname="SimSun", fontcolor=white, fontsize=18, label="??"];
BR -> DS[dir=forward];
}
Run Code Online (Sandbox Code Playgroud)
命令行的结果如下所示。
C:\dot>dot -Gcharset=utf-8 -Tpng -o demo.png demo.dot
Warning: No such file or directory while opening ???.png
Warning: No or improper image="???.png" for node "BR"
Run Code Online (Sandbox Code Playgroud) 在Qt中,可以使用以下代码绘制三次贝塞尔曲线。
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, true);
QPainterPath path;
path.moveTo(80, 320);
path.cubicTo(200, 80, 320, 80, 480, 320);
painter.setPen(QPen(Qt::black, 8));
painter.drawPath(path);
Run Code Online (Sandbox Code Playgroud)
如何使用wxWidgets绘制相同的曲线?
这是一个非常好的例子,说明了如何使用graphviz生成复杂的图形.此处列出了点文件.
digraph G {
compound=true;
ranksep=1.25;
label="From Past to Future...";
node [shape=plaintext, fontsize=16];
bgcolor=white;
edge [arrowsize=1, color=black];
/* Nodes */
subgraph cluster_Computers {label="Computers"; labelloc="b"; Computers_icon};
Computers_icon [label="", shape=box, style=invis, shapefile="Computers.png"];
subgraph cluster_Semantic_Web {label="Semantic Web"; labelloc="b"; Semantic_Web_icon};
Semantic_Web_icon [label="", shape=box, style=invis, shapefile="Semantic_Web.png"];
subgraph cluster_Cryptography {label="Cryptography"; labelloc="b"; Cryptography_icon};
Cryptography_icon [label="", shape=box, style=invis, shapefile="Cryptography.png"];
subgraph cluster_Automata {label="Automata"; labelloc="b"; Automata_icon};
Automata_icon [label="", shape=box, style=invis, shapefile="Automata.png"];
subgraph cluster_AI {label="A.I."; labelloc="b"; AI_icon};
AI_icon [label="", shape=box, style=invis, shapefile="AI.png"];
subgraph cluster_Chaos {label="Chaos / Fractals"; labelloc="b"; Chaos_icon};
Chaos_icon …Run Code Online (Sandbox Code Playgroud)