定制 innmind/graphviz 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

innmind/graphviz

Composer 安装命令:

composer require innmind/graphviz

包简介

Graphviz abstraction

README 文档

README

CI codecov Type Coverage

Graphviz model to help build graphs. This model goal is to express the possibilities offered by Graphviz (though note that all features are not implemented).

All objects of this package are immutable.

Important

You must use vimeo/psalm to make sure you use this library correctly.

Installation

composer require innmind/graphviz

Usage

use Innmind\Graphviz\{
    Layout\Dot,
    Graph,
    Node,
    Node\Shape,
};
use Innmind\Url\Url;
use Innmind\Colour\Colour;
use Innmind\OperatingSystem\Factory;
use Innmind\Server\Control\Server\Command;

$dot = Dot::of();
$clusterOne = Graph::directed('one')
    ->target(Url::of('http://example.com'))
    ->displayAs('One')
    ->fillWithColor(Colour::blue->toRGBA())
    ->add($one = Node::named('one'));
$clusterTwo = Graph::directed('two')
    ->fillWithColor(Colour::red->toRGBA())
    ->add($two = Node::named('two'));
$clusterThree = Graph::directed('three')
    ->add($three = Node::named('three'));

$root = Node::named('root')
    ->shaped(Shape::house())
    ->linkedTo($one->name())
    ->linkedTo($two->name());

$graph = Graph::directed()
    ->add($root)
    ->add($one->linkedTo($three->name()))
    ->add($two->linkedTo($three->name()))
    ->cluster($clusterOne)
    ->cluster($clusterTwo)
    ->cluster($clusterThree);

$output = $dot($graph);

Factory::build()
    ->control()
    ->processes()
    ->execute(
        Command::foreground('dot')
            ->withShortOption('Tsvg')
            ->withShortOption('o', 'graph.svg')
            ->withInput($output),
    )
    ->unwrap()
    ->wait();

This example will produce the given svg file: (source)

Note

This example uses innmind/operating-system.

统计信息

  • 总下载量: 58.93k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 4
  • 推荐数: 1

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固