Hi there. I'm having a very hard time gettin ginformation from an external xml file into the google visualization for display as a chart. I somewhat have it working in IE but it won't really work at all in firefox.
<script type="text/javascript" src="http://www.google.com/jsapi"></ script> <script type="text/javascript"> //Load the Visualization API and the Google piechart visualization google.load('visualization', '1', {'packages':['areachart']}); google.setOnLoadCallback(parseXML); //parseXML(); function parseXML() { var xmlDoc; var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined'); var ie = (typeof window.ActiveXObject != 'undefined'); if (moz) { var mXHR = new XMLHttpRequest(); mXHR.open("GET", "xmlreportdatatest1.xml", false); mXHR.send(null); xmlDoc = mXHR.responseXML; } else if (ie) { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = false; xmlDoc.load("xmlreportdatatest1.xml"); } var root = xmlDoc.documentElement; var userPointsRoot = root.getElementsByTagName("UserPoints"); var userPoints = userPointsRoot[0].getElementsByTagName ("UserPoint"); var communityPointsRoot = root.getElementsByTagName ("CommunityPoints"); var communityPoints = communityPointsRoot[0].getElementsByTagName ("CommunityPoint"); var data = new google.visualization.DataTable(); data.addColumn('string', 'Date'); data.addColumn('number', 'User'); //data.addColumn('number', 'Community'); data.addRows(userPoints.length); for (var i = 0; i <userPoints.length; i++){ if (ie) { var date = toString(userPoints[i].firstChild.nextSibling.text); var value = Number(userPoints[i].firstChild.text); data.setValue(i,0,date); data.setValue(i,1,value); } else { var date = toString(userPoints [i].firstChild.nextSibling.textContent); var value = Number(userPoints[i].firstChild.textContent); data.setValue(i,0,date); data.setValue(i,1,value); } } /*for (var i = 0; i <communityPoints.length; i++){ //data.setValue(i,0,communityPoints[i].getElementsByTagName ("ItemDate").nodeValue); data.setValue(i,2,communityPoints[i].getElementsByTagName ("ItemValue").nodeValue); }*/ var chart = new google.visualization.AreaChart (document.getElementById('chart_div')); chart.draw(data, {width: 600, height: 300, legend: 'bottom', title: 'Pronounciation Score'}); } </script> My issue is within the for loop going through user points. i can't display the value of the desired field. my XML looks like so though more data <ModelChartData> <UserPoints> <UserPoint> <ItemValue>14</ItemValue> <ItemDate>June 20, 2008</ItemDate> <ItemDateShort /> <IsXAxis>0</IsXAxis> </UserPoint> </UserPoints> </ModelChartData> any help on this matter would be greatly appreciated. thank you! Grant Lucas --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
