typescript - 如何将使用一个数据集的工具提示添加到使用 d3 中的另一个数据集的图表中
问题描述
我有一个和弦图,它的值是不可见的,因为值太小了。因此,我们决定将数据集更改为下边框 1% 以进行显示,并将原始值显示为工具提示。这样每个不是“0”的数据集都会被显示出来。现在我很难让工具提示使用 d3 中的第二个数据集。它适用于一个数据集。
function mousemove(p) {
var a = d3.select(this);
a.attr("fill-opacity", 1);
var d = d3.select(this).data()[0];
const toolTipText = '<b><span style= "color: ' + a.attr('sourceColor') + '">' + a.attr('sourceName') + '</span></b>: ' + d['source']['value']
+ '<hr>'
+ '<b><b><span style= "color: ' + a.attr('targetColor') + '">' + a.attr('targetName') + '</b>: ' + d['target']['value'];
div
.html(toolTipText)
.style("left", p.clientX - 50 + "px")
.style("top", p.clientY - 80 + "px");
}
有人可以帮忙吗?
解决方案
推荐阅读
- spring - Spring、Infinispan 和 JGroups - 以编程方式配置
- java - Maven 构建中的合同检查
- apache-spark - Spark无法加载大文件?
- python - VS Code Anaconda:ModuleNotFoundError
- wordpress - WP Courseware & ACF - 创建可用课程的概览
- java - JAVA - 如何设置不同类的相同字段
- ibm-watson - Watson Bluemix:无法创建应用程序
- lagom - 将 Lagom 写入/读取端分离到单独的服务中?
- delphi - TIdHTTP 通过代理发送 HTTPS 请求作为 HTTP
- database - 在不丢失数据的情况下更新 Knex.js 表