Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var barChartData1 = {
- labels: [<?php
- $arraylenght = count($month);
- for($x = 0; $x < $arraylenght; $x++) {
- echo '"' . $month[$x] . '"' . ',' ;
- }
- ?>
- ],
- datasets: [
- {
- type: 'line',
- label: 'Nps',
- borderColor: 'red',
- borderWidth: 1,
- fill: false,
- data: [
- <?php
- foreach ($month as $date ){
- $e_t = "select * from nps where date = '$date' and team_id ='$id'"; // to select total rows
- $e_p = "select * from nps where team_id= '$id' and nps_rating >= 9 and date = '$date' "; // select promoter
- $e_d = "select * from nps where team_id ='$id' and nps_rating <= 6 and date = '$date' "; // select dertactor
- $e_tq = $cont->query($e_t);
- $e_pq = $cont->query($e_p);
- $e_dq = $cont-> query ($e_d);
- if ($e_tq->num_rows == 0){
- $e_eq = 0;
- //continue;
- }else{
- $e_eq = (($e_pq->num_rows - $e_dq->num_rows) / $e_tq->num_rows) * 100 ; // get result of nps
- }
- echo round($e_eq) . ',';
- }
- ?>]
Add Comment
Please, Sign In to add comment