Comment afficher les valeurs Max de chaque jour d un mois ?

Eléphanteau du PHP | 21 Messages

17 août 2022, 17:13

Bonjour, je souhaiterai faire ressortir chaque valeur journaliere max et min dans un graphique mais je n y arrive pas. j ai sois toutes les valeurs max ou juste une journee. pouvez vous m aider ? merci
<script type="text/javascript">
      google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(graphtemp);

      function graphtemp() {
        var data = google.visualization.arrayToDataTable([
          ['Date', 'Maxi'],


          <?php
          mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); 
          $currentmois = date('m');
          $currentyear = date('Y'); 
          $chartQuery = "SELECT date_format(Date,'%d/%m %y ') AS datum,  max(TmpExt) as TmpExt FROM DAVIS where YEAR(date)=$currentyear and MONTH(date)=$currentmois  order by ID desc limit 31";
                   
               if (isset($_POST['SelecteurMoisTemperature'])) {                                                                  
                    $timestamp = strtotime($_POST['SelecteurMoisTemperature']);
                     $Y = (int) date('Y', $timestamp);
                     $M = (int) date('m', $timestamp); 
                     $d = (int) date('d-m-Y', $timestamp);
                     $YM = (int) date('Y-m', $timestamp);                                                
                                                                        
                      



               $chartQuery = "SELECT *, Date_format(Date,'%d/%m/%Y')  as datum ,max(TmpExt) as TmpExt FROM DAVIS where YEAR(Date)=$Y and MONTH(Date)= $M order by Date desc  limit 31"; 
           }
           
               $chartQueryRecords = mysqli_query($connect, $chartQuery);
                    while ($row = mysqli_fetch_assoc($chartQueryRecords)) {
                         echo "['".$row['datum']."',".$row['TmpExt']."],";
                    }
           ?>
           ]);

        var options = {
            
            
            explorer: {
                axis: 'horizontal',
                keepInBounds: true,
                maxZoomIn: 4.0
          },

            series: {
                0: { color: '#D80010',},
                1: { color: '#33FFF6' ,},
                
        },
            curveType:'function',

            intervals: {style: 'bars', },

            backgroundColor: 'transparent',

            color: ['white'],

            lineWidth: 4,

            hAxis: { direction: -1,
                     format:'MMM d, y',
                     textStyle: { color:'white'},
                                   },

            vAxis: { 
                     textStyle: {
                        color:'red',
                     },
            explorer: {
                    axis: 'horizontal',
                    keepInBounds: true,
                    maxZoomIn: 4.0,
                            },        


                 },

            chartArea: {left : 100,
                        width: 1130},
            legend: { position: 'top',
                      textStyle: {
                       color: 'white'},
                }
        };

        var chart = new google.visualization.ColumnChart(document.getElementById('temp_chart'));

        chart.draw(data, options);
      }
</script>

Mammouth du PHP | 2703 Messages

17 août 2022, 18:48


Eléphanteau du PHP | 21 Messages

17 août 2022, 20:03

j'avais essayé avec egalement mais pas de resultat non plus
 <?php
          mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); 
          $currentmois = date('m');
          $currentyear = date('Y'); 
          $chartQuery = "SELECT max(TmpExt) AS tmpMax , date_format(Date,'%d/%m %y ') AS datum  FROM DAVIS  group by Date";
                   
               if (isset($_POST['SelecteurMoisTemperature'])) {                                                                  
                    $timestamp = strtotime($_POST['SelecteurMoisTemperature']);
                     $Y = (int) date('Y', $timestamp);
                     $M = (int) date('m', $timestamp); 
                     $d = (int) date('d-m-Y', $timestamp);
                     $YM = (int) date('Y-m', $timestamp);                                                
                                                                        
                      



               $chartQuery = "SELECT *, Date_format(Date,'%d/%m/%Y')  as datum ,max(TmpExt) AS tmpMax FROM DAVIS where YEAR(Date)=$Y and MONTH(Date)= $M group by Date desc  limit 31"; 
           }
           
               $chartQueryRecords = mysqli_query($connect, $chartQuery);
                    while ($row = mysqli_fetch_assoc($chartQueryRecords)) {
                         echo "['".$row['datum']."',".$row['tmpMax']."],";
                    }
           ?>