implement d3 directive