本文介绍了如何在 bar chart.js 中将标签更改为图像(图标)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮帮我.如何将标签更改为 bar chart.js 中的图像(图标)?我的意思是,从这里改变
Help me, please.How to change the labels to the image (icon) in bar chart.js ?I mean, change from thischange labels: "LifeWall_files/logo.png","Bodily Functions","Sleep"
to thisbottom 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
这篇关于如何在 bar chart.js 中将标签更改为图像(图标)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!