disable default selection of button in range selector buttons
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 18.3k
- 派生
- 2k
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 28
描述
Hello all,
Right now, enabling the use of buttons in layout.xaxis.rangeselector makes it such that the button 'all' is always selected by default, no matter where it is positioned in the list of buttons. If the button 'all' is not present, the display is still rendered as if it was selected by default.
May we add a default (boolean) property inside a button to know which should be selected by default when first displaying the graph ? This could help to focus on a key point of the data, while allowing the user to zoom out by clicking the 'all' button or by double-clicking on the graph.
This property would be set to false by default, and if no buttons show a true value for this property, then the usual 'all' display shall be rendered.
Example :
Usual display
var layout = {
xaxis: {
autorange: true,
rangeselector: {
buttons: [
{
count: 1,
label: '1m',
step: 'month',
stepmode: 'backward'
},
{
count: 6,
label: '6m',
step: 'month',
stepmode: 'backward'
},
{
step: 'all'
}
]
},
rangeslider: {autorange: true},
type: 'date'
}
};
In the second case, when loading the page, we already have the 6 months zoom.
6 months button selected by default
var layout = {
xaxis: {
autorange: true,
rangeselector: {
buttons: [
{
count: 1,
label: '1m',
step: 'month',
stepmode: 'backward'
},
{
count: 6,
label: '6m',
step: 'month',
stepmode: 'backward',
default: true
},
{
step: 'all'
}
]
},
rangeslider: {autorange: true},
type: 'date'
}
};
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 issue 中描述的 xaxis.rangeselector 按钮处理开始,跟踪初始选定范围的选择方式。当带有 default: true 的按钮控制初始范围,同时在没有按钮被标记为默认时保留现有的“all”行为作为 fallback 时,工作即完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- data-visualization
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100