Sorry, but roles are not supported with the AnnotatedTimeline chart.    The
AnnotationChart is a newer version, but that also does not support roles
yet, though we plan to add that at some point.

Depending on the additional features you need, you might want to put
together your own version using a Dashboard wrapped around a LineChart and
a ChartRangeFilter.    See
https://developers.google.com/chart/interactive/docs/gallery/controls?hl=en
for the details.

On Fri, Nov 20, 2015 at 8:25 AM, dude <[email protected]> wrote:

> 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
> <https://groups.google.com/d/msgid/google-visualization-api/3f0eb70c-39a6-4602-9c08-d01a603df3dd%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>  -
978-394-1058
[email protected] <[email protected]>   5CC, Cambridge MA
[email protected] <[email protected]> 9 Juniper Ridge
Road, Acton 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 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/CAOtcSJN-Li9GZGksRos9NbdCY4mMRg9-HLjQdrhL8nyVOS6oVQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to