Nadav
Nadav

Reputation: 357

trying to use highchart xrange to display large number of categories

I'm trying to use highcharts xrange to display a large number of categories (>20). currently, I can show the data, but the categories are automatically resized so that they fit the height of the chart

What the client wants is to a. configure the height of the categories to absolute size b. display a vertical scrollbar

Is this possible?

Thanks, Nadav

Upvotes: 0

Views: 558

Answers (1)

ppotaczek
ppotaczek

Reputation: 39069

You can use scrollablePlotArea and dynamically calculate the minHeight property. For example:

chart: {
    events: {
        load: function(){
            var categoryWidth = 50,
                points = this.series[0].points;
            
            this.update({
                chart: {
                    scrollablePlotArea: {
                        minHeight: this.chartHeight - this.plotHeight + categoryWidth * points.length
                    }
                }
            }, true, true, false);
        }
    },
}

Live demo: http://jsfiddle.net/BlackLabel/5qp7rv1j/

API Reference:

https://api.highcharts.com/highcharts/chart.scrollablePlotArea

https://api.highcharts.com/class-reference/Highcharts.Chart#update

Upvotes: 1

Related Questions