Hi,
I think your problem is that the spreadsheet returns the data as number data
instead of string data...
You need to make this column a text (labels) column for the chart.
To do so in a spreadsheet - select the entire column --> go to the
formatting menu '123' --> select 'plain text' (at the bottom).
Now try to reload the visualization.
Hope this helps.
Regards,
VizBoy.
On Tue, May 19, 2009 at 10:32 PM, fcage <[email protected]> wrote:
>
> Hi-
>
> Im using a spreadsheet to load my data, and the values along the
> horizontal axis are numerical values 0-48 (representing the number of
> months passed at that data point. However, the line chart interprets
> this column not as labels for the horizontal axis, but instead as
> values and creates another category. Take a look, I'll paste my code
> below.
>
> Is there a work around to have x-axis values that are numbers, but not
> charted as values in the chart but rather as labels?
>
> <html>
> <head>
>
> </head>
>
> <body>
>
>
> <script type="text/javascript" src="http://www.google.com/jsapi"></
> script>
> <script type="text/javascript">
> google.load("visualization", "1", {packages:["linechart"]});
> google.setOnLoadCallback(drawVisualization);
>
>
> function drawVisualization() {
> var query = new google.visualization.Query('http://
> spreadsheets.google.com/pub?key=rbiiVqXrQZUgJ-ZRnLWXPsw'<http://spreadsheets.google.com/pub?key=rbiiVqXrQZUgJ-ZRnLWXPsw%27>
> );
> query.setQuery('select A, B, C, D, E, F, G');
> // Send the query with a callback function.
> query.send(handleQueryResponse);
> }
>
> function handleQueryResponse(response) {
> if (response.isError()) {
> alert('Error in query: ' + response.getMessage() + ' ' +
> response.getDetailedMessage());
> return;
> }
>
> var data = response.getDataTable();
> var chart = new google.visualization.LineChart
> (document.getElementById('chart_div'));
> chart.draw(data, {width: 525, height: 450, showCategories: false,
> legend: 'bottom', title: 'The Great Recession vs. the last
> five', titleX:'Months from employment peak' , showCategories:
> true , titleY:'% decline in payroll employment from peak
> month', backgroundColor: {stroke:null, fill:'#fff', strokeSize: 10}});
> }
>
>
>
>
> </script>
>
> <div id="chart_div"></div>
> </body>
> </html>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---