Hi all,
I need to format the horizontal axis labels of a line chart. The
following does not seem to work:
new
google.visualization.LineChart(document.getElementById('fp_chart_div')).draw(data,
{
width: 500,
height: 500,
fontSize: 9,
title: 'UK students 2004/05 to 2008/09',
legend: 'bottom',
legendFontSize: 9,
hAxis: {
textStyle: {color: 'red', fontName: 'arial', fontSize:
8}
}
});
...despite the fact that I tested all of these options in the
linechart playground and received the results I was expecting.
The full code is below. The first call is made, onload, to
frontpageChart().
How do I get hAxis to work?
Cheers,
Gareth
--- *** ---
Full code:
function frontpageChart(){
google.load("visualization", "1.1", {packages:["linechart"]});
google.setOnLoadCallback(initChart);
}
function initChart(){
var query = new google.visualization.Query('https://
spreadsheets.google.com/ccc?
key=0As2p56mlRLF6dFRpdXhzcW8tQjJXSEdYZmE1RWlsZ2c');
query.setQuery('select A, D');
query.send(showFrontpageChart);
}
function showFrontpageChart(response){
//TODO - on error, show a static image chart instead
/*if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' +
response.getDetailedMessage());
return;
}*/
var data = response.getDataTable();
//draw, with options
new
google.visualization.LineChart(document.getElementById('fp_chart_div')).draw(data,
{
width: 500,
height: 500,
fontSize: 9,
title: 'UK students 2004/05 to 2008/09',
legend: 'bottom',
legendFontSize: 9,
hAxis: {
textStyle: {color: 'red', fontName: 'arial', fontSize:
8}
}
});
}
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
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.