{ "class": "go.GraphLinksModel", "nodeDataArray": [ {"key":1, "text":"Alpha", "color":"lightblue"}, {"key":2, "text":"Beta", "color":"orange"}, {"key":3, "text":"Gamma", "color":"lightgreen"}, {"key":4, "text":"Delta", "color":"pink"}, {"key":5, "text":"Epsilon", "color":"gold"} ], "linkDataArray": [ {"from":1, "to":2, "colors":[ "red","orange","gold","green","blue" ]}, {"from":1, "to":3, "colors":[ "red","blue" ]}, {"from":1, "to":4, "colors":[ "purple","orange","green" ]}, {"from":4, "to":5, "colors":[ "fuchsia" ]}, {"from":5, "to":2} ]}

The Link template depends on a custom MultiColorLink class to render sections of each of the path Shapes that it has in a different color. The colors are specified in the link data object's colors property, an Array of CSS color strings. The template must have as many GraphObject.isPanelMain Shapes in it as the maximum length of the Arrays of colors. This sample's template has five path Shapes in it so that it can render in five different colors. But if for example you need to show at most two colors, for efficiency you should change the template to have only two path Shapes in it.