Categories
JavaScript Answers

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

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *