[英]chart.js modify style from dataset label
(hey!) I'm discovering JS and Chart.js and I need to change font size and font weight from the label in dataset but I don't find anything in documentation or on google. (嘿!)我正在发现 JS 和 Chart.js,我需要从数据集中的标签更改字体大小和字体粗细,但我在文档或谷歌上找不到任何内容。 Can anyone give me any suggestion ?任何人都可以给我任何建议吗?
import Chart from 'chart.js'
let ctx = document.getElementById('rentResumeChart').getContext('2d');
let rentResumeChart = new Chart(ctx, {
responsive: true,
maintainAspectRatio: false,
type: 'bar',
data: {
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
datasets: [{
label: '# of Votes', //this one
data: [12, 19, 3, 5, 2, 3],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
'rgba(255, 206, 86, 0.2)',
'rgba(75, 192, 192, 0.2)',
'rgba(153, 102, 255, 0.2)',
'rgba(255, 159, 64, 0.2)'
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
}]
},
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
fontSize: 25,
fontStyle: 'bold'
}
}],
xAxes: [{
ticks: {
fontSize: 25,
fontStyle: 'bold'
}
}],
},
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.