Motion Chart Problems with IE?

136 views
Skip to first unread message

Cristian

unread,
Sep 29, 2011, 12:55:52 AM9/29/11
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);

asgallant

unread,
Sep 29, 2011, 8:58:39 AM9/29/11
to google-visua...@googlegroups.com
Where is it failing in IE9 (the Developer Tools should be able to give you a hint)?

Cristian

unread,
Sep 29, 2011, 1:03:52 PM9/29/11
to Google Visualization API
Hi Asgallant,
I've been using the debugger in IE [it does sometimes crushes while I
use it].
While stepping through the code I noticed that .readyState doesn't
change to 4. It goes through state 1 and status unknown, state 2 and
status 200, state 3 and status 200, state 4 and status 200. I can see
the date stored in the array properly, but when it's time to Draw it
nothing happens.

I'm pussle since it seems to work just fine in the other browsers with
the same steps.

Is there some setting that needs to be enable in IE to display the
graph?

Thank you for your help

-Cristian

asgallant

unread,
Sep 29, 2011, 1:25:44 PM9/29/11
to google-visua...@googlegroups.com
Ok, so the problem is with the AJAX request, not the motion chart.  Looking into this briefly, there may be an issue with the IE9 implementation of XMLHttpRequest (see http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/8c01075f-a547-476a-b6b3-cf095917537a/).  Try using the jQuery AJAX functions and see if they work for you (http://api.jquery.com/jQuery.ajax/http://api.jquery.com/jQuery.get/).

Cristian

unread,
Oct 3, 2011, 10:58:22 AM10/3/11
to Google Visualization API
Hi,
sorry I took a couple of days off.
I tried using query to load the csv file. It populates the array used
in the chart, just fine, but when it comes time to draw it nothing
happens. Still works fine in other browsers, just not in IE9. [I don't
have access to an older version of IE to test there]

Do you have any suggestions?

Thanks,

-C


On Sep 29, 1:25 pm, asgallant <drew_gall...@abtassoc.com> wrote:
> Ok, so the problem is with the AJAX request, not the motion chart.  Looking
> into this briefly, there may be an issue with the IE9 implementation
> of XMLHttpRequest (seehttp://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread...).

asgallant

unread,
Oct 3, 2011, 11:50:10 AM10/3/11
to google-visua...@googlegroups.com
Ok, stupid question time: do you have Flash installed and enabled in IE9?  If you do, then this should run fine in IE9:


If that works, try manually populating the DataTable object and see if your chart draws.  If that works, then the problem is in the way you are retrieving data and/or populating the DataTable object.

Cristian

unread,
Oct 3, 2011, 1:01:38 PM10/3/11
to Google Visualization API
Ok, I'm not sure what happened, but thank for asking me to check if
Flash was installed.
I had flash installed 10,3,183,10 version ( http://www.adobe.com/software/flash/about/
), but I started doing a check making sure I had it enable everywhere
and without any "locks" ( http://kb2.adobe.com/cps/191/tn_19166.html )
I had everything set the recommended way, but just for kicks I enabled
and disabled the ActiveX Filtering from IE. After that Graphs and the
site you sent me (pretty cool by the way) started working just fine.

Thank you for your help and patience,

-Cristian

Cristian

unread,
Oct 3, 2011, 1:02:51 PM10/3/11
to Google Visualization API
Ok, I'm not sure what happened, but thanks for asking me to check if
Flash was installed.
I had flash installed 10,3,183,10 version ( http://www.adobe.com/software/flash/about/
), but I started doing a check making sure I had it enable everywhere
and without any "locks" ( http://kb2.adobe.com/cps/191/tn_19166.html )
I had everything set the recommended way, but just for kicks I enabled
and disabled the ActiveX Filtering from IE. After that Graphs and the
site you sent me (pretty cool by the way) started working just fine.

Thank you for your help and patience,

-Cristian

On Oct 3, 1:01 pm, Cristian <cristian.iban...@gmail.com> wrote:
> Ok, I'm not sure what happened, but thank for asking me to check if
> Flash was installed.
> I had flash installed 10,3,183,10 version (http://www.adobe.com/software/flash/about/
Reply all
Reply to author
Forward
0 new messages