How to listen for clicks on labels?


My use case must be pretty common so I bet it has been solved but I can’t find anything in the docs. I have a horizontal bar chart. When the user focuses on a category (clicks the bar), I show detailed info elsewhere in the view.

Often a category has value=0, so there is no bar to click on. Ironically these are the categories most interesting to my user (a low bar means a problem that requires the user’s attention) so I still need to give the user a way to show the category details in the view. Any user would expect that he could just click the category name (the yAxis label in my horizontal bar chart) to select that category. So my problem is simple: What’s the cleanest way to detect which label was clicked on?

Author: Fantashit

1 thought on “How to listen for clicks on labels?

Comments are closed.