update d3 with legends