From d82973769c08012199766f35cf361689429cc023 Mon Sep 17 00:00:00 2001 From: jos Date: Thu, 21 May 2015 14:00:29 +0200 Subject: [PATCH] Reworked the dot language playground and merged with the graphviz gallery --- .../data/JOIN ME WITH GRAPHVIZ.html | 219 ------------------ .../dotLanguage/data/cellular_automata.gv.txt | 23 ++ .../dotLanguage/data/computer_network.gv.txt | 19 ++ .../data/dotLanguage/data/simple.gv.txt | 15 ++ .../data/dotLanguage/dotLanguage.html | 22 ++ .../data/dotLanguage/dotPlayground.html | 195 ++++++++++++++++ .../dotLanguage/graphvizGallery}/fsm.gv.txt | 0 .../dotLanguage/graphvizGallery}/hello.gv.txt | 0 .../graphvizGallery}/process.gv.txt | 0 .../graphvizGallery}/screenshots/fsm.png | Bin .../graphvizGallery}/screenshots/hello.png | Bin .../screenshots/softmaint.png | Bin .../screenshots/traffic_lights.png | Bin .../graphvizGallery}/siblings.gv.txt | 0 .../graphvizGallery}/softmaint.gv.txt | 0 .../graphvizGallery}/traffic_lights.gv.txt | 0 .../graphvizGallery}/transparency.gv.txt | 0 .../graphvizGallery}/twopi2.gv.txt | 0 .../dotLanguage/graphvizGallery}/unix.gv.txt | 0 .../dotLanguage/graphvizGallery}/world.gv.txt | 0 .../network/categories/data/dot_language.html | 23 -- .../network/graphviz/graphviz_gallery.html | 86 ------- lib/network/dotparser.js | 2 + 23 files changed, 276 insertions(+), 328 deletions(-) delete mode 100644 examples/network/categories/data/JOIN ME WITH GRAPHVIZ.html create mode 100644 examples/network/categories/data/dotLanguage/data/cellular_automata.gv.txt create mode 100644 examples/network/categories/data/dotLanguage/data/computer_network.gv.txt create mode 100644 examples/network/categories/data/dotLanguage/data/simple.gv.txt create mode 100644 examples/network/categories/data/dotLanguage/dotLanguage.html create mode 100644 examples/network/categories/data/dotLanguage/dotPlayground.html rename examples/network/{graphviz/data => categories/data/dotLanguage/graphvizGallery}/fsm.gv.txt (100%) rename examples/network/{graphviz/data => categories/data/dotLanguage/graphvizGallery}/hello.gv.txt (100%) rename examples/network/{graphviz/data => categories/data/dotLanguage/graphvizGallery}/process.gv.txt (100%) rename examples/network/{graphviz => categories/data/dotLanguage/graphvizGallery}/screenshots/fsm.png (100%) rename examples/network/{graphviz => categories/data/dotLanguage/graphvizGallery}/screenshots/hello.png (100%) rename examples/network/{graphviz => categories/data/dotLanguage/graphvizGallery}/screenshots/softmaint.png (100%) rename examples/network/{graphviz => categories/data/dotLanguage/graphvizGallery}/screenshots/traffic_lights.png (100%) rename examples/network/{graphviz/data => categories/data/dotLanguage/graphvizGallery}/siblings.gv.txt (100%) rename examples/network/{graphviz/data => categories/data/dotLanguage/graphvizGallery}/softmaint.gv.txt (100%) rename examples/network/{graphviz/data => categories/data/dotLanguage/graphvizGallery}/traffic_lights.gv.txt (100%) rename examples/network/{graphviz/data => categories/data/dotLanguage/graphvizGallery}/transparency.gv.txt (100%) rename examples/network/{graphviz/data => categories/data/dotLanguage/graphvizGallery}/twopi2.gv.txt (100%) rename examples/network/{graphviz/data => categories/data/dotLanguage/graphvizGallery}/unix.gv.txt (100%) rename examples/network/{graphviz/data => categories/data/dotLanguage/graphvizGallery}/world.gv.txt (100%) delete mode 100644 examples/network/categories/data/dot_language.html delete mode 100644 examples/network/graphviz/graphviz_gallery.html diff --git a/examples/network/categories/data/JOIN ME WITH GRAPHVIZ.html b/examples/network/categories/data/JOIN ME WITH GRAPHVIZ.html deleted file mode 100644 index 908aaa94..00000000 --- a/examples/network/categories/data/JOIN ME WITH GRAPHVIZ.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - Network | DOT language playground - - - - - - - - - - - - - - - - - - - -
-

DOT language playground

- -
-
- - -
-
- - -
-
- - - - - - - - - - - diff --git a/examples/network/categories/data/dotLanguage/data/cellular_automata.gv.txt b/examples/network/categories/data/dotLanguage/data/cellular_automata.gv.txt new file mode 100644 index 00000000..495d7db7 --- /dev/null +++ b/examples/network/categories/data/dotLanguage/data/cellular_automata.gv.txt @@ -0,0 +1,23 @@ +digraph G { + // note: not all attributes are recognized and supported by Network + // unrecognized attributes are ignored + + node[width=.25,height=.375,fontsize=15] + node [shape=filled fillcolor=#F1AAF0] + 0-> 0 ; + 1-> 1 ; + 2-> 2 ; + 3-> 3 ; + 4-> 4 ; + 5-> 5 ; + 6-> 6 ; + 7-> 5 ; + 8-> 8 ; + 9-> 9 ; + 10-> 10 ; + 11-> 10 ; + 12-> 12 ; + 13-> 5 ; + 14-> 10 ; + 15-> 0 ; +} diff --git a/examples/network/categories/data/dotLanguage/data/computer_network.gv.txt b/examples/network/categories/data/dotLanguage/data/computer_network.gv.txt new file mode 100644 index 00000000..03f631a2 --- /dev/null +++ b/examples/network/categories/data/dotLanguage/data/computer_network.gv.txt @@ -0,0 +1,19 @@ +digraph topology +{ + node[shape=circle fontSize=12] + edge[length=170 fontSize=12] + "10.0.255.1" -> "10.0.255.3"[label="1.000"]; + "10.0.255.1" -> "10.0.255.2"[label="1.000"]; + "10.0.255.1" -> "10.0.255.2"[label="1.000"]; + "10.0.255.1" -> "10.0.255.3"[label="1.000"]; + "10.0.255.2" -> "10.0.255.1"[label="1.000"]; + "10.0.255.2" -> "10.0.255.3"[label="1.000"]; + "10.0.255.3" -> "10.0.255.1"[label="1.000"]; + "10.0.255.3" -> "10.0.255.2"[label="1.000"]; + "10.0.255.3" -> "10.0.3.0/24"[label="HNA", shape=solid]; + "10.0.3.0/24"[shape=box]; + "10.0.255.2" -> "10.0.2.0/24"[label="HNA"]; + "10.0.2.0/24"[shape=box]; + "10.0.255.1" -> "10.0.1.0/24"[label="HNA"]; + "10.0.1.0/24"[shape=box]; +} diff --git a/examples/network/categories/data/dotLanguage/data/simple.gv.txt b/examples/network/categories/data/dotLanguage/data/simple.gv.txt new file mode 100644 index 00000000..50fb06e3 --- /dev/null +++ b/examples/network/categories/data/dotLanguage/data/simple.gv.txt @@ -0,0 +1,15 @@ +digraph { + node [shape=circle fontsize=16] + edge [length=100, color=gray, fontcolor=black] + + A -> A[label=0.5]; + B -> B[label=1.2] -> C[label=0.7] -- A; + B -> D; + D -> {B; C} + D -> E[label=0.2]; + F -> F; + A [ + fontcolor=white, + color=red, + ] +} diff --git a/examples/network/categories/data/dotLanguage/dotLanguage.html b/examples/network/categories/data/dotLanguage/dotLanguage.html new file mode 100644 index 00000000..1d83f48d --- /dev/null +++ b/examples/network/categories/data/dotLanguage/dotLanguage.html @@ -0,0 +1,22 @@ + + + Network | DOT Language + + + + + + +

+ Network supports the DOT language. +

+
+ + + + diff --git a/examples/network/categories/data/dotLanguage/dotPlayground.html b/examples/network/categories/data/dotLanguage/dotPlayground.html new file mode 100644 index 00000000..01542247 --- /dev/null +++ b/examples/network/categories/data/dotLanguage/dotPlayground.html @@ -0,0 +1,195 @@ + + + + Network | DOT language playground + + + + + + + + + + + + + + + + + + + + +
+

DOT language playground

+ + + + +

+ Play around with the DOT language in the textarea below, or select one of the following examples: +

+

+ simple, + computer network, + cellular automata, + fsm *, + hello *, + process *, + siblings *, + softmaint *, + traffic lights *, + transparency *, + twopi2 *, + unix *, + world * +

+

+ The examples marked with a star (*) come straight from the gallery of GraphViz. +

+
+
+ + +
+
+ + +
+
+ + + + diff --git a/examples/network/graphviz/data/fsm.gv.txt b/examples/network/categories/data/dotLanguage/graphvizGallery/fsm.gv.txt similarity index 100% rename from examples/network/graphviz/data/fsm.gv.txt rename to examples/network/categories/data/dotLanguage/graphvizGallery/fsm.gv.txt diff --git a/examples/network/graphviz/data/hello.gv.txt b/examples/network/categories/data/dotLanguage/graphvizGallery/hello.gv.txt similarity index 100% rename from examples/network/graphviz/data/hello.gv.txt rename to examples/network/categories/data/dotLanguage/graphvizGallery/hello.gv.txt diff --git a/examples/network/graphviz/data/process.gv.txt b/examples/network/categories/data/dotLanguage/graphvizGallery/process.gv.txt similarity index 100% rename from examples/network/graphviz/data/process.gv.txt rename to examples/network/categories/data/dotLanguage/graphvizGallery/process.gv.txt diff --git a/examples/network/graphviz/screenshots/fsm.png b/examples/network/categories/data/dotLanguage/graphvizGallery/screenshots/fsm.png similarity index 100% rename from examples/network/graphviz/screenshots/fsm.png rename to examples/network/categories/data/dotLanguage/graphvizGallery/screenshots/fsm.png diff --git a/examples/network/graphviz/screenshots/hello.png b/examples/network/categories/data/dotLanguage/graphvizGallery/screenshots/hello.png similarity index 100% rename from examples/network/graphviz/screenshots/hello.png rename to examples/network/categories/data/dotLanguage/graphvizGallery/screenshots/hello.png diff --git a/examples/network/graphviz/screenshots/softmaint.png b/examples/network/categories/data/dotLanguage/graphvizGallery/screenshots/softmaint.png similarity index 100% rename from examples/network/graphviz/screenshots/softmaint.png rename to examples/network/categories/data/dotLanguage/graphvizGallery/screenshots/softmaint.png diff --git a/examples/network/graphviz/screenshots/traffic_lights.png b/examples/network/categories/data/dotLanguage/graphvizGallery/screenshots/traffic_lights.png similarity index 100% rename from examples/network/graphviz/screenshots/traffic_lights.png rename to examples/network/categories/data/dotLanguage/graphvizGallery/screenshots/traffic_lights.png diff --git a/examples/network/graphviz/data/siblings.gv.txt b/examples/network/categories/data/dotLanguage/graphvizGallery/siblings.gv.txt similarity index 100% rename from examples/network/graphviz/data/siblings.gv.txt rename to examples/network/categories/data/dotLanguage/graphvizGallery/siblings.gv.txt diff --git a/examples/network/graphviz/data/softmaint.gv.txt b/examples/network/categories/data/dotLanguage/graphvizGallery/softmaint.gv.txt similarity index 100% rename from examples/network/graphviz/data/softmaint.gv.txt rename to examples/network/categories/data/dotLanguage/graphvizGallery/softmaint.gv.txt diff --git a/examples/network/graphviz/data/traffic_lights.gv.txt b/examples/network/categories/data/dotLanguage/graphvizGallery/traffic_lights.gv.txt similarity index 100% rename from examples/network/graphviz/data/traffic_lights.gv.txt rename to examples/network/categories/data/dotLanguage/graphvizGallery/traffic_lights.gv.txt diff --git a/examples/network/graphviz/data/transparency.gv.txt b/examples/network/categories/data/dotLanguage/graphvizGallery/transparency.gv.txt similarity index 100% rename from examples/network/graphviz/data/transparency.gv.txt rename to examples/network/categories/data/dotLanguage/graphvizGallery/transparency.gv.txt diff --git a/examples/network/graphviz/data/twopi2.gv.txt b/examples/network/categories/data/dotLanguage/graphvizGallery/twopi2.gv.txt similarity index 100% rename from examples/network/graphviz/data/twopi2.gv.txt rename to examples/network/categories/data/dotLanguage/graphvizGallery/twopi2.gv.txt diff --git a/examples/network/graphviz/data/unix.gv.txt b/examples/network/categories/data/dotLanguage/graphvizGallery/unix.gv.txt similarity index 100% rename from examples/network/graphviz/data/unix.gv.txt rename to examples/network/categories/data/dotLanguage/graphvizGallery/unix.gv.txt diff --git a/examples/network/graphviz/data/world.gv.txt b/examples/network/categories/data/dotLanguage/graphvizGallery/world.gv.txt similarity index 100% rename from examples/network/graphviz/data/world.gv.txt rename to examples/network/categories/data/dotLanguage/graphvizGallery/world.gv.txt diff --git a/examples/network/categories/data/dot_language.html b/examples/network/categories/data/dot_language.html deleted file mode 100644 index 4f3df920..00000000 --- a/examples/network/categories/data/dot_language.html +++ /dev/null @@ -1,23 +0,0 @@ - - - Network | DOT Language - - - - - - -

- Network supports the DOT language. -

-
- - - - diff --git a/examples/network/graphviz/graphviz_gallery.html b/examples/network/graphviz/graphviz_gallery.html deleted file mode 100644 index 913ccacb..00000000 --- a/examples/network/graphviz/graphviz_gallery.html +++ /dev/null @@ -1,86 +0,0 @@ - - - Network | Graphviz Gallery - - - - - - - - - - -

- The following examples are unmodified copies from the - Graphviz Gallery. -

-

- Note that some style attributes of Graphviz are not supported by vis.js, - and that vis.js offers options not supported by Graphviz (which could make - some examples look much nicer). -

- -

- - -

- -
- - - diff --git a/lib/network/dotparser.js b/lib/network/dotparser.js index dd0c73f7..647ff63b 100644 --- a/lib/network/dotparser.js +++ b/lib/network/dotparser.js @@ -4,6 +4,8 @@ * * DOT language reference: http://www.graphviz.org/doc/info/lang.html * + * DOT language attributes: http://graphviz.org/content/attrs + * * @param {String} data Text containing a graph in DOT-notation * @return {Object} graph An object containing two parameters: * {Object[]} nodes