Highcharts line 如何控制滚动条在右侧显示

chart = Highcharts.chart('container', {
    title: {
        text: '实时数据',
        style: { "fontSize": "0.9rem" }
    },
    chart: {
        type: 'line',
        zoomType: 'x',
        scrollablePlotArea: {
            scrollPositionX: 1
        }
    },
    xAxis: {
        categories: timesarr,
        min: 0,
        max: 5
        // ,scrollbar:{
        //     enabled:true   //是否显示滚动条 true 显示 false 隐藏
        // }
    },
    scrollbar: {
        enabled: true
    },
    yAxis: {
        scrollbar: {
            enabled: true,
            showFull: false
        }
    },
    plotOptions: {
        line: {
            dataLabels: {
                // 开启数据标签
                enabled: true
            },
            // 关闭鼠标跟踪,对应的提示框、点击事件会失效
            enableMouseTracking: true
        }
    },


    series: [{
        name: sbname,
        data: datasarr
        // dataLabels: {
        //   enabled: true,
        //   align: 'right',
        //   color: '#000000'
        // }
    }],
    responsive: {
        rules: [{
            condition: {
                maxWidth: 500
            }
            // ,chartOptions: {
            //    legend: {
            //        layout: 'horizontal',
            //        align: 'center',
            //        verticalAlign: 'bottom'
            //    }
            // }
        }]
    }
});

滚动本质上是调整 x 轴显示范围,对应的就是 x 轴的 min 和 max

也就是说如果想要滚动条默认展示在右侧,那么应该配置 max = dataMax, min = max - 视图范围,

例如:数据范围 0 ~ 10, min = 0, max = 4,则滚动条展示在最左侧,min = 5,max = 9, 则是展示在最右侧。

感谢解答!现在的问题是我这个曲线是每分钟加载一次,每加载一次就会在数组里存一个数据,就是一上来就一个数据,我的min写的0,max写的5,大于5才会出现滚动条,但是此时数据长度还是在增加的。这种的怎么办呢?