I am trying to put labels on the y-Achse on my Dash-Code but it is not working, according to some example code I found online.
My code:
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import plotly.graph_objs as go
arrayValues = ['28.687', '29.687', '24.687', '21.687', '25.687', '28.687']
app = dash.Dash()
app.layout = html.Div([
html.H1('Title'),
dcc.Dropdown(
id='my-dropdown',
options=[
{'label': 'Fruit', 'value': 'FRUIT'}
# {'label': 'Tesla', 'value': 'TSLA'},
# {'label': 'Apple', 'value': 'AAPL'}
],
value='TEMPERATUR'
),
dcc.Slider(
min=-5,
max=10,
step=0.5,
value=-3,
),
dcc.Graph(id='my-graph', animate=True),
])
@app.callback(Output('my-graph', 'figure'), [Input('my-dropdown', 'value')])
def update_graph(selected_dropdown_value):
return {
'data': [
{'y': arrayValues} #Important part
]
}
if __name__ == '__main__':
app.run_server(
)
I have tried adding 'name' = 'somename' or name = 'somename', but it is not working, eventhough it should work.
Example:
{'y': arrayValues, 'name' = 'somename'} #Important part
I don't get any error or sth, it just doesn't show any results.