@JingYongWang wrote:
The following example like this: https://gojs.net/latest/samples/umlClass.html
I try to set a Label in Link and write some code like this
linkTemplate $(go.TextBlock, “value I want”, { segmentOffset: new go.Point(0, -10) })myDiagram.linkTemplate =$(go.Link, { routing: go.Link.AvoidsNodes }, new go.Binding("isLayoutPositioned", "relationship", convertIsTreeLink), $(go.Shape), $(go.Shape, { scale: 1.3, fill: "white" }, new go.Binding("fromArrow", "relationship", convertFromArrow)), $(go.Shape, { scale: 1.3, fill: "white" }, new go.Binding("toArrow", "relationship", convertToArrow)), $(go.TextBlock, "value I want to add", { segmentOffset: new go.Point(0, -10) }), );In second parameter(value I want to add) , I want to use nodedata[0][“key”] to get key data but not work
How to solve this problem with javascript or gojs API such as getLabelKeysForLinkData?
var nodedata = [{ key: 1, name: "BankAccount", properties: [ { name: "owner", type: "String", visibility: "public" }, { name: "balance", type: "Currency", visibility: "public", default: "0" } ], methods: [ { name: "deposit", parameters: [{ name: "amount", type: "Currency" }], visibility: "public" }, { name: "withdraw", parameters: [{ name: "amount", type: "Currency" }], visibility: "public" } ] }, { key: 11, name: "Person", properties: [ { name: "name", type: "String", visibility: "public" }, { name: "birth", type: "Date", visibility: "protected" } ], methods: [ { name: "getCurrentAge", type: "int", visibility: "public" } ] }, { key: 12, name: "Student", properties: [ { name: "classes", type: "List", visibility: "public" } ], methods: [ { name: "attend", parameters: [{ name: "class", type: "Course" }], visibility: "private" }, { name: "sleep", visibility: "private" } ] }, { key: 13, name: "Professor", properties: [ { name: "classes", type: "List", visibility: "public" } ], methods: [ { name: "teach", parameters: [{ name: "class", type: "Course" }], visibility: "private" } ] }, { key: 14, name: "Course", properties: [ { name: "name", type: "String", visibility: "public" }, { name: "description", type: "String", visibility: "public" }, { name: "professor", type: "Professor", visibility: "public" }, { name: "location", type: "String", visibility: "public" }, { name: "times", type: "List", visibility: "public" }, { name: "prerequisites", type: "List", visibility: "public" }, { name: "students", type: "List", visibility: "public" } ] } ];
Posts: 2
Participants: 2