简体   繁体   中英

How to change colour of specific xAxis label in charts js

I have been tasked to build a radar chart using 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" 图表.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?

Thanks in advance:-)

So you do this with "pointLabels", took a bit of finding 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,
       },
    }
 }                   

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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