简体   繁体   English

如何在图表js中更改特定xAxis label的颜色

[英]How to change colour of specific xAxis label in charts js

I have been tasked to build a radar chart using charts.js.我的任务是使用charts.js 构建雷达图。 I need to change the colour of one of the labels for the xAxis to show "This is the data point we are looking at"我需要更改 xAxis 的其中一个标签的颜色以显示“这是我们正在查看的数据点” 图表.js

I have looked at the "color" option in the documentation on their website, but can't get this to work.我已经查看了他们网站上文档中的“颜色”选项,但无法使其正常工作。 https://www.chartjs.org/docs/latest/general/options.html?h=color Anyone have any ideas? https://www.chartjs.org/docs/latest/general/options.html?h=color有人有什么想法吗?

Thanks in advance:-)提前致谢:-)

So you do this with "pointLabels", took a bit of finding TBH;-).因此,您使用“pointLabels”执行此操作,花了一些时间找到 TBH;-)。 EG:例如:

options: {
  legend: {
           display: false,
       },
    scale: {
       pointLabels: {
         display: true,
         fontColor: [
                    'rgba(95, 31, 34, 0.1)', 
                    'rgba(95, 31, 34, 0.1)', 
                    'rgba(95, 31, 34, 0.1)', 
                    'rgba(241, 78, 86, 1)', 
                    'rgba(95, 31, 34, 0.1)', 
                    'rgba(95, 31, 34, 0.1)'
                    ],
       },
       ticks: {
          display: false,
       },
    }
 }                   

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM