*Hey all,*
*maybe you can help me...*
*I have data in my database, MySQL.*
*1. column TIMESTAMP in format 2021-02-02 00:00:00*
*2. colum VALUE (float)*
*I want to use Annotation Chart but I do not know how to load data from
table to chart. Here is my code:*
*<?php*
* $con = mysqli_connect('server','user','pass','db');*
*?>*
*<html>*
* <head>*
* <script type="text/javascript"
src="https://www.gstatic.com/charts/loader.js"></script>*
* <script type='text/javascript'>*
* google.charts.load('current', {'packages':['annotationchart']});*
* google.charts.setOnLoadCallback(drawChart);*
* function drawChart() {*
* var data = new google.visualization.DataTable();*
* data.addColumn('date', 'Date');*
* data.addColumn('number', 'mm');*
* data.addRows([*
*here how to put data from my db? I am laso not sure about timestamp
format...*
*I tried this but no success:*
*<?php *
* $query = "SELECT * from SAVE_DATA";*
* $exec = mysqli_query($con,$query);*
* while($row = mysqli_fetch_array($exec)){*
* echo "['".$row['Time']."',".$row['Value1']."],";*
* }*
*?> *
* ]);*
* var chart = new
google.visualization.AnnotationChart(document.getElementById('chart_div'));*
* var options = {*
* displayAnnotations: true*
* };*
* chart.draw(data, options);*
* }*
* </script>*
* </head>*
* <body>*
* <div id='chart_div' style='width: 100%; height: 600px;'></div>*
* </body>*
*</html>*
Thanks all for help.
MF
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/0ae4f9cc-7776-4d6f-bf9d-1e3683867349n%40googlegroups.com.