Hi folks,
I’ve been looking into GoJS for a bit now, and am curious about something that may not be purely GoJS specific, but would still like to get some input on.
What’s the recommended way of handling multiple shapes/styles for nodes/links? I’d like the shapes and styles to also be data driven.
If the data representation is similar to this:
var nodeDataArray = [
{ key: 1, text: "Concept Maps", "type": "nodetype1"},
{ key: 2, text: "Organized Knowledge", "type": "nodetype2" },
{ key: 3, text: "Context Dependent", "type": "nodetype3" }
];
var linkDataArray = [
{ from: 1, to: 2, text: "represent", "type": "linktype1"},
{ from: 2, to: 3, text: "is", "type": "linktype2" }
];
Say that node type 1 is rectangle, type 2 is circle and type 3 is
triangle. For links, let’s say type 1 is a full straight line, and type 2
is a dashed curve.
Is the recommended way to simply iterate through and use constructors and set all properties like that? Or can one still make use of templates?
Hope it’s clear enough.
Thanks!