【发布时间】:2021-07-06 17:16:06
【问题描述】:
我在这里使用最新版本的 chart.js https://cdnjs.com/libraries/Chart.js(CDN 网站的第一个链接)。我想更改 pointLabels 的字体大小,但失败了。我也未能设置 display: false 的刻度。他们唯一起作用的是刻度的字体大小。谁能帮帮我?
const data = {
labels: [
'Eating',
'Drinking',
'Sleeping',
'Designing',
'Coding',
'Cycling',
'Running'
],
datasets: [{
data: [4, 1, 1, 4, 2, 3, 5],
fill: false,
borderColor: 'rgb(255, 99, 132)',
pointRadius: 1,
}]
};
const config = {
type: 'radar',
data: data,
options: {
elements: {
line: {borderWidth: 1}
},
scale: {
ticks: {
beginAtZero: true,
max: 5,
min: 0,
stepSize: 1,
font: {
size: 6
}
},
pointLabels:{
fontSize: 20
}
},
plugins: {
legend: {
display: false
}
}
},
};
var myChart = new Chart(
document.getElementById('chart'),
config
);
【问题讨论】:
标签: javascript chart.js