Hi Andrew,
I tried all the above example to make an annotation chart working, but I
miserably failed to have it working...
I always get this error, and even if mysql_num_rows() is deprecated I
cannot find a way to have it replaced
*Warning*: mysql_num_rows() expects parameter 1 to be resource, object
given in */Applications/XAMPP/xamppfiles/htdocs/server1/Result_console4.php* on
line *11*
Are you able to provide me some help?
Hope you can help me..
many thanks.
Here is my entire code of my php page.
<?php
//DB connection parameters
require_once("mysql_connect.php");
$result = mysqli_query($con,"select date,value1,value2 from DATABASE");
if ($result !== false) {
$num=mysql_num_rows($result);
$i=0;
echo"";
$output = Array();
while ($i < $num) {
$DateTimeArray=explode(' ', mysql_result($result,$i,"date"));
$MYvalue1=mysql_result($result,$i,"value1");
$MYvalue2=mysql_result($result,$i,"value2");
$dateArray = explode('-', $DateTimeArray[0]);
$year = $dateArray[0];
$month = $dateArray[1] - 1; // adjust for javascript's 0-indexed months
$day = $dateArray[2];
$timeArray = explode(':', $DateTimeArray[1]);
$hours = $timeArray[0];
$minutes = $timeArray[1];
$seconds = $timeArray[2];
$output[] = "[new Date($year, $month, $day, $hours, $minutes, $seconds),
$MYvalue1, $MYvalue2]";
$i++;
}
}
?>
<html>
<head>
</head>
<script type='text/javascript' src='http://www.google.com/jsapi'
></script>
<script type='text/javascript'>
google.load('visualization', '1.1', {'packages':['annotationchart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('datetime', 'Date');
data.addColumn('number', 'value1');
data.addColumn('number', 'value2');
data.addRows([ <?php echo implode(',', $output); ?>]);
var chart = new
google.visualization.AnnotationChart(document.getElementById('chart_div'));
var options = {
displayAnnotations: true,
};
chart.draw(data, options);
}
</script>
<body>
Graph should be here.
<div id='chart_div' style='width: 900px; height: 500px;'></div>
</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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.