title: Plotly / Dash: Multiple filters
body: <p>I would like to implement a few data filters to preselect the data by certain criteria. These filters should be diagrams itself, i.e. a pie chart (e.g. where one can select a continent) and a time line (e.g. where one can select a time-span). Most importantly, I need to <strong>apply multiple filters from mutliple diagrams without them resetting every time I filter by selecting another diagram</strong>.</p>
  
  <p>However, I do not know how to implement this. I found something old using dash.dependencies.Events, but that is not supported anymore. </p>
  
  <p>Whenever I filter by a criterion in diagram A and then want to filter by another criterion from diagram B, diagram A gets reset.</p>
  
  <p>Since this is probably a situation encountered by many people, and since dash does not seem to support this natively, I wanted to ask whether anyone has a workaround on this?</p>
  
  <p><strong>//edit:</strong> Here is a simple example. I can filter by clicking on a datapoint on the bar graph above. But <strong>whenever I click on a point on the line graph below, it resets the settings from the bar graph. I want to keep both.</strong></p>
  
  <pre><code>import datetime
  
  import dash
  import dash_core_components as dcc
  import dash_html_components as html
  import plotly
  from dash.dependencies import Input, Output
  
  external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
  
  app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
  app.layout = html.Div([
          dcc.Graph(id='graph')
      ])
  
  # Multiple components can update everytime interval gets fired.
  @app.callback(Output('graph', 'figure'),
                [Input('graph', 'selectedData')])
  def update_graph_live(input):
      print(input)
      data = {
          'x': [1,2,3,4,5],
          'y': [1,2,3,4,5],
          'a': [0,-1,-2],
          'b': [100,101,102]
      }
  
      # Create the graph with subplots
      fig = plotly.tools.make_subplots(rows=2, cols=1, vertical_spacing=0.2)
      fig['layout']['margin'] = {
          'l': 30, 'r': 10, 'b': 30, 't': 10
      }
      fig['layout']['legend'] = {'x': 0, 'y': 1, 'xanchor': 'left'}
      fig['layout']['clickmode'] = 'event+select'
  
      fig.append_trace({
          'x': data['x'],
          'y': data['y'],
          'name': 'xy',
          'type': 'bar',
      }, 1, 1)
      fig.append_trace({
          'x': data['a'],
          'y': data['b'],
          'name': 'ab',
          'mode': 'lines+markers',
          'type': 'scatter'
      }, 2, 1)
  
      return fig
  
  
  if __name__ == '__main__':
      app.run_server(debug=True)
  </code></pre>