Extension to show menu item for each display_data in output area

I create a few charts with different display_ids by code. Then, I want to give the end user the option to save the selected chart as a file.

  1. Is it possible to know which chart (display_id) is the selection by the mouse position?
  2. If not, is it possible to dynamically create a menu item for each display_data under a popup menu item, “Save as file” for example? So, the end user can pick up by display_id.

Thanks,