我正在尝试使用 HighCharts 制作一个简单的条形图。
我想删除栏之间的空间。我的研究使我相信这些属性groundPadding
和pointPadding
对这个空间负责。但是将两者都设置为0
并没有改变任何东西。
const config = {
chart: {
type: 'bar',
spacingTop: 0,
spacingRight: 0,
spacingBottom: 0,
spacingLeft: 0,
// marginTop: 0,
// marginRight: 0,
// marginBottom: 0,
// marginLeft: 0
},
title: {
text: null
},
legend: {
enabled: false
},
credits: {
text: ''
},
xAxis: {
categories: options.map(option => option.option),
// lineWidth: 0,
// tickWidth: 0,
},
yAxis: {
title: {
enabled: false,
},
gridLineWidth: 0,
tickAmount: 0,
showFirstLabel: false,
showLastLabel: false
},
series: [{
data: options.map(option => option.votes)
}],
plotOptions: {
bar: {
dataLabels: {
enabled: true
}
},
series: {
pointWidth: 20,
groundPadding: 0,
pointPadding: 0
}
}
};
有任何想法吗?
编辑:
不确定是否相关,但div
我图表的红色是:
<div style={{ width: '100%', height: '100%', margin: 'auto', border: '2px solid red' }}>
<ReactHighCharts config={config}></ReactHighCharts>
</div>
果岭div
有尺寸:width: 350px
和height: 400px