graphviz

Di., 17/07/2012 - 11:38
Body
http://www.oliver-konow.de/2008/09/20/kleines-graphviz-tutorial-teil1/

Online tools

http://graphviz-dev.appspot.com/ http://zvtm.sourceforge.net/zgrviewer/applet/

Offline/Other tools

http://www.graphviz.org/webdot/index.html http://www2.research.att.com/~john/Grappa/ | java http://www.pixelglow.com/graphviz/ | MAC only

Tutorials

http://jodiem.com.au/2012/09/28/using-graphviz-in-confluence-a-tutorial/ http://wiki.ubuntuusers.de/Graphviz http://4webmaster.de/wiki/Graphviz-Tutorial http://www.linuxjournal.com/article/7275?page=0,1 http://www.poirrier.be/~jean-etienne/articles/graphviz/ http://www.deesaster.org/dot/Graphen_zeichnen_mit_dot.pdf http://wiki.zum.de/Hilfe:Graphviz | wiki syntax http://talks.spline.de/slides/graphviz.pdf http://www.oliver-konow.de/2008/09/29/kleines-graphviz-tutorial-teil2/ www.graphviz.org/pdf/dotguide.pdf

Eigene Symbole

http://www.graphviz.org/wiki/how-create-custom-shapes http://www.karakas-online.de/forum/viewtopic.php?t=2647 http://rhodesmill.org/brandon/2007/a-database-symbol-for-graphviz/ http://stackoverflow.com/questions/8382304/how-to-generate-nodes-with-customized-shape Der Pfad muss stimmen unter Linux setzt man environment variablen so: http://lowfatlinux.com/linux-environment-variables.html
  1. SERVER_NAME=myservername
  2. GV_FILE_PATH=/var/www/graphviz_images

Install + php

For php: http://pear.php.net/package/Image_GraphViz/download bad docs, unmaintained? newer: aptitude install libgv-php5, see grapgviz page: http://www.graphviz.org/Documentation.php load the lin in php.ini "extension=gv.so" http://www.graphviz.org/pdf/gv.3php.pdf gv.3pgp needs "Then the 'enable_dl' setting in the php.ini needed" http://stackoverflow.com/questions/2241382/php-graphviz-documentation Of course install Graphviz.

An example using gv.3php

  1. <?php
  2. $myGraph = gv::digraph("myGraph");
  3.  
  4. //adding nodes
  5. $n1 = gv::node ($myGraph, 'a nodes name 1');
  6. $n2 = gv::node ($myGraph, 'a nodes name 2');
  7. $n4 = gv::node ($myGraph, 'a nodes name 3');
  8. $n5 = gv::node ($myGraph, 'a nodes name 4');
  9.  
  10. //adding connetcions
  11. gv::edge ($n1, $n2);
  12. gv::edge ($n2, $n4);
  13. gv::edge ($n4, $n5);
  14.  
  15.  
  16. gv::layout ($myGraph, 'neato');
  17. //saving the image
  18. gv::render ($myGraph, "png", "ggg.png");
  19. ?>

Example using the pear graphviz package

  1. <?php
  2. require_once 'Image/GraphViz.php';
  3.  
  4. $gv = new Image_GraphViz();
  5. $gv->addEdge(array('wake up'        => 'visit bathroom'));
  6. $gv->addEdge(array('visit bathroom' => 'make coffee'));
  7.  
  8. //directly outputs to browser
  9. //$gv->image();
  10.  
  11.  
  12. //save the PNG image data to a temporary PNG file
  13. $file = fopen("test.png", "wb");
  14. $raw_data = $gv->fetch('png');
  15. fwrite ($file, $raw_data);
  16. fclose($file);
  17. ?>

Directly using console (notrecommended in this way)

  1. <?php
  2.  
  3. $data = '
  4.  main -> parse -> execute
  5.  main -> init
  6.  main -> cleanup
  7.  execute -> make_string
  8.  execute -> printf
  9.  init -> make_string
  10.  main -> printf
  11.  execute -> compare
  12. ';
  13.  
  14. $data_str = str_replace(" ","", $data);
  15.  
  16. echo exec('echo "digraph G {' . $data_str . '}" | dot -Tpng >Yhello.png');
  17. ?>

Graphviz attributes

http://www.graphviz.org/doc/info/attrs.html

Hover effekt auf SVG

http://stackoverflow.com/questions/7450501/interactive-directed-graphs-with-svg-and-javascript http://old.nabble.com/simple-hovering-and-clicking-using-SVG-layers-and-CSS-td34165151.html http://www.petercollingridge.co.uk/data-visualisation/mouseover-effects-svgs

Js libs/tools

http://www.ryandesign.com/canviz/

Use in php test

Test

echo "digraph G {Hello->World}" | dot -Tpng >hello.png

Probleme mit drupal render()

Ganz toll .... http://drupal.org/node/1408224
Webdevelopment
Add new comment
The content of this field is kept private and will not be shown publicly.

Plain text

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <drupal-entity data-*>
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.