2

我用 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 中的力导向图之类的东西做同样的事情?

4

1 回答 1

0

最终我决定自己编写图表代码,因为 jsPlumb 在某些方面与 jQuery Mobile js 和 css 有冲突。在 html5 画布上进行自己的绘图并不难,您最终会得到一个“更轻”的应用程序。

这是结果:

链接到图表

于 2013-08-09T05:40:20.063 回答