Plotly.Fx.hover Questions

I want to trigger hover programmatically in a grouped bar chart.
Here is my CodePen https://codepen.io/bboughton/pen/dybVVmo

  • When I trigger using Plotly.Fx.hover and mimic the same curve # and points the hover looks different. I’d like it to look exactly as if I am hovering with mouse. But they seem to look different. How can I fix this?
  • Is there a way to trigger hover by category? E.g. ‘giraffes’ ? I was hoping something like {curveNumber:0, xaxis: 'giraffes'} might work but not so.

image
image

Cheers,
Ben

OK I can replicate the hover by using an integer in xval and have updated my codepen with a second button to show the difference. Guessing I’ll just need to refer back to my x axis data to get index? Something like Plotly.Fx.hover('myDiv',{xval:xdata.indexOf('giraffes')})

three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online