[英]increase the label size of a line chart in chart.js
我無法更改標簽的字體。 正如您在下面看到的,我有一個標簽,上面寫着"# of votes"
,另一個標簽上寫着"# of points"
。 我想為他們做更大的尺寸。 所以我什至添加了以下內容:
label: {
fontSize: 50
},
但我沒有運氣
我的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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.