Dash와 Plotly로 대시보드 만들기
Alex Scriven
Data Scientist
$$
$$
# 그림과 레이아웃 생성 dcc.Graph(id='bar_fig', figure=ecom_bar),html.Br(), html.H2("The Hover Data:"), html.P(id='text_output')
$$
# 콜백 설정 @callback( Output('text_output', 'children'), Input('bar_fig', 'hoverData'))def capture_hover_data(hoverData): return str(hoverData)
동작:
hoverData가 변경됩니다.P() 태그에 반환합니다
hoverData에 있음
ecom_scatter = px.scatter(ecom_data,
x='Total Sales ($)',
y='Sales Volume', color='Country',
custom_data=['Country'])
customData에 국가가 포함됩니다!
clickData 속성)@callback(
Output('text_output', 'children'),
Input('bar_fig', 'clickData'))
def capture_hover_data(clickData):
return str(clickData)

Dash와 Plotly로 대시보드 만들기