How to prevent splitting of Highcharts categories?

If the space is too tight, the axis labels are truncated. I am dealing with variable categories, so I would prefer that they overlap rather than disappear.

Example: http://jsfiddle.net/z1axtk31/

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'bar'
        },
        title: {
            text: 'Historic World Population by Region'
        },
        subtitle: {
            text: 'Source: Wikipedia.org'
        },
        xAxis: {
            categories: ['Sub-saharan Africa', 'North America', 'South America', 'East Asia', 'Middle East', 'Europe', 'Oceania', 'Ancapistan', 'North Africa', 'Mordor', 'Atlantis'],
            title: {
                text: null
            }
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Population (millions)',
                align: 'high'
            },
            labels: {
                overflow: 'justify'
            }
        },
        tooltip: {
            valueSuffix: ' millions'
        },
        plotOptions: {
            bar: {
                dataLabels: {
                    enabled: true
                }
            }
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'top',
            x: -40,
            y: 100,
            floating: true,
            borderWidth: 1,
            backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
            shadow: true
        },
        credits: {
            enabled: false
        },
        series: [{
            name: 'Year 1800',
            data: [107, 31, 635, 203, 2, 45, 23, 201, 50, 89, 210]
        }/*, {
            name: 'Year 1900',
            data: [133, 156, 947, 408, 6, 45, 23, 166, 50, 20, 110]
        }, {
            name: 'Year 2008',
            data: [973, 914, 4054, 732, 34, 45, 23, 20, 50, 133, 100]
        }*/]
    });
});

      

+3


source to share


1 answer


Just install:

xAxis: {
    labels: {
        step: 1
    }
}

      



Example

+4


source







All Articles