Chart.js 轴标签字体大小字体大小、标签、Chart、js

由网友(思念幻化成海)分享简介: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...

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 options object. I've also tried setting:

{
  ...
  scales: {
    xAxes: [{
      scaleFontSize: 40
      ...
    }]
   }
}
Excel表格美化 设置字体大小

解决方案

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 :

阅读全文

相关推荐

最新文章