Highcharts Column, Line and Pie Chart

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 combination chart by combining the multiple charts like column, line and pie chart using highcharts library with examples.

Highcharts Column, Line and Pie Chart Example

Following is the example of creating a combination chart (column, line, and pie) by setting the required chart properties using highcharts library.

 

Live Preview

<html>

<head>

    <title>Highcharts Column, Line and Pie Combination Chart</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/modules/series-label.js"></script>

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

    <script type="text/javascript">

        $(function() {

            Highcharts.chart('container', {

                title: {

                    text: 'Combination chart'

                },

                xAxis: {

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

                },

                labels: {

                    items: [{

                        html: 'Total fruit consumption',

                        style: {

                            left: '50px',

                            top: '18px',

                            color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'

                        }

                    }]

                },

                series: [{

                    type: 'column',

                    name: 'Jane',

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

                }, {

                    type: 'column',

                    name: 'John',

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

                }, {

                    type: 'column',

                    name: 'Joe',

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

                }, {

                    type: 'spline',

                    name: 'Average',

                    data: [3, 2.67, 3, 6.33, 3.33],

                    marker: {

                        lineWidth: 2,

                        lineColor: Highcharts.getOptions().colors[3],

                        fillColor: 'white'

                    }

                }, {

                    type: 'pie',

                    name: 'Total consumption',

                    data: [{

                        name: 'Jane',

                        y: 13,

                        color: Highcharts.getOptions().colors[0] // Jane's color

                    }, {

                        name: 'John',

                        y: 23,

                        color: Highcharts.getOptions().colors[1] // John's color

                    }, {

                        name: 'Joe',

                        y: 19,

                        color: Highcharts.getOptions().colors[2] // Joe's color

                    }],

                    center: [100, 80],

                    size: 100,

                    showInLegend: false,

                    dataLabels: {

                        enabled: false

                    }

                }]

            });

        });

    </script>

</head>

<body>

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

</body>

</html>

If you observe the above example, we created a combination chart by combining the multiple charts like column, pie and line charts using highcharts library with required properties.

 

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

 

Highcharts column line pie chart combinations example result

 

This is how we can create a combination chart using highcharts library with required properties.