如何自定义 d3plus.full.js 中的工具提示?

How to customize the tooltip in d3plus.full.js for rings?

我正在一个项目中尝试使用 d3plus 图表,我需要自定义显示在圆环右上角的工具提示。这个D3PLUS Example

我与一个额外的字段有如下联系

var connections = [ { "source": "alpha", "target": "beta", "strength": 200, "grade":"A" }, { "source": "alpha", "target": "gamma", "strength": 10, "grade": "A" }, { "source": "beta", "target": "delta", "strength": 5, "grade": "B" }, { "source": "beta", "target": "epsilon", "strength": 1.563, "grade": "B" }, { "source": "zeta", "target": "gamma", "strength": 3.125, "grade": "A" }, { "source": "theta", "target": "gamma", "strength": 0.732, "grade": "A" }, { "source": "eta", "target": "gamma", "strength": 2.063, "grade": "B" } ]

我想在每个来源下列出 grade 作为要点。

我通过对 d3plus.full.js 进行逆向工程进行了很多尝试,但没有成功。有可能吗?

您可以通过 jquery 轻松完成。在 document 准备好 select .class 并添加元素。下面的示例是单击如下按钮:

$(document).ready(function(){
$("#btn").on('click',function(){
        console.log("Hello");
        $(".d3plus_tooltip_focus_link").each(function (indx) {
            console.log(indx + " : " + $(this).text());
        });         
    });
});