Making each graph on dashboard downloadable as a CSV

Hi everyone,

I am building a dashboard for a friend (still a Dash novice) and one of the requirements is that every graph should have a button where they can export the data frame that was used to create the respective graph as an csv. I was wondering if anybody had any insight on how I should design it.

Currently, I am maintaining a dict that maps the id of a graph to the data frame.and this dicts updated every time the callback is kicked off. I was thinking of utilizing the MATCH from the pattern matching callbacks to link each button to the graph but cannot get the MATCH to work because I guess a MATCH is required on the OUTPUT I don’t need to match an OUTPUT because the callbacks are using the same download component to download the respective graphs.

***Side question, should each downloadable item have it’s own dcc.Download component or is it ok for them to be shared ??? *****