From 2ddca0725ce614cb8e5aecd61212c9df1bc069c8 Mon Sep 17 00:00:00 2001 From: Filip Izydorczyk Date: Mon, 21 Jun 2021 16:35:32 +0200 Subject: [PATCH] Added scatter plot --- assets/style.css | 12 ++++++++++++ finance.py | 15 ++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/assets/style.css b/assets/style.css index 02cce79..ac67f89 100755 --- a/assets/style.css +++ b/assets/style.css @@ -643,4 +643,16 @@ 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; } \ No newline at end of file diff --git a/finance.py b/finance.py index 66a289b..2296048 100755 --- a/finance.py +++ b/finance.py @@ -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)