d3 chart update functionality