Aakash Chauhan
Aakash Chauhan

Reputation: 338

How to customize both, width of the bar & spacing between bar in Highcharts.js

I want to make something like this

enter image description here

here goes my sample code :-

           plotOptions: {
                series: {
                    borderWidth: 0,
                    pointWidth: 80,
                    groupPadding: 4,
                    dataLabels: {
                        enabled: true,
                        format: '{point.y:.1f}%',
                    }
                }
            },

i am confused between pointWidh & groupPadding property, only one property woks at a time. when give only pointWidth, width applies, and when groupPadding only, it also applies. but i want these property doesn't apply at the same time. what am i doing wrong here's the reproduce example https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/column-pointpadding-025/

Upvotes: 2

Views: 344

Answers (1)

Siraj Alam
Siraj Alam

Reputation: 10025

I have written the complete working code, let me know if something is unclear.

Highcharts.chart('container', {
    chart: {
        type: 'column'
    },
    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

    plotOptions: {
        series: {
            pointPadding: 0,
            borderRadius: 8,
            pointWidth: 50
        }
    },

    series: [{
    data: [{y: 29.9, color: '#ff7841'}, {y: 71.5, color: '#ffa03c'}, {y: 106.4, color: '#ffbb39'}, {y: 129.2, color: '#b0bf05'}, {y:144.0, color: '#00bcb9'}, {y: 176.0, color: '#05a7cd'}, {y: 135.6, color: '#4d7ed7'}]
    }]
});
<script src="https://code.highcharts.com/highcharts.js"></script>

<div id="container" style="height: 400px"></div>


This fiddle seems very close to your design.

https://jsfiddle.net/sirajalam049/zxw0nLpr/7/

enter image description here

Upvotes: 1

Related Questions