你如何增加x轴标签区域的高度highchart.js图表​​上?(How do you increa

2019-09-19 07:51发布

我有highcharts.js创建一个简单的线图。 我有很多在x轴(30)的刻度线,所以设置错开2处理的标记水平彼此重叠。 然而,x轴刻度标记标签的下行正在由图表的末端切断。

不管我有多高使图表x轴刻度线的标签,下面一排被切断。 我怎样才能提高这一区域的高度,以解决这一问题? 或者是有一些其他的方法?

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

Answer 1:

只是碰到了marginBottom选项。 默认值是70,应该有充足的2行刻度标记的,你把它设置为25,是不是。



文章来源: How do you increase the height of the x-axis labels area on a highchart.js chart?