Is it possible to add a background image to a plot in vega or vega-lite?

与世无争的帅哥 提交于 2019-12-11 08:40:20

问题


I see from https://vega.github.io/vega-lite/docs/config.html that it is possible to change the background color. But i don't see any docs for adding an underlay background image.


回答1:


vega-lite creates a canvas element.

So adding a background image is explained in a question about how to add a background to a canvas element.

HTML5 Canvas background image

But you can just do it with css:

canvas {
  background: url("my_background.png");
}

This is just like any other background image css.

https://developer.mozilla.org/en-US/docs/Web/CSS/background-image



来源:https://stackoverflow.com/questions/49580080/is-it-possible-to-add-a-background-image-to-a-plot-in-vega-or-vega-lite

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