Sam
Sam

Reputation: 2065

highcharts scroll through axis

I am using a bar chart below.

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

my issue is when loads of data load in to the Y axis, chart is getting shrink. can i have a vertical scroll bar in to the highchart?

Thanks in advance and appreciate your help.

Upvotes: 0

Views: 17408

Answers (2)

Mariana Marica
Mariana Marica

Reputation: 141

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.

enter image description here

Upvotes: 0

Umi
Umi

Reputation: 108

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]
    }]
});

Upvotes: 5

Related Questions