i ran your code and found these 2 errors
Uncaught ReferenceError: parseXML is not defined - Line: 12
index.html:18Uncaught SyntaxError: Unexpected token ILLEGAL - Line 18
Take this:
<script type="text/javascript" >
google.load('visualization', '1', {'packages':
['annotatedtimeline']});
google.setOnLoadCallback(parseXML);
</script>
<script type="text/javascript">
function parseXML() {
var xmlDoc;
Make it this:
<script type="text/javascript">
google.load('visualization', '1', {'packages':
['annotatedtimeline']});
google.setOnLoadCallback(parseXML);
function parseXML() {
var xmlDoc;
That will get rid of the Line 12 error...The Line 16 (was 18 before
previous error) error is here:
var moz = (typeof document.implementation != 'undefined') && (typeof
document.implementation.createDocument != undefined');
Your missing a quote around the second undefined....
var moz = (typeof document.implementation != 'undefined') && (typeof
document.implementation.createDocument != 'undefined');
Fixing this will now show you another error:
Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101 - Line: 21
This is were i hate my limit on my javascript knowledge.....I suggest
using google chrome and its developer tools to locate errors
On Apr 13, 5:00 am, Divya Prakash <[email protected]> wrote:
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html >
>
> <head>
> <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
> <meta http-equiv="Refresh" content="10;URL="/>
> <title> Welcome all !!! </title>
> <script type='text/javascript' src='http://www.google.com/jsapi'>
> </script>
> <script type='text/javascript'>
> google.load('visualization', '1', {packages:['annotatedtimeline']});
> google.setOnLoadCallback(parseXML);
> </script>
> <script type="text/javascript">
>
> 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", "try_swat.xml", false);
> mXHR.send(null);
> xmlDoc = mXHR.responseXML;
> } else if (ie) {
> xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
> xmlDoc.async = false;
> xmlDoc.load("try_swat.xml");
> }
>
> var root = xmlDoc.documentElement;
> var userPointsRoot = root.getElementByTagName("reads");
> var userPoints = userPointsRoot[0].getElementByTagName("read");
>
> //var communityPointsRoot = root.getElementsByTagName("CommunityPoints");
> //var communityPoints =
> communityPointsRoot[0].getElementsByTagName("CommunityPoint");
>
> var data = new google.visualization.DataTable();
>
> data.addColumn('date', 'Date');
> data.addColumn('number', 'sniper');
> data.addColumn('number', 'critical');
> data.addColumn('number', 'top10');
>
> data.addRows(userPoints.length);
>
> for (var i = 0; i <userPoints.length; i++){
> if (ie) {
> var date =
> getElementsByTagName("date")[0].childNodes[0].nodeValue;
> var sniper = getElementsByTagName("sniper")[0].childNodes[0].nodeValue;
> var critical = getElementsByTagName("critical")[0].childNodes[0].nodeValue;
> var top10 = getElementsByTagName("top10")[0].childNodes[0].nodeValue;
>
> //var date = toString(userPoints[i].firstChild.nextSibling.text);
> //var value =
> Number(userPoints[i].firstChild.text);
> data.setValue(i,0,date);
> data.setValue(i,1,sniper);
> data.setValue(i,2,critical);
> data.setValue(i,3,top10);
>
> }
> else{
> var date = getElementsByTagName("date")[0].childNodes[0].nodeValue;
> var sniper = getElementsByTagName("sniper")[0].childNodes[0].nodeValue;
> var critical = getElementsByTagName("critical")[0].childNodes[0].nodeValue;
> var top10 = getElementsByTagName("top10")[0].childNodes[0].nodeValue;
> //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);
> data.setValue(i,0,date);
> data.setValue(i,1,sniper);
> data.setValue(i,2,critical);
> data.setValue(i,3,top10);
> }
> }
>
> var chart = new
> google.visualization.AnnotatedTimeLine(document.getElementById('chart_div') );
>
> chart.draw(data,{displayAnnotations: true});
> }
>
> </script>
> </head>
>
> <body>
> <h3 style='text-align:center; color:olive; font-family: sans-serif;
> font-style: oblique; text-decoration: underline'>Welcome to SWAT
> Dashboard</h3><br>
>
> <div id='chart_div' style='padding-left:80px; text-align: center; width:
> 1000px; height: 600px; '></div>
> </body>
> </html>
>
> XML FILE
>
> <data>
>
> <reads>
> <read>
> <date>April 1, 2010</date>
> <sniper>30000</sniper>
> <critical>40654</critical>
> <top10>15999</top10>
> </read>
>
> <read>
> <date>April 2, 2010</date>
> <sniper>20000</sniper>
> <critical>20654</critical>
> <top10>45999</top10>
> </read>
>
> <read>
> <date>April 3, 2010</date>
> <sniper>50000</sniper>
> <critical>50654</critical>
> <top10>5999</top10>
> </read>
>
> <read>
> <date>April 4, 2010</date>
> <sniper>10000</sniper>
> <critical>10654</critical>
> <top10>1999</top10>
> </read>
>
> <read>
> <date>April 5, 2010</date>
> <sniper>60000</sniper>
> <critical>20654</critical>
> <top10>15000</top10>
> </read>
>
> </reads>
> </data>
>
> Please see this code and suggest Y its not wrking....
> Thanks in advance....
> --
> Yours sincerely
> Divya Prakash :)
--
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.