简体   繁体   English

如何在SVG中的工具提示上添加图像?

[英]How can I add image on the tool-tip within SVG?

Trying to reference image on a tooltip within an SVG map. 尝试参考SVG地图内工具提示上的图像。 The reference is as the following: 参考如下:

<path
 inkscape:connector-curvature="0"
 id="BD"
 data-info="<div>Bangladesh</div><div><img src="http://www.digi4health.org/wp-content/uploads/2018/09/bd.png" alt="Bangladesh mHealth" width="600" height="171"></div><div>Some Description</div>"
 data-name="Bangladesh"
 data-id="BD"
 d="m 1486.5,431.9 -4.5,-10.1 -1.5,0.1 -0.2,4 -3.5,-3.3 1.1,-3.6 2.4,-0.4 1.6,-5.3 -3.4,-1.1 -5,0.1 -5.4,-0.9 -1.2,-4.4 -2.7,-0.4 -4.8,-2.7 -1.2,4.3 4.6,3.4 -3.1,2.4 -0.8,2.3 3.7,1.7 -0.4,3.8 2.6,4.8 1.6,5.2 2.2,0.6 1.7,0.7 0.6,-1.2 2.5,1.3 1.3,-3.5 -0.9,-2.6 5.1,0.2 2.8,3.7 1.5,3.1 0.8,3.2 2,3.3 -1.1,-5.1 2.1,1 -0.5,-4.6 z"
 style="fill:#c1f4ff;fill-rule:evenodd" />

I have SVG world map, where I have added some descriptions in a popup info box related to my project. 我有SVG世界地图,在其中添加了与我的项目相关的弹出信息框中的一些描述。 Currently, on the infobox I just have text. 目前,在信息框上我只有文字。 I am trying to include some pictures within the pop infobox. 我正在尝试在弹出信息框中添加一些图片。

Here I am sharing the full code for better understanding. 在这里,我分享了完整的代码,以更好地理解。 Appreciate your support. 感谢您的支持。

Your code is all wrong and I'm not very sure what are you asking. 您的代码都是错误的,我不太确定您在问什么。 Take a look at the following example and tell me if this is what you need: 看下面的示例,告诉我这是否是您需要的:

 <svg viewbox = "1450 400 50 50"> <clipPath id="Bangladesh"> <path d="m 1486.5,431.9 l-4.5,-10.1 -1.5,0.1 -0.2,4 -3.5,-3.3 1.1,-3.6 2.4,-0.4 1.6,-5.3 -3.4,-1.1 -5,0.1 -5.4,-0.9 -1.2,-4.4 -2.7,-0.4 -4.8,-2.7 -1.2,4.3 4.6,3.4 -3.1,2.4 -0.8,2.3 3.7,1.7 -0.4,3.8 2.6,4.8 1.6,5.2 2.2,0.6 1.7,0.7 0.6,-1.2 2.5,1.3 1.3,-3.5 -0.9,-2.6 5.1,0.2 2.8,3.7 1.5,3.1 0.8,3.2 2,3.3 -1.1,-5.1 2.1,1 -0.5,-4.6 z" /> </clipPath> <image xlink:href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/222579/darwin300.jpg" x="1450" y="400" height="50" width="50" clip-path="url(#Bangladesh)"/> </svg> 

I wasn't able to use your image since it comes from an http (not secure). 我无法使用您的图片,因为它来自http(不安全)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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