最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Column spacing in Highcharts - Stack Overflow

programmeradmin1浏览0评论

I am working with Highcharts and have e across a little problem that I am struggling to overe.

I have created a jsfiddle so you can see my issue:

/

And here is the code I am using:

$('#output-chart').highcharts({
        chart: { type: 'column' },
        title: { text: null },
        xAxis: { categories: ['Column 1', 'Column 2', 'Column 3', 'Column 4'] },
        yAxis: { allowDecimals: false, min: 0, labels: { format: '£{value}' }, title: { text: ''} },
        plotOptions: { column: { stacking: 'normal'}, series: { pointWidth: 50, pointPadding: 0, groupPadding: 0} },
        series: [{
            name: 'Product 1 Element 1',
            data: [0, 100 - 125, 100 - 150, 100 - 175],
            stack: 'Item1'                
        }, {
            name: 'Product 1 Element 2',
            data: [100, 125, 150, 175],
            stack: 'Item1'                          
        }, {
            name: 'Product 2 Element 1',
            data: [0, 100 - 125, 100 - 150, 100 - 175],
            stack: 'Item2'                            
        }, {
            name: 'Product 2 Element 2',
            data: [100, 125, 150, 175],
            stack: 'Item2'                    
        }]
    });

So, there are two bars in each column and I want to put those two bars right against each other but still have a gap between the columns.

I hope that makes sense!

Any help would be very much appreciated.

Many thanks

G.

I am working with Highcharts and have e across a little problem that I am struggling to overe.

I have created a jsfiddle so you can see my issue:

http://jsfiddle/gokninski/qkBsA/

And here is the code I am using:

$('#output-chart').highcharts({
        chart: { type: 'column' },
        title: { text: null },
        xAxis: { categories: ['Column 1', 'Column 2', 'Column 3', 'Column 4'] },
        yAxis: { allowDecimals: false, min: 0, labels: { format: '£{value}' }, title: { text: ''} },
        plotOptions: { column: { stacking: 'normal'}, series: { pointWidth: 50, pointPadding: 0, groupPadding: 0} },
        series: [{
            name: 'Product 1 Element 1',
            data: [0, 100 - 125, 100 - 150, 100 - 175],
            stack: 'Item1'                
        }, {
            name: 'Product 1 Element 2',
            data: [100, 125, 150, 175],
            stack: 'Item1'                          
        }, {
            name: 'Product 2 Element 1',
            data: [0, 100 - 125, 100 - 150, 100 - 175],
            stack: 'Item2'                            
        }, {
            name: 'Product 2 Element 2',
            data: [100, 125, 150, 175],
            stack: 'Item2'                    
        }]
    });

So, there are two bars in each column and I want to put those two bars right against each other but still have a gap between the columns.

I hope that makes sense!

Any help would be very much appreciated.

Many thanks

G.

Share asked Aug 22, 2013 at 9:50 gok-ninegok-nine 3034 silver badges15 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

If you want to have to bars together, but also have padding between pair of them you need to set only pointPadding and don't change pointWidth. See: http://jsfiddle/Fusher/FpKjQ/16/

you can use groupPadding: 0.1 then it will e much closer.

发布评论

评论列表(0)

  1. 暂无评论