View All Public Notes
Super in-depth! Adjusting legend positions horizontally Suppose , we want to draw legends using d3 From this data In most situations we have constant sized legends Which is problem if we change data Now, result looks like this But, using this snippet, we can modify group positions after it is drawn var marginLeft = 0; groups.each(function (d, i, arr) { var wrapper = d3.select(this); var bbox = wrapper.node().getBoundingClientRect(); wrapper.attr('transform', 'translate(' + marginLeft + ',15)') #dev #bookmarked_on_site #D3 #code #data_visualization #code_examples #$project_2018_js #javascript #in-depth #best_of #pub