You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #825, a centered doughnut label annotation was added, though the spacing option does not seem to reduce the label size, only the border and background sizes.
Ideally, I want to maximize the font size for the center label, while still keeping some padding around the label, so it doesn't hug the inside of the doughnut chart like it does now. Before the doughnutLabel annotation, I used my own plugin based on this StackOverflow answer, and there I can just add some padding around the label.
For example, with the text in blue, the background color in green, and in this case a spacing of 10, results in the background correctly getting padding, but the label is still the same size as if there was no spacing.
Additional bug: when increasing the spacing parameter until it becomes bigger than the innerRadius, results in the following error being thrown from the drawArc function:
IndexSizeError: Failed to execute 'arc' on 'CanvasRenderingContext2D': The radius provided (-38.5) is negative.
@ThenTech thank you very much for feedback! I have prepared a PR #955.
I need to test all possible cases (mainly when the circumference is <= 180 degrees. I'll set it "ready for review" asap.
In #825, a centered doughnut label annotation was added, though the
spacing
option does not seem to reduce the label size, only the border and background sizes.Ideally, I want to maximize the font size for the center label, while still keeping some padding around the label, so it doesn't hug the inside of the doughnut chart like it does now. Before the
doughnutLabel
annotation, I used my own plugin based on this StackOverflow answer, and there I can just add some padding around the label.For example, with the text in blue, the background color in green, and in this case a spacing of 10, results in the background correctly getting padding, but the label is still the same size as if there was no spacing.
Additional bug: when increasing the spacing parameter until it becomes bigger than the innerRadius, results in the following error being thrown from the drawArc function:
As used here (with
_radius
):chartjs-plugin-annotation/src/types/doughnutLabel.js
Line 188 in 0d6246d
Caused by this subtraction:
chartjs-plugin-annotation/src/types/doughnutLabel.js
Line 139 in 0d6246d
On another note, this function:
chartjs-plugin-annotation/src/types/doughnutLabel.js
Lines 157 to 160 in 0d6246d
could also use the built-in
Math.hypot
function, like so:The text was updated successfully, but these errors were encountered: