最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to add a background image to a plot created using D3 - Stack Overflow

programmeradmin5浏览0评论

I have created this line chart using D3.

Suppose I need to add some .png image from the local file on my puter to the above graph, how can I do that?

Thank you very much.

I have created this line chart using D3.

http://bl.ocks/d3noob/a22c42db65eb00d4e369

Suppose I need to add some .png image from the local file on my puter to the above graph, how can I do that?

Thank you very much.

Share Improve this question asked Nov 23, 2015 at 9:21 ArtigaArtiga 7962 gold badges17 silver badges39 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

You can add background property through CSS to svg element as any other HTML tag. For example, like this you will have google logo on background:

svg {
  background: url('https://www.google.nl/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png') no-repeat;
}

More on properties you can use in background, w3schools.

发布评论

评论列表(0)

  1. 暂无评论