我正在使用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"}
])
});
问题
最佳答案
我认为您在初始化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
关于javascript - Javascript-GoJS流程图,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41547324/