基于用户选择的颜色特定区域
Color specific region based on user selection
在documetation中调用go.choropleth建图时有属性selected
。我想问一下有没有人知道这是干什么用的?
因为目前我有一张法国地区的地图。我希望当用户点击特定区域时,该区域应该用浅蓝色阴影。
我正在寻找 clickmode='event+select'
这样的:
fig = px.choropleth(df1, geojson=jdataNo, color="winner",
locations="district", featureidkey="properties.NAME_1",
projection="gnomonic", color_discrete_sequence=['red','green','blue']
)
fig.update_geos(fitbounds="locations", visible=False)
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0},clickmode='event+select')
fig.show()
在 Dash 中,我可以使用 clickData 来读取哪个区域被点击,正如 @r-beginners.
所建议的
在documetation中调用go.choropleth建图时有属性selected
。我想问一下有没有人知道这是干什么用的?
因为目前我有一张法国地区的地图。我希望当用户点击特定区域时,该区域应该用浅蓝色阴影。
我正在寻找 clickmode='event+select'
这样的:
fig = px.choropleth(df1, geojson=jdataNo, color="winner",
locations="district", featureidkey="properties.NAME_1",
projection="gnomonic", color_discrete_sequence=['red','green','blue']
)
fig.update_geos(fitbounds="locations", visible=False)
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0},clickmode='event+select')
fig.show()
在 Dash 中,我可以使用 clickData 来读取哪个区域被点击,正如 @r-beginners.
所建议的