My Chart.js displays a horizontal stacked bar chart with legends corresponding to different classes. Here's a snippet (using dummy data, please ignore the random names): https://i.sstatic.net/XNTZZ.png
The left labels represent users, while the legend labels (associated with the classes in the chart) represent mailing lists. The chart depicts how many users are members of specific mailing lists; the length of each bar indicates the number of mailing lists a user is a part of.
I am looking to configure it so that hovering over a legend entry will highlight the relevant parts of the bar chart (ideally with a border or similar effect). For example, if I hover over the first dataset entry, the blue section at the left end of all bars (excluding "anionic") would be highlighted.
Currently, using the onHover
and onLeave
events for the legend, I can successfully log the index of the dataset being hovered over. However, I am struggling to figure out how to make the bar elements belonging to that dataset stand out visually.