How to change the Chart.js axes label font size with JavaScript?

Sometimes, we want to change the Chart.js axes label font size with JavaScript.

In this article, we’ll look at how to change the Chart.js axes label font size with JavaScript.

How to change the Chart.js axes label font size with JavaScript?

To change the Chart.js axes label font size with JavaScript, we set the fontSize property.

For instance, we write

const options = {
  scales: {
    yAxes: [
      {
        ticks: {
          fontSize: 40,
        },
      },
    ],
  },
};

to set the ticks.fontSize property in the yAxes array to set the font size of the y-axis labels.

Conclusion

To change the Chart.js axes label font size with JavaScript, we set the fontSize property.