How to add image inside the doughnut chart using chart.js?

£可爱£侵袭症+ 提交于 2021-02-08 09:58:08

问题


I want to add an image inside the doughnut

you can see my doughnut here

I already tried by using background-image:url(image.png) but is there any way to do it.


回答1:


Technically, it's not possible to add images in Charts.

However, you can easily work with that by adding an image as a background for chart container. I.e.:

#chartdiv {
  width: 210px;
  height: 210px;
  margin: 0 auto;
  background: transparent url(YourImage) no-repeat center 70px;
}


来源:https://stackoverflow.com/questions/45349113/how-to-add-image-inside-the-doughnut-chart-using-chart-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!