开发者

PHP GraphViz Documentation

开发者 https://www.devze.com 2022-12-20 00:35 出处:网络
Has anyone used graphviz-php and if so do they know where I can find any documentation regarding its usage/class structure 开发者_运维知识库etc?

Has anyone used graphviz-php and if so do they know where I can find any documentation regarding its usage/class structure 开发者_运维知识库etc?

Please note that this is the graphviz-php not the pear (image_graphviz).

Thanks


I have found an explanation of the graphviz.php as below.

The GraphViz class allows for the creation of and the work with directed and undirected graphs and their visualization with AT&T's GraphViz tools.


  require_once 'Image/GraphViz.php';

  $graph = new Image_GraphViz();

  $graph->addNode(
    'Node1',
    array(
      'URL'   => 'http://link1',
      'label' => 'This is a label',
      'shape' => 'box'
    )
  );

  $graph->addNode(
    'Node2',
    array(
      'URL'      => 'http://link2',
      'fontsize' => '14'
    )
  );

  $graph->addNode(
    'Node3',
    array(
      'URL'      => 'http://link3',
      'fontsize' => '20'
    )
  );

  $graph->addEdge(
    array(
      'Node1' => 'Node2'
    ),
    array(
      'label' => 'Edge Label'
    )
  );

  $graph->addEdge(
     array(
       'Node1' => 'Node2'
     ),
     array(
      'color' => 'red'
   )
  );
  $graph->image();


http://pear.php.net/manual/en/package.images.image-graphviz.example.php contains a usage example (updated)


On CentOS, when you install the "graphviz-php" package you get a man page. It's pretty terse, you wouldn't want that to be your only reference, but at least you get something.

man 3 gv

For what it's worth, there's a very simple example here...

https://github.com/ellson/graphviz/blob/master/tclpkg/gv/demo/modgraph.php

0

精彩评论

暂无评论...
验证码 换一张
取 消