Php 显示数据时未显示趋势线

Php 显示数据时未显示趋势线,php,charts,google-visualization,trendline,Php,Charts,Google Visualization,Trendline,从MySQL查询数据时,趋势线不显示。月份和结果均为整数格式。附件是图表的图像,趋势线不起作用。你能帮我吗 编码部分如下所示: <?php include ('connection.php'); ?> <html> <head> <title>Google Charts Tutorial</title> <script type = "text/javascript" src = "http

从MySQL查询数据时,趋势线不显示。月份和结果均为整数格式。附件是图表的图像,趋势线不起作用。你能帮我吗

编码部分如下所示:

<?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>

谷歌图表教程
load('current',{packages:['corechart']});
函数绘图图(){
var data=google.visualization.arrayToDataTable([
['Month','Performance%'],
]);
//设置图表选项
变量选项={
“标题”:“月份与%”,
“宽度”:550,
‘高度’:400,
趋势线:{
0: {
类型:'指数',
颜色:“绿色”,
visibleInLegend:是的,
}
}//为数据系列0绘制趋势线。
};
//实例化并绘制图表。
var chart=new google.visualization.ScatterChart(document.getElementById('container');
图表绘制(数据、选项);
}
google.charts.setOnLoadCallback(drawChart);

趋势线仅在连续轴(编号、日期等)上起作用

不在离散轴上(字符串)

因此,您需要从x轴值中删除单引号,此处

echo "[".$row['month'].",".$row['result_ind']."],";