Skip to content

Instantly share code, notes, and snippets.

@tswistak
Created June 4, 2018 09:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tswistak/50d62806197d84556c4cce7f52f28f60 to your computer and use it in GitHub Desktop.
Save tswistak/50d62806197d84556c4cce7f52f28f60 to your computer and use it in GitHub Desktop.
GoJS tutorial part 1, listing 7
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