Jameu Lukasli1
Jameu Lukasli1

Reputation: 507

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

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!

Upvotes: 5

Views: 9458

Answers (2)

Anton Hirov
Anton Hirov

Reputation: 351

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

Upvotes: 11

code
code

Reputation: 6329

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
      }
    }
  }
}

Upvotes: 2

Related Questions