简体   繁体   中英

How do you increase the height of the x-axis labels area on a highchart.js chart?

I have a simple line graph created by highcharts.js. I have a lot of tick marks in the x-axis (30), so I set stagger to 2 deal with the marks overlapping each other horizontally. However, the lower row of x-axis tick labels is being cut off by the end of the chart.

No matter how tall I make the chart the lower row of x-axis tick mark labels is cut off. How can I increase the height of this area to fix this? Or is there some other method?

month_chart = new Highcharts.Chart({
chart: {
    borderRadius: 0,
    height: chart_height,
    marginRight: 30,
    marginBottom: 25,
    renderTo: 'leads-by-month',
    type: 'line',
},
title: {
    text: 'Past 30 Days',
},
xAxis: {
    categories: [<?php print $bymonth_categories; ?>],
    labels: {
        staggerLines: 2,
    },
},
yAxis: {
    title: {
        text: 'Leads',
        style: {color: '#3d3e41', }
    },
    plotLines: [{
        value: 0,
        width: 1,
        color: '#808080'
    }],
    min: 0,
},
plotOptions: {
    line: {
        color: '#578df1',
        dataLabels: {
            enabled: true,
            color: '#3d3e41',
        },
        enableMouseTracking: false
    }
},
legend: {
    layout: 'vertical',
    align: 'right',
    verticalAlign: 'top',
    x: -100,
    y: 74,
    floating: true,
    borderWidth: 1,
    backgroundColor: '#FFFFFF',
    shadow: true
},
series: [{
    name: '<?php print $organization['name']; ?>',
    data: [<?php print $bymonth_data; ?>]
}]
        });

Just bump up the marginBottom option. The default is 70 which should be plenty for 2 rows of tick labels, you've set it to 25 which is not.

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