Advertisement
Guest User

contoh kode chartjs

a guest
Apr 4th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <?php
  2. $select_services = mysqli_query($db, "SELECT * FROM orders WHERE date='2018-03-08' and user='$sess_username' order by id ASC");
  3. $total_ordr = mysqli_query($db, "SELECT * FROM orders WHERE user = '$sess_username' ORDER BY id ASC");
  4. $cek_total_ord = mysqli_num_rows($total_ordr);
  5. $nomor_chart = 1;
  6. ?>
  7.  
  8. <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.3.0/Chart.bundle.js"></script>
  9. <script type="text/javascript">
  10. var ctx = document.getElementById("myChart");
  11. var myChart = new Chart(ctx, {
  12. type: 'line',
  13. data: {
  14. labels: [<?php while ($b = mysqli_fetch_array($select_services)) { echo '"' . $b['date'] . '",';}?>],
  15. datasets: [{
  16. label: '# of Votes',
  17. data: [
  18. <?php while ($p = mysqli_fetch_array($total_ordr))
  19. {
  20. echo '"' . $cek_total_ord . '",';
  21. }?>
  22. ],
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement