plotly / plotly/plotly.js

Table Unable to Become Invisible with 'updatemenus' Buttons

未关闭
#4,640 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug P3
主要语言
JavaScript
星标
18.3k
派生
2k
平均合并
2 天 12 小时
30 天内合并 PR
28

描述

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'}
      }
      ]

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从链接的 CodePen 和提供的 layout/updatemenus 配置开始;追踪 Chart 和 Table 按钮的 method: 'update' 调用及其 visible 数组。重现这两种转换,并确认选择 Chart 会移除表格并恢复图表布局。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
data-visualization, frontend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。