plotly / plotly/plotly.js

Table Unable to Become Invisible with 'updatemenus' Buttons

Open
#4,640 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
JavaScript
Stars
18.3k
Forks
2k
Avg merge
2d 12h
Merged PRs (30d)
28

Description

I love plotly.js, such a fantastic library. I have very little javascript knowledge and yet have accomplished quite a lot. Unfortunately, I have run into a problem with the layout/updatemenus buttons. I am trying to create a set of buttons that would allow a user to switch from a "Chart" mode to a "Table" mode. When the user clicks "Table", it successfully displays the table, as you can see from the included codepen. Unfortunately, once the table is set to visible, it will never leave the screen, no matter what you select. The table continues to obscure the chart after you select "Chart".

https://codepen.io/rar83/pen/OJVvXWW

If this is indeed a bug, could someone possibly point out an alternative way of doing this? Or it is quite possible I am just using the plotly.js badly.

I have included a portion of the relevant code to show how I am turning on/off visibility, just as the documentation shows.

      var updatemenus=[
      {
          buttons: [
              {
                  args: [{'visible': [true, true, true, true, false]},{'xaxis.visible': true, 'yaxis.visible': true, 'autosize': true}],
                  label: 'Chart',
                  method: 'update'
              },
              {
                  args: [{'visible': [false, false, false, false, true]},{'xaxis.visible': false, 'yaxis.visible': false, 'autosize': false, 'width': 500}],
                  label: 'Table',
                  method:'update'
              }
          ],
          direction: 'left',
          pad: {'r': 5, 't': 5},
          showactive: true,
          type: 'buttons',
          x: 0.01,
          xanchor: 'left',
          y: 1.1,
          yanchor: 'middle',
          font: {size: '30'}
      }
      ]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with the linked CodePen and the supplied layout/updatemenus configuration; trace the method: 'update' calls and their visible arrays for the Chart and Table buttons. Reproduce both transitions and confirm that selecting Chart removes the table and restores the chart layout.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.