title: How to fix "Highcharts error #13" on live chart? when i'm already insert DOMContentLoaded
body: <p>i'm already follow this [link]: <a href="https://stackoverflow.com/questions/21536233/how-can-i-fix-highcharts-error-13">How can I fix Highcharts error #13?</a> but still got an error on my highchart. i wanna make live highchart , this is my first time i make live chart and use highchart, can someone please help me to fix this problem ? </p>
  
  <p>This is my dataPLLive.php</p>
  
  <pre><code>&lt;?php
  
  header("Content-type: text/json");
  
  $servername = "....0";
  $username = "...s";
  $password = "....";
  $dbname = "...n";
  
  $conn = mysqli_connect($servername, $username, $password, $dbname);
  $query = mysqli_query($conn,   ("SELECT a.`JAM`, AVG(a.PacketLoss) AVG
  FROM (
  SELECT `JAM`,`RNC`,`IPPATH_PM` AS PHB,`VS_IPPM_FORWORD_DROPMEANS` AS PacketLoss, `VSIPPMRttMeans` AS Latency, 'IPPM'
  FROM `rnc_ippm_meas`
  WHERE JAM=(SELECT MAX(JAM) FROM `rnc_ippm_meas`) AND `IPPATH_PM` LIKE '%AF31%'
  UNION
  SELECT `JAM`,`RNC`,`IPPOOL_PM`,`VSIPPOOLIPPMForwardDrop-Means`,`VSIPPOOLIPPMRttMeans`, 'IPPOOLPM'
  FROM `rnc_ippool_ippm_meas` 
  WHERE JAM=(SELECT MAX(JAM) FROM `rnc_ippool_ippm_meas`) AND `IPPOOL_PM` LIKE '%AF31%') a
  GROUP BY a.`JAM`
  LIMIT 10000 "));
  
  if (!$query) {
      printf("Error: %s\n", mysqli_error($conn));
      exit();
  }
  
  while ($row = mysqli_fetch_assoc($query)) {            
      $value = $row['AVG'];
  
      $x = time() * 1000;
      $y = $value;
  
      $arr = array($x, $y);
      echo json_encode($arr);         
  }
  
  ?&gt;
  </code></pre>
  
  <p>this is json looks like</p>
  
  <pre><code>[1557373542000,"0.019680205406590504"]
  </code></pre>
  
  <p>then this is my html code</p>
  
  <pre><code>&lt;script&gt;
          var chart;
          function requestData() {
              $.ajax({
                  url: 'Controller/dataPLLive.php',
                  success: function(point) {
                      var series = chart.series[0],
                          shift = series.data.length &gt; 20; // shift if the series is 
                                                           // longer than 20
  
                      // add the point
                      chart.series[0].addPoint(point, true, shift);
  
                      // call it again after one second
                      setTimeout(requestData, 1000);    
                  },
                  cache: false
              });
          }
          document.addEventListener('DOMContentLoaded', function() {
  
              chart = Highcharts.chart('loss_live', {
                  chart: {
                      type: 'spline',
                      events: {
                          load: requestData
                      }
                  },
                  title: {
                      text: 'Live random data'
                  },
                  xAxis: {
                      type: 'datetime',
                      tickPixelInterval: 150,
                      maxZoom: 20 * 1000
                  },
                  yAxis: {
                      minPadding: 0.2,
                      maxPadding: 0.2,
                      title: {
                          text: 'Value',
                          margin: 80
                      }
                  },
                  series: [{
                      name: 'Random data',
                      data: []
                  }]
              });        
          });
      &lt;/script&gt;
  </code></pre>
  
  <p>and i follow <a href="https://www.highcharts.com/docs/working-with-data/live-data" rel="nofollow noreferrer">https://www.highcharts.com/docs/working-with-data/live-data</a> to make live chart.</p>
  
  <p>is that something wrong with my code ? hope someone help me , Thanks btw</p>