我用 viz.js 制作了这张图。
点代码非常简单:
<script type="text/vnd.graphviz" id="myDiagram">
digraph G {
graph [
fontname = "Arial",
fontsize = 18,
label = "Digest Email Flow Chart",
size = "4,4" ];
node [
shape = ellipse,
sides = 4,
distortion = "0.0",
orientation = "0.0",
skew = "0.0",
bgcolor = lightgray,
style = filled,
fontname = "Arial" ];
"Email Notification" [shape=ellipse, shape = "Mrecord" label="Digest Email\n(scheduled)"];
"Sentiment Analysis" [shape=ellipse, shape = "Mrecord" label="Sentiment Analysis\n(triggered)"];
"Google News" [shape=ellipse, shape = "Mrecord" label="Google News\n(scheduled)"];
"Dilbert Daily Comics" [shape=ellipse, shape = "Mrecord" label="Dilbert Daily Comics\n(scheduled)"];
"Time Series Chart" [shape=ellipse, shape = "Mrecord" label="Time Series Chart\n(triggered)"];
"Twitter Stream" [shape=ellipse, shape = "Mrecord" label="Twitter Stream\n(scheduled)"];
"Email Notification" -> "Time Series Chart" [dir = "back"];
"Email Notification" -> "Dilbert Daily Comics" [dir = "back"];
"Time Series Chart" -> "Twitter Stream" [dir = "back"];
"Sentiment Analysis" -> "Google News" [dir = "back"];
"Email Notification" -> "Sentiment Analysis" [dir = "back"];
}
</script>
但是 viz.js 库是 2.3 MB!那太大了。
是否可以对 D3.js 中的力导向图之类的东西做同样的事情?