You will have to use a DataView to merge those two columns into one:
var view = new google.visualization.DataView(data);
view.setColumns([{
type: 'string',
label: 'Name',
calc: function (dt, row) {
return dt.getValue(row, 0) + ' ' + dt.getValue(row, 1);
}
}, 2, 3]);
Use the DataView to draw the chart instead of the DataTable.
On Friday, November 16, 2012 6:57:29 PM UTC-5, Matt wrote:
> Related question... is it possible to display two string labels on a
> column chart? In the example below, each column label and associated
> tooltip is labeled as "Smith" which is not useful. It would be great to
> show both the first name and last name; not just the last name.
>
> data.addColumn('string', 'First Name');
> data.addColumn('string', 'Last Name');
> data.addColumn('number', 'Age');
> data.addColumn('number', 'Height);
>
> data.addRows([
> ['Jim', 'Smith', 24, 60],
> ['John', 'Smith', 36, 68],
>
> Thank you.
>
>>
>>>
--
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/-/iOqKerG6gTYJ.
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.