How can I change the font (family) for the labels in Chart.JS?

后端 未结 4 469
走了就别回头了
走了就别回头了 2020-12-03 17:06

I want to change the font to something snazzier in my Chart.JS horizontal bar chart. I\'ve tried the following, but none of it works:

var optionsBar = {
             


        
4条回答
  •  独厮守ぢ
    2020-12-03 17:50

    If you wanted to add the font-family to the chart object then you can add it in the options object.

    options: {
      legend: {
        labels: { 
          fontFamily: 'YourFont'
        }
      }...}
    

    Here is a link to the docs: https://www.chartjs.org/docs/latest/general/fonts.html

提交回复
热议问题