gpt4 book ai didi

nvd3.js - nvd3 + lineAndFocus + BrushExtent(访问被点击的焦点部分)

转载 作者:行者123 更新时间:2023-12-04 16:09:40 25 4
gpt4 key购买 nike

我正在使用此处显示的 nvd3 示例中显示的 lineWithFocusChart.js 模型:http://nvd3.org/examples/lineWithFocus.html

我希望能够访问用户在 brushExtent 中选择的值(稍微相关,请参阅 here )然后将焦点应用于所有其他 lineAndFocus 图表。

我可以为折线图部分这样做:

chart.lines.dispatch.on('elementClick.customNameSpace', function(e) {
console.log('click', e);
});
brushExtent 是否有类似的东西? ?

EDIT1:我可以使用此代码控制它的重点。编辑此示例 here
chart.brushExtent([10,20])
chart.update()

EDIT2:这就是我要找的,现在我只需要把它们放在一起,(即绘制图形,监听变化,然后绘制带有变化的图形......)
chart.dispatch.on('brush.update', function(b) { 
console.log(b.extent[0], b.extent[1]);
});

最佳答案

做就是了:

chart.focus.dispatch.on('onBrush', function brushChanged(brushExtent) {
otherCharts.forEach((chart) => chart.brushExtent(brushExtent));
});

我在 lineWithFocusPlusSecondaryChart 中使用了类似的方法模型。

关于nvd3.js - nvd3 + lineAndFocus + BrushExtent(访问被点击的焦点部分),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23820608/

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