Re: multiple labels in X axis in visualization column chart

319 views
Skip to first unread message

asgallant

unread,
Nov 12, 2012, 3:49:43 PM11/12/12
to google-visua...@googlegroups.com
You can format the dates to have date and day of week (by setting the axis format to an ICU date format pattern), but you can't force them to be on separate lines.

On Monday, November 12, 2012 3:36:16 PM UTC-5, cavan wrote:
Hello,

I would like to know if it is possible to have two labels in X axis in column visualization charts. I need to display day of the week and under it date, for example MON and under it 2012-11-12.

Thanks.
cavan.

asgallant

unread,
Nov 16, 2012, 7:47:30 PM11/16/12
to google-visua...@googlegroups.com
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',
    calcfunction (dtrow{
        return dt.getValue(row0' ' dt.getValue(row1);
    }
}23]);

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.

Matt

unread,
Nov 16, 2012, 11:25:18 PM11/16/12
to google-visua...@googlegroups.com
Thank you. I will try that...
Matt
Reply all
Reply to author
Forward
0 new messages