I am trying to make these two graphs responsive so that if i highlight a selection and zoom in on one, the other graph zooms in on the same dates. Can anyone please help me?
import dash
import dash_core_components as dcc
import dash_html_components as html
import ssl
import pandas as pd
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
ssl._create_default_https_context = ssl._create_unverified_context
df = pd.read_csv("https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv")
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
colors = {
'background': '#111111',
'text': '#7FDBFF'
}
app.layout = html.Div(style={'backgroundColor': colors['background']}, children=[
html.H1(
children='graph1',
style={
'textAlign': 'center',
'color': colors['text']
}
),
html.Div(children='Displaying Apple High and Low.', style={
'textAlign': 'center',
'color': colors['text']
}),
dcc.Graph(
id='example-graph-2',
figure={
'data': [
{'y': df['AAPL.Open'], 'x': df['Date'], 'type': 'line', 'name': 'Activity'},
{'y': df['AAPL.High'], 'x': df['Date'], 'type': 'line', 'name': 'Baseline'},
],
'layout': {
'plot_bgcolor': colors['background'],
'paper_bgcolor': colors['background'],
'font': {
'color': colors['text']
}
}
}
),
html.Div(children='Second Graph (Volume).', style={
'textAlign': 'center',
'color': colors['text']
}),
dcc.Graph(
id='graph2',
figure={
'data': [
{'y': df['AAPL.Volume'], 'x': df['Date'], 'type': 'bar', 'name': 'Volume'},
],
'layout': {
'plot_bgcolor': colors['background'],
'paper_bgcolor': colors['background'],
'font': {
'color': colors['text']
}
}
}
),
])
if __name__ == '__main__':
app.run_server(debug=True)