4
var myChart = new Chart(ctx, {
            type: 'radar',
            data: chartData,
            options: {
                scale: {
                    min: 0,
                    max: 5,
                    stepSize: 1
                },
                scales: {
                    r: {
                        pointLabels: {
                            fontSize: 100
                        }
                    }
                },
                elements: {
                    line: {
                        borderWidth: 3
                    }
                }
            }
        })

I'm trying to change the font size for the point labels on a radar chart. It seems that this is the way you are supposed to do it, but it is not working for me. Any help is greatly appreciated.

  • Does this answer your question? [Radar Chart, Chart.js v3.2 labels customization](https://stackoverflow.com/questions/67300746/radar-chart-chart-js-v3-2-labels-customization) – uminder May 22 '21 at 05:14

1 Answers1

13

In V3 they introduced a font object instead of separate propperties so you will have to put it like this:

r: {
  pointLabels: {
    font: {
      size: 100
    }
  }
}

Example:

var options = {
  type: 'radar',
  data: {
    labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
    datasets: [{
      label: '# of Votes',
      data: [12, 19, 3, 5, 2, 3],
      borderWidth: 1
    }]
  },
  options: {
    scales: {
      r: {
        pointLabels: {
          font: {
            size: 100
          }
        }
      }
    }
  }
}

var ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);
<body>
  <canvas id="chartJSContainer" width="600" height="400"></canvas>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.2.0/chart.js"></script>
</body>

Font documentation: https://www.chartjs.org/docs/latest/general/fonts.html

LeeLenalee
  • 27,463
  • 6
  • 45
  • 69
  • thank you, this is the full config that worked for me : options: { scales: { // ticks: { // beginAtZero: true, // max: 4, // min: 0, // stepSize: 1, // }, r: { pointLabels: { font: { size: 8, }, }, }, }, – Khaled Boussoffara Dec 30 '21 at 12:19