javascript - 将水印/徽标添加到 Chart.js
问题描述
我一直在查看文档和其他 SO 帖子,但似乎以前没有人问过这个问题。
有什么方法可以在 Chart.js 制作的图表中添加水印或徽标?
我需要这个主要是因为当人们将图表作为图像下载时,我不太关心它是否显示在我的网站上,只要用户下载它时它就在那里。
谁能指出我正确的方向?
非常感谢!:)
解决方案
I'm sorry for finding an answer myself minutes after posting the question, but for the life of me I couldn't find this before :(
This Chart.js plugin will do exactly that: https://www.npmjs.com/package/chartjs-plugin-watermark
options: {
watermark: {
image: "//imgurlhere.jpg",
x: 20,
y: 10,
width: 53,
height: 60,
opacity: 0.25,
alignX: "left",
alignY: "top",
alignToChartArea: true,
position: "back"
},
}
推荐阅读
- linux - 处理第二个和更多参数中的每一个
- google-data-studio - 具有 OAuth 和唯一参数的合作伙伴连接器
- angular-material - 无法掉落 Angular 材质掉落物品
- windows - 更改 ComboBox 中嵌入的编辑控件的背景色
- php - 将 type="text" & type="time" 中的值连接为 php、Mysql 中的 timstamp
- python-3.x - 2D 数据的自定义 Lambert 保形投影在另存为 pdf (16MB) 时会提供非常大的文件大小
- nvidia-jetson-nano - 例外:jetson.utils -- 未能创建 glDisplay 设备
- xml - 通过 XSLT 从 xml 中选择动态标签
- html - Ruby on Rails 购物车
- javascript - 在博客上使用 javascript 定义要标记的值