Refactor label and lines as d3