Adding md-tooltip to a SVG chart?

倖福魔咒の 提交于 2019-12-11 14:37:47

问题


This is an example:

<svg>
    <g ng-repeat="rect in rectList">
        <rect ng-attr-fill="rect.fill"
              ng-attr-x="rect.x"
              ng-attr-y="rect.y"
              ng-attr-width="rect.width"
              ng-attr-height="rect.height"></rect>
    </g>
</svg>

I want to add a <md-tooltip> to each of these rects. Can I do it somehow? I am talking about the Angular Material Tooltip specifically, not any other tooltip implementation from other libraries.


回答1:


Try to wrap it in a div and apply the md-tooltip

<div ng-repeat="status in statuses">
   <md-tooltip md-direction="right">
     {{status.description}}
    </md-tooltip>     
<svg >
   <rect width="300" height="100"   >
   </rect>          
</svg>
</div>

Here is the working Sample



来源:https://stackoverflow.com/questions/34576728/adding-md-tooltip-to-a-svg-chart

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