我想ngx-tooltip
在两个节点之间的边缘上使用 a 。ntx-tooltip
作品发现了边和节点,只是边要小得多,因此必须准确定位鼠标才能触发工具提示弹出窗口。
<ng-template #linkTemplate let-link>
<svg:g class="edge"
ngx-tooltip
[tooltipPlacement]="'top'"
[tooltipType]="'popover'"
[tooltipTitle]="link.direction"
>
<ng-container [ngSwitch]="link.direction">
<svg:path
*ngSwitchCase="'ToFrom'"
[ngStyle]="pathStyle(link.source, link.target, link.direction)"
class="line"
stroke-width="3"
marker-start="url(#arrow)"
marker-end="url(#arrow)"
>
</svg:path>
<svg:path
*ngSwitchCase="'FromOnly'"
[ngStyle]="pathStyle(link.source, link.target, link.direction)"
class="line"
stroke-width="3"
marker-start="url(#EndMarker)"
marker-end="url(#arrow)"
>
</svg:path>
<svg:path
*ngSwitchCase="'ToOnly'"
[ngStyle]="pathStyle(link.source, link.target, link.direction)"
class="line"
stroke-width="3"
marker-start="url(#arrow)"
marker-end="url(#EndMarker)"
>
</svg:path>
</ng-container>
<svg:text class="edge-label" text-anchor="middle">
<svg:textPath class="text-path" [attr.href]="'#' + link.id"
[style.dominant-baseline]="link.dominantBaseline" startOffset="50%"
>
{{link.label}}
</svg:textPath>
</svg:text>
</svg:g>
</ng-template>