Skip to content

Some configuration changes aren't reflected during calls to Plotly.react #7551

@camdecoster

Description

@camdecoster

Description

Some configuration changes aren't reflected during calls to Plotly.react. This includes mode bar button title changes, icons, etc. Toggling display of the logo (among other config options) seems to force a full update that reflects all the config changes. This is discussed a bit here in #6394.

Steps to reproduce

  • Be on master
  • Launch Plotly DevTools
  • Open mock line_scatter (other mocks could work, but I know this one does)
  • Run the following snippet to update the mode bar buttons:
    let toggle = true
    
    Plotly.react(
      gd,
      gd.data,
      gd.layout,
      {
        displaylogo: false,
        modeBarButtonsToAdd: [
          {
            name: 'custombutton',
            title: toggle ? 'Take PICTURE' : 'Record MOVIE',
            icon: toggle ? Plotly.Icons.camera : Plotly.Icons.movie,
            click: () => {}
          },
        ],
        modeBarButtonsToRemove: [
          "autoscale",
          "pan2d",
          "lasso2d",
          "resetScale2d",
          "select2d",
          "toImage",
          "zoom",
          "zoomIn2d",
          "zoomOut2d"
        ]
      }
    )
  • Run this other snippet to update the label of the custom button:
    toggle = false
    
    Plotly.react(
      gd,
      gd.data,
      gd.layout,
      {
        displaylogo: false,
        modeBarButtonsToAdd: [
          {
            name: 'custombutton',
            title: toggle ? 'Take PICTURE' : 'Record MOVIE',
            icon: toggle ? Plotly.Icons.camera : Plotly.Icons.movie,
            click: () => {}
          },
        ],
        modeBarButtonsToRemove: [
          "autoscale",
          "pan2d",
          "lasso2d",
          "resetScale2d",
          "select2d",
          "toImage",
          "zoom",
          "zoomIn2d",
          "zoomOut2d"
        ]
      }
    )
  • Note that the button title and icon have not updated

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions