在破折号中加载带有预选值(例如框选择)的绘图模式栏



我正在dash创建一个绘图图,并尝试创建具有预选操作值的模式栏boxSelect.加载图形时,模式栏中没有预选值。

这是我的代码:

dcc.Graph(
id='scatter',
className="chart-graph",
config={
"modeBarButtonsToRemove": ['toImage', 'zoom2d', 'zoomIn', 'zoomOut','autoScale2d','toggleSpikelines','hoverCompareCartesian', 'hoverClosestCartesian'],
# This is the line of code I'm hoping initializes things, but it does not work...
"select2d": True,
},
)

知道了!配置layout时,添加以下参数:

layout = go.Layout(
# ...
clickmode='event+select',
dragmode = 'lasso',
)

参考文档。

最新更新