admin管理员组文章数量:1406913
I have a Highcharts column chart that I want to be super minimal. Just the bars, no padding, no title, no labels, etc.
I've tried several settings with the api, however I can't seem to get rid of a aproximately 15px padding on the left and right sides of the graph I have built.
My chart settings are as follows:
chart: {
backgroundColor: 'transparent',
borderWidth: 0,
plotBackgroundColor: 'transparent',
plotShadow: false,
plotBorderWidth: 0,
margin: 0,
padding: 0,
spacing: [0, 0, 0, 0]
}
I thought the spacing
set to 0
would have fixed the issue however it hasn't.
I have opened a fiddle here: /
I have a Highcharts column chart that I want to be super minimal. Just the bars, no padding, no title, no labels, etc.
I've tried several settings with the api, however I can't seem to get rid of a aproximately 15px padding on the left and right sides of the graph I have built.
My chart settings are as follows:
chart: {
backgroundColor: 'transparent',
borderWidth: 0,
plotBackgroundColor: 'transparent',
plotShadow: false,
plotBorderWidth: 0,
margin: 0,
padding: 0,
spacing: [0, 0, 0, 0]
}
I thought the spacing
set to 0
would have fixed the issue however it hasn't.
I have opened a fiddle here: http://jsfiddle/kMVB5/16/
Share Improve this question asked May 27, 2014 at 20:02 NeilNeil 2,5197 gold badges34 silver badges47 bronze badges4 Answers
Reset to default 3Simply set minPadding
and maxPadding
to 0. See: http://jsfiddle/kMVB5/26/
xAxis: {
gridLineColor: 'transparent',
gridLineWidth: 0,
lineColor: 'transparent',
lineWidth: 0,
labels: {
enabled: false
},
title: {
enabled: false
},
tickWidth: 0,
minPadding: 0,
maxPadding: 0
},
This will help to remove all left and right empty spaces.
plotOptions: {
series: {
groupPadding: 0
}
}
Check this jsfiddle
In the xAxis section, within setOptions, you can add the element:
min: data[0]
That will set the minimum value in the xAxis to be the first element of your data array. You can take a look here
Hope it helps!
EDIT: Actually, that brings some issues. A better approach is to set min to 0 and max to data.length, with the pointInterval set to 1, like this
Regards
according to the fiddle you provide, I find a way to erase the 15px padding: in your css you have a
div {
text-align: center;
padding: 15px;
}
in the .graph-wapper class, just delete padding: 15px and it will be fixed.
Be careful this may cause other issues.
本文标签: javascriptHighcharts Remove padding around column chartStack Overflow
版权声明:本文标题:javascript - Highcharts: Remove padding around column chart - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744986195a2636106.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论