more reusable code d3 plugin style