Added scatter plot

This commit is contained in:
Filip Izydorczyk 2021-06-21 16:35:32 +02:00
parent 4f5381bf41
commit 2ddca0725c
2 changed files with 26 additions and 1 deletions

View File

@ -644,3 +644,15 @@ a {
#average_gauge{
flex-grow: 1;
}
#tab-1, #tab-2{
background-color: #1E1E1E;
color: #fff;
border-left: none;
border-right: none;
border-bottom: none;
}
.tab--selected{
background-color: #111111 !important;
}

View File

@ -140,7 +140,14 @@ app.layout = html.Div(
]),
html.Div(className='eight columns div-for-charts bg-grey',
children=[
dcc.Graph(id='timeseries', config={'displayModeBar': False}, animate=True),
dcc.Tabs(id='tabs', value='tab-1', children=[
dcc.Tab(id='tab-1', label='Chart 1', value='tab-1', children=[
dcc.Graph(id='timeseries', config={'displayModeBar': False}, animate=True),
]),
dcc.Tab(id='tab-2', label='Chart 2', value='tab-2',children=[
dcc.Graph(id='price-dividends', config={'displayModeBar': False}, animate=True),
]),
]),
dash_table.DataTable(
id='stock_price_table',
style_header={'backgroundColor': 'rgb(30, 30, 30)'},
@ -239,6 +246,12 @@ def change_time_period(selectedData):
volatility_gauge = make_gauge('wolatylność', 0, std['Close'], 400)
return average_gauge, volatility_gauge, stock_info_in_time_period_df.T.to_dict('records')
@app.callback(Output('price-dividends', 'figure'),
[Input('table_selector', 'value')])
def update_point_chart(selected_dropdown_value):
selected_stock_in_table_df = fullTableDf.xs(selected_dropdown_value, axis=1, level=1)
figure = px.scatter(selected_stock_in_table_df, x='Volume', y='Dividends', template='plotly_dark')
return figure
if __name__ == '__main__':
app.run_server(debug=True)