Hi All,

can help me teach and check on this google chart i have tried, seems the 
trendline is not showing when querying data from mysqli. The month and the 
result is both in integer format. Attached is the image of the chart and 
the trendline is not working. Can help me on this? i have been stuck here 
long time already.. 

Thank you!

my Coding part is like this:




<?php
   include ('connection.php');
?>


<html>
   <head>
      <title>Google Charts Tutorial</title>
      <script type = "text/javascript" src = 
"https://www.gstatic.com/charts/loader.js";>
      </script>
      <script type = "text/javascript" src = "https://www.google.com/jsapi";>
      </script>
      <script type = "text/javascript">
         google.charts.load('current', {packages: ['corechart']});     
      </script>
   </head>
   
   <body>
      <div id = "container" style = "width: 550px; height: 400px; margin: 0 
auto">
      </div>
      <script language = "JavaScript">
       function drawChart() {
      var data = google.visualization.arrayToDataTable([
         ['Month', 'Performance %'],
         <?php 
          $query = "SELECT month , result_ind FROM performance GROUP BY 
month";


          $exec = mysqli_query($db,$query);
          while($row = mysqli_fetch_assoc($exec)){


          echo "['".$row['month']."',".$row['result_ind']."],";
         }
        ?>
       ]);


               
            // Set chart options
            var options = {
               'title':'Month vs %',
               'width':550,
               'height':400,
               
                trendlines: {
                0: {
                type: 'exponential',
                color: 'green',
                visibleInLegend: true,
      }
    }  // Draw a trendline for data series 0.
            };


            // Instantiate and draw the chart.
            var chart = new google.visualization.ScatterChart(document.
getElementById('container'));
            chart.draw(data, options);
         }
         google.charts.setOnLoadCallback(drawChart);
      </script>
   </body>
</html>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Chart API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-chart-api/f319de46-86dd-4c57-ba6a-f37a313ca182%40googlegroups.com.

Reply via email to