定制 fidelize/flowchart-to-png 二次开发

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

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

fidelize/flowchart-to-png

最新稳定版本:1.1.0

Composer 安装命令:

composer create-project fidelize/flowchart-to-png

包简介

Convert from flowchart json encoded to png

README 文档

README

Setup

Add the library to your composer.json file in your project:

{
  "require": {
      "fidelize/flowchart-to-png": "1.0.0"
  }
}

Use composer to install the library:

$ php composer.phar install

Composer will install flowchart-to-png inside your vendor folder. Then you can add the following to your .php files to use the library with Autoloading.

require_once(__DIR__ . '/vendor/autoload.php');

Usage

$json = '{
  "nodes": [
    {
      "id": "flowchartStart",
      "type": "start",
      "text": "Start",
      "left": "20px",
      "top": "180px",
      "countSource": null
    },
    {
      "id": "flowchartEnd",
      "type": "end",
      "text": "End",
      "left": "940px",
      "top": "180px",
      "countSource": null
    },
    {
      "id": "flowchartWindow1489779664638",
      "type": "action",
      "text": "Approve",
      "left": "680px",
      "top": "260px",
      "action": "Approve",
      "extraParams": "",
      "countSource": "1"
    },
    {
      "id": "flowchartWindow1489779672763",
      "type": "action",
      "text": "Reject",
      "left": "620px",
      "top": "40px",
      "action": "Reject",
      "extraParams": "",
      "countSource": "1"
    }
  ],
  "edges": [
    {
      "source": "flowchartStart",
      "target": "flowchartWindow1489779664638",
      "data": {
        "label": "",
        "positionSource": "RightMiddle",
        "positionTarget": "LeftMiddle"
      }
    },
    {
      "source": "flowchartStart",
      "target": "flowchartWindow1489779672763",
      "data": {
        "label": "",
        "positionSource": "RightMiddle",
        "positionTarget": "LeftMiddle"
      }
    },
    {
      "source": "flowchartWindow1489779672763",
      "target": "flowchartEnd",
      "data": {
        "label": "Success",
        "return": "success",
        "positionSource": "RightMiddle",
        "positionTarget": "LeftMiddle"
      }
    },
    {
      "source": "flowchartWindow1489779664638",
      "target": "flowchartEnd",
      "data": {
        "label": "Success",
        "return": "success",
        "positionSource": "RightMiddle",
        "positionTarget": "LeftMiddle"
      }
    }
  ]
}';


$flowChartImage = new FlowChartImage();
$flowChartImage->setContent($json);
$flowChartImage->generate()->toPng($path);

Change Node Color

$image->setSelectedAction('flowchartWindow1489779664638');
$image->setSelectedColor([255, 0, 0]);

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 11
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2017-03-29