How can the legend label be something other than the column name?

65 views
Skip to first unread message

T-Roy

unread,
Jul 17, 2012, 5:06:44 PM7/17/12
to google-visua...@googlegroups.com
I have created a column chart with a legend of 4 items and the legend labels are the column name.  However, the column heading comes from a database query and I cannot change it there.

Is there a way in javascript to modify the legend label?

I do have a tooltip column data role so it would be great if there was a legend data role that could be assigned but I don' see that available.  any ideas out there?

T-Roy

asgallant

unread,
Jul 17, 2012, 5:17:36 PM7/17/12
to google-visua...@googlegroups.com
You can change the label of a column by calling the DataTable#setColumnLabel method.  Use it like this:

// assumes data is a DataTable object
// set the label of the first column to "Foo"
data.setColumnLabel(0, 'Foo');

T-Roy

unread,
Jul 20, 2012, 12:15:26 PM7/20/12
to google-visua...@googlegroups.com
I'll consider this. Thank you.

T-Roy

unread,
Feb 25, 2013, 12:48:48 PM2/25/13
to google-visua...@googlegroups.com
This is exactly what was needed. Thank you!
Reply all
Reply to author
Forward
0 new messages