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.