Can we see what is in your data?   That makes all the difference in
determining what happened when it appears to be a data-related problem.

It appears your data table will have a datetime column as the domain
values, but your data is integers.  It *might* work if you are specifying
milliseconds, but that is not a supported mechanism.

If your time values are really only times during the day regardless of day,
then you probably want to use the timeofday type instead.  See the
documentation page on dates and times here:
https://developers.google.com/chart/interactive/docs/datesandtimes

I would also recommend first replacing your LineChart with a Table chart,
just to see what data you are getting.


On Mon, Jan 23, 2017 at 9:57 PM, [email protected] <
[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:-
>
>
>    - 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/
> 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">
>     // 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/e105c322-3f54-49f5-951d-
> 63f44d7d673b%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/e105c322-3f54-49f5-951d-63f44d7d673b%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/CAOtcSJPOtV9PU1LWqC6CENsYH0WcMw5xDJUNOBoOv%3DJ5E7Z5dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to