【问题标题】:How to add image inside the doughnut chart using chart.js?如何使用 chart.js 在圆环图中添加图像?
【发布时间】:2017-07-27 19:20:00
【问题描述】:

我想在甜甜圈内添加一张图片

you can see my doughnut here

我已经尝试过使用 background-image:url(image.png) 但有什么方法可以做到。

【问题讨论】:

  • 你为什么要投反对票,有人知道答案与否
  • 欢迎来到 StackOverflow。 SO不是一个教程网站。你应该展示你迄今为止所做的尝试,以鼓励用户帮助你。我建议您take the tour 并阅读有关how to ask 的信息。或者看看this checklist,这是一个很好的参考。

标签: angularjs chart.js


【解决方案1】:

从技术上讲,无法在图表中添加图像。

但是,您可以通过添加图像作为图表容器的背景来轻松使用它。即:

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

【讨论】:

    猜你喜欢
    • 2014-01-24
    • 2017-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多