I'm trying to plot an annotated timeline using two data sources. However adding roles is not recognised by the chart - the columns with role interval are plotted as lines on the cart. Here is the code from the index page:
<script type="text/javascript" src="https://www.google.com/jsapi" ></script> <script type="text/javascript" src= "https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script type='text/javascript'> google.load('visualization', '1', {'packages':['annotatedtimeline']}); // google.load('visualization', '1.1', {packages: ['corechart']}); google.setOnLoadCallback(drawChartSeptTEC); function drawChartSeptTEC(){ var json = $.ajax({ url: "get_json_forecast.php", dataType: "json", async: false }).responseText; var data = new google.visualization.DataTable(json); var chart = new google.visualization.AnnotatedTimeLine(document. getElementById('chart_div')); chart.draw(data, {displayAnnotations: true}); } // setInterval(drawChartSeptTEC, 59000 ); </script> and the server side: $tempcols=array(); $tempcols[] =array('type' => 'datetime','role' => 'domain'); $tempcols[] =array('type' => 'number','role' => 'data','label'=> 'polynomial'); $tempcols[] =array('type' => 'number','role' => 'interval'); $tempcols[] =array('type' => 'number','role' => 'interval'); $tempcols[] =array('type' => 'datetime','role' => 'domain'); $tempcols[] =array('type' => 'number','role' => 'data','label'=> 'spectral'); $table['cols'] = $tempcols; $rows = array(); $pg_result = pg_query($link,$query); pg_close($link); while ($row = pg_fetch_assoc($pg_result)) { $temp = array(); $correctDateTime = substr_replace($row['time'], ( substr($row['time'],5 ,2) -1 ) ,5,2); $temp[] = array('v' => "Date(".$correctDateTime.")"); $temp[] = array('v' => (float) $row['f2poly']); $temp[] = array('v' => (float) $row['f2polydev']); $temp[] = array('v' => (float) $row['f2polydev']); $temp[] = array('v' => "Date(".$correctDateTime.")"); $temp[] = array('v' => (float) $row['f2spec']); $rows[] = array('c' => $temp); } $table['rows'] = $rows; $jsonTable = json_encode($table); header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Content-type: application/json'); header('Access-Control-Allow-Origin: *'); echo $jsonTable; the console error states: *Error: each values column may be followed by one or two annotation columns. Column number 4 is of type datetime.Any ideas what is going wrong?Thanks in advance! * -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/3f0eb70c-39a6-4602-9c08-d01a603df3dd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
