简体   繁体   中英

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM