AntV X6 流程图

本文详细介绍了如何安装和使用AntV X6进行流程图的创建。内容涵盖HTML结构的设计、JavaScript代码的组织,以及最终实现的效果展示。
摘要由CSDN通过智能技术生成

安装 AntV X6 

npm install @antv/x6 --save

html结构

<div class="editor" ref="editor" style="height: 400px"></div>

js结构

  initEditor() {
      // 获取容器的宽高
      const { clientHeight: height, clientWidth: width } = this.$refs["editor"];
      console.table({ width, height });
      /** 初始化实例 */
      this.graph = new Graph({
        // 容器
        container: this.$refs["editor"],
        // 宽高
        width: width,
        height: 400,
        connecting: {
          connector: { name: "smooth" },
        },
      });
      console.log("graph: ", this.graph);
      const appNodes = [
        {
          x: 500,
          y: 50,
          attrs: {
            body: {
              fill: "#e2e8f0",
              stroke: "#cbd5e1",
            },
            label: {
              fill: "#334155",
            },
            text: {
              fontSize: 18,
              textWrap: {
                text: "数据采集",
                width: -15,
              },
            },
          },
        },
        {
          x: 700,
          y: 50,
          attrs: {
            body: {
              fill: "#e2e8f0",
              stroke: "#cbd5e1",
            },
            label: {
              fill: "#334155",
            },
            text: {
              fontSize: 18,
              textWrap: {
                text: "计费",
                width: -15,
              },
            },
          },
        },
        {
          x: 900,
          y: 50,
          attrs: {
            body: {
              fill: "#e2e8f0",
              stroke: "#cbd5e1",
            },
            label: {
              fill: "#334155",
            },
            text: {
              fontSize: 18,
              textWrap: {
                text: "多协议接入",
                width: -15,
              },
            },
          },
        },
        {
          x: 1100,
          y: 50,
          attrs: {
            body: {
              fill: "#e2e8f0",
              stroke: "#cbd5e1",
            },
            label: {
              fill: "#334155",
            },
            text: {
              fontSize: 18,
              textWrap: {
                text: "数据分发",
                width: -15,
              },
      
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值