Use d3-annotation with built-in annotation types, or extend it to make custom annotations. It is made for d3-v4 in SVG.
d3d3-moduleannotation
http://d3-annotation.susielu.com