我尝试将单击事件添加到sankey图节点。我发现链接单击事件是可能的,但节点单击事件不是。是否可以将单击事件添加到节点?
m1m5dgzv1#
在本例中,您可以看到如何将单击点事件添加到图表plotOptions,这是将单击添加到点的一种方法。https://api.highcharts.com/highcharts/series.sankey.point.events
plotOptions: { series: { point: { events: { click: function() { let point = this; console.log('click point', point, 'from', point.from, 'to', point.to); } }, } } },
另一种方法是单击使用其id链接的点。https://api.highcharts.com/highcharts/series.sankey.nodes
nodes: [{ id: 'Brazil', }, { id: 'Portugal', events: { click() { let series = this.series, nodes = series.nodeLookup; console.log('click event on node linked by id ', nodes); } } }],
演示:https://jsfiddle.net/BlackLabel/jw8skp1z/
1条答案
按热度按时间m1m5dgzv1#
在本例中,您可以看到如何将单击点事件添加到图表plotOptions,这是将单击添加到点的一种方法。
https://api.highcharts.com/highcharts/series.sankey.point.events
另一种方法是单击使用其id链接的点。
https://api.highcharts.com/highcharts/series.sankey.nodes
演示:https://jsfiddle.net/BlackLabel/jw8skp1z/