Pie chart with lots of labels - Javascript highcharts

Javascript examples for highcharts:Pie Chart

Description

Pie chart with lots of labels

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <script type="text/javascript">
$(function() {/*from w w w  .  j  av  a 2 s  . c  o  m*/
    var labels = ["Afghanistan","Bahrain","Bangladesh","Bhutan","Brunei","Burma","Cambodia","China (PRC)","India","Indonesia","Iran","Iraq","Japan","Jordan","Kazakhstan","North Korea","South Korea","Kuwait","Kyrgyzstan","Laos","Lebanon","Macau SAR of China","Malaysia","Maldives","Mongolia","Nepal","Oman","Pakistan","Philippines","Qatar","Republic of China (Taiwan)","Saudi Arabia","Singapore","Sri Lanka","Syria","Tajikistan","Thailand","Turkmenistan","United Arab Emirates","Uzbekistan","Vietnam","Yemen"]
    var data = [];
    for (var i = 0; i < labels.length; i++){
        data.push([labels[i],10]);
    }
    console.log(data);
        // Create the chart
        chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                type: 'pie'
            },
            legend:{
                enabled: false
            },
            plotOptions: {
                pie: {
                    shadow: false
                }
            },
            series: [{
                name: 'Asia',
                data: data,
                innerSize: '40%',
                showInLegend:true,
                dataLabels: {
                    enabled: true,
                    padding: 0
                }
            }]
        });
    });

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials