如何在 bar chart.js 中将标签更改为图像(图标)中将、图标、图像、标签

2023-09-07 11:34:35 作者:娶了嫦娥炖了玉兔

请帮帮我.如何将标签更改为 bar chart.js 中的图像(图标)?我的意思是,从这里改变

Help me, please. How to change the labels to the image (icon) in bar chart.js ? I mean, change from this change labels: "LifeWall_files/logo.png","Bodily Functions","Sleep"

Excel图标数据标记怎么使用特殊图片 excel图表特殊点标记的方法

to this bottom icons

解决方案

The easiest way to do this would be to get a font that includes these icons and then set the font family for the ticks

  ...
  options: {
    scales: {
      xAxes: [{
        ticks: {
          fontFamily: 'FontAwesome'
        }
      }]
    }
  }
};

and then specify the appropriate character codes in your labels

labels: ["uf24e", "uf1b9", "uf242", "uf0fc", "uf236"],

With the FontAwesome CSS, the above would give you