# Dash - Bar graphs - 2 Inputs ClickData - 2 clicks required

**URL:** <https://community.plotly.com/t/dash-bar-graphs-2-inputs-clickdata-2-clicks-required/39036>\
**Category:** Dash Python\
**Created:** [May 7, 2020, 4:46am UTC](https://community.plotly.com/t/dash-bar-graphs-2-inputs-clickdata-2-clicks-required/39036 "2020-05-07T04:46:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Rowie](https://avatars.discourse-cdn.com/v4/letter/d/8c91f0/32.png) [@David\_Rowie](https://community.plotly.com/u/David_Rowie)\
**Post date:** [May 7, 2020, 4:46am UTC](https://community.plotly.com/t/dash-bar-graphs-2-inputs-clickdata-2-clicks-required/39036/1 "2020-05-07T04:46:39Z")

</div>

Hi, I wonder if anyone could help me with this issue.

I have 2 bar graphs.

When I click Graph 1:

- it changes the color of the bar clicked in graph 1
- it changes the data of Graph 2

When i click Graph 2:

- it changes the color of the bar clicked in graph 2

(this is a simplification of wider dashboard)

The callback for the Graph 2 is this one:

```auto
@app.callback(
    Output('graph_2', 'figure'),
    [Input('graph_1', 'clickData'),
     Input('graph_2', 'clickData')])
def change_graph2(click_g1, click_g2):
    y = click_g1['points'][0]['x']
    x = click_g2['points'][0]['pointIndex']
    return upgrade_g2(y, x)

```

When the app is opened, if graph 1 is clicked, graph 2 doesn’t refresh, not until the graph2 is clicked at least once. After that, clicking on graph 1 refreshes graph 2.

The weird thing is that, when the app is opened, if i click graph 2 without having clicked graph1, the appcallback for graph2 works…

I would thank anyone that can help me  
David Rowie
