cannot properly show candlestick chart when i'm trying to connect mySQL

```

<?php
$con = mysqli_connect('localhost','root','password','twse');
?>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>GChartExample</title>
  <meta name="robots" content="noindex, nofollow">
  <meta name="googlebot" content="noindex, nofollow">
  <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
    <script type="text/javascript" 
src="https://www.gstatic.com/charts/loader.js";></script>
    
      <div id="chart_div" style="width: 1400px; height: 600px;"></div>
  

  <script type="text/javascript">//<![CDATA[


      google.charts.load('current', {
        'packages': ['corechart']
      });
      google.charts.setOnLoadCallback(drawChart);

      function drawChart() {
        var data = google.visualization.arrayToDataTable([
[['Date','low','open','close','high']]
<?php 
$query = "SELECT 'Date','low','open','close','high' FROM 'table_name' WHERE 
'stock_code' = 2330 and 'date' BETWEEN '2019/12/10 00:00:00' AND '2020/1/10 
23:59:59'";

$exec = mysqli_query($con,$query);
while($row = mysqli_fetch_array($exec)){

echo 
"['".$row['Date']."','".$row['low']."','".$row['open']."','".$row['close']."','".$row['high']."'],";
}
?> 
]);
        var options = {
          title: 'TWSE #2330',
          titleTextStyle: {
            color: 'black',
            fontName: 'Courier New',
            fontSize: 30,
            bold: true,
            italic: false
          },
          legend: 'show',
          series: [{
            color: 'black',
            visibleInLegend: false
          }],
          candlestick: {
            fallingColor: {
              strokeWidth: 0,
              fill: '#0f9d58'
            },
            risingColor: {
              strokeWidth: 0,
              fill: '#a52714'
            }
          }
        };

        var chart = new 
google.visualization.CandlestickChart(document.getElementById('chart_div'));

        chart.draw(data, options);
      }



  //]]></script>


  </script>
</body>
</html>

```

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/7a45296d-f07e-44b6-b25d-e5c46f227bedn%40googlegroups.com.

<<attachment: candlestick_chart_cannot_show.php>>

Reply via email to