【发布时间】:2018-05-06 11:17:50
【问题描述】:
我正在尝试使用 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
【问题讨论】:
标签: highcharts bar-chart react-highcharts