我有一个固定宽度和固定条宽的柱形图。当数据较少时,条形之间的空间会增加。我想减少空间,我不介意条形图是从图表的开头还是中间显示,但应该减小条形的空间。10px 的空间看起来不错。任何帮助深表感谢。这是一个演示 -
Highcharts.chart('container', {
chart: {
type: 'column',
width:1200
},
title: {
text: 'Monthly Average Rainfall'
},
subtitle: {
text: 'Source: WorldClimate.com'
},
xAxis: {
categories: [
'Jan',
'Feb'
],
crosshair: true
},
yAxis: {
min: 0,
title: {
text: 'Rainfall (mm)'
}
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
column: {
pointWidth:30
}
},
series: [{
name: 'Tokyo',
data: [49.9, 71.5]
}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>