我无法更改标签的字体。如下所示,我有一个标签为"# of votes"
的标签,另一个标签为"# of points"
。我想为他们增大尺寸。所以我什至添加了以下内容:
label: {
fontSize: 50
},
但是我没有运气
MY JS代码
var options = {
type: 'line',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [
{
label: '# of Votes',
data: [12, 19, 3, 5, 2, 3],
borderWidth: 1,
backgroundColor: 'rgba(255, 0, 15, 0.54)'
},
{
label: '# of Points',
data: [7, 11, 5, 8, 3, 7],
borderWidth: 1
}
]
},
options: {
label: {
fontSize: 50
},
scales: {
yAxes: [{
ticks: {
reverse: false
}
}]
}
}
}
var ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);
尝试这样的事情(在我的项目中效果很好):
options: {
legend: {
labels: {
fontSize: 50
}
},
//rest of options