Please check the link above and help me, I have created the plot myself by need your help in setting the on-click functionality for the same.
It looks like your question was answered on StackOverflow, which you should indicate here if cross-posted. Please see hadley’s note here re. cross positing in general:
In addition to @mara’s suggestion to indicate that your post has been answered, I believe that you should at least copy and paste your actual question to this site if you are going to cross-post. I think that posting the actual question rather than just a link to SO would increase your chances of getting an answer here.
Additionally, it looks like you are not quite satisfied with the answer you got on SO (judging from the comments). If that is the case, then you should specifically say that since like Mara said, it looks right now that your question is answered. Also judging from the comments, it looks like your app works for your training data set but not your real-life data. If that is truly the case, then you should either a) get training data that more closely represents your real-life data or b) look into getting your data into a cleaner format before using it in the shiny app
Finally, you question is extremely long, as the members on SO suggested, you should work on making your question as minimal as possible as this will also increase your chances of getting help.