javascript / d3 - 工具提示中的图像

时间:2016-10-18 01:30:23

标签: d3.js

如何更改此代码以在d3工具提示中绘制图像?

    var tip = d3.tip() 
    .attr('class', 'd3heatmap-tip')
    .html(function(d, i) {
      return "<table>" + 
        "<tr><th align=\"right\">Row</th><td>" + htmlEscape(data.rows[d.row]) + "</td></tr>" +
        "<tr><th align=\"right\">Column</th><td>" + htmlEscape(data.cols[d.col]) + "</td></tr>" +
        "<tr><th align=\"right\">Value</th><td>" + htmlEscape(d.label) + "</td></tr>" +
        "</table>";
    })
    .direction("se")
.style("position", "fixed");

不幸的是,我不确定在这种情况下构成可重现的例子是什么......

1 个答案:

答案 0 :(得分:0)

您可以尝试使用foxToolTip.js。有一个如何在工具提示中使用图像的示例,以及如何使用d3。

https://github.com/MichaelRFox/foxToolTip.js