Plotly.js points to multiple subnets

I have a plotly.js graph with several subheadings that have an x ​​axis, as in https://plot.ly/javascript/subplots/#stacked-subplots-with-a-shared-x-axis

I'm trying to hover over all the subtasks to immediately display the values ​​of all points with the same x value.

I tried to solve this by calling Plotly.Fx.hover on each subtitle, but it seems to take effect only for the last subtitle on which it is called. http://codepen.io/john-soklaski/pen/adQwBa

The code I tried is:

Plotly.Fx.hover('myDiv', {xval: 2, curveNumber: 0}, "xy") Plotly.Fx.hover('myDiv', {xval: 2, curveNumber: 1}, "xy2") 

Ideally, the API would be such that I could do this at a time:

 Plotly.Fx.hover('myDiv', [{xval: 2, curveNumber: 0, subplot: "xy"}, {xval: 2, curveNumber: 1, subplot: "xy2"}]) 

Any thoughts on how to make this work?

+8
javascript plotly
source share
3 answers

I see that this question is old, but this functionality was added: https://github.com/plotly/plotly.js/pull/301

0
source share
 Plotly.plot('myDiv', data, layout); graph = document.getElementById('myDiv'); graph.on('plotly_hover', function(eventdata) { if (eventdata.xvals) { Plotly.Fx.hover(graph, { xval: eventdata.xvals[0] }, ['xy', 'x2y2', 'x3y3', 'x4y4']); } }); 

An array of axis labels is also added for several subheadings. In this case

['xy', 'x2y2', 'x3y3', 'x4y4']

This way you can get related guidance events for subplots in div

0
source share

I am trying to do the same in R plot. I have a subplot for each group, and I would like that when you hover over one point, the points in all auxiliary sections with the same x value are highlighted. I tried an example of a crosstalk packet, but so far no luck. Any ideas?

0
source share

All Articles