Guest User

Untitled

a guest
Jun 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. var barChartData1 = {
  2. labels: [<?php
  3. $arraylenght = count($month);
  4. for($x = 0; $x < $arraylenght; $x++) {
  5. echo '"' . $month[$x] . '"' . ',' ;
  6. }
  7. ?>
  8. ],
  9.  
  10.  
  11. datasets: [
  12.  
  13. {
  14.  
  15. type: 'line',
  16. label: 'Nps',
  17. borderColor: 'red',
  18.  
  19. borderWidth: 1,
  20. fill: false,
  21.  
  22. data: [
  23. <?php
  24. foreach ($month as $date ){
  25. $e_t = "select * from nps where date = '$date' and team_id ='$id'"; // to select total rows
  26. $e_p = "select * from nps where team_id= '$id' and nps_rating >= 9 and date = '$date' "; // select promoter
  27. $e_d = "select * from nps where team_id ='$id' and nps_rating <= 6 and date = '$date' "; // select dertactor
  28. $e_tq = $cont->query($e_t);
  29. $e_pq = $cont->query($e_p);
  30. $e_dq = $cont-> query ($e_d);
  31.  
  32. if ($e_tq->num_rows == 0){
  33. $e_eq = 0;
  34. //continue;
  35.  
  36. }else{
  37.  
  38. $e_eq = (($e_pq->num_rows - $e_dq->num_rows) / $e_tq->num_rows) * 100 ; // get result of nps
  39.  
  40. }
  41.  
  42. echo round($e_eq) . ',';
  43.  
  44.  
  45. }
  46.  
  47. ?>]
Add Comment
Please, Sign In to add comment