将预选值(例如boxSelect)加载到破折号模式栏中

时间:2019-12-02 20:07:57

标签: python plotly plotly-dash

我正在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,
  },
)

1 个答案:

答案 0 :(得分:0)

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

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

Reference documentation