Yes, there is a way to do that.  Assuming your python script updates the 
file in the background (ie, it doesn't need to be prompted by the 
javascript), then you could use something like jQuery's AJAX function to 
retrieve the data and the setTimeout() function to call the AJAX on some 
interval of time:

function drawChart () {
    // set up chart variables
    var data;
    var chart = new google.visualization.LineChart(document.getElementById(
'chart_div'));
    var options = {};
    
    function refreshData () {
        jQuery.ajax({
            dataType: 'text',
            url: 'http://localhost:8080/path/to/file.ext',
            success: function (data, status) {
                // check status for errors
                // if no errors, convert data into DataTable object
                chart.draw(data, options);
                
                // refresh the data every 10 seconds (10k microseconds)
                setTimeout(function () {
                    refreshData();
                }, 10000);
            }
        });
    }
}
​ 

On Wednesday, March 14, 2012 2:29:11 PM UTC-4, Confused Student wrote:
>
> Hi, 
>
> I looked around on the site and could not find anything related to 
> what I want to do so it may not even be possible but here goes.  I 
> have a project that I am working on where a sensor outputs data to a 
> serial port and then that data is collected by a python script.  The 
> data is then recorded as a tab delimited file.  Is there a way to have 
> the script update the file on the fly and have the graph use the new 
> data. 
>
> Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/ClBcYNMDkt4J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to