小编Tro*_*ats的帖子

D3.js 按组分层边缘捆绑着色

我正在尝试根据连接到的组来为分层边缘捆绑可视化中的连接着色。可以在这里看到这样的一个例子。

在此输入图像描述

这是我当前的鼠标悬停功能:

    function mouseover(d) {
        svg.selectAll("path.link.target-" + d.key)
            .classed("target", true)
            .each(updateNodes("source", true));

        svg.selectAll("path.link.source-" + d.key)
            .classed("source", true)
            .each(updateNodes("target", true));
    }
Run Code Online (Sandbox Code Playgroud)

这是我发布的示例中的鼠标悬停函数:

function mouseovered(d) 
{
        // Handle tooltip
        // Tooltips should avoid crossing into the center circle

        d3.selectAll("#tooltip").remove();
        d3.selectAll("#vis")
            .append("xhtml:div")
            .attr("id", "tooltip")
            .style("opacity", 0)
            .html(d.title);
        var mouseloc = d3.mouse(d3.select("#vis")[0][0]),
            my = ((rotateit(d.x) > 90) && (rotateit(d.x) < 270)) ? mouseloc[1] + 10 : mouseloc[1] - 35,
            mx = (rotateit(d.x) < 180) ? (mouseloc[0] + 10) :  Math.max(130, (mouseloc[0] - …
Run Code Online (Sandbox Code Playgroud)

html javascript css svg d3.js

5
推荐指数
1
解决办法
2337
查看次数

标签 统计

css ×1

d3.js ×1

html ×1

javascript ×1

svg ×1