Chartjs-How I can change the font-family of labels in the bar chart?

0👍

Looks like you’re missing the x-axis font settings:

var doughnutChart = new Chart(ctx, {
    ...

    scales: {
      ...
      xAxes: [
        {
          ticks: {
            fontFamily: 'Montserrat, sans-serif',
          },
        },
      ],
    },
  },
});

Here is the demo: https://jsfiddle.net/mbratch/wxgry4p2/1/

But you could set the default font for the whole chart if that’s the desired result:

Chart.defaults.global.defaultFontFamily = 'Montserrat, sans-serif';

var doughnutChart = new Chart(ctx, {
    ...   // no need to set font family in here
});

Demo: https://jsfiddle.net/mbratch/wxgry4p2/2/

Leave a comment