Legend height and pie size in pie chart - Javascript highcharts

Javascript examples for highcharts:Pie Chart

Description

Legend height and pie size in pie chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-git.js"></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"></div> 
      <script type="text/javascript">
$(document).ready(function() {
  $('#container').highcharts({
    chart: {//from www  . ja v  a  2 s.  c o  m
      type: 'pie',
      events: {
        load: function() {
          var chart = this,
            legend = chart.legend,
            newHeight = chart.chartHeight + legend.fullHeight;
          chart.setSize(undefined, newHeight);
        }
      }
    },
    title: {
      text: 'Browser market shares at a specific website, 2010'
    },
    plotOptions: {
      pie: {
        allowPointSelect: true,
        cursor: 'pointer',
        dataLabels: {
          enabled: false
        },
        showInLegend: true
      }
    },
    legend: {
      align: 'center',
      enabled: true,
      layout: 'vertical',
      verticalAlign: 'bottom'
    },
    series: [{
      type: 'pie',
      name: 'Browser share',
      data: [
        ['Firefox', 45.0],
        ['IE', 26.8],
        ['Chrome', 12.8],
        ['Safari', 8.5],
        ['Opera', 6.2],
        ['Others', 0.7],
        ['Firefox', 45.0],
        ['IE', 26.8],
        ['Chrome', 12.8],
        ['Safari', 8.5],
        ['Opera', 6.2],
        ['Others', 0.7],
        ['Firefox', 45.0],
        ['IE', 26.8],
        ['Chrome', 12.8],
        ['Safari', 8.5],
        ['Opera', 6.2],
        ['Others', 0.7],
        ['Firefox', 45.0],
        ['IE', 26.8],
        ['Chrome', 12.8],
        ['Safari', 8.5],
        ['Opera', 6.2],
        ['Others', 0.7]
      ]
    }]
  });
});

      </script>  
   </body>
</html>

Related Tutorials