Craig Bridges
unread,Feb 29, 2012, 2:42:24 PM2/29/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Visualization API
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?