gojs
作者:互联网
gojs
gojs是一个前端插件,帮助用户动态创建节点信息。
下载地址
https://gojs.net.cn/download.html
概念
- TextBlock 创建文本
<script>
var $ = go.GraphObject.make;
var myDiagram = $(go.Diagram, 'myDiagramDiv');
var node1 = $(go.Node, $(go.TextBlock, {text: '测试'}));
myDiagram.add(node1)
var node2 = $(go.Node, $(go.TextBlock, {text: '测试', stroke: 'red'}));
myDiagram.add(node2)
var node3 = $(go.Node, $(go.TextBlock, {text: '测试', background: 'lightblue'}));
myDiagram.add(node3)
</script>
- Shap 创建图形
https://gojs.net.cn/intro/shapes.html
<script src="js/go.js"></script>
<script src="js/Figures.js"></script>
<div style="width: 100px;height: 100px;background-color: aquamarine;" id="myDiagramDiv"></div>
<script>
var $ = go.GraphObject.make;
var myDiagram = $(go.Diagram, 'myDiagramDiv');
/*figure:形状 黑圆*/
var node1 = $(go.Node, $(go.Shape, {figure: 'Ellipse', width: 40, height: 40}));
myDiagram.add(node1);
var node2 = $(go.Node, $(go.Shape, {
figure: 'RoundedRectangle',
width: 40,
height: 40,
fill: 'green',
stroke: 'red',
}));
myDiagram.add(node2)
var node3 = $(go.Node, $(go.Shape, {figure: 'TriangleUp', width: 40, height: 40, fill: null}));
myDiagram.add(node3)
var node4 = $(go.Node, $(go.Shape, {figure: 'Diamond', width: 40, height: 40, fill: '#ddd'}));
myDiagram.add(node4)
/*引入Figures.js*/
var node22 = $(go.Node, $(go.Shape, {figure: 'Club', width: 40, height: 40, fill: null}));
myDiagram.add(node22)
</script>
- Node 节点,文本和图形组合
https://gojs.net.cn/intro/nodes.html - Link 箭头线
https://gojs.net.cn/intro/links.html - 数据绑定
https://gojs.net.cn/intro/dataBinding.html
标签:Node,40,myDiagram,var,go,gojs 来源: https://www.cnblogs.com/20190707wdd/p/16364211.html