其他分享
首页 > 其他分享> > gojs

gojs

作者:互联网

gojs

gojs是一个前端插件,帮助用户动态创建节点信息。

下载地址
https://gojs.net.cn/download.html


概念

<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>
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,40,myDiagram,var,go,gojs
来源: https://www.cnblogs.com/20190707wdd/p/16364211.html