Javascript - GoJS 流程图
Javascript - GoJS Flowchart
我正在使用 http://gojs.net/latest/samples/flowchart.html 中的 Flowchart
,它工作正常。唯一的问题是,它也没有 t display the toolbar symbols which are shown in the example. Have someone used
Flowchart` 并且有同样的问题?
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.nodeTemplateMap 之前初始化调色板。这实际上意味着 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
我正在使用 http://gojs.net/latest/samples/flowchart.html 中的 Flowchart
,它工作正常。唯一的问题是,它也没有 t display the toolbar symbols which are shown in the example. Have someone used
Flowchart` 并且有同样的问题?
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.nodeTemplateMap 之前初始化调色板。这实际上意味着 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