I have a d3.js static forces layout graph that can get quite large (sometimes parts of it are cropped), so I would like to allow the user to pan the entire graph by dragging it. I donβt think that I need to drag and drop individual nodes, I have a feeling that it will just be confusing, but I would like to show parts of the graph that are cut off by svg borders.
I have a minimal example at http://bl.ocks.org/3811811 that uses
visF.append("rect") .attr("class", "background") .attr("width", width) .attr("height", height) .call(d3.behavior.zoom().on("zoom", redrawVisF)); function redrawVisF () { visF.attr("transform","translate(" + d3.event.translate + ")" + " scale(" + d3.event.scale + ")"); }
to implement panning, but I find it really βskitteryβ and not very smooth at all, to the extent that I suppose this will stop people from trying to drag and drop in general. Has anyone understood why this is happening and / or an idea how to fix it?
unhammer
source share