mykola-digtiar / chartjs-plugin-piechart-outlabels

Highly customizable Chart.js plugin that displays labels outside the pie/doughnut chart.
https://piechart-outlabels.netlify.com/sample/
MIT License
52 stars 39 forks source link

Lable placement #6

Open face opened 6 years ago

face commented 6 years ago

One solution for https://github.com/Neckster/chartjs-plugin-piechart-outlabels/issues/2

This PR moves labels to the left and down, instead of up off the screen.

NOTE: This PR has some things specific to our needs, so it may not be ready to merge as a generic solution. The things that might be specific to us: 1) We don't use a background color, so we use the text for label placement so they are close together. 2) Works ok for a few small pie slices. However, probably won't work to well if there are too many slices. 3) We removed a check that the labels don't touch the pie, because it would cause an infinite loop if the lables moving down hit the chart.

Even though this is probably not generic enough for everyone, I'm submitting this PR as it may help someone and give the maintainers ideas how to solve this bug.