I have the following Radar chart using Chart.js v2.
My configuration:
legend: false,
scale: {
pointLabels :{
fontSize: 16,
fontStyle: "bold",
}
}
The problem here is the "Communication" label has 0 padding between the label and the number 100. How can I configure this padding and/or fix this issue?
Usually problem occurs with the first
pointLabel
when it is single liner you can add the callback in options as followsMaking
pointLabel
multi line text solves the problem.EDIT: Current version of
chartjs
is2.7.3
. Upcoming version will probably solves this problem.I have the same problem as described in the question and also was unable to find a solution using known chart options.
However, here is another workaround to achieve a behaviour similar to the desired padding (although not exactly):
The idea is to add one additional grid line with a transparent color. While this does not cause any padding between the pointLabels and the angleLines, it does cause there to be one gridLine worth of space between the label and the next gridLine. To me, this at least looks a little better.
Note that this is only feasible if you do not need to display ticks (or if you are ok with your scale showing one additional tick value that you don't actually use).
Spent an hour and still can't find the proper label padding options.
My workaround is padding the labels with newlines and spaces:
The outcome is acceptable:
Make it auto if you wish:
I use chart.js 2.6.0. I suffered from the same problem as you. I use only the radar type chart and amended as follows.
Whenever my PR will be merged,
pointLabels.padding
option will be added ;)