Cristian
unread,Sep 29, 2011, 12:55:52 AM9/29/11Sign 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 using Motion Chart and for most browsers works just fine. I'm
having trouble when I try to use IE 9.
I'm loading my points from a CSV file. In Mozilla, Safari, Chrome
everything works, but when I try it in IE nothing... any ideas?
Thank you for your help.
-Cristian
------------------------------------------------------------------------------
THE BASICS OF MY CODE
-----------------------------------------------------------------------------
I CHECK FOR BROWSER, LOAD THE FILE, THEN I PARCED THE FILE, build an
ARRAY and then .DRAW IT
--------------
if (window.XMLHttpRequest)
{
// code for IE7+, Firefox, Chrome, Opera, Safari
txtFile=new XMLHttpRequest();
}
else
{ // code for IE6, IE5
txtFile=new ActiveXObject("Microsoft.XMLHTTP");
}
txtFile.open("GET", "SomeFile.csv", true);
txtFile.onreadystatechange = function()
{
if (txtFile.readyState == 4 && txtFile.status == 200)
{ // Makes sure it's found the file.
allText = txtFile.responseText;
allTextLines = allText.split(/\r\n|\n|,|\r/);
}
}
txtFile.send(null);
google.load('visualization', '1', {'packages':['motionchart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Indicator');
data.addColumn('date', 'Date');
data.addColumn('number', 'Value');
var totalNumberOfLines = allTextLines.length;
for (var i =0 ; i< totalNumberOfLines ; i=i+3)
{
data.addRows([[allTextLines[i].toString(),new Date (allTextLines[i
+1]),parseFloat(allTextLines[i+2])]]);
//document.write ("i = "+ i+ " " +allTextLines[i] +" "+ new Date
(allTextLines[i+1]) +" "+ allTextLines[i+2]+"<br /> ")
}
var chart = new
google.visualization.MotionChart(document.getElementById('chart_div'));
var options = {};
options['width'] = 600;
options['height'] = 300;
chart.draw(data, options);