access highcharts pie chart plotOptions - Javascript highcharts

Javascript examples for highcharts:Pie Chart

Description

access highcharts pie chart plotOptions

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://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <script type="text/javascript">
$(function () {//from w w  w . j  a va2  s  .  c om
    $('#container').highcharts({
        chart: {
            type: 'pie'
        },
        plotOptions: {
            pie: {
                size: 200
            }
        },
        series: [{
            data: [
                ['Firefox',   44.2],
                ['IE7',       26.6],
                ['IE6',       20],
                ['Chrome',    3.1],
                ['Other',    5.4]
            ]
        }]
    }
                              );
    $("p").click(function(){
        var chart= $('#container').highcharts(); chart.userOptions.plotOptions.pie.size=parseInt($("#newSize").val(),10);
        $('#container').highcharts(chart.userOptions);
  });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div>
         Enter new size
      </div>
      <input id="newSize"> 
      <p>Click to change size</p> 
      <div id="container" style="height: 400px; width: 500"></div>  
   </body>
</html>

Related Tutorials