plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
16.94k stars 1.86k forks source link

Table Unable to Become Invisible with 'updatemenus' Buttons #4640

Open ryanaross opened 4 years ago

ryanaross commented 4 years ago

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'}
      }
      ]
Sednaoui commented 3 years ago

can confirm that I do have the same issue. I am using plotly.py in the same way and I would like to display tables and charts separately. Here's my python code.

Have you figured out a way? Or even a different approach? The closest solution is to display subplots, but that's not ideal if you are showing a lot of charts on a single page.

gvwilson commented 3 months ago

Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson

janyaswaller commented 2 months ago

Hey, I've got the same problem with version 2.32.0. The table cant be toggled so it is unvisible once it was visible.