THAT DOES IT! Thanks so much, I had gotten to the fact that I needed the chart construction outside the refresh loop, but I couldn't get it all flowing.
So here's a question. I might just be kinda an amatuer at all this, but I am surprised this common function was so difficult in the Google API. I mean it seems very common that you might have a simple line chart on a page that updates automatically from a data source. But, this seemed to be a non-covered use case. I often wonder if the wider world of web programmers are just writting MUCH more complex applications than I am. So simple stuff like this is covered by them on day 1. Am I right? Is this such elementary work that it's just too simple for most people? Here's the page this will replace, is this just the simplest thing you've ever seen: https://www.misoenergy.org/MarketsOperations/RealTimeMarketData/Pages/ACEChart.aspx On Thursday, May 22, 2014 3:41:00 PM UTC-4, Paul Duer wrote: > > > Hey all, I am using the following Javascript. But, it causing the chart to > BREAK badly on each update. > > What have I done wrong? > > <script type="text/javascript"> > google.load('visualization', '1.1', { 'packages': > ['annotationchart'] }); > google.setOnLoadCallback(drawChart); > > setInterval(drawChart, 10000); > > > function drawChart() { > var jsonData = $.ajax({ > url: "/data/aceResponse.txt", > dataType: "json", > async: false, > cache: false > }).responseText; > var interval = $.ajax({ > url: "/data/IntervalRequest.txt", > dataType: "text", > async: false, > cache: false > }).responseText; > > $("#interval").text(interval); > var data = new google.visualization.DataTable(jsonData); > > var chart = new > google.visualization.AnnotationChart(document.getElementById('chart_div')); > chart.draw(data, { > is3D: true, > > colors: ['red'], > displayZoomButtons: false, > displayRangeSelector: false, > dateFormat: 'HH:mm:ss' > }); > } > -- 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.
