How to add font family to Chart.js V3.7.0

Viewed 733

I tried both this:

plugin: {
  label: {
    font: {
      family: "Lato"
    }
  }
}

and this:

myChart.defaults.global.defaultFontFamily = "Lato";

Pieces of code to add Lato font family to my chart, but both cases didn't work.

Any better suggestions? Note that the version I use is 3.7.0. Thanks in advance!

2 Answers

For global use: Chart.defaults.font.family = "Lato".
Details here.

The correct way to specify would be like this (in options):

plugins: { // not plugin
  legend: { // extra layer: legend
    labels: { // with an "s"
      font: {
        family: "Lato" // right here
      }
    }
  }
}
Related