Open crkrenn opened 2 years ago
I did this
! pip install dash
! pip install dash-html-components
! pip install dash-core-components
! pip install plotly
import dash import dash_html_components as html import plotly.graph_objects as go import dash_core_components as dcc import plotly.express as px from dash.dependencies import Input, Output
It worked
to test run this....
app = dash.Dash()
df = px.data.stocks()
app.layout = html.Div(id = 'parent', children = [ html.H1(id = 'H1', children = 'Styling using html components', style = {'textAlign':'center',\ 'marginTop':40,'marginBottom':40}),
dcc.Dropdown( id = 'dropdown',
options = [
{'label':'Google', 'value':'GOOG' },
{'label': 'Apple', 'value':'AAPL'},
{'label': 'Amazon', 'value':'AMZN'},
],
value = 'GOOG'),
dcc.Graph(id = 'bar_plot')
])
@app.callback(Output(component_id='bar_plot', component_property= 'figure'), [Input(component_id='dropdown', component_property= 'value')]) def graph_update(dropdown_value): print(dropdown_value) fig = go.Figure([go.Scatter(x = df['date'], y = df['{}'.format(dropdown_value)],\ line = dict(color = 'firebrick', width = 4)) ])
fig.update_layout(title = 'Stock prices over time',
xaxis_title = 'Dates',
yaxis_title = 'Prices'
)
return fig
if name == 'main': app.run_server()
Hello,
I just tried running your app in a clean virtual environment, and got a "ModuleNotFoundError: No module named 'plotly.io.json'".
Because this was a problem in imported packages, simply removing the version numbers solved the problem, but this is probably not the best long-term solution.
Below are working and frozen versions of
requirements.txt
. Please let me know if you want help in testing any updatedrequirements.txt
files.Sincerely,
-Chris Krenn
Working
requirements.txt
:Frozen
requirements.txt
: