Created
June 4, 2018 09:53
-
-
Save tswistak/50d62806197d84556c4cce7f52f28f60 to your computer and use it in GitHub Desktop.
GoJS tutorial part 1, listing 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getTemplates = function () { | |
return [{ | |
category: 'first', | |
template: $(go.Node, 'Auto', $(go.Shape, 'Circle')) | |
}, { | |
category: 'second', | |
template: $(go.Node, | |
'Auto', | |
$(go.Shape, { | |
// ... | |
})) | |
}, { | |
category: 'third', | |
template: $(go.Node, | |
'Vertical', | |
// ... | |
})) | |
}]; | |
} | |
var initDiagram = function () { | |
// ... | |
getTemplates().forEach(x => diagram.nodeTemplateMap.add(x.category, x.template)); | |
diagram.model = $(go.GraphLinksModel, { | |
// ... | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment