Trevor,

I may be missing something in what you are asking for, but you need to just
treat the annotations columns like other columns and include them in your
array of columns for the view.  So if you include column 4 that has
annotations in column 5 (that you would have added after column 4) then
just include both 4 and 5 in the columns array.  E.g. view: { columns: [
... 4, 5 ...] }

Perhaps your concern is that you can't just list all the columns that way,
but maybe you need to conditionally add one at a time.  If so, just start
with an empty columnsArray variable that you accumulate your columns in.
 Here is part of the code that you might use.

  var columnsArray = [];
  var columnIndex = 0;

  // One column with annotations
  columnsArray.push(columnIndex++);  // for data
  columnsArray.push(columnIndex++);  // for annotations

  // Another column with annotations
  columnsArray.push(columnIndex++);  // for data
  columnsArray.push(columnIndex++);  // for annotations

  ...
Then just use view: { columns: columnsArray }

Hope that helps.
dan



On Mon, Jul 15, 2013 at 8:12 AM, Trevor <[email protected]> wrote:

> Since I can't seem to figure out how to edit my posts, here is a little
> bit more information about what I mean.
>
> Before, I created a separate data table for each chart, by saying
>      var data = new google.visualization.DataTable();
>      data.addRow(...);
>      data.addColumn(....);
>      etc...
>
> In this way it is easy to add an annotaton, I could just call:
>     .addColumn({type: 'string', role: 'annotation'});
>
> However, now if I simply set views: { columns: [] } in the chart
> initialization, I am simply giving it access to the main data table. How
> can I add annotations to the data when using this method?
>
>
> On Monday, July 15, 2013 1:54:21 PM UTC+2, Trevor wrote:
>>
>> Thanks for your replies. I have begun using the view: { columns: [] }
>> option which is working now.
>>
>> The only problem is that I'm not sure how to set annotations using the
>> view: { columns: [] } option. When procedurally generating a 2d array and
>> passing that as the data to the charts, it was quite easy to simply append
>> a "role: annotation" column wherever it was needed. But if I am using the
>> view: { columns: [] } option I am unsure how to add in the annotations. Any
>> suggestions?
>>
>>>   --
> 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/groups/opt_out.
>
>
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>  -
978-394-1058
[email protected] <[email protected]>   562D 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.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to