Highcharts 从左侧的滚动条开始选择Highstock

Highcharts 从左侧的滚动条开始选择Highstock,highcharts,highstock,Highcharts,Highstock,我需要在我的Highstock图的左侧而不是右侧启动滚动条。有什么建议吗?我见过setExtremes选项,但我要么没有正确使用它,要么它不能满足我的需要。这是我到目前为止的图形代码 $(function() { $('#container').highcharts({ chart: { renderTo: 'container', defaultSeriesType: 'column' }, title: { text:

我需要在我的Highstock图的左侧而不是右侧启动滚动条。有什么建议吗?我见过setExtremes选项,但我要么没有正确使用它,要么它不能满足我的需要。这是我到目前为止的图形代码

$(function() {
$('#container').highcharts({

    chart: {
        renderTo: 'container',
        defaultSeriesType: 'column'
    },
    title: {
        text: 'Placed By Advisor'
    },
    xAxis: {
        categories: ['John Jenkins', 'Steve Smith', 'Will Douglas', 'Dustin Johnson', 'Suzy Abbott', 'Wendy Jones'],
        min: 2

    },
    yAxis: {
        min: 0
    },
    legend: {
        shadow: true
    },
    plotOptions: {
        column: {
            pointPadding: 0.2,
            borderWidth: 0.5
        }
    },
    series: [{
        name: 'Unemployed',
        data: [100, 100, 120, 55, 35, 189]},
    {
        name: 'Placed In Related',
        data: [80, 108, 15, 74, 48, 88]},
    {
        name: 'Placed In Unrelated',
        data: [17, 22, 187, 70, 75, 35]},
    {
        name: 'Except',
        data: [10, 0, 19, 65, 25, 174]}],

    scrollbar: {
        enabled:true,
        barBackgroundColor: 'lightgray',
        //barBorderRadius: 7,
        //barBorderWidth: 0,
        //buttonBackgroundColor: 'gray',
        //buttonBorderWidth: 0,
        //buttonArrowColor: 'yellow',
        //buttonBorderRadius: 0,
        //rifleColor: 'yellow',
        //trackBackgroundColor: 'red',
        //trackBorderWidth: 1,
        //trackBorderColor: 'silver',
        //trackBorderRadius: 7
    }
});

$('#button').click(function() {
    var chart = $('#container').highcharts();
    chart.xAxis[0].setExtremes(

    );
});
}))


以下是我到目前为止所拥有的内容。

您需要将
min
值设置为0,将
max
设置为任意值(如2)

$(function() {
$('#container').highcharts({

    chart: {
        renderTo: 'container',
        defaultSeriesType: 'column'
    },
    title: {
        text: 'Placed By Advisor'
    },
    xAxis: {
        categories: ['John Jenkins', 'Steve Smith', 'Will Douglas', 'Dustin Johnson', 'Suzy Abbott', 'Wendy Jones'],
        min: 2

    },
    yAxis: {
        min: 0
    },
    legend: {
        shadow: true
    },
    plotOptions: {
        column: {
            pointPadding: 0.2,
            borderWidth: 0.5
        }
    },
    series: [{
        name: 'Unemployed',
        data: [100, 100, 120, 55, 35, 189]},
    {
        name: 'Placed In Related',
        data: [80, 108, 15, 74, 48, 88]},
    {
        name: 'Placed In Unrelated',
        data: [17, 22, 187, 70, 75, 35]},
    {
        name: 'Except',
        data: [10, 0, 19, 65, 25, 174]}],

    scrollbar: {
        enabled:true,
        barBackgroundColor: 'lightgray',
        //barBorderRadius: 7,
        //barBorderWidth: 0,
        //buttonBackgroundColor: 'gray',
        //buttonBorderWidth: 0,
        //buttonArrowColor: 'yellow',
        //buttonBorderRadius: 0,
        //rifleColor: 'yellow',
        //trackBackgroundColor: 'red',
        //trackBorderWidth: 1,
        //trackBorderColor: 'silver',
        //trackBorderRadius: 7
    }
});

$('#button').click(function() {
    var chart = $('#container').highcharts();
    chart.xAxis[0].setExtremes(

    );
});

您可以将类别索引传递给
setExtremes
。例如: