【问题标题】:plotly rangeslider how to restore the limit bar on the sliderplotly rangeslider 如何恢复滑块上的限制栏
【发布时间】:2016-05-18 17:11:22
【问题描述】:

我有一个带有滑动限制的范围滑块,我需要重新绘制滑块 像这样的灰色部分。 rangeslider example

如果我从布局中保存范围值并恢复它,它会影响 xaxis 范围为顶部和底部,所以它是不正确的。也许 限制范围之类的?

【问题讨论】:

    标签: javascript plotly rangeslider


    【解决方案1】:

    这是最近在v1.10.0 版本中添加的一项功能(特别是this PR。

    如果您想在范围滑块上设置最初选择的范围,您可以在 layout 对象中使用此语法:

    {
      xaxis: {
        range: [20, 30] // this is the range the *selected area* of the slider spans
        rangeslider: {
          range: [0, 100] // this is the range the *entire* slider spans
        }
      }
    }
    

    默认情况下,范围滑块将跨越整个数据范围,但是通过指定 rangeslider.range,您可以限制此范围。我们想让界面熟悉“常规”范围,因此xaxis.range 仍将设置可见的绘图范围,并且滑块将相应地运行。

    例如,this mock data 创建 this image,这些目录中还有一些其他示例也使用范围滑块。

    【讨论】:

    • 在使用答案创建绘图时,我能够为 xaxis 和 axis.rangeslider.range 设置范围有限的范围滑块。现在我想用不同的子范围重置范围滑块。是 Plotly.relayout(plot,update)
    • 使用正确的命令?我尝试使用新的 xaxis 结构进行更新。
    猜你喜欢
    • 2020-03-12
    • 1970-01-01
    • 1970-01-01
    • 2017-04-19
    • 1970-01-01
    • 2021-02-22
    • 2013-10-12
    • 2017-03-14
    • 2011-11-21
    相关资源
    最近更新 更多