【发布时间】:2017-11-28 22:40:34
【问题描述】:
我正在使用 GoJS 制作图表, 我允许对节点进行文本编辑,并在以后创建新节点并编辑节点和链接
window.diagram =
$(go.Diagram, "myDiagramDiv",
{
initialContentAlignment: go.Spot.Center, // center Diagram contents
"undoManager.isEnabled": true, // enable Ctrl-Z to undo and Ctrl-Y to redo
});
// the node template describes how each Node should be constructed
diagram.nodeTemplate =
$(go.Node, "Auto", // the Shape automatically fits around the TextBlock
$(go.Shape, "RoundedRectangle", // use this kind of figure for the Shape
// bind Shape.fill to Node.data.color
new go.Binding("fill", "color")),
$(go.TextBlock,
{ margin: 3 ,// some room around the text
editable: true }, // permet de le modifier
// bind TextBlock.text to Node.data.key
new go.Binding("text", "key")),
);
diagram.linkTemplate =
$(go.Link,
$(go.Shape), // this is the link shape (the line)
$(go.Shape, { toArrow: "Standard" }), // this is an arrowhead
$(go.TextBlock, // this is a Link label
new go.Binding("text", "text"))
);
我可以得到对象使用
window.diagram.GraphLinksModel.nodeDataArray
但即使在编辑图表后我也会得到相同的对象数组 编辑后获取 nodeDataArray 和 linkDataArray 有什么帮助吗?
【问题讨论】:
标签: javascript graph diagram gojs