Chart.js and long labels

chart.js, charts, radar-chart

Solution

For Chart.js 2.0+ you can use an array as label:

Quoting the DOCs:

"Usage: If a label is an array as opposed to a string i.e. [["June","2015"], "July"] then each element is treated as a seperate line."

var data = {
   labels: [["My", "long", "long", "long", "label"], "another label",...],
   ...
}

Problem

I use Chart.js to display a Radar Chart. My problem is that some labels are very long : the chart can't be display or it appears very small. So, is there a way to break lines or to assign a max-width to the labels? Thank you for your help!

Original source

Related problems