Access Plotly config dictionary

Hi all,

It looks like the plot component allows us to set the data and layout dictionaries for Plotly. Is there a way to access the config dictionary as well? (This dictionary is required to do things like disable scroll-zoom, hide the mode-bar, or customize the buttons on the mode-bar.)

It looks like I can access the config dictionary through Javascript, but this is not ideal. Here’s an example that will remove some mode-bar buttons and disable scroll-to-zoom:

Plotly.plot(
  document.getElementsByClassName('js-plotly-plot')[0], [], [], 
  {
    "scrollZoom": false,
    "displaylogo": false,
    "modeBarButtonsToRemove": ["sendDataToCloud", "hoverCompareCartesian", "toImage", "hoverClosestGeo",]
  }
)

Is there a way to do this from Anvil without using call_js?

Thanks,
AJ

1 Like

Using the JS API is currently the way to do this - thanks for the example!

Moving to Feature Requests.

This feature request is technically completed with the move to Plotly v4 as the config dict is now accessible.

1 Like