如何根据所选范围修复高图导航和步长

How to fix highchart navigation and step based on selected range?

本文关键字:导航 高图 何根 范围      更新时间:2023-09-26

有没有办法根据所选范围固定高图表导航持续时间和强制步长?

例如,如果选择了 1 天范围,则导航将每天踩踏

rangeSelector: {
    selected: 0,
    buttons: [ {
        type: "minute",
        count: 60,
        text: "1h"
    }, {
        type: 'day',
        count: 1,
        text: '1d'
    }, {
        type: 'all',
        text: 'All'
    }]
},
navigator: {
    xAxis: {
        tickWidth: 1,
        lineWidth: 1,
        gridLineWidth: 1,
        tickPixelInterval: 200,
        range: 113600000,
        labels: {
            align: 'left',
            style: {
                color: '#888'
            },
            x: 3,
            y: -4
        }
    }
}

JSFIDDLE 链接

我禁用了导航器并使用范围选择器来修复持续时间。

rangeSelector: {
            selected: 0,
            buttons: [ {
                type: "minute",
                count: 60,
                text: "1h"
            }, {
                type: "minute",
                count: 180,
                text: "3h"
            }, {
                type: "minute",
                count: 300,
                text: "5h"
            }]
},
navigator: {
  enabled: false
}