Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

enter image description here

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

like image 997
ii iml0sto1 Avatar asked Mar 06 '23 11:03

ii iml0sto1


2 Answers

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.

like image 126
vrajau Avatar answered Mar 15 '23 07:03

vrajau


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.

configuration works for me

like image 29
impactCn Avatar answered Mar 15 '23 08:03

impactCn