What is your data source?  The default query language is SQL-like (but is 
not SQL) and does not handle the "concat" operator, so that may be the 
problem.  Also, most databases that support "concat" require you to supply 
a "group by" clause.  In case the problem isn't on the database end, add 
the line:

console.log(data.toJSON);

to the handletestDsResponse function (after the var data = ... line), open 
the page in Chrome, view the developer's console, and post the json string 
here.  I'll look over it and see what might be the problem.

On a side note, you are loading the packages wrong, it should be:

google.load('visualization', '1', {'packages':['table', 'orgchart', 
'corechart']});

With 3 strings in the "packages" array, not one string.  The "piechart" and 
"barchart" packages are obsolete (PieCharts and BarCharts are in the 
"corechart" package now).

On Sunday, July 7, 2013 6:32:13 PM UTC-4, armon d wrote:
>
> I have a problem to conversion of database type in MySQL.
> One of my database elements in the datatable is in Timestamp type and when 
> I run my program in horizontal axis it is just "timestamp" string which is 
> written not my data content. You can find the sample code I created.
> How can I change my code to have the date instead of "timestamp"?
>
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>       <script type="text/javascript">
>       // Load the Visualization API and the ready-made Google table 
> visualization.
>       google.load('visualization', '1', 
> {'packages':['table,piechart,orgchart,barchart,corechart']});
>       // Set a callback to run when the API is loaded.
>       google.setOnLoadCallback(init);
>       // Send the queries to the data sources.
>       function init() { 
>         query = new google.visualization.Query('test');
>         query.setQuery**("select concat('',timestamp),outdoor,indoor");**
>         query.send(handletestDsResponse);
>         drawToolbar();
>       }
>       //Handle the test data source query response
>       function handletestDsResponse(response) {
>         if (response.isError()) {
>           alert('Error in query4: ' + response.getMessage() + ' ' + 
> response.getDetailedMessage());
>           return;
>         }
>         var data = response.getDataTable();
>         var chart = new 
> google.visualization.LineChart(document.getElementById('test_div'));
>         chart.draw(data, {width: 600, height: 400, is3D: true});
>       }
>       // Draw the toolbar.
>       function drawToolbar() {
>         var components = [
>             /* {type: 'html', datasource: '
> http://localhost:8080/myWebApp/simpleexample'},
>             {type: 'csv', datasource: '
> http://localhost:8080/myWebApp/simpleexample'}, */
>             {type: 'html', datasource: '
> http://localhost:8080/myWebApp/test'},
>         ];
>         var container = document.getElementById('toolbar_div');
>         google.visualization.drawToolbar(container, components);
>       }
>       </script>
>     </head>
>     <body>
>       <h1> test Data Source </h1>
>       A line chart to show temperature.
>       The data is taken from the test data source.
>       <div id="test_div"></div>
>     </body>
>     </html>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to