PHP Classes

File: resources/views/dashboard/chart/quote.blade.php

Recommend this page to a friend!
  Classes of adriano123456   Budget System   resources/views/dashboard/chart/quote.blade.php   Download  
File: resources/views/dashboard/chart/quote.blade.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Budget System
Elaborate budgets for purchases of products
Author: By
Last change:
Date: 4 months ago
Size: 1,332 bytes
 

Contents

Class file image Download
<?php
$mes
= NULL;
$valor = NULL;
$mesD = NULL;
$valorD = NULL;

$i=0;
$dataC = $aprove;
foreach(
$dataC as $value):

 
$virgula = $i > 0 ? "," : NULL;

 
$mes .= "{$virgula}'{$value->dt_lancamento}'";
 
$valor .= $virgula.$value->total;

 
$i++;

 endforeach;

$i=0;
$dataD = $quote;
foreach(
$dataD as $value):

 
$virgula = $i > 0 ? "," : NULL;

 
$mesD .= "{$virgula}'{$value->dt_lancamento}'";
 
$valorD .= $virgula.($value->total);

 
$i++;

 endforeach;
 
?>


    <canvas id="myChart2"></canvas>

<script>
  const labels = [
    <?php echo $mes;?>
];

  const data1 = {
    labels: labels,
    datasets: [{
      label: 'Cotações',
      backgroundColor: 'rgb(255, 99, 132)',
      borderColor: 'rgb(255, 99, 132)',
      data: [<?php echo $valorD;?>],
    }]
  };

  const data2 = {
    labels: labels,
    datasets: [{
      label: 'Finalizadas',
      backgroundColor: 'rgb(102, 255, 102)',
      borderColor: 'rgb(102, 255, 102)',
      data: [<?php echo $valor;?>],
    },
    {
      label: 'Abertas',
      backgroundColor: 'rgb(102, 102, 255)',
      borderColor: 'rgb(102, 102, 255)',
      data: [<?php echo $valorD;?>],
    }]
  };

  const config = {
    type: 'line',
    data: data2,
    options: {}
  };

  const myChart = new Chart(
    document.getElementById('myChart2'),
    config
  );
</script>