Axis Title

216 views
Skip to first unread message

Thumper

unread,
Nov 3, 2011, 7:59:25 PM11/3/11
to Google Visualization API
I am using a Column chart and setting the options one by one.

options['width'] = "100%";
options['height'] = "300";
options['legend'] = "none";
options['hAxis.title'] = "asdf";
options["vAxis.title"] = "asdf";

I cannot get the Axis titles to show. All other options work
correctly. I have read and reread the API documentation, I have no
clue why the Axis titles are not displaying.

Thanks

asgallant

unread,
Nov 4, 2011, 8:31:54 AM11/4/11
to google-visua...@googlegroups.com
The API is rather particular about how you set options.  I usually see it done in object notation, but it you have to do it this way, the proper notation is probably:

options['width'] = "100%"; 
options['height'] = "300"; 
options['legend'] = "none"; 
options['hAxis']['title'] = "asdf"; 
options["vAxis']['title"] = "asdf"; 

Riccardo Govoni ☢

unread,
Nov 4, 2011, 9:20:27 AM11/4/11
to google-visua...@googlegroups.com
More likely

options['hAxis'] = {'title': 'asdf' };

or 

options['hAxis'] = {};
options['hAxis']['title'] = "asdf"; 

Otherwise I suspect you'd end up with an undefined property when executing the last line without the one before it.

- R.

--
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/-/41kpxYp_-kEJ.

To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

Tony Holmes

unread,
Nov 7, 2011, 9:22:16 AM11/7/11
to Google Visualization API
Hi,

this is how I have done it on a recent chart and it works fine...

// Define the Column chart
var mychart = new google.visualization.ChartWrapper({
'chartType': 'ColumnChart',
'containerId': 'chart1',
'options':
{
'width': 800,
'height': 500,
'isStacked': 'true',
'legend': 'right',
'hAxis': {
'textStyle': {'fontSize': 12},
'textPosition': 'out',
'slantedText': 'true',
'slantedTextAngle': 40
'title': 'Tracked Categories',
},
'title': 'EMEA - % change month',
},
// Instruct the chart on what columns to use for display
// from the data in DataTable.
'view': {'columns': x}
});

Hope this helps
Tony



On Nov 4, 1:20 pm, Riccardo Govoni ☢ <battleho...@gmail.com> wrote:
> More likely
>
> options['hAxis'] = {'title': 'asdf' };
>
> or
>
> options['hAxis'] = {};
> options['hAxis']['title'] = "asdf";
>
> Otherwise I suspect you'd end up with an undefined property when executing
> the last line without the one before it.
>
> - R.
>
Reply all
Reply to author
Forward
0 new messages