我想增加图表标签中字体的大小并更改其颜色,但这不是图例标签。它是雷达图每个数据旁边的名称。
我尝试这样做:
options={{
legend: {
labels: {
fontColor: 'rgba(255,255,255,1)',
fontSize: 16,
fontStyle: "bold"
}
},
但是它只会更改'Undefined'标签的名称。
谢谢您的帮助。
options: {
scale: {
pointLabels: {
fontSize: 16
}
}
}
这里是配置好的雷达网格。
options.scale.pointLabels.fontSize
设置options.scale.pointLabels.fontColor
设置options.legend.labels.fontColor
设置文档非常好,您应该将其签出:
var skillCanvas = document.getElementById('skillChart');
var skillData = {
labels: ["Teamwork", "Organization", "Adaptability", "Curiousity", "Self-taught"],
datasets: [{
label: "Student A",
backgroundColor: 'rgba(17, 192, 145, 0.2)',
data: [90, 80, 92, 88, 75]
}]
};
var skillChart = new Chart(skillCanvas, {
type: 'radar',
data: skillData,
options: {
legend: {
labels: {
fontColor: '#11c091'
}
},
scale: {
gridLines: {
color: '#AAA'
},
ticks: {
beginAtZero: false,
max: 100,
min: 20,
stepSize: 10,
fontColor: '#fff',
backdropColor: '#444'
},
pointLabels: {
fontSize: 16,
fontColor: '#11c091'
}
}
}
});
body {
background: #444;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.css" rel="stylesheet" />
<canvas id="skillChart" width="400" height="200"></canvas>