[Chartjs]-How to change font size of labeled scales in Chart.js?

1👍

You have to configure it in the font options for the label like so:

var options = {
  type: 'line',
  data: {
    labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
    datasets: [{
      label: '# of Votes',
      data: [12, 19, 3, 5, 2, 3],
      borderColor: 'pink'
    }]
  },
  options: {
    scales: {
      x: {
        ticks: {
          font: {
            size: 20
          }
        },
        title: {
          display: true,
          text: 'titleX',
          font: {
            size: 25
          }
        }
      },
      y: {
        ticks: {
          font: {
            size: 20
          }
        },
        title: {
          display: true,
          text: 'titleY',
          font: {
            size: 20
          }
        }
      }
    }
  }
}

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.5.0/chart.js"></script>
</body>

EDIT:
Since you want to make the ticks bigger you still need to do that with the font object but than in the ticks sub category

Leave a comment