Skip to content

Instantly share code, notes, and snippets.

@tswistak
Created June 18, 2018 09:04
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/eff928ba396903b7ab060a91203c89a5 to your computer and use it in GitHub Desktop.
Save tswistak/eff928ba396903b7ab060a91203c89a5 to your computer and use it in GitHub Desktop.
GoJS tutorial part 3, listing 2
var initDiagram = function () {
diagram = $(go.Diagram,
'diagram-content', {
initialContentAlignment: go.Spot.Center,
allowDrop: true
});
// ...
}
var initPalette = function () {
palette = $(go.Palette, 'palette-content');
getTemplates().forEach(x => palette.nodeTemplateMap.add(x.category, x.template));
palette.model.nodeDataArray = [
{key: 1, category: 'first'},
{key: 2, category: 'second'},
{key: 3, category: 'third'}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment