[Chartjs]-How can I fasten up the Chart.js graph generation from JQuery over PHP and mySQL?

1👍

You would try to embed the data from php directly. or include the file using

<?php include('getTestData.php'); ?>

such like below to replace the ajax get request.

    <?php foreach($dataGet->label as $label){ ?>
  labels.push("<?= $label ?>");
 <?= } ?>

  <?php foreach($dataGet->temperature as $temperature){ ?>
  temperature.push("<?= $temperature ?>");
 <?= } ?>

  <?php foreach($dataGet->humidity as $humidity){ ?>
  humidity.push("<?= $humidity ?>");
 <?= } ?>

  var ctx = document.getElementById("canvas").getContext("2d");
window.myLine = new Chart(ctx, config);
$(".loaderClass").fadeOut("slow");

Leave a comment