Hi,
I am trying to dynamically load data in to a graph but when i add the
lines
data.setValue(x, 0, new Date(year, month, day));
data.setValue(x, 1, numQueries);
In the ajax call it hangs and will not work. When I take those lines
out my data is returned as expected and the graph displays but says
there is no data. here is what i am working with:
function drawVisualization() {
var data = new google.visualization.DataTable();
data.addColumn('date', 'Date');
data.addColumn('number', 'Number of Users');
var numOfRows = 2;
data.addRows(numOfRows);
$.ajax({
url: "/WebServiceURL",
type: "GET",
dataType: "xml",
data: "inputReportName=S,N",
success: function(xml) {
var x = 0;
$(xml).find("UsageMetricsDTO").each(function()
{
var date =
$(this).find('logDate').text();
var dateArray = date.split('-');
var year = dateArray[0];
var month = dateArray[1];
var day = dateArray[2];
var numQueries =
$(this).find('numOfQueries').text();
if(x == 1){
day = 02;
}
data.setValue(x, 0, new
Date(year, month, day));
data.setValue(x, 1, numQueries);
alert("year: "+year+"
<br/>month: "+month+"<br/> day: "+day
+"<br/>numqueries: "+numQueries+"<br/>x: "+x);
x++;
});
},
error: function() {
$("#tabs-1").writeErrorMessage();
}
});
var annotatedtimeline = new
google.visualization.AnnotatedTimeLine(
document.getElementById('visualization'));
annotatedtimeline.draw(data, {'displayAnnotations': true});
}
Any ideas why this is happening?
--
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.