6 thoughts on “Allow wrapping in axis labels

  1. Is this working in V2.1.2?
    I’m using \n to create a newline within my label set. But it doesn’t create a new line…..

  2. @thopah quoted from the linked issue #2704

    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. The appropriate calculations are made to determine the correct height and width, and rotation is still supported.

    view samples/line-multiline-labels.html to see it working.

  3. Is there any way to make wrapping available for options.scales.yAxes scaleLabel? Having only one line is very limited for y axis label.

  4. Since you need an inner array to wrap labels, you may use this to achieve it:

    const wrap = (str, limit) => {
        const words = str.split(" ");
        let aux = []
        let concat = []
        for (let i = 0; i < words.length; i++) {
          let join = concat.join(' ')
          if (join.length > limit) {
            concat = []
        if (concat.length) {
          aux.push(concat.join(' ').trim())
        return aux

    From a string, it returns an array of words up to the limit you set

Comments are closed.