d3.js - Fix only one dimension of a node in force layout? -


this question - fix node position in d3 force-directed layout - covers how fix position of node in force-layout.

my question how fix 1 dimension, x or y, of node , let other respond forces in layout.

this isn't directly supported in d3, can manually resetting coordinate want remain constant in tick handler function.

force.on("tick", function() {   nodes.each(function(d) {     d.x = d.px = d.savedx; // similar y   });   // other stuff }); 

this requires store desired value data bound nodes, in example in attribute savedx (although can use other name long it's not used else).


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -