[dynamicCharts] move d3 code into update functions