DavideViolante / chartjs-plugin-labels

Plugin for Chart.js to display percentage, value or label in Pie or Doughnut.
MIT License
55 stars 18 forks source link

Responsive labels within arc? #27

Open J7mbo opened 9 months ago

J7mbo commented 9 months ago

Is it possible to make the labels within the arc responsive? Or is this too complicated? This is unfortunately something I can't contribute as the maths looks too complicated for me, but if it's actually complex, I'd be willing to pay for it :)

J7mbo commented 9 months ago

Right now I'm using a combination of textMargin within plugins.labels, and fontSize, and I've attempting the following for textMargin:

textMargin: function (){
    // This is how far away from the edge of the circle the text is.
    return window.innerWidth / 40;
}(),

This doesn't work well though :/ Both the font size, and the margin (when using position: 'outside'), need to be adjusted as the window is resized.

DavideViolante commented 9 months ago

Right now I'm pretty busy with a job, so I'm unable to look into this. I'll try to find some time.