Here are the changes we made to a standard vis.js template
to pin the foundation nodes to the left and the goal nodes
to the right.
1 2 3 4 5 6 7 8 910111213141516171819
// Extract nodes from the JSON dataconstnodes=newvis.DataSet(data.nodes);// Function to fix the x positions for foundation and goal groups after JSON load// and set red boxes for foundation and gold stars for goalsnodes.forEach(function(node){if(node.group==="found"){node.x=-900;node.fixed={x:true,y:false};// Fix x, but let y be adjusted by physicsnode.shape="box";node.color="red";node.font={"color":"white"};}elseif(node.group==="goal"){node.x=900;node.fixed={x:true,y:false};// Fix x, but let y be adjusted by physicsnode.shape="star";node.color="gold";}});