无法更改默认范围选择器Highstock

时间:2017-07-14 09:18:06

标签: highcharts highstock

我正在尝试将5M作为我的默认范围选择器,但它似乎一直在坚持所有'在选择器上。

   rangeSelector: {
            enabled: true,
            buttons: [{
                    count: 2,
                    type: 'minute',
                    text: '2M'
                }, {
                    count: 5,
                    type: 'minute',
                    text: '5M'
                }, {
                    count: 15,
                    type: 'minute',
                    text: '15M'
                }, {
                    count: 30,
                    type: 'minute',
                    text: '30M'
                }, {
                    count: 3,
                    type: 'hour',
                    text: '3H'
                }, {
                    count: 1,
                    type: 'day',
                    text: '1D'
                }, {
                    count: 30,
                    type: 'day',
                    text: '30D'
                }, {
                    type: 'all',
                    text: 'All'
                }],
            selected: 5,
        },

有人能告诉我我的代码出错了吗? 感谢您的帮助。

1 个答案:

答案 0 :(得分:2)

我通过添加 allButtonsEnabled:true 并更改所选内容来解决我的问题: 1 。我刚才有点困惑

   rangeSelector: {
            enabled: true,
            allButtonsEnabled: true,
            buttons: [{
                    count: 2,
                    type: 'minute',
                    text: '2M'
                }, {
                    count: 5,
                    type: 'minute',
                    text: '5M'
                }, {
                    count: 15,
                    type: 'minute',
                    text: '15M'
                }, {
                    count: 30,
                    type: 'minute',
                    text: '30M'
                }, {
                    count: 3,
                    type: 'hour',
                    text: '3H'
                }, {
                    count: 1,
                    type: 'day',
                    text: '1D'
                }, {
                    count: 30,
                    type: 'day',
                    text: '30D'
                }, {
                    type: 'all',
                    text: 'All'
                }],
            selected: 1,
        },