gpt4 book ai didi

javascript - 使用 nvd3 同步多个图

转载 作者:搜寻专家 更新时间:2023-11-01 04:41:59 25 4
gpt4 key购买 nike

我在一个页面上有 2 个共享相同 X 轴的基本折线图。我想要完成的是同步这些图表,以便在将鼠标悬停在一个图表上的一个点上时,在第二个图表上触发相同的悬停事件。

到目前为止,我已经想出了如何通过以下方式收听事件:

chart.lines.dispatch.on('elementMouseover.tooltip', function(e) {
// Need to trigger same event on the xAxis of a separate graph
});

到目前为止,通过 nvd3 和 d3 源代码的挖掘并没有揭示如何实现这一点。

最佳答案

我猜这样的事情应该可行。

chart1.lines.dispatch.on('customEvent', chart2.lines.dispatch.customEvent);

关于javascript - 使用 nvd3 同步多个图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18494602/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com