event based painting for d3