由网友(思念幻化成海)分享简介: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...![Excel表格美化 设置字体大小](https://p.xsw88.cn/allimgs/daicuo/20230907/5404.png)
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表格美化 设置字体大小](https://p.xsw88.cn/allimgs/daicuo/20230907/5404.png)
解决方案
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 :
相关推荐
最新文章