[英]Chartjs Radar - Change color of end point labels
I need to change the color of the labels displayed at each point on the chart, I have tried many different things without any result at all.我需要更改图表上每个点显示的标签的颜色,我尝试了许多不同的东西,但根本没有任何结果。
Image图片
Code代码
const CHART = document.getElementById("radar_chart");
Chart.defaults.scale.ticks.beginAtZero = true;
Chart.defaults.scale.ticks.max = 10;
Chart.defaults.scale.ticks.display = false;
Chart.defaults.scale.ticks.display = false;
var radar = new Chart(CHART, {
type: 'radar',
data: {
labels: ["Team", "Potential", "Risk", "Social", "Hype"],
datasets: [
{
backgroundColor: "#2e4259cc",
borderColor: "#fff",
borderWidth: 3,
pointBorderColor: "#fff",
pointBackgroundColor: "#2e4259",
pointHoverRadius: 5,
data: [3, 5, 9, 5, 8]
}
]
},
options: {
legend: {
display: false,
fontColor: "#fff",
labels: {
fontColor: '#fff'
}
}
}
});
My latest effort was changing pointLabelFontColor but with no luck, i can't seem to find anything about it我最近的努力是改变 pointLabelFontColor 但没有运气,我似乎找不到任何关于它的东西
options:{
scale:{
pointLabels:{
fontColor:"red",
},
}
In theory this should be the configuration you should use if we follow the doc for the Linear Radial Axis理论上,如果我们遵循线性径向轴的文档,这应该是您应该使用的配置
The doc is for the version 2.7.2, so I am not sure it would work for your version, or if it would be any different in older version.该文档适用于 2.7.2 版,因此我不确定它是否适用于您的版本,或者在旧版本中是否会有所不同。
options: {
scales: {
r: {
pointLabels:{
color: 'rgb(54, 162, 235)',
},
},
}
I don't know what version you are using, but the current configuration works for me.我不知道您使用的是什么版本,但当前配置对我有用。 enter image description here
在此处输入图像描述
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.