问题描述
我有一个Highcharts datetime柱形图,其中包含几个动态添加和更新的系列。看来该库正在生成第一列之前和最后一列之后有大块空间的图表。就好像列被分组到图表的中心,而它们应该在整个空间中均匀排列。我已经尝试调整轴选项的minPadding和maxPadding但没有成功:
xAxis:{
type:' datetime',
minPadding:0,
maxPadding:0,
labels:{
formatter:function(){
return Highcharts.dateFormat('%b%e ',this.value);
}
}
},
这是一个适应的例子来自Highcharts演示页面的行为正确:
谢谢。
你可以修改 pointWidth
和 groupPadding / pointPadding
参数
编辑:你应该定义 pointRange
I have a Highcharts datetime column chart, with several series that which are added and updated dynamically. It appears that the library is producing the chart with a large chunk of space before the first column and after the last column. It's as if the columns are grouped into the center of the chart, while they should be arranged evenly across the space. I have tried adjusting the minPadding and maxPadding of the axis options with no success:
xAxis: {
type: 'datetime',
minPadding: 0,
maxPadding: 0,
labels:{
formatter:function () {
return Highcharts.dateFormat('%b %e', this.value);
}
}
},
Here is an example adapted from the Highcharts demo page which is behaving correctly:
http://jsfiddle.net/ricksuggs/8Gt2y/
While this example which is written by myself, is showing the extra padding:
http://jsfiddle.net/ricksuggs/PRKAJ/36/
Thank you.
You can modify pointWidth
and groupPadding/pointPadding
parameter
EDIT: You should define pointRange
http://api.highcharts.com/highcharts#plotOptions.series.pointRange
这篇关于Highcharts - 为什么在第一列之前和最后一列之后有额外的间距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!