Chart.js and long labels

前端 未结 6 646
难免孤独
难免孤独 2020-12-30 22:45

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 b

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-30 22:55

    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",...],
       ...
    }
    

提交回复
热议问题