Highcharts - 为什么在第一列之前和最后一列之后有额外的间距? [英] Highcharts - Why is there extra spacing before the first column and after the last column?

查看:76
本文介绍了Highcharts - 为什么在第一列之前和最后一列之后有额外的间距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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 参数



http://jsfiddle.net/ PRKAJ / 37 /



编辑:你应该定义 pointRange



http://jsfiddle.net/PRKAJ/41/



http://api.highcharts.com /highcharts#plotOptions.series.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

http://jsfiddle.net/PRKAJ/37/

EDIT: You should define pointRange

http://jsfiddle.net/PRKAJ/41/

http://api.highcharts.com/highcharts#plotOptions.series.pointRange

这篇关于Highcharts - 为什么在第一列之前和最后一列之后有额外的间距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆