Javascript - GoJS流程图

时间:2017-01-09 11:43:47

标签: javascript flowchart gojs

我正在使用http://gojs.net/latest/samples/flowchart.html中的Flowchart并且工作正常。唯一的问题是它没有t display the toolbar symbols which are shown in the example. Have someone used流程图`并且遇到了同样的问题?

var $ = go.GraphObject.make;

myPalette =
                    $(go.Palette, "myPaletteDiv",  // must name or refer to the DIV HTML element
                        {
                            "animationManager.duration": 800, // slightly longer than default (600ms) animation
                            nodeTemplateMap: myDiagram.nodeTemplateMap,  // share the templates used by myDiagram
                            model: new go.GraphLinksModel([  // specify the contents of the Palette
                                {category: "Start", text: "Start"},
                                {text: "Step"},
                                {text: "???", figure: "Diamond"},
                                {category: "End", text: "End"},
                                {category: "Comment", text: "Comment"}
                            ])
                        });

问题

enter image description here

1 个答案:

答案 0 :(得分:3)

我认为在初始化Diagram及其 Diagram.nodeTemplateMap 之前,您正在初始化Palette。这实际上意味着Palette不使用您的自定义模板,因此Palette中的节点使用默认节点模板。

如果您查看流程图示例中的源代码,您会看到:

// initialize the Palette that is on the left side of the page
myPalette =
  $(go.Palette, "myPaletteDiv",  // must name or refer to the DIV HTML element
    {
      "animationManager.duration": 800, // slightly longer than default (600ms) animation
      nodeTemplateMap: myDiagram.nodeTemplateMap,  // share the templates used by myDiagram