如何在Chartjs中将图像添加为背景? [英] How can i add an image as background in Chartjs?

查看:161
本文介绍了如何在Chartjs中将图像添加为背景?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在可编程设备上使用chart.js lib,我需要将图像作为背景添加到图表中,如果不可能的话,如何将背景颜色更改为黑色?我无法使用Jquery,因为平台不支持它.

I am using chart.js lib on a programmable device i need to add an image as background to my chart, if that is not possible how can i change background color to black?. I cannot use Jquery as it is not supported by the Platform.

谢谢

推荐答案

您可以设置canvas元素的样式.这样的事情会起作用

You can style the canvas element. Something like this will work

canvas {
    background-color: black;
}

提琴- https://jsfiddle.net/w1yhp03h/

这篇关于如何在Chartjs中将图像添加为背景?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆