Highcharts Variable Radius 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 variable radius pie chart using highcharts library with examples.

Highcharts Variable Radius Pie Chart Example

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

 

<html>

<head>

    <title>Highcharts Variable Radius Pie 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/variable-pie.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: 'variablepie'

                },

                title: {

                    text: 'Countries population density and total area.'

                },

                tooltip: {

                    headerFormat: '',

                    pointFormat: '<span style="color:{point.color}">\u25CF</span> <b> {point.name}</b><br/>' +

                        'Area (square km): <b>{point.y}</b><br/>' +

                        'Population density (people per square km): <b>{point.z}</b><br/>'

                },

                series: [{

                    minPointSize: 10,

                    innerSize: '20%',

                    zMin: 0,

                    name: 'countries',

                    data: [

                        {name: 'Spain',y: 505370,z: 92.9},

                        {name: 'France',y: 551500,z: 118.7},

                        {name: 'Poland',y: 312685,z: 124.6},

                        {name: 'Czech Republic',y: 78867,z: 137.5},

                        {name: 'Italy',y: 301340,z: 201.8},

                        {name: 'Switzerland',y: 41277,z: 214.5},

                        {name: 'Germany',y: 357022,z: 235.6}

                        ]

                }]

            });

        });

    </script>

</head>

<body>

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

</body>

</html>

If you observe the above example, we created a variable radius pie chart using highcharts library with required properties.

 

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

 

Highcharts Variable Radius Pie Chart Example Result

 

This is how we can create a variable radius pie chart using highcharts library with required properties.

Topics Covered