This is how it can be done using GWT (and JSNI):

// First create this JSNI method to create the Options object for your chart
private native Options createOptionsWithAnnotationStyle() /*-{
      options = {
         annotation: {1: { style : 'line'} } // this assumes the column 
with index 1 is {type: "string", role: "annotation"}
      };
      return options;
   }-*/;

// Then use it like this:
Options options = createOptionsWithAnnotationStyle();
options.setTitle(title); // etc

myChart = new LineChart(myDataTable, options);

Now if only somebody would tell me that the color of the annotation line 
CAN be changed, and how (question posted on thread linked below), I'll be a 
happy man. At least for today ;-)

On Saturday, January 5, 2013 4:19:32 PM UTC-5, Rogelio Flores wrote:
>
> Ups, looks like I should have searched better. I just found this in this 
> forum:
>
> https://groups.google.com/forum/?fromgroups=#!searchin/google-visualization-api/annotation$20style$20letter$20line/google-visualization-api/ccLfHm-EhFU/2uMHoJT5TKkJ
>
> I'm still not sure I can implement this using gwt-visualization, but 
> hopefully from the javascript sample above I can figure it out even if I 
> have to use javascript (JSNI). If any of you has already  done this on the 
> GWT/Java side, please share your knowledge. Thanks.
>
>
> On Saturday, January 5, 2013 4:13:08 PM UTC-5, Rogelio Flores wrote:
>>
>> (Asked same question here: http://goo.gl/SScHN but since I haven't 
>> figured this out and nobody has responded, asking here)
>>
>> Using gwt-visualization 1.1.2 on a GWT app, I was able to add annotation 
>> and annotationText columns to a LineChart thanks to: ComboChart with 
>> annotation text in gwt 
>> google-visualization<http://stackoverflow.com/questions/13337000/combochart-with-annotation-text-in-gwt-google-visualization>
>>
>> but instead of the "letter" annotation style, I really want the "line" 
>> style that the documentation refers to: "You can specify the line style by 
>> setting this chart option: annotation:
>>
>>  {'column_id': {style: 'line'}}
>>
>> (See 
>> https://developers.google.com/chart/interactive/docs/roles#annotationtextrole
>> )
>>
>> but I'm not sure how I can do this using the gwt wrapper. In fact, I'm 
>> not even able to set this property in the Code Playground (using 
>> javascript). I tried setting the property like this (and in some other 
>> variations):
>>
>> data.addColumn({type: 'string', role: 'annotation', id:'TEST'});
>> annotation: {'TEST': {style: 'line'}} // inside chart options
>>
>> but the style of the annotation doesn't change. As I said, interested in 
>> doing this on GWT/Java, but even if you know how to do it on javascript, I 
>> might be able to figure out a gwt solution.
>>
>

-- 
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/-/6uYNe3lbzfwJ.
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