hover events for labels/legends
See original GitHub issueI would like to be able to know when the user hovers or clicks on my label or legend items. Specifically, I would like to be able to highlight a given pie slice or bar trace when a particular label or legend item is hovered over. d3pie does this, and an example can be seen here: http://d3pie.org/#generator-start
As a starting point, it would be useful to have this click
handler fire an event after it calls Plotly.restyle
or Plotly.relayout
: https://github.com/plotly/plotly.js/blob/47b13b0c2ecffae3ecb0b37d957978f3004a7ac7/src/components/legend/index.js#L484
A hover
handler for the same traces would help a lot as well.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:6
- Comments:14 (4 by maintainers)
Top Results From Across the Web
Hover style for labels in legend - highcharts
I've disabled clicking on legend labels by adding this property: plotOptions.series.events.legendItemClick = function() { return false; }.
Read more >Show series bullets/labels on legend hover
This demo shows how we can add events to Legend items that would toggle on respective series' bullets and bullet labels on hover....
Read more >Add an event for legend item hovering –
You might add mouseover/mouseout events to legend items. This event should provide the index of the legend item.
Read more >show datalabels on legends hover
Hi anu_1555, In mouseOver and mouseOut events, you can loop over all available series and set their state programmatically. ... Let me know...
Read more >itemmouseover - Sets Mouse Over Event
Sets the mouseover event handler for the legend, which is triggered when the user moves the mouse(input device) over a legend item.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For anybody looking to add hover events to the the Plotly legend, here’s are some simple events I added to the traceToggle item that highlights the hovered legend item using opacity:
`
`
Another vote here.
Another use for this would be if you have a plot with a collection of line graphs corresponding to different groups. The user could then hover over the legend to highlight the particular plot similar to the d3pie example above.