title: How to display dynamically label and values of label in pie chart using chart.js?
body: <p>My Pie chart <a href="https://i.stack.imgur.com/ABwVv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ABwVv.png" alt="enter image description here"></a> but actually i want this 
     type of chart
      <a href="https://i.stack.imgur.com/TdJ21.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TdJ21.png" alt="enter image description here"></a></p>
  
  <p>I want to display dynamically label and label values in pie chart using chart 
     js but according to my code which i have written ,it display all label in one 
     label. I don't know where is the issue in my code.I don't know as much about 
      js. Please guide me.Thanks in advance.  </p>
  
  <pre><code>$("#get_data").click(function(){
  
      var employees = $("#employees").val();
      //var fairs     = $("#fairs").val();
  
      $.ajax({
  
          url     : 'php_script/chart_values.php',
          method  : 'POST',
          data    : {employees:employees},
  
          success : function(data){
  
              var obj = JSON.parse(data);
  
              var a = obj[0]; // labele data "Negotiation on 
              proposal","Won","Contracted","Intersted",
              var b = obj[1]; // label values "100","90","70"
              var labeldata;
              for( i=0; i&lt;a.length;i++){ // loop to fetch label data one by one
                  labeldata += [a][i];
  
              }
              console.log(labeldata);
  
              var chart = new CanvasJS.Chart("chartContainer", {
              title: { 
                  //text: "Worldwide Smartphone sales by brand - 2012",
                  fontSize:15
              }, 
              axisY: { 
                  title: "Products in %" 
              }, 
              legend :{ 
                  verticalAlign: "center", 
                  horizontalAlign: "right" 
              },
              data: [{
              type: "pie", 
              showInLegend: true, 
              toolTipContent: "{label} &lt;br/&gt; {y} %", 
              indexLabel: "{y} %", 
              dataPoints: [ 
                  { 
  
                   label: [labeldata],y:19 // dispaly lable data here
  
  
                  } 
               /*{ label: "Apple",    y: 19.1, legendText: "Apple"  }, 
              { label: "Huawei",   y: 4.0,  legendText: "Huawei" }, 
              { label: "LG",       y: 3.8,  legendText: "LG Electronics"}, 
              { label: "Lenovo",   y: 3.2,  legendText: "Lenovo" }, 
              { label: "Others",   y: 39.6, legendText: "Others" }  */
             ]
          } 
       ] 
  }); 
  chart.render();
  
          }
  
      });
  
  });
  </code></pre>