There are a couple of things going on here. First, annotations are applied
to the columns immediately preceding them in the DataTable, so by adding
them like this:
data.addColumn({type: 'string', role: 'annotation'});
data.addColumn({type: 'string', role: 'annotationText'});
data.addColumn('number', score[0]);
the annotations will apply to the previous column, not to the column
created by data.addColumn('number', score[0]);. This means that your first
annotation columns are being applied to the domain column ("Year" in your
example), which is why you see the numbers at the bottom of the central
bars in each group. To fix that, you would need to change the order of the
columns:
data.addColumn('number', score[0]);
data.addColumn({type: 'string', role: 'annotation'});
data.addColumn({type: 'string', role: 'annotationText'});
The annotations don't show up for the bars because annotations are not
supported with bars; they work with LineCharts and AreaCharts, and
"line"/"area" series in ComboCharts (and maybe a few others that escape my
memory at this time), but they don't work for BarCharts, ColumnCharts,
CandleStickCharts, and "bar"/"candlestick" series in ComboCharts.
I wrote a hack that can fake annotations on "bar" series in a ComboChart
(see http://jsfiddle.net/asgallant/QjQNX/); it doesn't work in all cases -
specifically, it won't work well with columns that are side-by-side like
the ones in your example. If you can stack your columns (setting the
chart's "isStacked" option to true), then this method might work.
On Thursday, October 3, 2013 9:38:40 AM UTC-4, Shyam Agarwal wrote:
>
> Please found the code here.
> http://jsfiddle.net/QjQNX/183/
>
--
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.