title: Json Array for highchart
body: <pre><code>[{"outlet":"K-SM3","tanggal":"2016-06-02","total":5083600},
   {"outlet":"K-SM3","tanggal":"2016-06-01","total" :4660500},
   {"outlet":"K-PKM","tanggal":"2016-06-02","total":1576250},
   {"outlet":"K-PKM","tanggal":"2016-06-01" ,"total":921300}]
  </code></pre>
  
  <p>I'm currently learning about highchart. Above are my result from <code>console.log</code>, i'm using ajax to show somedata. But no luck, the chart not showing up. I can't find error inside <code>console.log</code>.</p>
  
  <p>My PHP Script</p>
  
  <pre><code>function onchange()
      {
          extract(populateform());
          $explode = explode('-',$tgl);
          $start_date = inggris_date($explode[0]);
          $end_date = inggris_date($explode[1]);
          $jumlah = count($datanya);
          $result = array();
          for($x = 0 ;$x&lt;$jumlah;$x++)
              {
                  $hasil = $this-&gt;modelmodel-&gt;showdata("select outlet,convert(date,tanggal)tanggal,(cash + cc + dc + flash + piutang + reject + disc50)
                                                  total from transaksi 
                                                  where outlet = '".$datanya[$x]."' and tanggal between '$start_date' and '$end_date' order by tanggal desc");
                      foreach($hasil as $hsl)
                          {
                              $result[] = $hsl;
                          }
              }
          echo json_encode($result);
      }
  </code></pre>
  
  <p>And here is My JavaScript</p>
  
  <pre><code>$('.changeschanges').change(function() {
        $.ajax({
                   url: '&lt;?=base_url();?&gt;graph/onchange',
                   data: {datanya:$(".select2").val(),tgl:$("#reservation").val()},
                   type: 'POST',
                   dataType: 'JSON',
                   success: function(data) {
                        $.each(data, function(k, v) { 
                       res.push(data[k].outlet,[data[k].tanggal, data[k].total])
              });
                $.each(data, function(k, v) { 
                       date.push([data[k].tanggal])
              });
               $.each(data, function(y, x) { 
                       otl.push([data[y].outlet])
              });
  
                  $('#container').highcharts({
                                  title: {
                                      text: '',
                                      x: -20
                                  },
                                  subtitle: {
                                      text: 'Perbanding Grafik Pendapatan',
                                      x: -20
                                  },
                                  xAxis: {
                                   categories: date
                                  },
                                  yAxis: {
                                      title: {
                                          text: 'Rupiah (Rp.)'
                                      },
                                      plotLines: [{
                                          value: 0,
                                          width: 1,
                                          color: '#808080'
                                      }]
                                  },
                                  tooltip: {
                                      valueSuffix: ' Rupiah'
                                  },
                                  legend: {
                                      layout: 'vertical',
                                      align: 'right',
                                      verticalAlign: 'middle',
                                      borderWidth: 0
                                  },
  
                                  series: [{
                                      name: 'Outlet '+ otl,
                                      data: res
  
                                  }]
  
                              });
                              setTimeout(function () {
          }, 1000);
          },
  
      });
      });
  </code></pre>
  
  <p>I was able to create ajax with this ajax result</p>
  
  <pre><code> [{"tanggal":"2016-04-03","total":5371010},
       {"tanggal":"2016-04-02","total":6387090},
       {"tanggal":"2016-04-01","total":2116550}]
  </code></pre>
  
  <p>why i adding <code>outlet</code> inside my newest ajax result (at the top). Because there will be multiple line <code>K-SM3 &amp; K-PKM</code>. Sorry for my bad english.</p>
  
  <p>It's the result example</p>
  
  <p><a href="https://i.stack.imgur.com/exRIq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/exRIq.png" alt="enter image description here"></a></p>