I can't really tell from the data that you copy as strings into your
message because they could have just been formatted as you expect to see
them.  But I would guess your datetime values really are dates and times,
in which case, you should probably use the "Date(...)" string notation
rather than just converting the datetime values into milliseconds.  This
may resolve the timezone offset problem you are experiencing.

To display in a Table chart, load package 'table' and call
google.visualization.Table(..)


On Tue, Jan 24, 2017 at 4:12 PM, [email protected] <
[email protected]> wrote:

> Hi Daniel,
>
>    - ID - Int(11)
>    - Time - datetime
>    - Temperature - double
>
> ID     -      Datetime          - Temperature
> 6065 - 2017-01-24 21:00: - 29.375
> 6064 - 2017-01-24 20:42: - 29.125
> 6063 - 2017-01-24 20:29: - 28.875
>
> To create the table chart, do I just change the chart type from LineChart
> to TableChart here:-
>
> var chart = new google.visualization.LineChart(document.getElementById('
> chart_div'));
>
>
>
>
> On Tuesday, 24 January 2017 13:57:25 UTC+11, [email protected]
> wrote:
>
>> Hi All,
>> I am new to Google charts and this forum.
>> For some time now I have been trying to graph temperature against time
>> from data I am logging to MySQL, using a variety of different applications
>> / java scripts / methods.
>> It was not until I first tried Google Charts that I was able to achieve
>> any kind of success.
>>
>> My DB table has 3 columns:-
>>
>>
>>    <http://192.168.66.39/phpmyadmin/themes/dot.gif>
>>    - ID
>>    - Time
>>    - Temperature
>>
>> Starting with a working Pie Chart example, I was able to make the
>> necessary changes to create a fully functioning line chart to plot
>> temperature against ID, however when I update the code to plot against time
>> I get the following error:-
>>
>> Object doesn't support property or method 'getTimezoneOffset'
>>
>> Any suggestions as to where in the code below could be causing the
>> problem, would be greatly appreciated.
>>
>> Thanks
>> Darren
>>
>>
>>  $result = $mysqli->query('SELECT Temperature, Time FROM dp00000001 ORDER
>> BY ID DESC LIMIT 2000');
>>
>>   $rows = array();
>>   $table = array();
>>   $table['cols'] = array(
>>
>>     array('label' => 'Time', 'type' => 'datetime'),
>>     array('label' => 'Temperature', 'type' => 'number')
>> );
>>     /* Extract the information from $result */
>>     foreach($result as $r) {
>>       $temp = array();
>>
>>       $temp[] = array('v' => (int) $r['Time']);
>>
>>       $temp[] = array('v' => (float) $r['Temperature']);
>>       $rows[] = array('c' => $temp);
>>     }
>> $table['rows'] = $rows;
>>
>> $jsonTable = json_encode($table);
>> ?>
>>
>> <html>
>>   <head>
>> <meta http-equiv="refresh" content="600">
>>     <!--Load the Ajax API-->
>>     <script type="text/javascript" src="https://www.google.com/js
>> api"></script>
>>     <script type="text/javascript" src="http://ajax.googleapis.co
>> m/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
>>     <script type="text/javascript">
>>     // Load the Visualization API and the piechart package.
>>     google.load('visualization', '1', {'packages':['corechart']});
>>     // Set a callback to run when the Google Visualization API is loaded.
>>     google.setOnLoadCallback(drawChart);
>>     function drawChart() {
>>       // Create our data table out of JSON data loaded from server.
>>       var data = new google.visualization.DataTable(<?=$jsonTable?>);
>>       var options = {
>>            title: 'Temperature',
>>           curveType: 'function',
>>           width: 1200,
>>           height:400,
>>       explorer:{maxZoomIn:10,   
>> actions:["dragToZoom","rightClickToReset"],axis:
>> "horizontal"
>>     }
>>         };
>>       // Instantiate and draw our chart, passing in some options.
>>       // Do not forget to check your div ID
>>       var chart = new google.visualization.LineChart
>> (document.getElementById('chart_div'));
>>       chart.draw(data, options);
>>     }
>>     </script>
>>   </head>
>>   <body>
>>     <!--this is the div that will hold the pie chart-->
>>     <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/d2171d3c-67cd-4cd7-8c7f-
> 10e3e9004cbb%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/d2171d3c-67cd-4cd7-8c7f-10e3e9004cbb%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/CAOtcSJNeAxpxRk5LxQPyTXXhjKegVsz_0H4fdycQfMgJPTnVRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to