简体   繁体   中英

Highcharts Omits X Axis Label

I have a demo of the problem chart available here .

Here is the code that I am using to generate the highchart. When the chart renders, it cuts off option2 of the x axis label? What would be causing this?

I'm not using the step parameter, so there shouldn't be any reason to skip the label... It renders find with the mouseover event to display the category name when you hover over the bar, but it won't display the category name next to the bar.

Any advice is appreciated.

$(function () {
    prchart3 = new Highcharts.Chart({
        chart: {
            renderTo: 'prcont23',
            type: 'bar',
            width: 300,
            height: 180
        },
        title: {
            text: 'Test results'
        },
        xAxis: {
            categories: ['option1', 'option2', 'opt3'],
            title: {
                text: null
            }
        },
        yAxis: {
            min: 0,
            title: {
                text: '0 Total Votes',
                align: 'high'
            },
            labels: {
                overflow: 'justify'
            }
        },
        plotOptions: {
            bar: {
                dataLabels: {
                    enabled: true
                }
            }
        },

        legend: {
            enabled: false
        },
        exporting: {
            enabled: false
        },
        credits: {
            enabled: false
        },
        series: [{
            name: 'vote test',
            data: [20, 50, 1000]
        }]
    });
});

The problem is here:

height: 180

I can reproduce your issues on Chrome, and I fixed it by either removing "height: 180" or assigning a bigger value, so I think your label are hidden because of insufficient height. If you have 4 points, then the 2nd and 3rd will get hidden with that height.

It's known bug of 3.0.7 version for Highcharts. Already resolved on master branch: http://jsfiddle.net/DNREz/1/

Master taken from:

<script src="http://github.highcharts.com/master/highcharts.js"></script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM