gpt4 book ai didi

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

转载 作者:数据小太阳 更新时间:2023-10-29 05:08:27 26 4
gpt4 key购买 nike

我有一个由 highcharts.js 创建的简单折线图。我在 x 轴 (30) 上有很多刻度线,所以我将 stagger 设置为 2 来处理水平相互重叠的标记。然而,x 轴刻度标签的下一行在图表末尾被 chop 。

无论我将图表制作多高,x 轴刻度标记标签的下一行都会被 chop 。我怎样才能增加这个区域的高度来解决这个问题?还是有其他方法?

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 而不是。

关于javascript - 如何增加 highchart.js 图表上 x 轴标签区域的高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11421748/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com