DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:graphviz

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
plugin:graphviz [2015-10-06 17:42] – [Example] 80.153.3.250plugin:graphviz [2022-05-05 16:47] – [Example] 47.57.142.223
Line 6: Line 6:
 email      : andi@splitbrain.org email      : andi@splitbrain.org
 type       : Syntax type       : Syntax
-lastupdate : 2013-12-25 +lastupdate : 2016-02-03 
-compatible : anteater, 2011-05-25, adora belle, weatherwax, ponder stibbons, Hrun+compatible : anteater, 2011-05-25, adora belle, weatherwax, ponder stibbons, Hrun, Detritus
 depends    :  depends    : 
 conflicts  conflicts 
Line 31: Line 31:
 ===== Download and Installation ===== ===== Download and Installation =====
  
-Download and install the plugin using the [[plugin:plugin|Plugin Manager]] using the URL given above. Refer to [[:Plugins]] on how to install plugins manually.+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
 ==== Changes ==== ==== Changes ====
  
-{{rss>http://github.com/splitbrain/dokuwiki-plugin-graphviz/commits/master.atom date}}+{{rss>https://github.com/splitbrain/dokuwiki-plugin-graphviz/commits/master.atom date}}
  
 ===== Configuration ===== ===== Configuration =====
Line 58: Line 58:
 ==== Example ==== ==== Example ====
  
-<code> +<graphviz dot right 800x400
-<graphviz dot right 500x200+digraph ATN 
-digraph finite_state_machine +rankdir=LR; 
- rankdir=LR; +s25[fontsize=11, label="25"shape=doublecircle, fixedsize=true, width=.6]; 
- size="12,5+s239[fontsize=24,label="239", shape=circle, fixedsize=true, width=.55, peripheries=1]; 
- node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8 LR_10+s240[fontsize=11,label="240", shape=circle, fixedsize=true, width=.55, peripheries=1]; 
- node [shape = circle]; +s241[fontsize=11,label="241", shape=circle, fixedsize=true, width=.55, peripheries=1]
- LR_0 -> LR_10 [ label = "Sa(B)" ]; +s242[fontsize=11,label="242", shape=circle, fixedsize=true, width=.55, peripheries=1]; 
- LR_0 -> LR_1 [ label = "Testen" ]; +s243[fontsize=11,label="{&rarr;\n243\nd=24|{<p0>|<p1>}}", shape=record, fixedsize=false, peripheries=1]; 
- LR_1 -> LR_3 [ label = "S($end)" ]; +s244[fontsize=11,label="&larr;\n244", shape=circle, fixedsize=true, width=.55, peripheries=1]; 
- LR_2 -> LR_6 [ label = "SS(b)" ]; +s245[fontsize=11,label="245", shape=circle, fixedsize=true, width=.55, peripheries=1]; 
- LR_2 -> LR_5 [ label = "SS(a)" ]; +s246[fontsize=11,label="246", shape=circle, fixedsize=true, width=.55, peripheries=1]; 
- LR_2 -> LR_4 [ label = "Sx(A)" ]; +s247[fontsize=11,label="&rarr;\n247+", shape=circle, fixedsize=true, width=.55, peripheries=1]; 
- LR_5 -> LR_7 [ label = "S(b)" ]; +s24[fontsize=11,label="24", shape=circle, fixedsize=true, width=.55, peripheries=1]; 
- LR_5 -> LR_5 [ label = "S(a)" ]; +s248[fontsize=11,label="&larr;\n248", shape=circle, fixedsize=true, width=.55, peripheries=1]; 
- LR_6 -> LR_6 [ label = "S(b)" ]; +s249[fontsize=11,label="{249+\nd=25|{<p0>|<p1>}}", shape=record, fixedsize=false, peripheries=1]; 
- LR_6 -> LR_5 [ label = "S(a)" ]; +s250[fontsize=11,label="250", shape=circle, fixedsize=true, width=.55, peripheries=1]; 
- LR_7 -> LR_8 [ label = "S(b)" ]; +s251[fontsize=11,label="251", shape=circle, fixedsize=true, width=.55, peripheries=1]; 
- LR_7 -> LR_5 [ label = "S(a)" ]; +s252[fontsize=11,label="252", shape=circle, fixedsize=true, width=.55, peripheries=1]; 
- LR_8 -> LR_6 [ label = "S(b)" ]; +s24 -> s239 [fontname="Times-Italic", label="&epsilon;"]; 
- LR_8 -> LR_5 [ label = "S(a)" ]; +s239 -> s247 [fontsize=11, fontname="Courier", arrowsize=.7, label = "'{'", arrowhead = normal]; 
-        LR_8 -> LR_9 [ label = "Test" ];+s247 -> s240 [fontname="Times-Italic", label="&epsilon;"]; 
 +s240 -> s243 [fontsize=11, fontname="Courier", arrowsize=.7, label = "'case'", arrowhead = normal]; 
 +s243:p0 -> s241 [fontname="Times-Italic", label="&epsilon;"]; 
 +s243:p1 -> s242 [fontname="Times-Italic", label="&epsilon;"]; 
 +s241 -> s244 [fontsize=11, fontname="Courier", arrowsize=.7, label = "'null'", arrowhead = normal]; 
 +s242 -> s244 [fontsize=11, fontname="Courier", arrowsize=.7, label = "<element>", arrowhead = normal]; 
 +s244 -> s245 [fontname="Times-Italic", label="&epsilon;"]; 
 +s245 -> s246 [fontsize=11, fontname="Courier", arrowsize=.7, label = "'=>'", arrowhead = normal]; 
 +s246 -> s248 [fontsize=11, fontname="Courier", arrowsize=.7, label = "<block>", arrowhead = normal]; 
 +s248 -> s249 [fontname="Times-Italic", label="&epsilon;"]; 
 +s249:p0 -> s247 [fontname="Times-Italic", label="&epsilon;", style="dashed"]; 
 +s249:p1 -> s250 [fontname="Times-Italic", label="&epsilon;"]; 
 +s250 -> s251 [fontname="Times-Italic", label="&epsilon;"]; 
 +s251 -> s252 [fontsize=11, fontname="Courier", arrowsize=.7, label = "'}'", arrowhead = normal]; 
 +s252 -> s25 [fontname="Times-Italic", label="&epsilon;"];
 } }
 </graphviz> </graphviz>
-</code> 
  
  
 {{ http://img97.imageshack.us/img97/2613/dotb.png?nolink& }} {{ http://img97.imageshack.us/img97/2613/dotb.png?nolink& }}
 +===== how to display dot MAPs =====
 +
 +  * For UNIX users ( since assumes a PATH of /usr/bin/dot )
 +
 +Using an old version of Graphviz I fixed to display **dot** maps //(nodes that when you click on them  link to a URL ie another page in your wiki or an external link.) //
 +
 +This is a fragment of the render section of the syntax file ie ( I replaced my render function with this ):
 +
 +<file PHP r.php>
 +  /**
 +   * Create output
 +   */
 +  function render($mode, &$renderer, $data) {
 +    global $conf;
 +    global $gr_ext;
 +    $gr_ext='png';
 +    $grf_ext='.'.$gr_ext;
 +    if($data[1] == 'map' && strlen($data[0]) > 1) {
 +      if ( !is_dir($conf['mediadir'] . '/graphviz') ) 
 + io_mkdir_p($conf['mediadir'] . '/graphviz'); //Using dokuwiki framework
 +      $hash = md5(serialize($data));
 +      $filename = $conf['mediadir'] . '/graphviz/'.$hash.$grf_ext;
 +      $url = ml('graphviz:'.$hash.$grf_ext); //Using dokuwiki framework
 +
 +      //$renderer->doc .= '<p> valor filename=['.$filename.']</p>';
 +      //$renderer->doc .= '<p> valor url=['.$url .']</p>';
 +
 +      // if already exist render
 +      if ( is_readable($filename) ) {
 + // cached.
 +
 +        // generate the map to variable
 +        $kk1 = "sed '1d'|sed '\$d'";
 +        $cmd = "echo '$data[0]' | /usr/bin/dot -Tcmapx | ".$kk1;
 +  //$renderer->doc .= '<p> DSP-graph value cmd=>['.$cmd.']</p>'; //Debug cmd
 +        exec( $cmd, $map);
 +        //$renderer->doc .= '<p> valor map=['.$map .']</p>';
 +        $maphtml = implode("\n",$map);
 +        // add the target - cant do this with DOT
 +        $maphtml = str_replace("<area ", "<area target=\"".$hash."\" ",$maphtml);
 +
 +        // Include Map in the page
 + $renderer->doc .= '<map id="'.$hash.'" name="'.$hash.'">';
 +  $renderer->doc .= $maphtml;
 +  $renderer->doc .= '</map>';
 +
 +        // Link the Image below with the map above by hash
 + $renderer->doc .= '<img src="'.$url.'" border="0" usemap="#'.$hash.'" Ismap>';
 +
 + return true;
 +      }
 +
 +      if (!$this->createImageMap($filename, $data[0], $data[1])) {
 +
 +        // generate the map 
 +        $kk1 = "sed '1d'|sed '\$d'";
 +        $cmd = "echo '$data[0]' | /usr/bin/dot -Tcmapx | ".$kk1;
 +  //$renderer->doc .= '<p> CR-graph value cmd=>['.$cmd.']</p>'; //Debug cmd
 +        exec( $cmd, $map);
 +        $maphtml= implode("\n",$map);
 +        // add the target - cant do this with DOT
 +        $maphtml=str_replace("<area ", "<area target=\"".$hash."\"",$maphtml);
 +
 +        // Include Map in the page
 + $renderer->doc .= '<map id="'.$hash.'" name="'.$hash.'">';
 +  $renderer->doc .= $maphtml;
 +  $renderer->doc .= '</map>';
 +
 +        // Link the Image below with the map above by hash
 + $renderer->doc .= '<img src="'.$url.'" border="0" usemap="#'.$hash.'" Ismap>';
 +
 +      } else {
 + $renderer->doc .= '**ERROR RENDERING GRAPHVIZ**';
 +      }
 +      return true;
 +   }
 +
 +
 +</file>
 +
 +My 2 cents to this wonderful dokuwiki community that has given me so much through the years.
 +
 +Regards, \\ Enrique M
 +
 +Sign update: "UnUZYQK2Yh4qWKI4U5rMjU9IdfGvDSWWQP+rVbQA/oo="
 +
 +
 +==== Hyperlinks from Graphviz nodes ====
 +
 +If you want links from the nodes, you can use this forked version:
 +
 +https://github.com/splitbrain/dokuwiki-plugin-graphviz/issues/12
 +
 +Hopefully the fix will be merged soon in the official version..
 +
 +Fabio
 +
 +
 ===== Compatibility ===== ===== Compatibility =====
 +
 +
 It seems to be compatible with "Rincewind", but I don't dare to list it as compatible based on only my test. It seems to be compatible with "Rincewind", but I don't dare to list it as compatible based on only my test.
 > I use it in Rincewind, it seems to work fine for me! Thanks for this great plugin! [[info@drost-tenfelde.de|jdt]]  > I use it in Rincewind, it seems to work fine for me! Thanks for this great plugin! [[info@drost-tenfelde.de|jdt]] 
Line 159: Line 272:
  
 == Does the server need an access to Internet ? == == Does the server need an access to Internet ? ==
-Yes, it uses Google API to generate graphs.+Default: Yes, it uses Google API to generate graphs.\\  
 +However, it can be set up to point straight to a local install of graphiz. In that case no internet access is needed. 
 + 
 +== How to read external dot File? == 
 +How can i render an external (autogenerated) dot file? 
 + 
 +== How to include images in HTML-Labels? ==
plugin/graphviz.txt · Last modified: 2022-05-05 16:50 by 47.57.142.223

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki