This examples creates a d3 donut chart, with labels and lines connecting labels to segments.
Labels are arranged to avoid overlap, label text is wrapped to ensure it fits on the page
The pie chart code is modular, so can be reused simply.
https://d3js.org/d3.v4.min.js