Sending series data dynamically to pie charts in Highcharts
<p>Here In this script am sending data to the pichart dynamically from the PHP code where am able to get the data from the Database. </p>

<pre><code>&lt;script type="text/javascript"&gt;
      var temp=new Array();
      function addArray(tmp,z){
         temp[z]=tmp;
         //alert(temp[3]);
      }   
      $(function () {
         var chart;
     var n = document.getElementById('itypename').value;
         var tmp=new Array();
         //var temp=new Array();
         var u=0;
     for(m=0;m&lt;n;m++){
           var x = document.getElementsByClassName("itype")[m].value;   //alert(x);
           var nn = x.indexOf("*"); 
           cnt=Number(x.substring(0,nn));
           value=x.substring(nn+1);  
           tmp[0]=value;
           tmp[1]=cnt;
           //addArray(tmp,m);           
           //alert(tmp);
           temp[m]=tmp;
           **alert(temp);**
           //u=u+1;
           //alert(cnt+". Value is :"+value);
        }
        //for(m=0;m&lt;n;m++){alert(temp[m]);}
         //var itype = Number($("#itypeid").val());
         //alert(itype);
         //var itype1 = Number($("#itypeid1").val());
         //alert(itype1);
         //var itype2 = Number($("#itypeid2").val());
         //alert(itype2);
         $(document).ready(function() {
            chart = new Highcharts.Chart({
               chart: {
                  renderTo: 'container2',
                  //borderRadius: 10,
                  plotBackgroundColor: null,
                  plotBorderWidth: 2,
                  // borderWidth: 0,
                  plotShadow: false,
                  // margin: [20, 600, 10, 50]
               },
               title: {
                  text: ''
               },
               tooltip: {
                  formatter: function() {
                     return '&lt;b&gt;'+ this.point.name +'&lt;/b&gt;: '+ Math.round(this.percentage) +' %';
                  }
               },
               plotOptions: {
                  pie: {
                     allowPointSelect: true,
                     cursor: 'pointer',
                     dataLabels: {
                        enabled: false,
                        color: '#000000',
                        connectorColor: '#000000',
                        formatter: function() {
                           return '&lt;b&gt;'+ this.point.name +'&lt;/b&gt;: '+ this.percentage +' %';
                        }
                     }
                  }
               },
               series: [{

                  type: 'pie',
                  name: 'Browser share',
          data: temp                  
               }]
            });
         });
      });
</code></pre>

<p>Here I am able to pass the data to this script but I am unable get the actual output,the problem I am facing is:</p>

<p>If my array length is 5, the jquery is reading every value from the php code but the pie chart is forming with only last value among the values of array</p>

<p>ex: if array is like data[ [a,1],[b,2][c,3][d,4][e,5] ]</p>

<p>The pie chart is contructing with [e,5]
When I give alert (temp); the alert is like 
e,5 e,5 e,5 e,5 e,5 </p>
