Hello, currently i have a function returning to a children of an div, why clickData event is not working for me?
I want to get the cord where i clicked to save to another input
# プロット情報設定
fig.update_layout(
mapbox_style=mapbox_type,
clickmode='event+select',
mapbox=dict(
accesstoken=MAPBOX_ACCESS_TOKEN,
zoom=zoom,
center=center,
),
width=w,
height=h,
font_size=20,
margin={"r": 0, "t": 0, "l": 0, "b": 0}
)
@app.callback(
[Input('map-manage', 'clickData')])
def update_map_click(clickData):
if clickData is not None:
point = clickData['points'][0]
lat = point['lat']
lon = point['lon']
name = point.get('name', 'Unknown')
print(f"Clicked on point: {name} at ({lat}, {lon})")
# 表示生成
result = [html.Div([
dcc.Graph(
id='map-manage',
figure=fig,
config={'displayModeBar': False}
),
],
style={
'display': 'inline-block',
'margin-left': '10px',
'margin-top': '10px',
})]
return result