javascript – 如何在highchart.js图表​​上增加x轴标签区域的高度?

前端之家收集整理的这篇文章主要介绍了javascript – 如何在highchart.js图表​​上增加x轴标签区域的高度?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个由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; ?>]
}]
        });

解决方法

只需提高 marginBottom选项即可.默认值为70,对于2行刻度标签应该足够多,你将它设置为25而不是.
原文链接:https://www.f2er.com/js/150449.html

猜你在找的JavaScript相关文章