如何默认选择图例中的一项,而取消选择其他项目?
我希望最初的情节看起来像这样:
#prepare thr chart
fig = px.line(df, x='date', y='diesel_price', color='region',
title='Diesel price in the US',
labels={'date':'Date',
'diesel_price':'Price ($)', 'region':'Region'})
app.layout = html.Div([
html.H4('Metrics for trucking companies'),
dcc.Graph(figure=fig),
])
if __name__ == '__main__':
app.run_server(debug=True, host='0.0.0.0', port=8050)
Run Code Online (Sandbox Code Playgroud)