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

后端 未结 4 470
走了就别回头了
走了就别回头了 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 18:03

    This should be useful: http://www.chartjs.org/docs/. It says "There are 4 special global settings that can change all of the fonts on the chart. These options are in Chart.defaults.global".

    You'll need to change defaultFontFamily for the font. And defaultFontColor, defaultFontSize, and defaultFontStyle for color, size, etc.

提交回复
热议问题