hi chap, i hope you are referring this
this library says that you can configure the click event on legand. visit the link and search for "legend.onClick" keyword. this will give you the event and legandItem.
Now you have to write the logic to identify your leganditem and proceed.
so the modified code will somewhat look like
your logic to show value in popup;
second solution can be found here