Le5le-topology

Le5le-topology 是一个可视化在线绘图工具,使用 Canvas + Typescript。可以很方便的绘制各种如 topology, UML 等图;还可以很方便的分析微服务之间的关联关系、动态流量等。

→ 在线画图官网 ,网站可能比较慢,个人申请的云服务器带宽仅仅 1M。

特性

极易扩展 - 程序员可以以中间件方式编写自己的图表。框架实现了拖曳、缩放、旋转、自定义属性等基础操作,开发者只用关心图表绘画实现即可。

流畅、高性能 - 使用 canvas 和多个场景离屏,操作过程流畅;完全不用担心 SVG 方式 dom 元素过多,性能高效。

动画特效 - 目前暂实现了线条动画,可用于展示微服务直接的调用关系和流量演示。

TypeScript - 使用 TypeScript 编写,支持导出到 es6 和 TypeScript 中。

源码结构

- libs

|- topology // topogoly-core库源码

- src // 官网源码.

- demo // demo

快速上手

import { Topology } from 'togology-core';

var canvas = new Topology('topo-dom', options);

canvas.render(data, true);

文档

[Todo]

开发

扩展定制自己的图

第 1 步: 绘制节点 node 的样式

// 节点node绘图函数

export function diagram(ctx: CanvasRenderingContext2D, node: Node) {

ctx.beginPath();

// ...

ctx.fill();

ctx.stroke();

}

// [可选] 计算节点node图标区域,默认使用矩形相关函数.

export function diagramIconRect(node: Node) {

let w = node.rect.width / 3;

let h = node.rect.height / 3;

if (w > h) {

w = h;

} else {

h = w;

}

let top = node.rect.width / 5;

if (top < 10) {

top = 10;

}

node.iconRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + top, w, h);

}

// [可选] 计算节点node文字区域,默认使用矩形相关函数.

// fullTextRect - Only text.

// iconTextRect - Incloud icon and text.

export function diagramTextRect(node: Node) {

let bottom = node.rect.height / 10;

if (bottom < 5) {

bottom = 0;

}

node.iconTextRect = new Rect(

node.rect.x + node.rect.width / 3,

node.rect.y + (node.rect.height * 2) / 3 - bottom,

node.rect.width / 3,

node.rect.height / 3 - 5

);

const w = node.rect.width / 2;

const h = (node.rect.height * 1) / 2;

node.fullTextRect = new Rect(node.rect.x + (node.rect.width - w) / 2, node.rect.y + node.rect.height / 4, w, h);

}

// [可选] 计算节点node可连线的锚点,默认使用矩形相关函数.

export function diagramAnchors(node: Node) {

node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y, Direction.Up));

node.anchors.push(new Point(node.rect.x + node.rect.width, node.rect.y + node.rect.height / 2, Direction.Right));

node.anchors.push(new Point(node.rect.x + node.rect.width / 2, node.rect.y + node.rect.height, Direction.Bottom));

node.anchors.push(new Point(node.rect.x, node.rect.y + node.rect.height / 2, Direction.Left));

}

第 2 步: 注册节点 node

// registerNode: Register a custom node.

// name - The name of node.

// drawFn - How to draw.

// anchorsFn - How to get the anchors.

// iconRectFn - How to get the icon rect.

// textRectFn - How to get the text rect.

// force - Overwirte the node if exists.

registerNode(

name: string,

drawFn: (ctx: CanvasRenderingContext2D, node: Node) => void,

anchorsFn?: (node: Node) => void,

iconRectFn?: (node: Node) => void,

textRectFn?: (node: Node) => void,

force?: boolean

);

Angular project

$ yarn or npm install

# build watching file changes and run angular project

$ npm start

# build

$ npm run build

Topology-core lib

核心库源码

[libs/topology#] yarn or npm install

# build

[libs/topology#] npm run build

Topology-flow-diagram lib

流程图源码

[libs/topology#] yarn or npm install

# build

[libs/topology-flow-diagram#] npm run build

Demo

demo 源码

[demo#] yarn or npm install

# build

[demo#] npm run build

贡献

有任何建议或问题可以在 issue 提出;或提供一个 pr。

License

MIT © le5le.com

高性能服务器架构拓扑图,topology: 开源、易扩展、方便集成的在线绘图(微服务架构图、网络拓扑图、流程图等)工具...相关推荐

  1. 高性能服务器架构(High-Performance Server Architecture)

    原文: https://blog.csdn.net/marising/article/details/5186643 High-Performance Server Architecture 高性能服 ...

  2. 高性能服务器架构(High-Performance Server Architecture) .

    //  http://blog.csdn.net/bsplover/article/details/7498718 High-Performance Server Architecture 高性能服务 ...

  3. High performance server architecture(高性能服务器架构)

    from: http://pl.atyp.us/content/tech/servers.html http://www.cppblog.com/isware/archive/2011/07/19/1 ...

  4. 《企业IT架构转型之道》随笔之SOA、ESB、微服务、API网关(2019-08-07)

    <企业IT架构转型之道>随笔之SOA.ESB.微服务.API网关(2019-08-07) 名词注释 为什么会进化 展望 作者在本章中提到的"烟筒式"系统建设模式,在目前 ...

  5. 高性能服务器架构思路「不仅是思路」

    在服务器端程序开发领域,性能问题一直是备受关注的重点.业界有大量的框架.组件.类库都是以性能为卖点而广为人知.然而,服务器端程序在性能问题上应该有何种基本思路,这个却很少被这些项目的文档提及.本文正式 ...

  6. web 服务器 内存 影响_高性能服务器架构思路「不仅是思路」

    在服务器端程序开发领域,性能问题一直是备受关注的重点.业界有大量的框架.组件.类库都是以性能为卖点而广为人知.然而,服务器端程序在性能问题上应该有何种基本思路,这个却很少被这些项目的文档提及.本文正式 ...

  7. 高性能服务器架构思路【不仅是思路】

    在服务器端程序开发领域,性能问题一直是备受关注的重点.业界有大量的框架.组件.类库都是以性能为卖点而广为人知.然而,服务器端程序在性能问题上应该有何种基本思路,这个却很少被这些项目的文档提及.本文正式 ...

  8. 高性能服务器架构思路

    在服务器端程序开发领域,性能问题一直是备受关注的重点.业界有大量的框架.组件.类库都是以性能为卖点而广为人知.然而,服务器端程序在性能问题上应该有何种基本思路,这个却很少被这些项目的文档提及.本文正式 ...

  9. linux socket recv函数如何判断收完一包_linux服务器端编程之高性能服务器架构设计总结...

    所谓高性能就是服务器能流畅地处理各个客户端的连接并尽量低延迟地应答客户端的请求:所谓高并发,指的是服务器可以同时支持多的客户端连接,且这些客户端在连接期间内会不断与服务器有数据来往. 这篇文章将从两个 ...

  10. 高性能服务器架构思路(五)——分布式缓存

    2019独角兽企业重金招聘Python工程师标准>>> 版权声明:本文由韩伟原创文章,转载请注明出处:  文章原文链接:https://www.qcloud.com/communit ...

最新文章

  1. mysql 异步api_Hiredis异步API
  2. PHP文件上传和文件操作案例
  3. C++对象的内存分析(5)
  4. MATLAB实战系列(二十二)-matlab三维图形绘制案例最全集锦(毕设和数学建模必看)
  5. 算法——常用的数据结构/模板/基础知识
  6. 如何在 Mac 上启用 root 用户或更改 root 密码
  7. 对于python初学者,如何使用python定义联合(使用ctypes)?
  8. 小家电的精致生活幻想,都在闲鱼上被粉碎了
  9. vba替换字符串中的字符_R语言 | 字符串替换
  10. java 配置文件参数_从Java的配置文件中读取配置参数的最佳方法是什么?
  11. 使用Python修改图片格式
  12. 印度官方语言有几种_印度货币上有17种语言,你知道每种语言有多少人在用吗?...
  13. 用python画气球程序_动态编程气球最大得分(Python实现),规划,打,的,分数,python...
  14. linux tail 命令 阿星小栈
  15. Ubuntu 10.10学习笔记
  16. ios 纯代码怎么适配ipad_iOS屏幕适配(纯代码)
  17. 正则“^[a-zA-Z]” 和 “[^a-zA-Z]”的区别
  18. App卡顿的原因及解决方案
  19. 设计师解放双手之作!3秒生成风景园林效果图,AIGC赋能景观设计
  20. 电脑报2013年第3期

热门文章

  1. 裸辞计算机考研,一位工作三年,裸辞,跨考,347学姐的考研经验 - 考研 - 小木虫 - 学术 科研 互动社区...
  2. 关于后端接口测试没问题,HTTP500错误
  3. 计算机左侧没有桌面菜单栏,教您电脑菜单栏不见了
  4. Python压缩、减压7z文件
  5. SQL - 数据查询语句之字符串拆分
  6. GPK游戏包安装方法
  7. 明日复明日,明日何其多,我生待明日,万事成蹉跎(分享)
  8. Spring Boot启动参考指南(官方版)
  9. python两行代码实现转换视频格式,以flv转换mp4为例
  10. DBeaver打开sql文件中文乱码问题解决