highcharts scroll through axis

前端 未结 2 1592
谎友^
谎友^ 2020-12-03 20:26

I am using a bar chart below.

chart = new Highcharts.Chart({
            chart: {
                renderTo: \'container\',
                defaultSeriesType:         


        
相关标签:
2条回答
  • 2020-12-03 21:12

    This is fiddle link showing how to enable scroll bars in highcharts:

    How to enable scroolbars in highcharts

    var chart = new Highcharts.Chart({
    
        chart: {
            renderTo: 'container'
        },
    
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
            min: 6
        },
    
        legend: {
            verticalAlign: 'top',
            y: 100,
            align: 'right'
        },
    
        scrollbar: {
            enabled: true
        },
    
        series: [{
            data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
        }]
    });
    
    0 讨论(0)
  • 2020-12-03 21:20

    At the time of this answer, scrollbar can be added via highstock js. For those who want to implement a scrollbar without using highstock, I managed to implement an elegant and simple scrollbar solution to my column chart, using only highcharts js, without highstock, as follows:

    chart: {
       type: 'column',
       scrollablePlotArea: {
       minWidth: {{ count($period_interval_categories) * 70}},
            // nr of interval data x (40 + 30) where 40 are column width pixels and
            // 30 is additional distancing between columns;
            // Increase spacing pixels if needed
       scrollPositionX: 1
       }
    },
    plotOptions: {
       column: {
           stacking: 'normal',
           pointWidth: 40, // column width in pixels
           dataLabels: {
               // enabled: true
           }
        }
    },
    

    where $period_interval_categories represents in my chart the period on x axis consisting of days, weeks, months, etc.

    0 讨论(0)
提交回复
热议问题