I'm trying to make a simple bar chart using HighCharts.
I'd like to remove the space in between the bars. My research led me to believe that the properties groundPadding
and pointPadding
were responsible for this space. But setting both to 0
did not change anything.
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
}
}
};
Any ideas?
EDIT:
Not sure if relevant, but the red div
wrapping my chart is:
<div style={{ width: '100%', height: '100%', margin: 'auto', border: '2px solid red' }}>
<ReactHighCharts config={config}></ReactHighCharts>
</div>
And the green div
has dimensions: width: 350px
and height: 400px