Update a graph using multiple inputs with time hierarchy

Hi guys.

I have 4 objects:
3)Input box

I am trying to update graph C via clickdata on graph A, B, or a text in the input box. Currently I use if loops, as a consequence it gives me a hierarchy (input>graphA>graphB) that is problematic. Does anyone have an idea how to update the C chart based on the last input that came?

Im trying (input=graphA=graphB) hierarchy by time

Here is a bit of the actually code.

    Output(component_id='graphC', component_property='figure'),             #Return Graph C
    Input(component_id='my_GENEname', component_property='value'),   #The input box
    Input(component_id="count_type",component_property="value"),         #Inputbox can be str or a number
    Input(component_id='Volcano-plot', component_property='clickData'),  #Clicks on Graph A
    Input(component_id='MA-plot', component_property='clickData'),          #Clicks on Graph B

def update_graph1(name,tipo,c_v,c_ma):

    if c_v == None and c_ma == None:                                                                 #If no clicks extract the data with the input box
        if tipo == "gn":                                                                                                #Check if is a str
            val = dff1[dff1["Name"] == name].values[0]
        elif tipo == "gid":                                                                                            #Or check if is a number
            val = dff1[dff1["Unnamed: 0"] == name].values[0]                                 
        if c_v is not None:                                                                                          #if is a click on graph A extract the data 
            name = c_v["points"][0]["text"].split(": ")[1].split("<")[0]                 
        elif c_ma is not None:                                                                                   #Or is a click on graph B extract the data
            name = c_ma["points"][0]["text"].split(": ")[1].split("<")[0]      
        val = dff1[dff1["Name"] == name].values[0]
    #Code for the plot 
    return GraphC


It seems to me that the best solution is to use the callback context to check which component triggers the update:

The documentation should be pretty straightforward, but please follow up if you have doubts or specific question on how to use it in your app.

Although clickData is an “event” data, it does persist its value if you are triggering the callback via other components. Something to be aware of.