Javascript 在d3中的特定svg上永久添加工具提示

Javascript 在d3中的特定svg上永久添加工具提示,javascript,d3.js,svg,Javascript,D3.js,Svg,我正在尝试向由svg构成的漏斗图添加工具提示。我希望工具提示是静态的,它应该在图表加载时显示,并且应该静态地保留在图表上。它必须看起来像这样 我试过一些东西: var tip = d3.tip() .attr('class', 'd3-tip') .html(function (d) { return '<table style="width:100px"><tr><td style="font-size:14px;

我正在尝试向由svg构成的漏斗图添加工具提示。我希望工具提示是静态的,它应该在图表加载时显示,并且应该静态地保留在图表上。它必须看起来像这样

我试过一些东西:

var tip = d3.tip()
        .attr('class', 'd3-tip')
        .html(function (d) {
        return '<table style="width:100px"><tr><td style="font-size:14px; font-weight:bold"> ' + d.ind + '</td></tr><tr><td style="font-size:10px">Total Cases:</td></tr><tr><td font-weight-800" style="font-size:12px; color: #2B597C; font-weight: bold" >' + d.tot_cases + '</td></tr></table>'
            ;
        })
    svg.call(tip);
        g.append("polygon")
            .attr("points", points.map(function (d) { return [d.x, d.y].join(","); }).join(" "))
            .attr("stroke", "white")
            .attr("stroke-width", 1)
            .attr('fill', function () { return (color2[i]) })
            .each(function(){
                 if (data[i].ind == "Notified") {
                 // tip.style('top', (event.pageY) + 500 + "px");
                 // tip.style('left', (event.pageX) + 30+ "px");
                tip.show(data[i], this);
        }
      })

var tip=d3.tip()
.attr('class','d3 tip')
.html(函数(d){

返回“+d.ind+”总案例数:静态是什么意思?您希望将其放置在何处?它不应固定在鼠标上方、悬停或单击上。它应按照第一幅图像@Ma'moun othman中所示进行定位