Would appreciate any guidance. I thought i had this working but not so.
My csv file i confirmed is updating and the n_internal seems to be firing but graph is not updating. Any guidance would be appreciated.
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
#df_data_to_chart = pd.read_csv(r'C:\Users\shadm\PycharmProjects\ExchangeProj\XXRPZEUR_Crypto_Price.csv')
#crypto_ticker = df_data_to_chart.loc[0]['Ticker']
app = dash.Dash(__name__)
app.layout = html.Div(
[
dcc.Graph(id='live-graph', animate=True),
dcc.Interval(id='interval-component', disabled=False, interval=6000, n_intervals=0, max_intervals=-1)
]
)
@app.callback(Output('live-graph', 'figure'),
[Input('interval-component', 'n_intervals')])
def update_graph(n):
df = pd.read_csv(r'C:\Users\shadm\PycharmProjects\ExchangeProj\XXRPZEUR_Crypto_Price.csv')
print(f"you've clicked {n} times")
#print('this is df_index', df.index)
return {'data': [{
'x': df['Date'],
'y': df['Close'],
'type': 'scatter'
}],
'layout': {
'margin': {'b': 0, 'r': 10, 'l': 60, 't': 0},
'legend': {'x': 0},
'xaxis': {'title': 'Time', 'rangeslider':{'visible':True}},
'yaxis': {'range': [min(df['Close']) , max(df['Close']) ], 'title': 'Price $'}
}
}
if __name__ == '__main__':
app.run_server(debug=True)