简体   繁体   English

如何编辑基本图表的go.js组模板?

[英]How to edit go.js group templates of basic charts?

I want to create a Directed Acyclic Graph as shown in image 2. I'm using go.js basic charts . 我想创建如图2所示的有向无环图。我正在使用go.js基本图表 But after setting nodedataarray and linkdatarray , it outputs as in image 1. To generate the graph in image 2, I want two things to be done. 但是在设置了nodedataarraylinkdatarray ,它的输出如图像1所示。要在图像2中生成图形,我希望做两件事。

1. Display node templates horizontally in a group template. 1.在组模板中水平显示节点模板。

2. Set levels(positions) for group templates. 2.设置组模板的级别(位置)。

I read examples given on the web site and I couldn't find a way. 我阅读了网站上给出的示例,但找不到方法。 Please help me to solve above two problems. 请帮助我解决以上两个问题。


image 1 图片1

图片1

image 2 图片2

图片2

I think you want the Diagram.layout to be a LayeredDigraphLayout and the Group.layout to be a GridLayout . 我想你想的Diagram.layout成为LayeredDigraphLayoutGroup.layout是一个网格布局

The Diagram could be set up with: 可以设置为:

  $(go.Diagram, "myDiagramDiv",element
    {
      layout:
        $(go.LayeredDigraphLayout,
          { direction: 90, layerSpacing: 50 }),
      . . .
    });

The Group template could be something like: 模板可能类似于:

$(go.Group, go.Panel.Vertical,
    {
      layout: $(go.GridLayout, { wrappingColumn: 4 }),
      . . .
    },
    $(go.TextBlock, . . .),
    $(go.Panel, "Auto",
      $(go.Shape, . . .),
      $(go.Placeholder, . . .)
    )
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM