I am using a “ForceDirectedLayout” graph and have added 5 nodes. The graph and nodes show as expected but do not see any images.
The pertinent code snippets.
this.graphObject(go.Picture,
{ maxSize: new go.Size(250, 250) },
new go.Binding("source", "img") ),
for (var i = 0 ; i < 5; i++) {
var node = {
key: i,
parent: '1',
text: 'Node_' + i,
img: 'images/gojs_switch.png'
}
// add the node
nodeDataArray.push(node)
// add some lingk
// from, to, color
linkDataArray.push (this.getLink(0,i, 'red'))
linkDataArray.push (this.getLink(0,i, 'green'))
}
Like I said, everything shows as expected in the graph but do not see any images.
The obvious question is whether the relative URL “images/gojs_switch.png” really produces a valid image file. I suppose you can try this by adding an <IMG src=“images/gojs_switch.png” /> to your HTML page and see if the image shows properly.
Yes it does. I have been using this same image in my evaluation of vis.js and cytoscape.js and works fine in their graphs. I admit this does seem strange but currently at a loss to figure why it won’t work here.
Nope, first thing I checked using go-debug.js and have console open, no error being displayed unless of course I have some bogus properties which have fixed so I know it will display errors.