Chart.js axes label font size

前端 未结 5 1167
天命终不由人
天命终不由人 2021-02-01 01:20

In chart.js how can I set the set the font size for just the x axis labels without touching global config?

I\'ve already tried setting the \'scaleFontSize\' option my op

5条回答
  •  一整个雨季
    2021-02-01 02:10

    The fontSize attribute is actually in scales.xAxes.ticks and not in scales.xAxes as you thought.

    So you just have to edit the attribute like this :

    var options = {
        scales: {
            yAxes: [{
                ticks: {
                    fontSize: 40
                }
            }]
        }
    }
    


    You can see a fully working example in this jsFiddle and here is its result :

提交回复
热议问题