Open sirallen opened 7 years ago
I think this is a reasonable suggestion, even if not as easy to implement as it may sound. Would anyone miss the old behavior? Not sure it would be worth the hassle supporting both?
Iirc, everything is put in an SVG group that can pan and zoom, so it might be as easy as putting the legend in a different group.
Continuing to support the non-fixed-location behaviour does seem strange.
Hey, so I took a look at the htmlwidget for forceNetwork. Looks like a very simple change; just
var legend = d3.select(el).select('svg').selectAll('.legend')
...
This is a wonderful package.
Currently the legend (
legend = TRUE
) moves around and scales with a forceNetwork when the user pans and zooms, which--I think it's fair to say--is not ideal. Would be better if the legend were fixed in the top left of the plot area.