chartjs / chartjs-plugin-annotation

Annotation plugin for Chart.js
MIT License
607 stars 328 forks source link

Add rotation support to label annotation #660

Closed kurkle closed 2 years ago

stockiNail commented 2 years ago

@kurkle I have done a preliminary study in order to enable the label rotation. The issue is the callout position calculated automatically:

https://github.com/chartjs/chartjs-plugin-annotation/blob/d2c18fc1fe1d290010047d22621c22bd1dc3a07d/src/types/label.js#L207-L220

With the rotation, the above checking are useless because the assumption was a label not rotated. That said, I have change a little bit the logic for position: 'auto' (default), take the sides nearest to the point. This could be a breaking change but sounds working fine.

I'm going to submit the PR (in draft) in order you can have a look.

stockiNail commented 2 years ago

PR #672