title: How can i loop data in highcharts
body: <p>How do I loop my variable <code>eNum</code> inside the <code>y</code> data in Highcharts?</p>
  
  <p>I try to use a <code>for</code> loop to assign <code>i</code> to increment data in the <code>parseFloat</code>, but the graph only shows one set of data. Why is this?</p>
  
  
  
  <pre class="lang-js prettyprint-override"><code>$(document).ready(function() {
    $.extend({
      getValues: function(url) {
        var result = [];
        $.ajax({
          url: url,
          type: 'get',
          dataType: 'json',
          async: false,
          success: function(data) {
            $.each(data, function(index, element) {
              result.push(element.revenue);
            });
          }
        });
        return result;
      }
    });
    var results = $.getValues("&lt;?php echo base_url('admin_controller/get_data_for_graph') ?&gt;");
    for (var i = 0; i &lt; results.length; i++) {
      var eNum = parseFloat(results[i]);
      $('#container').highcharts({
        chart: {
          plotBackgroundColor: null,
          plotBorderWidth: null,
          plotShadow: false,
          type: 'pie'
        },
        title: {
          text: ''
        },
        tooltip: {
          pointFormat: '{series.name}: &lt;b&gt;{point.percentage:.1f}%&lt;/b&gt;'
        },
        plotOptions: {
          pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
              enabled: true,
              format: '&lt;b&gt;{point.name}&lt;/b&gt;: {point.percentage:.1f} %',
              style: {
                color: (Highcharts.theme &amp;&amp; Highcharts.theme.contrastTextColor) || 'black'
              }
            }
          }
        },
        series: [{
          name: 'Brands',
          colorByPoint: true,
          data: [{
            name: "Deluxe",
            y: eNum,
          }, ]
        }]
      });
    }
  });
  </code></pre>
  
  <p>I just want to loop eNum </p>
  
  <pre><code>data: [{
      name: "Deluxe",
      y: eNum,
  },]
  </code></pre>