Okay.
This is the code in question.
02 google.load("visualization", "1", {packages:
["table"]});
503 google.setOnLoadCallback(drawTable);
504 var data;
505
506 function drawTable() {
507 data = new google.visualization.DataTable
();
508 data.addColumn('string', 'Id');
509 data.addColumn('string', 'PI');
510 data.addColumn('string', 'Cruise Info');
511 data.addColumn('string', 'Date and Time');
512 data.addColumn('string', 'Latitude');
513 data.addColumn('string', 'Longitude');
514 data.addColumn('string', 'Depth');
515 data.addColumn('string', 'Name');
516 data.addColumn('string', 'Value');
517 data.addRows(1);
518 var id;
519 GDownloadUrl("../output/search/
results.xml", function(dataX, responseCode) {
520 if(responseCode == 200) {
521 var xml = GXml.parse(dataX);
522 var dataId =
xml.documentElement.getElementsByTagName("data_id");
523 // alert(dataId[0].childNodes
[0].nodeValue);
524 id = dataId[0].childNodes
[0].nodeValue;
525 alert(id);
526 // data.setCell(0, 0, String(id));
527 // for (var i = 0; i < dataId.length;
i++) {
528 // var id = new Integer(parseInt
(dataId[i]));
529 // alert(id);
530 // }
531 } else if (responseCode == -1) {
532 alert("Data request timed out.
Please try later.");
533 } else {
534 alert("Request resulted in error.
Check XML file is retrievable.");
535 }
536 });
537
538 var table = new google.visualization.Table
(document.getElementById('table_div'));
539 table.draw(data, {showRowNumber: true});
540 data.setCell(0, 0, String(id));
541 }
542 </script>
1. data.setCell(0, 0, String(id));
2. data.setCell(0, 0, id);
3. data.setCell(0, 0, Integer(id));
None of these work, within the function called from GDownloadURL(line
519) or outside of that function.
However, note that alert(id) does produce the result that I am looking
for. The question now is how do I get this inside of my data table.
On Nov 17, 9:40 am, p00kie <[EMAIL PROTECTED]> wrote:
> It does not work..
>
> The solution was pointed out to me - you need to typecast the
> variable.
>
> var x = 5;
> data.setcell(0, 0, String(x));
>
> On Nov 15, 4:38 pm, VizGuy <[EMAIL PROTECTED]> wrote:
>
> > It is possible, and works well.
>
> > If it doesn't work for you, please provide more info.
>
> > VizGuy
>
> > On Fri, Nov 14, 2008 at 9:43 PM, p00kie <[EMAIL PROTECTED]> wrote:
>
> > > is this possible?
>
> > > 534 var x = 5;
> > > 535 data.setCell(0, 0, x);
>
> > > does not seem to work.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---