downloading table
This commit is contained in:
parent
e5df1f30ac
commit
4733fd3cb5
15
finance.py
15
finance.py
@ -4,7 +4,7 @@ import dash_core_components as dcc
|
|||||||
import dash_table
|
import dash_table
|
||||||
import plotly.express as px
|
import plotly.express as px
|
||||||
import yfinance as yf
|
import yfinance as yf
|
||||||
from dash.dependencies import Input, Output
|
from dash.dependencies import Input, Output, State
|
||||||
import plotly.graph_objects as go
|
import plotly.graph_objects as go
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
@ -116,7 +116,10 @@ app.layout = html.Div(
|
|||||||
multi=False, value=selected_stock_in_table,
|
multi=False, value=selected_stock_in_table,
|
||||||
style={'backgroundColor': '#1E1E1E'},
|
style={'backgroundColor': '#1E1E1E'},
|
||||||
className='stockselector'
|
className='stockselector'
|
||||||
)
|
),
|
||||||
|
html.Button("Pobierz dane", id="btn_data"),
|
||||||
|
dcc.Download(id="download-data")
|
||||||
|
|
||||||
],
|
],
|
||||||
style={'color': '#1E1E1E'}),
|
style={'color': '#1E1E1E'}),
|
||||||
html.P('Wybierz przedział czasu by policzyć średnie i wachania'),
|
html.P('Wybierz przedział czasu by policzyć średnie i wachania'),
|
||||||
@ -147,6 +150,14 @@ app.layout = html.Div(
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@app.callback(
|
||||||
|
Output("download-data", "data"),
|
||||||
|
Input("btn_data", "n_clicks"),
|
||||||
|
prevent_initial_call=True,
|
||||||
|
)
|
||||||
|
def create_download_file(n_clicks):
|
||||||
|
global selected_stock_in_table_df
|
||||||
|
return dcc.send_data_frame(selected_stock_in_table_df.to_csv, "data.csv")
|
||||||
|
|
||||||
# Callback for timeseries price
|
# Callback for timeseries price
|
||||||
@app.callback(Output('timeseries', 'figure'), [Input('stockselector', 'value')])
|
@app.callback(Output('timeseries', 'figure'), [Input('stockselector', 'value')])
|
||||||
|
Loading…
Reference in New Issue
Block a user