Highcharts Pareto 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 pareto chart using highcharts library with examples.

Highcharts Pareto Chart Example

Following is the example of creating a pareto chart by setting the required chart properties using highcharts library.

 

<html>

<head>

    <title>Highcharts Pareto 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/pareto.js"></script>

    <script type="text/javascript">

        $(function() {

            Highcharts.chart('container', {

                chart: {

                    renderTo: 'container',

                    type: 'column'

                },

                titlea: {

                    text: 'Restaurants Complaints'

                },

                tooltip: {

                    shared: true

                },

                xAxis: {

                    categories: [

                        'Overpriced',

                        'Small portions',

                        'Wait time',

                        'Food is tasteless',

                        'No atmosphere',

                        'Not clean',

                        'Too noisy',

                        'Unfriendly staff'

                    ],

                    crosshair: true

                },

                yAxis: [{

                    title: {

                        text: ''

                    }

                }, {

                    title: {

                        text: ''

                    },

                    minPadding: 0,

                    maxPadding: 0,

                    max: 100,

                    min: 0,

                    opposite: true,

                    labels: {

                        format: "{value}%"

                    }

                }],

                series: [{

                    type: 'pareto',

                    name: 'Pareto',

                    yAxis: 1,

                    zIndex: 10,

                    baseSeries: 1

                }, {

                    name: 'Complaints',

                    type: 'column',

                    zIndex: 2,

                    data: [755, 222, 151, 86, 72, 51, 36, 10]

                }]

            });

        });

    </script>

</head>

<body>

    <div id="container"></div>

</body>

</html>

If you observe the above example, we created a pareto chart by using highcharts library with required properties.

 

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

 

 Highcharts pareto chart example result

 

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