Highcharts 3D Column Chart with Stacking and Grouping

In the previous chapters, we learned how to setup highcharts library and how to create a chart with required configurations using highcharts library in our webpage. Now, we will learn how to create a 3d column chart with stacking and grouping using highcharts library with examples.

Highcharts 3D Column Chart with Stacking Example

Following is the example of creating a 3D column chart with stacking and grouping by setting the required chart properties using highcharts library.

 

<html>

<head>

    <title>Highcharts 3D Column Chart with Stacking and Grouping</title>

    <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>

    <script src="https://code.highcharts.com/highcharts.js"></script>

    <script src="https://code.highcharts.com/highcharts-3d.js"></script>

    <script src="https://code.highcharts.com/modules/exporting.js"></script>

    <script src="https://code.highcharts.com/modules/export-data.js"></script>

    <script type="text/javascript">

        $(function() {

            Highcharts.chart('container', {

                chart: {

                    type: 'column',

                    options3d: {

                        enabled: true,

                        alpha: 15,

                        beta: 15,

                        viewDistance: 25,

                        depth: 40

                    }

                },

                title: {

                    text: 'Total fruit consumption, grouped by gender'

                },

                xAxis: {

                    categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'],

                    labels: {

                        skew3d: true,

                        style: {

                            fontSize: '16px'

                        }

                    }

                },

                yAxis: {

                    allowDecimals: false,

                    min: 0,

                    title: {

                        text: 'Number of fruits',

                        skew3d: true

                    }

                },

 

                tooltip: {

                    headerFormat: '<b>{point.key}</b><br>',

                    pointFormat: '<span style="color:{series.color}">\u25CF</span> {series.name}: {point.y} / {point.stackTotal}'

                },

                plotOptions: {

                    column: {

                        stacking: 'normal',

                        depth: 40

                    }

                },

                series: [{

                    name: 'John',

                    data: [5, 3, 4, 7, 2],

                    stack: 'male'

                }, {

                    name: 'Joe',

                    data: [3, 4, 4, 2, 5],

                    stack: 'male'

                }, {

                    name: 'Jane',

                    data: [2, 5, 6, 2, 1],

                    stack: 'female'

                }, {

                    name: 'Janet',

                    data: [3, 0, 4, 4, 3],

                    stack: 'female'

                }]

            });

        });

    </script>

</head>

<body>

    <div id="container" style="width: 100%; height: 400px;"> </div>

</body>

</html>

If you observe the above example, we created a 3D column chart with stacking and grouping using highcharts library with required properties.

 

When we execute the above highcharts example, we will get the result like as shown below.

 

Highcharts 3D column chart with stacking and grouping example result

 

This is how we can create a 3D column chart with stacking and grouping using highcharts library with required properties.