It appears that you are missing the year value from your dates.  You must
start with the four digit year, e.g. 2017.

On Sat, Feb 18, 2017 at 6:20 PM, [email protected] <
[email protected]> wrote:

> I am getting closer, however struggling to get over the last hurdle.
> My code has now been modified as per below, breaking the date and time
> down before encoding with json.
> The resulting web page can be seen in the attached image, I have echoed
> the json to the screen for diagnostics. There are 10 entries starting at
> 18th Feb 22:59 and ending 18th Feb 19:16 however on the graph it is showing
> Jul 20, 1903 - Jul 24, 1903.
> if I change the format of this line to have a ":" in place of "," I get
> the original error Object doesn't support property or method
> 'getTimezoneOffset'
> $temp[] = array('v' => 'Date('.date('m',strtotime($r[
> 'Time'])).','.(date('d',strtotime($r['Time']))).','.(
> date('H',strtotime($r['Time']))).':'.date('i',strtotime($r['Time'])).')');
>
> Any help would be greatly appreciated
> Thanks
> Darren
>
>
>
>
>
>>  $mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
>>   if (mysqli_connect_errno()) {
>>     printf("Connect failed: %s\n", mysqli_connect_error());
>>     exit();
>>   }
>>   $result = $mysqli->query('SELECT Temperature, Time FROM dp00000001
>> ORDER BY ID DESC LIMIT 10');
>>   $rows = array();
>>   $table = array();
>>   $table['cols'] = array(
>>     array('label' => 'Time', 'type' =>'datetime'),
>>     array('label' => 'Temperature', 'type' => 'number')
>> );
>>     foreach($result as $r) {
>>       $temp = array();
>>       $temp[] = array('v' => 'Date('.date('m',strtotime($r[
>> 'Time'])).','.(date('d',strtotime($r['Time']))).','.(
>> date('H',strtotime($r['Time']))).','.date('i',strtotime($r['
>> Time'])).')');
>>      $temp[] = array('v' => (float) $r['Temperature']);
>>       $rows[] = array('c' => $temp);
>>     }
>> $table['rows'] = $rows;
>> $jsonTable = json_encode($table);
>> echo $jsonTable;
>> ?>
>> <html>
>>   <head>
>> <meta http-equiv="refresh" content="600">
>>
>>     <script type="text/javascript" src="https://www.google.com/jsapi
>> "></script>
>>     <script type="text/javascript" src="http://ajax.googleapis.
>> com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
>>     <script type="text/javascript">
>>
>>     google.load('visualization', '1', {'packages':['corechart']});
>>
>>     google.setOnLoadCallback(drawChart);
>>     function drawChart() {
>>
>>       var data = new google.visualization.DataTable(<?=$jsonTable?>);
>>       var options = {
>>           haxis:{format:'mm-dd hh:ii'},
>>           title: 'Temperature',
>>           curveType: 'function',
>>           width: 1200,
>>           height:400,
>>
>>       explorer:{maxZoomIn:10,   
>> actions:["dragToZoom","rightClickToReset"],axis:
>> "horizontal"
>>     }
>>         };
>>
>>       var chart = new google.visualization.LineChart(document.
>> getElementById('chart_div'));
>>       chart.draw(data, options);
>>     }
>>     </script>
>>   </head>
>>   <body>
>>
>>     <div id="chart_div"></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 google-visualization-api@
> googlegroups.com.
> Visit this group at https://groups.google.com/
> group/google-visualization-api.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/google-visualization-api/751ef014-fd7e-40e5-a91c-
> 7e6f8647dae9%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/751ef014-fd7e-40e5-a91c-7e6f8647dae9%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
[email protected] <[email protected]>   5CC, Cambridge MA

-- 
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 https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJOJ4F3pteRLuYPvn6JVoFDkvJumRd4eijMzRCq7G%3DCcUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to