本文介绍了将图表放在图表的最开始部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用highcharts来制作一些图形。在同一个highchart中有3个图形,但我的问题是,highchart从左边的一些填充开始,如下所示:

我希望它看起来像这样:(用photoshop编辑)





帮助请解答

解决方案

那个问题已经被问了好几次了(我不记得链接了),但是一般不用分类xAxis,但对特定标签格式化程序使用标准线性,例如:

  var categories = ['01 / 02/2012','01/03/2012','01 / 04 / 2012' , '01/05/2012', '01/06/2012', '01/07/2012']; 
$ b $ var chart2 = new Highcharts.Chart({
图表:{
renderTo:'container2'
},
xAxis:{
标签:{
formatter:function(){
return categories [this.value];
}
}
},

series :[{
data:[29.9,71.5,106.4,129.2,144.0,176.0]
}]
});

现在你可以玩弄 startOnTick minPadding 。对于分类坐标轴,这不可能改变空间分布 - 它总是平分在所有点之间。


I am using highcharts to make some graphics. There are 3 graphics inside the same highchart, but my problem is that the highchart start with some padding at the left, like this:

I want it to look like this: (Edited with photoshop)

Help please

解决方案

That question has been asked several times (I don't remember link), but in general don't use categorized xAxis, but use standard linear with specific label formatter, for example: http://jsfiddle.net/3bQne/266/

    var categories = ['01/02/2012','01/03/2012','01/04/2012','01/05/2012','01/06/2012','01/07/2012'];

var chart2 = new Highcharts.Chart({
    chart: {
        renderTo: 'container2'
    },
    xAxis: {
        labels: {
            formatter: function() {
                return categories[this.value];
            }
        }
    },

    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0]
    }]
});

Now you can play around with startOnTick and minPadding. For categorized axis this is not possible to change space distribution - it's always evenly divided between all points.

这篇关于将图表放在图表的最开始部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 00:23